diff -Nru wine1.7-1.7.13/aclocal.m4 wine1.7-1.7.16/aclocal.m4 --- wine1.7-1.7.13/aclocal.m4 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/aclocal.m4 2014-04-04 19:13:44.000000000 +0000 @@ -782,13 +782,13 @@ IFS="|" for msg in $wine_notices; do IFS="$ac_save_IFS" - AS_VAR_SET_IF([msg],[AC_MSG_NOTICE([$msg])]) + AS_VAR_IF([msg],[],,[AC_MSG_NOTICE([$msg])]) done fi IFS="|" for msg in $wine_warnings; do IFS="$ac_save_IFS" - AS_VAR_SET_IF([msg],[echo >&2 + AS_VAR_IF([msg],[],,[echo >&2 AC_MSG_WARN([$msg])]) done IFS="$ac_save_IFS"]) diff -Nru wine1.7-1.7.13/ANNOUNCE wine1.7-1.7.16/ANNOUNCE --- wine1.7-1.7.13/ANNOUNCE 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/ANNOUNCE 2014-04-04 19:13:44.000000000 +0000 @@ -1,17 +1,15 @@ -The Wine development release 1.7.13 is now available. +The Wine development release 1.7.16 is now available. What's new in this release (see below for details): - - More Task Scheduler support. - - A few more Direct3D 10 interfaces. - - More Windows Media Player stubs. - - ARM code generation improvements. - - Better memory size reporting on Mac OS X. + - More regression test fixes. + - String arrays better supported in the IDL compiler. + - Initial stubs for DirectX Video Acceleration. - Various bug fixes. The source is available from the following locations: - http://prdownloads.sourceforge.net/wine/wine-1.7.13.tar.bz2 - http://mirrors.ibiblio.org/wine/source/1.7/wine-1.7.13.tar.bz2 + http://prdownloads.sourceforge.net/wine/wine-1.7.16.tar.bz2 + http://mirrors.ibiblio.org/wine/source/1.7/wine-1.7.16.tar.bz2 Binary packages for various distributions will be available from: @@ -27,374 +25,349 @@ ---------------------------------------------------------------- -Bugs fixed in 1.7.13 (total 63): +Bugs fixed in 1.7.16 (total 50): - 6351 Battlefield 2 graphics problems - 7366 softPROGRESS eISLP fails to display prescription information details - 10528 mdiviewer unusable - 12320 [The Master Genealogist (5/6/7) Gold U.S Edition] - Fonts/Text Do not Show in "Details/Children & Siblings" Windows (unless you install vb6run and choose: native_oleaut32 with winetricks ) - 12442 UOAssist: crash after startup attempting to fetch http page in frame - 12792 Warcraft III videos is not playing - 17214 Proteus VX fails to install (VT_DISPATCH to VT_xxx conversion: uninitialized VARIANTARG passed to DISPID_VALUE invoke call) - 19322 Letters missing in tahomabd.ttf - 19553 VideoReDo Plus crashes when video file is loaded. - 22433 Starship Tycoon demo crashes on exit - 24517 Many DirectX10/11 games need dxgi.dll.CreateDXGIFactory1 (Deus Ex: Human Revolution, Alan Wake, AC III, NFS: Most Wanted, Civ V, ...) - 25481 Desktop launchers generated by Steam use unregistered URL handler - 25526 Aura crashes - 25649 Firefox: alt tabbing is sometimes screwy - 25771 getElementsByName not implemented- causes problems for some applications navigating internet. - 26001 Champions Online installer crashes on startup - 26221 Shattered Origins config screen edges are not transparent, but pink - 26698 Dope Wars 2.2 weapon rack text is not drawn correctly - 27364 Osu! fails to install (ole32.IIDFromString returns unexpected error code) - 27417 Assassins Creed media validation fails (SafeDisc 4.85.x) - 27527 Move of the SendMessage() breaks 3DMark2001se - 27733 Fishdom 2: some fish render purple - 27977 freegate fg715x.exe exit silently - 28460 ieframe/ie test fails if CFLAGS="-fstack-protector-all" is used - 28463 oleaut32/tmarshal.c test crashes if CFLAGS="-fstack-protector-all" is used - 28996 rynga aborts on startup due to stubby GdipGetPropertyItemSize - 29611 FL Studio 10 is invisible without "emulate virtual desktop" - 29615 Inpage Urdu 2000 crashes on startup - 29983 AVRstudio 4.14 unable to get list of supported device for AVR simulator - 30132 FL Studio 10 crashes on start - 30447 Lexware 2012 product installers show an empty dialog window on startup (urlmon.CreateURLMoniker with base context and non-well formed URI, DOS-style path) - 31159 League of Legends: store doesn't load with builtin wininet - 31162 New Ubisoft Game Launcher fails to start games - 31439 ITKFEGUI.EXE crashes on startup. - 31505 AVR Studio 4.18 SP2 (build 700) crashes during build of projects - 33372 winmm:midi fails on systems with no sound card - 34052 The Witcher: Character models are sometimes invisible - 34098 Gamefly Client fails to install downloaded game content - 34304 Louisiana Adventure Demo fails with 'OLE error 80004001' (HTMLStyleSheet_get_href is a stub) - 34852 Xibo installer 1.4.x complains "Player cannot be installed on systems with Internet Explorer version smaller than 7.0" - 34892 IE8 crashes in 'purist' mode, needs unimplemented urlmon.dll.108 - 34921 Multiple games and applications need bcrypt.dll.BCryptGenRandom (Need for Speed: The Run, Battlefield 3) - 35171 Adobe Shockwave Player 12.x installer crashes on startup (URL moniker notify window class not unregistered during unload of urlmon) - 35256 Skyrim - "Not enough memory to run application" error - 35362 Aeria Games/Aura Kingdom launcher account signin fails due to IHTMLDocument2.GetActiveElement stub - 35406 Dawn Of War: Dark Crusade crash - 35417 all texts looks a bit shifted left - 35433 Civilization 4 BTS randomly page faults - 35485 Tab control is keeping pressed with TCM_SETCURSEL wParam:-1 - 35509 ProPresenter 4.x (.NET 3.5 WPF app) installer needs WshShortcut_put_IconLocation - 35524 Adobe Audition 3.0 crashes on startup (GdipFillRectangles must validate graphics object parameter) - 35546 Microsoft .NET Framework 3.0 'servicemodelreg.exe' crashes during installation - 35565 Assassin's Creed 2: 'UbisoftGameLauncher.exe' needs msvcp90.dll.??0?$basic_fstream@DU?$char_traits@D@std@@@std@@QAE@PBDHH@Z - 35567 Xibo Player 1.4.x crashes on startup (WMI reports network adapter with IPEnabled=true and MACaddress=NULL) - 35569 Questrade IQ needs msvcr110.dll._libm_sse2_pow_precise - 35579 d3d8:visual test_scalar_instructions() fails on Windows - 35580 d3d8:device test_display_formats() fails on Windows 8 - 35584 wine can no longer execute rm.com (DOS application) - 35588 Assassins Creed II fails installation fails at the end - 35601 Mediacoder crashes on start after transcoding audio - 35609 Menu popup failures in user32:msg on Windows XP - 35612 jscript:activex fails if the user does not have sufficient privileges - 35620 WatchGuard System Manager 11.8.1 crashes on unimplemented function wsnmp32.dll.SnmpStartup + 11114 World in Conflict complains with "No appropriate 3D graphics card detected" (b3DAccelerationExists and b3DAccelerationEnabled dxdiagn properties missing) + 12388 Commandos 3: read_from_framebuffer_texture error (glCopyTexSubImage2D) + 15133 Application blocks waiting for a critical section during startup. This problem does not occur in Windows. + 17440 Anarchy Online: Fog bug introduced between v. 1.1.11 and 1.1.13 + 19269 Distant impostors does not work in Lord of the Rings Online + 20466 Multiple broken apps and games with incorrect TLS usage crash on startup (TLS slot index allocation must start at non-zero indexes (Brothers in Arms: Hell's Highway, ProShow Gold 5/6) + 21576 Touch screen loses calibration when in full screen mode - specifically AtomixMP3.exe + 21956 Empire Earth 1.00 and 1.04 crash with unhanded page fault + 22016 R.U.S.E. Public Beta in-game rendering is washed out + 23601 Windows Movie Maker 2.6 reports 'A new collections file cannot be created' (needs 'Microsoft' folder in CSIDL_LOCAL_APPDATA) + 24702 Pro Evolution Soccer 2010 DEMO: shows black screen with stars and never load + 25727 Dead Space resolution issues + 25780 MS Works 9.0 can't find license terms + 25914 Dead Space 2 exits with error + 27625 Panzer General 3D Demo: second scenario fails to load + 27797 No sound in FMOD games (Gratuitous Space Battles demo, Armored Brigade) + 27900 Miranda IM v0.9.25 group chats are broken + 28571 Saving file in Rockwell Arena Simulator causes crash. + 29003 T4C: Crashes during or after patching phase + 29875 MS Works 9.0 can't install (infinite waiting for estimating time) + 29968 Final Fantasy XI crashes when unfocused in windowed mode + 30079 Broken Sword - The Sleeping Dragon: Graphics corruption + 31079 Fatal error during Stronghold Crusader Demo installation + 31433 Foxit Reader 5.3.1.0606 crashes on startup + 32245 Multiple applications crash on startup due to unimplemented function shell32.dll.SHExtractIconsW + 32835 Batman: Arkham Asylum (non-Steam) Demo fails on startup (IWbemClassObject::GetNames with qualifier unsupported) + 33603 Metro: Last Light crash after several minutes + 33732 Broken non-PCM audio playback in Microsoft Sound Recorder + 34352 Multiple applications need 'Network Configuration Component Object', CLSID '{5b035261-40f9-11d1-aaec-00805fc1270e}' (CommView, iNodeSetup 3.60) + 34668 Age of Empires Trial version only gives a black screen + 35064 Daemon Tools Lite crashes after opening + 35112 L.A. Noire 1.3 (Steam version) fails to start, claiming "DX94: Graphics card capabilities are below the minimum specifications." (wined3d clamps device caps MaxVertexIndex to 0xFFFFF) + 35359 Kompas-3D v14 installer fails + 35474 'Das Fussball Studio' (VB6 based german soccer league db app) reports Run-time error '445' (needs IFile::OpenAsTextStream) + 35550 Horizon (Steam) needs msvcp100.dll.?_Random_device@tr1@std@@YAIXZ + 35555 Drakan Demo doesn't show the name of the display driver (the problem is in GetDeviceIdentifier when it is _not_ passed the DDGDI_GETHOSTIDENTIFIER flag) + 35678 Defiance patcher crashes on start (gdiplus/GdipDrawImagePointsRect) + 35786 Incorrect behaviour in printf with 0 value on "%#x" + 35802 OneNote 2013 installer needs KERNEL32.dll.SetWaitableTimerEx + 35809 Avoid deletion of precious (empty) folders such as '%USERPROFILE%\\Application Data' during MSI product upgrades/uninstalls + 35818 mscms/profile tests fail on Fedora + 35825 Mortal Online (MMORPG) client 1.75.00.07 displays garbled buttons/images with builtin gdiplus + 35827 Corel PaintShop Pro X6 v16.2 installer crashes on startup ('text/jscript' type not recognized when converting to script GUID) + 35833 iTunes 7 installer aborts early (automation methods HRESULT incorrectly translated to VBScript runtime Err.number) + 35838 MS Works 9.0 word processor crashes on startup (process heaps need to be 64K aligned) + 35840 'Das Fussball Studio' (VB6 based german soccer league db app) reports Run-time error '445' (needs ITextStream ReadAll method implementation) + 35867 Multiple applications need support for INetCfgLock, CLSID '{c0e8ae93-306e-11d1-aacf-00805fc1270e}' (CommView, iNodeSetup 3.60) + 35888 Stahlschlüssel 2007 no CD in drive warning + 35891 sdb2xml and native setupapi override crash on unimplemented function apphelp.dll.SdbInitDatabase + 35908 Regedit has wrong letter view in title bar with a desktop mode ---------------------------------------------------------------- -Changes since 1.7.12: +Changes since 1.7.15: -Akihiro Sagawa (3): - gdi32/tests: Mark Win2k result as broken. - gdi32/tests: Improve the font search method for test_EnumFontFamiliesEx_default_charset. - gdi32/tests: Avoid using GetGlyphIndices directly. - -Alexandre Julliard (21): - makefiles: Generate the testlist.c files at make depend time. - makefiles: Add makefile variables for the winegcc parameters. - user32: Use delayed imports to call the imm32 functions. - winebuild: Generate position-independent code for ARM. - ntdll: Fix printing formats for ARM registers. - kernel32: Set correct binary type for COM and PIF files. - widl: Ignore unknown -m target options. - wrc: Ignore unknown -m target options. - winebuild: Add support for -marm and -mthumb target flags. - winegcc: Forward -marm and -mthumb options to winebuild. - configure: Add the -marm option to the target flags. - ntdll: Trace missing exception info on ARM. - kernel32/tests: Add some tests for dll import resolution. - ntdll: Don't fixup imports when a dll is already loaded. - ntdll: Don't fixup imports for executables. - ntdll: Move fixup_imports to avoid forward declarations. - ntdll: Only allocate TLS data when resolving imports. - makedep: Only add global includes to the include paths when generating the makefile. - makedep: Look for source files only in the source directory. - makedep: Generate .fon rules directly into the output instead of adding generated files. - kernel32: Fix build on older Mac OS X. +Alexandre Julliard (10): + ntdll: Heap handles should be 64K-aligned. + kernel32/tests: Move allocation tests into heap.c. + kernel32: Don't allocate FLS index 0. + makedep: Add dependency for ttf font files when necessary. + makedep: Add phony install targets for fonts also for the ttf case. + makedep: Load some variables from the top-level makefile. + makedep: Allow the top-level makefile to set default values for make variables. + makedep: Add helper functions to get and set variables in string arrays. + make_xftmpl: Always output data in little-endian format. + make_xftmpl: Get rid of the parser structure. Alistair Leslie-Hughes (4): - dpnet/tests: Add DirectPlay8Server tests. - dpnet/tests: Add IDirectPlay8Peer_EnumHosts tests. - dpnet: Add DirectPlay8 registry keys. - dpnsvr.exe: New stub program. - -Andrey Gusev (3): - Assorted typos fixes. - odbccu32: Correct filename string. - xinput1_4: Add version.rc file. + netcfgx: Add INetCfg interface support. + include: Add interface INetCfgLock. + netcfgx: Add INetCfgLock support. + dbghelp: Improve dwarf support. + +Andrew Eikum (1): + winmm/tests: Accept MMSYSERR_ALLOCATED for more tests. + +Andrey Gusev (1): + po: Update Ukrainian translation. + +André Hentschel (2): + setupapi: Add support for more architectures when building fake dlls. + setupapi: Don't confuse ARM with ARM64. -André Hentschel (1): - gdiplus/tests: Remove assertions in graphics tests. - -Aric Stewart (1): - winemac.drv: Improve positioning of IME client window based on caret. - -Aurimas Fišeras (1): +Aurimas Fišeras (2): + po: Update Lithuanian translation. po: Update Lithuanian translation. -Austin English (3): - wbemprox: Add a missing break (Coverity). - riched20: Remove duplicate declaration. - configure: Give a warning for missing gnutls. - -Bruno Jesus (4): - bcrypt: Add semi-stub implementation of BCryptGenRandom. - ws2_32: Add AI_NUMERICSERV support. - ws2_32: Fix edge case for getaddrinfo in BSD and OSX. - ws2_32: Fix conversion of address in GetAddrInfoW. - -Dmitry Timoshkov (36): - xmllite/tests: Fix stack corruption in 64-bit builds. - xmllite/tests: There is no need to initialize OLE. - xmllite/tests: Add a test for short variant of xml declaration. - cabinet/tests: Advance buffer by actually read bytes count. - advapi32/tests: Add a test for page to access mapping performed by CreateFileMapping. - kernel32: Fix page protection to access mapping performed by CreateFileMapping. - advapi32/tests: Correct the test failure message. - scrrun: Move the counter check into the code block where counter is actually incremented. - scrrun: Fix a file enumeration handle leak. - taskschd: Forward ITaskFolder::RegisterTask to IRegisterTask constructor. - taskschd/tests: Add some ITaskDefinition tests. - taskschd: Add ITaskSettings stub implementation. - taskschd: Implement most of ITaskSettings get methods. - advapi32/tests: Fix test failures under Windows 2000 and some XP versions. - xmllite: Don't fail if encoding declaration is missing. - xmllite: Don't fail if standalone declaration is missing. - xmllite/tests: Add a test for names and values parsed from an XML declaration. - xmllite: Reader should set starting string offsets when encoding is being parsed. - xmllite: Don't fail the whole parsing process because of unsupported 'xmlns' attribute. - xmllite: Add an import library. - taskschd: Implement ITaskFolder::RegisterTask as a wrapper around ITaskFolder::RegisterTaskDefinition. - taskschd: Add initial implementation of ITaskDefinition::put_XmlText. - taskschd: Make ITaskSettings a part of ITaskDefinition implementation. - taskschd: Implement ITaskDefinition::put_Settings. - taskschd: Implement reading Settings of the task definition XML chunk. - user32/tests: Flush pending events before testing menu messages. - shlwapi: Return interface instead of implementation pointer. - shlwapi: Avoid potential NULL pointer access if HeapAlloc fails. - shlwapi: Avoid a not necessary intermediate variable. - taskschd: Add IRegistrationInfo stub implementation. - taskschd: Make IRegistrationInfo a part of ITaskDefinition implementation. - taskschd: Delay creation of ITaskSettings until it's required. - taskschd: Make ITaskDefinition a part of IRegisteredTask implementation. - taskschd: Implement IRegisteredTask::get_Definition. - taskschd: Implement IRegisteredTask::get_Xml. - xmllite/tests: Add a test for parsing an empty element after XML declaration. - -Erich Hoover (3): - kernel32: Add support for security access parameters for named pipes. - ddraw: Return a DLL in szDriver for GetDeviceIdentifier. - ddraw: Return the D3D identifier when GetDeviceIdentifier is called with no flags. - -François Gouget (8): - inetmib1/tests: Add a trailing '\n' to an ok() call. - dpnet/tests: Add a trailing '\n' to an ok() call. - shell32/tests: Skip any test that needs the .shlexec association if we could not create it. - ddraw/tests: Skip the primary palette tests if the 640x480x8 mode is not supported. - atl/registrar: Skip the test_registrar() tests if we don't have elevated privileges. - atl100/tests: Skip the test_regcat() tests if we don't have elevated privileges. - ddraw/tests: Better clean up when skipping the primary palette tests. - faultrep/tests: AddERExcludedApplication() fails if we have insufficient privileges. - -Frédéric Delanoy (14): - Assorted spelling fixes. - propsys: Use BOOL type where appropriate. - msvcrtd: Use BOOL type where appropriate. - crypt32/tests: Use common wine_dbgstr_guid implementation from test.h. - propsys/tests: Use common wine_dbgstr_guid implementation from test.h. - dsound/tests: Use wine_dbgstr_guid for printing GUIDs. - ole32/tests: Use wine_dbgstr_guid for printing GUIDs. - setupapi: Use BOOL type where appropriate. - msi: Fix typo in a field name. - winhlp32: Use BOOL type where appropriate. - mscoree: Use BOOL type where appropriate. - mscoree/tests: Use BOOL type where appropriate. - user32: Use BOOL type where appropriate. - cabarc: Use BOOL type where appropriate. - -Hans Leidekker (3): - winhttp/tests: Fix a couple of test failures. - winhttp/tests: Improve tracing. - wbemprox: Don't list loopback network adapters. - -Henri Verbeet (31): - dxgi/tests: Cleanup test_output(). - dxgi/tests: Use D3D10CreateDevice() to create a device. - dxgi/tests: Don't reuse the device. - dxgi: Return DXGI_ERROR_INVALID_CALL when given a NULL mode_count in dxgi_output_GetDisplayModeList(). - dxgi: Properly check if the output array is large enough in dxgi_output_GetDisplayModeList(). - dxgi: Implement CreateDXGIFactory1(). - dxgi/tests: Add tests for CreateDXGIFactory(). - dxgi/tests: Also test for ID3D10Device1 and ID3D11Device in test_device_interfaces(). - d3d10core: Implement ID3D10Device1. - d3d10_1: Implement D3D10CreateDevice1(). - d3d10core: Implement ID3D10Multithread. - d3d8/tests: Accept some broken results in test_scalar_instructions(). - d3d10core: Implement d3d10_texture2d_GetDevice(). - d3d10core: Implement d3d10_texture3d_GetDevice(). - d3d10core: Implement d3d10_buffer_GetDevice(). - d3d10core: Implement d3d10_depthstencil_view_GetDevice(). - d3d10core: Implement d3d10_rendertarget_view_GetDevice(). - d3d10core: Implement d3d10_shader_resource_view_GetDevice(). - d3d10core: Implement d3d10_vertex_shader_GetDevice(). - d3d10core: Implement d3d10_pixel_shader_GetDevice(). - d3d10: Release depth stencil state references in d3d10_effect_variable_destroy(). - d3d10: Release blend state references in d3d10_effect_variable_destroy(). - d3d10: Release rasterizer state references in d3d10_effect_variable_destroy(). - d3d10: Release sampler state references in d3d10_effect_variable_destroy(). - d3d10core: Implement d3d10_sampler_state_GetDevice(). - d3d10core: Implement d3d10_blend_state_GetDevice(). - d3d10core: Implement d3d10_depthstencil_state_GetDevice(). - d3d10core: Implement d3d10_rasterizer_state_GetDevice(). - d3d10core: Implement d3d10_query_GetDevice(). - advapi32: Add a stub for EventProviderEnabled. - d2d1: Add a stub D2D1CreateFactory() implementation. - -Huw D. M. Davies (1): - user32: If the listbox loses focus while holding capture, release it by essentially simulating a button up event. - -Jacek Caban (35): - wmp: Added SetClientSite implementation. - wmp: Added SetClientSite tests. - wmp: Added GetClientSite implementation. - wmp.idl: Added proper version independent ProgID. - wmp: Added missing registry entries for WindowsMediaPlayer coclass registration. - wmp: Added GetMiscStatus implementation. - wmp: Added IOleInPlaceObjectWindowless stub implementation. - msxml3: Fixed qname leak. - wmp: Added IConnectionPointContainer stub implementation. - msxml3: Read stream data until Read fails or returns 0 bytes. - urlmon: Added IsInternetESCEnabledLocal implementation. - atl: Share atl_ax.c with atl100. - atl: Share sources with atl100 instead of forwarding calls. - atl: Moved AtlRegisterTypeLib to atl.c to avoid importing atl80.dll in atl.dll. - urlmon: Unregister window class on DLL unload. - atl: Renamed atl_main.c to atl30.c. - atl: Moved source files from atl100 to atl directory. - mshtml: Added IHTMLDocument2::get_activeElement implementation. - mshtml.idl: Added IHTMLDocument7 and related interfaces declarations. - mshtml: Use IWebBrowserPriv2IE9 instead of IWebBrowserPriv2IE8 in tests on IE9+. - wmp.idl: Added some missing interfaces. - jscript: Skip tests if we can't register ActiveX object. - vbscript: Skip tests if we can't register ActiveX object. - wscript: Skip tests if we can't register ActiveX object. - d3d10_1.idl: Added D3D10CreateDevice1 declaration. - d3d9.h: Added Direct3DCreate9Ex declaration. - dxgi.idl: Added CreateDXGIFactory1 declaration. - shell32/tests: Ensure that tmpdir contains long path name. - mshtml: Added support for ZoomFactor registry value. - wmp: Added IWMPPlayer4 stub implementation. - wmp/tests: Fixed tests on old WMP versions. - wmp: Added DoVerb(OLEIVERB_INPLACEACTIVATE) implementation. - wmp: Added IOleObject::Close implementation. - wmp: Added IOleInPlaceObject::GetWindow implementaiton. - wmp: Added more tests. +Austin English (5): + ws2_32: Skip some tests on broken ISPs. + winhttp: Skip tests on broken ISPs. + shell32: Fix a typo. + wine.inf: Add %AppData%\Microsoft and %LocalAppData%\Microsoft folders:. + apphelp: Add a stub for SdbInitDatabase. + +Dmitry Timoshkov (13): + include: Fix a typo in _MSC_VER. + schedsvc: Skip the UTF-8 byte order mark when returing XML to the client. + widl: Pass type attributes from write_array_tfs to write_pointer_description. + widl: Pass type attributes from write_array_tfs to write_array_element_type. + widl: Avoid generating negative offsets for conformant arrays of strings. + widl: Don't call write_embedded_types if an array element is a string. + widl: Add support for an array of strings to write_string_tfs. + rpcrt4/tests: Add a couple of tests for marshalling an array of strings. + widl: Correct the condition when to use new code path which avoids writing negative offsets in the pointer description. + schrpc.idl: Add missing [string] attribute to an array of strings being returned by SchRpcEnumFolders/SchRpcEnumTasks. + schedsvc: Implement SchRpcEnumFolders. + schedsvc: Implement SchRpcEnumTasks. + schedsvc: Add some tests for scheduler RPC API. + +Erich Hoover (1): + ws2_32: Ask the server to process unsupported WSAIoctl operations. + +Eriks Dobelis (2): + wintab: Fix incorrectly classifying cursor as stylus instead of eraser. + wintab: Initialize lcOutExtX and Y values. + +François Gouget (3): + wbemprox/tests: Make test_GetNames() static. + netcfgx/tests: Make create_configuration() static. + user32/tests: Fix compilation on systems that don't support nameless unions. + +Gerald Pfeifer (1): + readme: Raise the minimum version of FreeBSD to 8.0. + +Hans Leidekker (13): + wbemprox: Add support for WBEM_FLAG_NONSYSTEM_ONLY and WBEM_FLAG_SYSTEM_ONLY in IWbemClassObject::GetNames. + user32/tests: Add more tests for PrivateExtractIcons. + shell32: Forward ShExtractIconsW to user32.PrivateExtractIconsW. + riched20: Don't return DLGC_HASSETSEL from WM_GETDLGCODE if the control style includes ES_SAVESEL. + fonts: Add Hungarian localization of Tahoma font names. + wldap32/tests: Skip tests if the connection times out. + shell32/tests: Remove todo handling from DDE tests. + shell32/tests: Mark some test results as broken. + wbemprox: Add a stub implementation of Win32_PhysicalMemory. + wbemprox: Implement more properties of Win32_OperatingSystem. + wbemprox: Implement more properties of Win32_DiskDrive. + wbemprox: Implement Win32_CDROMDrive.MediaType. + wbemprox: Implement Win32_VideoController.Availability. + +Henri Verbeet (25): + d3d9/tests: Use a separate device for texdepth_test(). + d3d9/tests: Use a separate device for texbem_test(). + d3d9/tests: Use a separate device for fog_with_shader_test(). + d3d9/tests: Use a separate device for stream_test(). + d3d9/tests: Use a separate device for test_vshader_float16(). + d3d9/tests: Handle the Windows 8 testbot results in zenable_test(). + d3d9/tests: Handle the Windows 8 testbot results in fp_special_test(). + d3d9/tests: Handle the Windows 8 testbot results in cnd_test(). + d3d9/tests: Use an easier to debug texture in generate_bumpmap_textures(). + d3d9/tests: Handle the Windows 8 testbot results in test_vshader_input(). + d3d9/tests: Use a separate device for test_vshader_input(). + d3d9/tests: Use a separate device for clip_planes_test(). + d3d9/tests: Use a separate device for sgn_test(). + d3d9/tests: Use a separate device for sincos_test(). + d3d9/tests: Use a separate device for loop_index_test(). + d3d9/tests: Use a separate device for test_mova(). + d3d9/tests: Use a separate device for test_compare_instructions(). + d3d9/tests: Use a separate device for test_constant_clamp_vs(). + d3d9/tests: Use a separate device for viewport_test(). + d3d9/tests: Use a separate device for alphatest_test(). + d3d9/tests: Use a separate device for zwriteenable_test(). + d3d9/tests: Use a separate device for yuv_layout_test(). + d3d9/tests: Use a separate device for yuv_color_test(). + d3d9/tests: Use a separate device for np2_stretch_rect_test(). + d3d9/tests: Use a separate device for tssargtemp_test(). + +Hermès Bélusca-Maïto (2): + usp10: Avoid non-standard array initialization. + winemac.drv: Fix a typo in _MSC_VER. + +Hugh McMaster (3): + regsvr32: Replace printf calls with WriteConsole function. + regsvr32: Move silent check to the output_write function. + regsvr32: Fix filename in version definition. + +Huw D. M. Davies (2): + riched20: Add a helper to return the default line height and use that in EM_LINESCROLL. + riched20: Keep track of fractions of WHEEL_DELTA when scrolling. + +Jacek Caban (14): + mshtml: Added IHTMLStyle::listStyleType property implementation. + vbscript: Fixed a leak. + wininet: Merge GetLastError() test into other request tests. + wininet: Fixed tests on some old Windows versions. + vbscript: Store required stack offset before doing jump. + dxgi.idl: Added IDXGIDevice1 declaration. + dxgi1_2.idl: Added new file. + vbscript: Map some known error codes to vbscript errors. + vbscript: Return only code part of HRESULT for vbscript errors as Err.number. + vbscript/tests: Added more error tests. + ntdll: Reserve TLS slot 0 for broken apps that compare index to 0 instead of TLS_OUT_OF_INDEXES. + kernel32: Skip reserved TLS tests on WinXP SP1. + docobj.idl: Added some new OLECMDID values. + ieframe: Fixed some tests on IE11. + +Jactry Zeng (2): + riched20: Return E_INVALIDARG for empty ppSel in ITextDocument::GetSelection. + riched20: Fix a typo in CreateIRichEditOle. + +Javier Cantero (3): + user32: Fix side effect in SubtractRect(). + user32/tests: Add SubtractRect() test. + user32/tests: New test cases for SubtractRect(). -Jactry Zeng (1): - riched20/tests: Add tests to check the content open by ITextDocument_fnOpen. +Julian Rüger (1): + po: Update German translation. + +Kai Tietz (1): + corerror.h: Merge with mingw-w64's extensions. Ken Thomases (10): - d3d8/tests: Ignore broken CheckDeviceType() behavior on 64-bit Windows 8. - d3d9/tests: Ignore broken CheckDeviceType() behavior on 64-bit Windows 8. - kernel32: Check that sysctl() call succeeded before using its output. - kernel32: Avoid truncating 64-bit ullTotalPhys value to 32 bits when copying to ullAvailPhys, ullTotalPageFile, and ullAvailPageFile. - kernel32: Consolidate some duplicate variable declarations. - kernel32: Prefer HW_MEMSIZE sysctl variable over HW_PHYSMEM, if available, since it's 64 bits. - kernel32: Use sysctl(VM_SWAPUSAGE) to get swap sizes on BSDs, if available. - kernel32: Use the Mach host_info(HOST_BASIC_INFO) API to obtain total RAM after trying sysctl(HW_MEMSIZE) and before HW_PHYSMEM. - kernel32: Prefer the Mach host_statistics64(HOST_VM_INFO64) API over sysctl(HW_USERMEM) to obtain free memory. - kernel32: Fix build on newer Mac OS X. + winemac: Don't recreate the GL view when the pixel format is set again. + winemac: Improve handling of swap interval with respect to pbuffers, clamping to 0. + wined3d: Don't leak the HDC of an invalid context in context_update_window(). + wined3d: Simplify the error path of context_update_window(). + wined3d: Don't call GetPixelFormat() to set a flag that's already set. + wined3d: When restoring pixel format in context_release(), mark the context as needing to be set on the next context_acquire(). + wined3d: Track if a context's hdc is private so we never need to restore its pixel format. + wined3d: Track if a context's private hdc has had its pixel format set, so we don't need to check it. + winex11: Maintain the swap interval when the drawable is recreated. + winex11: Remove set-but-never-read hwnd and fbconfig_id fields of struct x11drv_escape_set_drawable. Lauri Kenttä (1): po: Update Finnish translation. Marcus Meissner (1): - oleaut32: Incorrect sizeof() to MultiByteToWideChar (Coverity). + wbemprox: Fixed leaks in fill_datafile (Coverity). + +Markus Weiland (1): + dxdiagn: Added properties for hardware acceleration capabilities. + +Michael Müller (6): + dxva2: Added stub dll. + include: Add dxva2api.idl. + include: Add physicalmonitorenumerationapi.h. + include: Add lowlevelmonitorconfigurationapi.h. + include: Add highlevelmonitorconfigurationapi.h. + dxva2: Add implementation for stub functions. + +Michael Stefaniuc (2): + shell32: Simplify the creation of an IEnumIDList. + shell32: COM cleanup for IEnumIDList. + +Nikolay Sivov (30): + kernel32: Added SetWaitableTimerEx(). + scrrun: Implement OpenAsTextStream(). + oleaut32/tests: Remove early returns on test failure that never happen. + oleaut32/tests: Move string allocation after function pointer check (Coverity). + comctl32/tests: Fix uninitialized variable case (Coverity). + ole32: Fix some leaks on early returns (Coverity). + ole32: Fix leaks on error paths (Coverity). + scrrun: Close find handle on error (Coverity). + scrrun: Fix a find handle leak (Coverity). + winhttp: Move allocation after input validation to fix leaks (Coverity). + comctl32: Fix a leak on error path (Coverity). + gdiplus: Fix image attributes leak (Coverity). + msi: Fix a record leak on error paths (Coverity). + msi: Fix a leak of allocated string buffer on error path (Coverity). + msi: Fix a record leak on error path (Coverity). + msi: Fix a record leak on failure removing a column (Coverity). + scrrun: Added IsReady property for a drive. + scrrun: Implement TotalSize property for a drive. + scrrun: Implement AvailableSpace property for a drive. + scrrun: Implement DriveLetter property for a drive. + qcap/tests: Check method return values (Coverity). + msxml3/tests: Check return values (Coverity). + regsvr32: Fix some usage message issues. + kernel32: Added QueryUnbiasedInterruptTime(). + po: Update Russian translation. + msxml3: Handle NULL child in appendChild(). + scrrun: Implement ReadAll(). + scrrun: Implement Read(). + scrrun: Implement FreeSpace() for a drive. + fonts: Added glyphs for U+0404/U+0454 Ukrainian Ye for Tahoma Bold. + +Piotr Caban (7): + user32/tests: Workaround SetForegroundWindow failure due to foreground lock timeout. + msvcp90: Add _Random_device implementation. + msvcrt: Remove setlocale test with empty locale string. + qcap/tests: Fix AviMux test failures on Win2k. + user32: Change SetFocus behavior on windows with parent and no WS_CHILD flag. + user32: Change SetForegroundWindow behavior on windows with parent and no WS_CHILD flag. + user32: Make it possible to activate a window with parent and no WS_CHILD flag in WS_NCLBUTTONDOWN function. + +Robert Naumann (1): + mgmtapi: Fix a typo in the export of SnmpMgrRequest. + +Sebastian Lackner (1): + kernel32: Silence SetWaitableTimerEx fixme message. + +Shuai Meng (1): + oleaut32: Fixed bounds of VarIntFromFloat. + +Stefan Dösinger (15): + d3d9: Introduce a resource structure. + d3d9: Use the private store api for buffers. + d3d9: Use the private store api for textures. + d3d9: Use the private store api for surfaces. + wined3d: Remove resource private data methods. + wined3d: Select the component by editing the swizzle. + wined3d: Handle LOG and LOGP in shader_hw_scalar_op. + wined3d: Handle RCP in shader_hw_scalar_op. + wined3d: Translate LOGP to LG2 in the ARB shader backend. + wined3d: Translate shader model 2.0+ EXPP to EX2. + wined3d: Raise MaxPrimitiveCount and MaxVertexIndex. + d3dx9_36/tests: Initialize some test values. + d3dxof: Make the get_primitive_string parameter a DWORD. + d3dxof: Include wine/port.h in parsing.c. + include: The NumUAVs parameter of OMGetRenderTargetsAndUnorderedAccessViews is an input parameter. + +Stefan Leichter (1): + wtsapi32: Extend the parameter check of WTSEnumerateProcessesW. + +Thomas Faber (15): + dplayx: Fix broken pointer arithmetic. + gameux/tests: Avoid a variable-length array. + gdi32: Avoid variable-length arrays. + msxml3: Avoid a variable-length array. + shell32: Avoid a variable-length array. + ws2_32: Avoid a variable-length array. + oleview: Avoid variable-length arrays. + configure: Enable -Wvla if available. + comctl32: Make Str* functions private. + setupapi: Fix buffer overflow in SetupGetFileCompressionInfoW. + advapi32: Fix stack corruption in CredIsMarshaledCredentialW. + advapi32: Remove unnecessary buffer copy in CredMarshalCredentialW. + advapi32/tests: Use a loop for CredUnmarshalCredential test cases. + advapi32: Set output type earlier in CredUnmarshalCredential. + advapi32: Fix uneven length handling in CredUnmarshalCredential. + +Vijay Kiran Kamuju (1): + mshtml: Add text/jscript as valid mime type for javascript files. + +Vincent Povirk (4): + gdiplus: Limit image output to the bounds of the Graphics object. + gdiplus: Remove a useless comparison. + gdiplus: Copy palettes with bitmaps. + msi: Fix infinite loop. -Martin Storsjo (5): - wined3d: Fix clamping in reading rectangular YV12 textures. - wined3d: Fix the YV12 illustration. - wined3d: Add support for NV12 textures. - wined3d: Use an rbtree for storing shaders for texture format conversion/blitting. - d3d9/tests: Add tests for different YUV texture layouts. - -Matteo Bruni (10): - d3dx9: Add some TRACEs and FIXMEs to D3DXCreateTextureFromFileInMemoryEx. - d3dx9: Enforce minimum texture dimensions for block-based pixel formats. - d3dx9: Trace DDS pixel format. - d3dx9: Add missing trace to D3DXLoadVolumeFromFileInMemory. - d3dx9: Handle pixel formats larger than 32 bits in surface loading / filtering functions. - d3dx9/tests: Create A8L8 and DXTn textures instead of plain surfaces. - d3dx9: Add some more float pixel formats. - d3dx9: Allow loading float "FOURCC" DDS files. - d3dx9/tests: Add a test for constant tables in FX20 shaders. - d3dx9/tests: Use a valid version tag for the "empty" shader. - -Michael Stefaniuc (6): - qedit: IMemInputPin / IQualityControl are IPin stuff. - qedit/tests: Expand the SampleGrabber COM tests. - qedit: Return the correct iface in IEnumPins_QueryInterface(). - qedit/tests: COM tests for IEnumPins from SampleGrabber. - strmbase: Return the iface instead of the object pointer. - qedit: Use the generic BaseFilter implementation in SampleGrabber. - -Nikolay Sivov (23): - oleaut32: Add more tracing, hide initialization details by calling a method. - oleaut32: Initialize result VARIANT in *FromDisp(). - comctl32/tab: Fix TCM_SETCURSEL on negative indices. - wshom: Implement LocationPath property for shortcut. - wininet: Update module version. - mshtml: Implement HTMLStyleSheet_get_href(). - ole32: Use CoTaskMemAlloc() instead of IMalloc directly. - ole32: Separate IIDFromString() for CLSIDFromString(), fix corner cases and return values. - ole32: Use precomposed table for GUID from string conversion. - ole32: Remove ERR() output that's not really helpful. - kernel32/tests: Don't test last error when there's no failure. - kernel32/tests: Fix some test failures in older XP/Win2k3 versions. - msxml3: Implement addParameter() for XSLProcessor. - include: Added ITransferSource/ITransferDestination interfaces. - shell32/tests: Fix a test failure on Win8. - comctl32/tests: Don't assert() on test failures. - advapi32/tests: Accept another error code returned on some WinXP systems. - msxml3: Pass XSL processor parameters to libxml2. - oleaut32/tests: Some tests for record-based safearray copy. - comctl32/tests: Some tests for Button control. - oleaut32: Fix destination data release when copying FADF_RECORD arrays. - oleaut32: No need to VariantClear() before VariantCopy(). - ole32/tests: Handle context generation failure better. - -Piotr Caban (2): - msvcrt/tests: Don't pass path containing spaces to _spawnvp. - msvcrt: Return error on invalid handle in _open_osfhandle. - -Stefan Dösinger (7): - wined3d: Don't use NP2 repacking for RECT textures. - wined3d: Reject height scaled repacked np2 textures. - d3d9/tests: Clean up yuv_color_test. - d3d9/tests: Skip YUV tests if the formats cannot be converted. - d3d9/tests: Add a test for sub resource private data. - d3d8/tests: Add a test for sub resource private data. - ddraw/tests: Port test_private_data to ddraw4. - -Vincent Povirk (1): - gdiplus: Improve GdipFillRectangles parameter validation. - -Ștefan Fulea (2): - fonts: Add the missing Romanian diacritical letters to Tahoma Bold. - fonts: Correct the bitmap parts of Romanian diacritical letters in Tahoma Bold. +Zhenbo Li (1): + mshtml: Added IHTMLTableRow::bgColor property implementation. -- Alexandre Julliard diff -Nru wine1.7-1.7.13/AUTHORS wine1.7-1.7.16/AUTHORS --- wine1.7-1.7.13/AUTHORS 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/AUTHORS 2014-04-04 19:13:44.000000000 +0000 @@ -383,6 +383,7 @@ Erik de Castro Lopo Erik Hofman Erik Inge Bolsø +Eriks Dobelis Erik Svendsen Erwin Wolff Eryk Wieliczko @@ -515,6 +516,7 @@ Hongbo Ni Howard Abrams Howell Tam +Hugh McMaster Huw D. M. Davies Hwang YunSong (황윤성) Iain Arnell @@ -584,6 +586,7 @@ Jason McMullan Jason Phillips Jau-Horng Chen +Javier Cantero Jay Yang Jean-Bruno Luginbühl Jean-Claude Batista @@ -1162,6 +1165,7 @@ Robert Lunnon Robert McDonald Robert Millan +Robert Naumann Robert North Roberto Augusto Pungartnik Robert O'Callahan @@ -1237,6 +1241,7 @@ Shaun Morris Sheri Steeves Shi Quan He +Shuai Meng Shunichi Fuji Simen Zamecnik Simeon Pilgrim diff -Nru wine1.7-1.7.13/configure wine1.7-1.7.16/configure --- wine1.7-1.7.13/configure 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/configure 2014-04-04 19:13:44.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.13. +# Generated by GNU Autoconf 2.69 for Wine 1.7.16. # # Report bugs to . # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='Wine' PACKAGE_TARNAME='wine' -PACKAGE_VERSION='1.7.13' -PACKAGE_STRING='Wine 1.7.13' +PACKAGE_VERSION='1.7.16' +PACKAGE_STRING='Wine 1.7.16' PACKAGE_BUGREPORT='wine-devel@winehq.org' PACKAGE_URL='http://www.winehq.org' @@ -1024,10 +1024,13 @@ enable_dwrite enable_dxdiagn enable_dxgi +enable_dxva2 enable_explorerframe enable_ext_ms_win_gdi_devcaps_l1_1_0 enable_faultrep enable_fltlib +enable_fntcache +enable_fontsub enable_fusion enable_fwpuclnt enable_gameux @@ -1193,6 +1196,7 @@ enable_scarddlg enable_sccbase enable_schannel +enable_schedsvc enable_scrrun enable_scsiport_sys enable_secur32 @@ -1356,6 +1360,7 @@ enable_uninstaller enable_unlodctr enable_view +enable_wevtutil enable_wineboot enable_winebrowser enable_winecfg @@ -1966,7 +1971,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.13 to adapt to many kinds of systems. +\`configure' configures Wine 1.7.16 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2035,7 +2040,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Wine 1.7.13:";; + short | recursive ) echo "Configuration of Wine 1.7.16:";; esac cat <<\_ACEOF @@ -2230,7 +2235,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -Wine configure 1.7.13 +Wine configure 1.7.16 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2748,7 +2753,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.13, which was +It was created by Wine $as_me 1.7.16, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -4843,13 +4848,16 @@ fi fi if test -z "$wine_cv_toolsdir"; then + wine_makedep=tools/makedep wine_cv_toolsdir="\$(top_builddir)" elif test -d "$wine_cv_toolsdir/tools/winebuild"; then + wine_makedep=$wine_cv_toolsdir/tools/makedep case "$wine_cv_toolsdir" in /*) ;; *) wine_cv_toolsdir="\$(top_builddir)/$wine_cv_toolsdir" ;; esac enable_tools=${enable_tools:-no} + test -f "$wine_makedep" || as_fn_error $? "the Wine tools have not yet been built in $wine_cv_toolsdir" "$LINENO" 5 else as_fn_error $? "could not find Wine tools in $wine_cv_toolsdir" "$LINENO" 5 fi @@ -13687,6 +13695,31 @@ if test "x$ac_cv_cflags__Wunused_but_set_parameter" = xyes; then : EXTRACFLAGS="$EXTRACFLAGS -Wunused-but-set-parameter" fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wvla" >&5 +$as_echo_n "checking whether the compiler supports -Wvla... " >&6; } +if ${ac_cv_cflags__Wvla+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_wine_try_cflags_saved=$CFLAGS +CFLAGS="$CFLAGS -Wvla" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(int argc, char **argv) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_cflags__Wvla=yes +else + ac_cv_cflags__Wvla=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS=$ac_wine_try_cflags_saved +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wvla" >&5 +$as_echo "$ac_cv_cflags__Wvla" >&6; } +if test "x$ac_cv_cflags__Wvla" = xyes; then : + EXTRACFLAGS="$EXTRACFLAGS -Wvla" +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wwrite-strings" >&5 $as_echo_n "checking whether the compiler supports -Wwrite-strings... " >&6; } if ${ac_cv_cflags__Wwrite_strings+:} false; then : @@ -16575,7 +16608,7 @@ .MAKEFILEDEPS: all: Makefile Makefile: $srcdir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) - @./config.status Make.tmp Makefile && \$(MAKEDEP) ." + @./config.status Make.tmp Makefile" test "$srcdir" = . && wine_fn_append_rule "all: .gitignore .gitignore: config.status @@ -16833,6 +16866,7 @@ wine_fn_config_dll dssenh enable_dssenh wine_fn_config_test dlls/dssenh/tests dssenh_test wine_fn_config_dll dswave enable_dswave clean +wine_fn_config_test dlls/dswave/tests dswave_test wine_fn_config_dll dwmapi enable_dwmapi implib wine_fn_config_dll dwrite enable_dwrite implib wine_fn_config_test dlls/dwrite/tests dwrite_test @@ -16843,12 +16877,15 @@ wine_fn_config_dll dxgi enable_dxgi implib wine_fn_config_test dlls/dxgi/tests dxgi_test wine_fn_config_lib dxguid +wine_fn_config_dll dxva2 enable_dxva2 wine_fn_config_dll explorerframe enable_explorerframe clean wine_fn_config_test dlls/explorerframe/tests explorerframe_test wine_fn_config_dll ext-ms-win-gdi-devcaps-l1-1-0 enable_ext_ms_win_gdi_devcaps_l1_1_0 wine_fn_config_dll faultrep enable_faultrep implib wine_fn_config_test dlls/faultrep/tests faultrep_test wine_fn_config_dll fltlib enable_fltlib +wine_fn_config_dll fntcache enable_fntcache +wine_fn_config_dll fontsub enable_fontsub wine_fn_config_dll fusion enable_fusion wine_fn_config_test dlls/fusion/tests fusion_test wine_fn_config_dll fwpuclnt enable_fwpuclnt @@ -17013,7 +17050,8 @@ wine_fn_config_dll nddeapi enable_nddeapi implib wine_fn_config_dll netapi32 enable_netapi32 implib wine_fn_config_test dlls/netapi32/tests netapi32_test -wine_fn_config_dll netcfgx enable_netcfgx +wine_fn_config_dll netcfgx enable_netcfgx clean +wine_fn_config_test dlls/netcfgx/tests netcfgx_test wine_fn_config_dll newdev enable_newdev implib wine_fn_config_dll normaliz enable_normaliz implib wine_fn_config_dll npmshtml enable_npmshtml @@ -17098,6 +17136,8 @@ wine_fn_config_dll sccbase enable_sccbase wine_fn_config_dll schannel enable_schannel wine_fn_config_test dlls/schannel/tests schannel_test +wine_fn_config_dll schedsvc enable_schedsvc clean +wine_fn_config_test dlls/schedsvc/tests schedsvc_test clean wine_fn_config_dll scrrun enable_scrrun clean wine_fn_config_test dlls/scrrun/tests scrrun_test clean wine_fn_config_dll scsiport.sys enable_scsiport_sys @@ -17253,6 +17293,7 @@ wine_fn_config_test dlls/wsnmp32/tests wsnmp32_test wine_fn_config_dll wsock32 enable_wsock32 implib wine_fn_config_dll wtsapi32 enable_wtsapi32 implib +wine_fn_config_test dlls/wtsapi32/tests wtsapi32_test wine_fn_config_dll wuapi enable_wuapi clean wine_fn_config_dll wuaueng enable_wuaueng wine_fn_config_dll xapofx1_1 enable_xapofx1_1 @@ -17316,7 +17357,7 @@ wine_fn_config_program regedit enable_regedit install,installbin,manpage,po wine_fn_config_test programs/regedit/tests regedit.exe_test wine_fn_config_program regsvcs enable_regsvcs install -wine_fn_config_program regsvr32 enable_regsvr32 install,installbin,manpage +wine_fn_config_program regsvr32 enable_regsvr32 install,installbin,manpage,po wine_fn_config_program rpcss enable_rpcss clean,install wine_fn_config_program rundll.exe16 enable_win16 install wine_fn_config_program rundll32 enable_rundll32 install @@ -17336,6 +17377,7 @@ wine_fn_config_program uninstaller enable_uninstaller install,po wine_fn_config_program unlodctr enable_unlodctr install wine_fn_config_program view enable_view install,po +wine_fn_config_program wevtutil enable_wevtutil install wine_fn_config_program wineboot enable_wineboot install,installbin,manpage,po wine_fn_config_program winebrowser enable_winebrowser install wine_fn_config_program winecfg enable_winecfg install,installbin,manpage,po @@ -18035,7 +18077,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.13, which was +This file was extended by Wine $as_me 1.7.16, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18106,7 +18148,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.13 +Wine config.status 1.7.16 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -18229,7 +18271,7 @@ } wine_fn_output_makefile () { - cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$1 && rm -f Make.tmp && return + cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$1 && rm -f Make.tmp && "$wine_makedep" . && return `cat $wine_rules_file` _WINE_EOF as_fn_error $? "could not create Makefile" "$LINENO" 5 @@ -18900,7 +18942,9 @@ IFS="|" for msg in $wine_notices; do IFS="$ac_save_IFS" - if ${msg+:} false; then : + if ${msg:+false} :; then : + +else { $as_echo "$as_me:${as_lineno-$LINENO}: $msg" >&5 $as_echo "$as_me: $msg" >&6;} fi @@ -18909,7 +18953,9 @@ IFS="|" for msg in $wine_warnings; do IFS="$ac_save_IFS" - if ${msg+:} false; then : + if ${msg:+false} :; then : + +else echo >&2 { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $msg" >&5 $as_echo "$as_me: WARNING: $msg" >&2;} diff -Nru wine1.7-1.7.13/configure.ac wine1.7-1.7.16/configure.ac --- wine1.7-1.7.13/configure.ac 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/configure.ac 2014-04-04 19:13:44.000000000 +0000 @@ -215,13 +215,16 @@ fi fi if test -z "$wine_cv_toolsdir"; then + wine_makedep=tools/makedep wine_cv_toolsdir="\$(top_builddir)" elif test -d "$wine_cv_toolsdir/tools/winebuild"; then + wine_makedep=$wine_cv_toolsdir/tools/makedep case "$wine_cv_toolsdir" in /*) ;; *) wine_cv_toolsdir="\$(top_builddir)/$wine_cv_toolsdir" ;; esac enable_tools=${enable_tools:-no} + test -f "$wine_makedep" || AC_MSG_ERROR([the Wine tools have not yet been built in $wine_cv_toolsdir]) else AC_MSG_ERROR([could not find Wine tools in $wine_cv_toolsdir]) fi]) @@ -1777,6 +1780,7 @@ WINE_TRY_CFLAGS([-Wstrict-prototypes]) WINE_TRY_CFLAGS([-Wtype-limits]) WINE_TRY_CFLAGS([-Wunused-but-set-parameter]) + WINE_TRY_CFLAGS([-Wvla]) WINE_TRY_CFLAGS([-Wwrite-strings]) dnl Check for noisy string.h @@ -2593,7 +2597,7 @@ .MAKEFILEDEPS: all: Makefile Makefile: $srcdir/Makefile.in $srcdir/Make.vars.in config.status \$(MAKEDEP) - @./config.status Make.tmp Makefile && \$(MAKEDEP) .]) + @./config.status Make.tmp Makefile]) test "$srcdir" = . && WINE_APPEND_RULE( [all: .gitignore @@ -2841,6 +2845,7 @@ WINE_CONFIG_DLL(dssenh) WINE_CONFIG_TEST(dlls/dssenh/tests) WINE_CONFIG_DLL(dswave,,[clean]) +WINE_CONFIG_TEST(dlls/dswave/tests) WINE_CONFIG_DLL(dwmapi,,[implib]) WINE_CONFIG_DLL(dwrite,,[implib]) WINE_CONFIG_TEST(dlls/dwrite/tests) @@ -2851,12 +2856,15 @@ WINE_CONFIG_DLL(dxgi,,[implib]) WINE_CONFIG_TEST(dlls/dxgi/tests) WINE_CONFIG_LIB(dxguid) +WINE_CONFIG_DLL(dxva2) WINE_CONFIG_DLL(explorerframe,,[clean]) WINE_CONFIG_TEST(dlls/explorerframe/tests) WINE_CONFIG_DLL(ext-ms-win-gdi-devcaps-l1-1-0) WINE_CONFIG_DLL(faultrep,,[implib]) WINE_CONFIG_TEST(dlls/faultrep/tests) WINE_CONFIG_DLL(fltlib) +WINE_CONFIG_DLL(fntcache) +WINE_CONFIG_DLL(fontsub) WINE_CONFIG_DLL(fusion) WINE_CONFIG_TEST(dlls/fusion/tests) WINE_CONFIG_DLL(fwpuclnt) @@ -3021,7 +3029,8 @@ WINE_CONFIG_DLL(nddeapi,,[implib]) WINE_CONFIG_DLL(netapi32,,[implib]) WINE_CONFIG_TEST(dlls/netapi32/tests) -WINE_CONFIG_DLL(netcfgx) +WINE_CONFIG_DLL(netcfgx,,[clean]) +WINE_CONFIG_TEST(dlls/netcfgx/tests) WINE_CONFIG_DLL(newdev,,[implib]) WINE_CONFIG_DLL(normaliz,,[implib]) WINE_CONFIG_DLL(npmshtml) @@ -3106,6 +3115,8 @@ WINE_CONFIG_DLL(sccbase) WINE_CONFIG_DLL(schannel) WINE_CONFIG_TEST(dlls/schannel/tests) +WINE_CONFIG_DLL(schedsvc,,[clean]) +WINE_CONFIG_TEST(dlls/schedsvc/tests,[clean]) WINE_CONFIG_DLL(scrrun,,[clean]) WINE_CONFIG_TEST(dlls/scrrun/tests,[clean]) WINE_CONFIG_DLL(scsiport.sys) @@ -3261,6 +3272,7 @@ WINE_CONFIG_TEST(dlls/wsnmp32/tests) WINE_CONFIG_DLL(wsock32,,[implib]) WINE_CONFIG_DLL(wtsapi32,,[implib]) +WINE_CONFIG_TEST(dlls/wtsapi32/tests) WINE_CONFIG_DLL(wuapi,,[clean]) WINE_CONFIG_DLL(wuaueng) WINE_CONFIG_DLL(xapofx1_1) @@ -3324,7 +3336,7 @@ WINE_CONFIG_PROGRAM(regedit,,[install,installbin,manpage,po]) WINE_CONFIG_TEST(programs/regedit/tests) WINE_CONFIG_PROGRAM(regsvcs,,[install]) -WINE_CONFIG_PROGRAM(regsvr32,,[install,installbin,manpage]) +WINE_CONFIG_PROGRAM(regsvr32,,[install,installbin,manpage,po]) WINE_CONFIG_PROGRAM(rpcss,,[clean,install]) WINE_CONFIG_PROGRAM(rundll.exe16,enable_win16,[install]) WINE_CONFIG_PROGRAM(rundll32,,[install]) @@ -3344,6 +3356,7 @@ WINE_CONFIG_PROGRAM(uninstaller,,[install,po]) WINE_CONFIG_PROGRAM(unlodctr,,[install]) WINE_CONFIG_PROGRAM(view,,[install,po]) +WINE_CONFIG_PROGRAM(wevtutil,,[install]) WINE_CONFIG_PROGRAM(wineboot,,[install,installbin,manpage,po]) WINE_CONFIG_PROGRAM(winebrowser,,[install]) WINE_CONFIG_PROGRAM(winecfg,,[install,installbin,manpage,po]) @@ -3457,7 +3470,7 @@ AC_CONFIG_COMMANDS([Makefile], [wine_fn_output_makefile Makefile], [wine_fn_output_makefile () { - cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$[]1 && rm -f Make.tmp && return + cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$[]1 && rm -f Make.tmp && "$wine_makedep" . && return `cat $wine_rules_file` _WINE_EOF AS_ERROR([could not create Makefile]) diff -Nru wine1.7-1.7.13/debian/changelog wine1.7-1.7.16/debian/changelog --- wine1.7-1.7.13/debian/changelog 2014-02-22 16:55:02.000000000 +0000 +++ wine1.7-1.7.16/debian/changelog 2014-04-11 18:14:58.000000000 +0000 @@ -1,3 +1,37 @@ +wine1.7 (1:1.7.16-0ubuntu1) precise; urgency=low + + * New upstream release + - More regression test fixes. + - String arrays better supported in the IDL compiler. + - Initial stubs for DirectX Video Acceleration. + - Various bug fixes. + + -- Maarten Lankhorst Fri, 11 Apr 2014 20:14:57 +0200 + +wine1.7 (1:1.7.15-0ubuntu1) precise; urgency=low + + * New upstream release + - New Task Scheduler service. + - Many regression test fixes. + - Support for exception unwinding in VBScript. + - Various bug fixes. + * Add missing conflicts to wine1.6 in wine1.7. + * Add libgphoto-2-dev as a possible build-depends (trusty). + + -- Maarten Lankhorst Wed, 26 Mar 2014 09:46:14 +0100 + +wine1.7 (1:1.7.14-0ubuntu1) precise; urgency=low + + * New upstream release + - More Task Scheduler support. + - Improvements for AVI encoding support. + - More VisualBasic interfaces in MSXML. + - Support for deflate content encoding in Wininet. + - Some fixes for monochrome printers. + - Various bug fixes. + + -- Maarten Lankhorst Mon, 10 Mar 2014 11:39:31 +0100 + wine1.7 (1:1.7.13-0ubuntu1) precise; urgency=medium * New upstream release diff -Nru wine1.7-1.7.13/debian/control wine1.7-1.7.16/debian/control --- wine1.7-1.7.13/debian/control 2013-12-19 04:14:00.000000000 +0000 +++ wine1.7-1.7.16/debian/control 2014-03-26 08:49:18.000000000 +0000 @@ -22,7 +22,7 @@ libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev, libgnutls-dev, - libgphoto2-6-dev | libgphoto2-2-dev, + libgphoto2-dev | libgphoto2-6-dev | libgphoto2-2-dev, libgsm1-dev, libgstreamer-plugins-base0.10-dev, libgstreamer0.10-dev, @@ -182,7 +182,7 @@ winetricks, xdg-utils Suggests: dosbox:any -Conflicts: wine1.0, wine1.2, wine1.3, wine1.4 +Conflicts: wine1.0, wine1.2, wine1.3, wine1.4, wine1.5, wine1.6 Replaces: wine, wine1.0, wine1.2, wine1.3, wine1.4, wine1.5, wine1.6 Provides: wine Description: Microsoft Windows Compatibility Layer (Binary Emulator and Library) diff -Nru wine1.7-1.7.13/dlls/advapi32/cred.c wine1.7-1.7.16/dlls/advapi32/cred.c --- wine1.7-1.7.13/dlls/advapi32/cred.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/advapi32/cred.c 2014-04-04 19:13:44.000000000 +0000 @@ -1952,18 +1952,13 @@ { case CertCredential: { - char hash[CERT_HASH_LENGTH + 2]; - - memcpy( hash, cert->rgbHashOfCert, sizeof(cert->rgbHashOfCert) ); - memset( hash + sizeof(cert->rgbHashOfCert), 0, sizeof(hash) - sizeof(cert->rgbHashOfCert) ); - - size = sizeof(hash) * 4 / 3; + size = (sizeof(cert->rgbHashOfCert) + 2) * 4 / 3; if (!(p = HeapAlloc( GetProcessHeap(), 0, (size + 4) * sizeof(WCHAR) ))) return FALSE; p[0] = '@'; p[1] = '@'; p[2] = 'A' + type; - len = cred_encode( (const char *)hash, sizeof(hash), p + 3 ); - p[len] = 0; + len = cred_encode( (const char *)cert->rgbHashOfCert, sizeof(cert->rgbHashOfCert), p + 3 ); + p[len + 3] = 0; break; } case UsernameTargetCredential: @@ -2049,7 +2044,6 @@ buf[i + 0] = (c1 << 6) | c0; buf[i + 1] = (c2 << 4) | (c1 >> 2); - buf[i + 2] = c2 >> 4; } else if (len == 2) { @@ -2057,16 +2051,10 @@ if ((c1 = char_decode( p[1] )) > 63) return FALSE; buf[i + 0] = (c1 << 6) | c0; - buf[i + 1] = c1 >> 2; - buf[i + 2] = 0; } else if (len == 1) { - if ((c0 = char_decode( p[0] )) > 63) return FALSE; - - buf[i + 0] = c0; - buf[i + 1] = 0; - buf[i + 2] = 0; + return FALSE; } return TRUE; } @@ -2080,17 +2068,19 @@ TRACE("%s, %p, %p\n", debugstr_w(cred), type, out); - if (!cred || cred[0] != '@' || cred[1] != '@' || !cred[2] || !cred[3]) + if (!cred || cred[0] != '@' || cred[1] != '@' || + char_decode( cred[2] ) > 63) { SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } len = strlenW( cred + 3 ); - switch (cred[2] - 'A') + *type = char_decode( cred[2] ); + switch (*type) { case CertCredential: { - char hash[CERT_HASH_LENGTH + 2]; + char hash[CERT_HASH_LENGTH]; CERT_CREDENTIAL_INFO *cert; if (len != 27 || !cred_decode( cred + 3, len, hash )) @@ -2101,17 +2091,16 @@ if (!(cert = HeapAlloc( GetProcessHeap(), 0, sizeof(*cert) ))) return FALSE; memcpy( cert->rgbHashOfCert, hash, sizeof(cert->rgbHashOfCert) ); cert->cbSize = sizeof(*cert); - *type = CertCredential; *out = cert; break; } case UsernameTargetCredential: { USERNAME_TARGET_CREDENTIAL_INFO *target; - ULONGLONG size = 0; + DWORD size; if (len < 9 || !cred_decode( cred + 3, 6, (char *)&size ) || - !size || size % sizeof(WCHAR) || size > INT_MAX) + size % sizeof(WCHAR) || len - 6 != (size * 4 + 2) / 3) { SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; @@ -2125,7 +2114,6 @@ } target->UserName = (WCHAR *)(target + 1); target->UserName[size / sizeof(WCHAR)] = 0; - *type = UsernameTargetCredential; *out = target; break; } @@ -2133,7 +2121,8 @@ FIXME("BinaryBlobCredential not implemented\n"); return FALSE; default: - WARN("unhandled type %u\n", cred[2] - 'A'); + WARN("unhandled type %u\n", *type); + SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; } return TRUE; @@ -2157,7 +2146,7 @@ if (name && name[0] == '@' && name[1] == '@' && name[2] > 'A' && name[3]) { - char hash[CERT_HASH_LENGTH + 2]; + char hash[CERT_HASH_LENGTH]; int len = strlenW(name + 3 ); DWORD size; diff -Nru wine1.7-1.7.13/dlls/advapi32/tests/cred.c wine1.7-1.7.16/dlls/advapi32/tests/cred.c --- wine1.7-1.7.13/dlls/advapi32/tests/cred.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/advapi32/tests/cred.c 2014-04-04 19:13:44.000000000 +0000 @@ -563,14 +563,65 @@ static void test_CredUnmarshalCredentialA(void) { + static const UCHAR cert_empty[CERT_HASH_LENGTH] = {0}; + static const UCHAR cert_wine[CERT_HASH_LENGTH] = {'W','i','n','e',0}; static const WCHAR tW[] = {'t',0}; + static const WCHAR teW[] = {'t','e',0}; + static const WCHAR tesW[] = {'t','e','s',0}; static const WCHAR testW[] = {'t','e','s','t',0}; + void *p; CERT_CREDENTIAL_INFO *cert; + const UCHAR *hash; USERNAME_TARGET_CREDENTIAL_INFO *username; CRED_MARSHAL_TYPE type; - unsigned int i; + unsigned int i, j; DWORD error; BOOL ret; + const struct { + const char *cred; + CRED_MARSHAL_TYPE type; + const void *unmarshaled; + } tests[] = { + { "", 0, NULL }, + { "@", 0, NULL }, + { "@@", 0, NULL }, + { "@@@", 0, NULL }, + { "@@A", 0, NULL }, + { "@@E", 4, NULL }, + { "@@Z", 25, NULL }, + { "@@a", 26, NULL }, + { "@@0", 52, NULL }, + { "@@#", 62, NULL }, + { "@@-", 63, NULL }, + { "@@B", CertCredential, NULL }, + { "@@BA", CertCredential, NULL }, + { "@@BAAAAAAAAAAAAAAAAAAAAAAAAAA", CertCredential, NULL }, + { "@@BAAAAAAAAAAAAAAAAAAAAAAAAAAAA", CertCredential, NULL }, + { "@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA", CertCredential, cert_empty }, + { "@@BXlmblBAAAAAAAAAAAAAAAAAAAAA", CertCredential, cert_wine }, + { "@@C", UsernameTargetCredential, NULL }, + { "@@CA", UsernameTargetCredential, NULL }, + { "@@CAAAAAA", UsernameTargetCredential, NULL }, + { "@@CAAAAAA0B", UsernameTargetCredential, NULL }, + { "@@CAAAAAA0BA", UsernameTargetCredential, NULL }, + { "@@CCAAAAA0BA", UsernameTargetCredential, tW }, + { "@@CEAAAAA0BA", UsernameTargetCredential, NULL }, + { "@@CEAAAAA0BAd", UsernameTargetCredential, NULL }, + { "@@CEAAAAA0BAdA", UsernameTargetCredential, NULL }, + { "@@CEAAAAA0BQZAA", UsernameTargetCredential, teW }, + { "@@CEAAAAA0BQZAQ", UsernameTargetCredential, teW }, + { "@@CEAAAAA0BQZAg", UsernameTargetCredential, teW }, + { "@@CEAAAAA0BQZAw", UsernameTargetCredential, teW }, + { "@@CEAAAAA0BQZAAA", UsernameTargetCredential, NULL }, + { "@@CGAAAAA0BQZAMH", UsernameTargetCredential, NULL }, + { "@@CGAAAAA0BQZAMHA", UsernameTargetCredential, tesW }, + { "@@CGAAAAA0BQZAMHAA", UsernameTargetCredential, NULL }, + { "@@CCAAAAA0BAA", UsernameTargetCredential, NULL }, + { "@@CBAAAAA0BAA", UsernameTargetCredential, NULL }, + { "@@CAgAAAA0BAA", UsernameTargetCredential, NULL }, + { "@@CIAAAAA0BQZAMHA0BA", UsernameTargetCredential, testW }, + { "@@CA-----0BQZAMHA0BA", UsernameTargetCredential, NULL }, + }; SetLastError( 0xdeadbeef ); ret = pCredUnmarshalCredentialA( NULL, NULL, NULL ); @@ -593,14 +644,6 @@ ok( !ret, "unexpected success\n" ); ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); - type = 0; - cert = NULL; - SetLastError( 0xdeadbeef ); - ret = pCredUnmarshalCredentialA( "", &type, (void **)&cert ); - error = GetLastError(); - ok( !ret, "unexpected success\n" ); - ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); - if (0) { /* crash */ SetLastError( 0xdeadbeef ); ret = pCredUnmarshalCredentialA( "@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA", &type, NULL ); @@ -615,69 +658,46 @@ ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); } - type = 0; - cert = NULL; - ret = pCredUnmarshalCredentialA( "@@BAAAAAAAAAAAAAAAAAAAAAAAAAAA", &type, (void **)&cert ); - ok( ret, "unexpected failure %u\n", GetLastError() ); - ok( type == CertCredential, "got %u\n", type ); - ok( cert != NULL, "cert is NULL\n" ); - ok( cert->cbSize == sizeof(*cert), "wrong size %u\n", cert->cbSize ); - for (i = 0; i < sizeof(cert->rgbHashOfCert); i++) ok( !cert->rgbHashOfCert[i], "wrong data\n" ); - pCredFree( cert ); - - type = 0; - cert = NULL; - ret = pCredUnmarshalCredentialA( "@@BXlmblBAAAAAAAAAAAAAAAAAAAAA", &type, (void **)&cert ); - ok( ret, "unexpected failure %u\n", GetLastError() ); - ok( type == CertCredential, "got %u\n", type ); - ok( cert != NULL, "cert is NULL\n" ); - ok( cert->cbSize == sizeof(*cert), "wrong size %u\n", cert->cbSize ); - ok( cert->rgbHashOfCert[0] == 'W', "wrong data)\n" ); - ok( cert->rgbHashOfCert[1] == 'i', "wrong data\n" ); - ok( cert->rgbHashOfCert[2] == 'n', "wrong data\n" ); - ok( cert->rgbHashOfCert[3] == 'e', "wrong data\n" ); - for (i = 4; i < sizeof(cert->rgbHashOfCert); i++) ok( !cert->rgbHashOfCert[i], "wrong data\n" ); - pCredFree( cert ); - - SetLastError( 0xdeadbeef ); - ret = pCredUnmarshalCredentialA( "@@CAAAAAA", &type, (void **)&username ); - error = GetLastError(); - ok( !ret, "unexpected success\n" ); - ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); - - SetLastError( 0xdeadbeef ); - ret = pCredUnmarshalCredentialA( "@@CAAAAAA0BA", &type, (void **)&username ); - error = GetLastError(); - ok( !ret, "unexpected success\n" ); - ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); - - type = 0; - username = NULL; - ret = pCredUnmarshalCredentialA( "@@CCAAAAA0BA", &type, (void **)&username ); - ok( ret, "unexpected failure %u\n", GetLastError() ); - ok( type == UsernameTargetCredential, "got %u\n", type ); - ok( username != NULL, "username is NULL\n" ); - ok( username->UserName != NULL, "UserName is NULL\n" ); - ok( !lstrcmpW( username->UserName, tW ), "got %s\n", wine_dbgstr_w(username->UserName) ); - pCredFree( username ); - - type = 0; - username = NULL; - ret = pCredUnmarshalCredentialA( "@@CIAAAAA0BQZAMHA0BA", &type, (void **)&username ); - ok( ret, "unexpected failure %u\n", GetLastError() ); - ok( type == UsernameTargetCredential, "got %u\n", type ); - ok( username != NULL, "username is NULL\n" ); - ok( username->UserName != NULL, "UserName is NULL\n" ); - ok( !lstrcmpW( username->UserName, testW ), "got %s\n", wine_dbgstr_w(username->UserName) ); - pCredFree( username ); + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) + { + SetLastError(0xdeadbeef); + type = 0; + p = NULL; + ret = pCredUnmarshalCredentialA(tests[i].cred, &type, &p); + error = GetLastError(); + if (tests[i].unmarshaled) + { + ok(ret, "[%u] unexpected failure %u\n", i, error); + ok(type == tests[i].type, "[%u] got %u\n", i, type); + ok(p != NULL, "[%u] returned pointer is NULL\n", i); + if (tests[i].type == CertCredential) + { + cert = p; + hash = tests[i].unmarshaled; + ok(cert->cbSize == sizeof(*cert), + "[%u] wrong size %u\n", i, cert->cbSize); + for (j = 0; j < sizeof(cert->rgbHashOfCert); j++) + ok(cert->rgbHashOfCert[j] == hash[j], "[%u] wrong data\n", i); + } + else if (tests[i].type == UsernameTargetCredential) + { + username = p; + ok(username->UserName != NULL, "[%u] UserName is NULL\n", i); + ok(!lstrcmpW(username->UserName, tests[i].unmarshaled), + "[%u] got %s\n", i, wine_dbgstr_w(username->UserName)); + } + } + else + { + ok(!ret, "[%u] unexpected success\n", i); + ok(error == ERROR_INVALID_PARAMETER, "[%u] got %u\n", i, error); + ok(type == tests[i].type, "[%u] got %u\n", i, type); + ok(p == NULL, "[%u] returned pointer is not NULL\n", i); + } - type = 0; - username = NULL; - SetLastError( 0xdeadbeef ); - ret = pCredUnmarshalCredentialA( "@@CA-----0BQZAMHA0BA", &type, (void **)&username ); - error = GetLastError(); - ok( !ret, "unexpected success\n" ); - ok( error == ERROR_INVALID_PARAMETER, "got %u\n", error ); + if (ret) + pCredFree(p); + } } static void test_CredIsMarshaledCredentialA(void) diff -Nru wine1.7-1.7.13/dlls/advapi32/tests/eventlog.c wine1.7-1.7.16/dlls/advapi32/tests/eventlog.c --- wine1.7-1.7.13/dlls/advapi32/tests/eventlog.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/advapi32/tests/eventlog.c 2014-04-04 19:13:44.000000000 +0000 @@ -49,17 +49,27 @@ pWow64RevertWow64FsRedirection = (void*)GetProcAddress(hkernel32, "Wow64RevertWow64FsRedirection"); } -static void create_backup(const char *filename) +static BOOL create_backup(const char *filename) { HANDLE handle; + DWORD rc, attribs; DeleteFileA(filename); handle = OpenEventLogA(NULL, "Application"); - BackupEventLogA(handle, filename); + rc = BackupEventLogA(handle, filename); + if (!rc && GetLastError() == ERROR_PRIVILEGE_NOT_HELD) + { + skip("insufficient privileges to backup the eventlog\n"); + CloseEventLog(handle); + return FALSE; + } + ok(rc, "BackupEventLogA failed, le=%u\n", GetLastError()); CloseEventLog(handle); + attribs = GetFileAttributesA(filename); todo_wine - ok(GetFileAttributesA(filename) != INVALID_FILE_ATTRIBUTES, "Expected a backup file\n"); + ok(attribs != INVALID_FILE_ATTRIBUTES, "Expected a backup file attribs=%#x le=%u\n", attribs, GetLastError()); + return TRUE; } static void test_open_close(void) @@ -209,23 +219,24 @@ CloseEventLog(handle); /* Make a backup eventlog to work with */ - create_backup(backup); - - handle = OpenBackupEventLogA(NULL, backup); - todo_wine - ok(handle != NULL, "Expected a handle\n"); - - /* Does GetNumberOfEventLogRecords work with backup eventlogs? */ - count = 0xdeadbeef; - ret = GetNumberOfEventLogRecords(handle, &count); - todo_wine + if (create_backup(backup)) { - ok(ret, "Expected success\n"); - ok(count != 0xdeadbeef, "Expected the number of records\n"); - } + handle = OpenBackupEventLogA(NULL, backup); + todo_wine + ok(handle != NULL, "Expected a handle, le=%d\n", GetLastError()); + + /* Does GetNumberOfEventLogRecords work with backup eventlogs? */ + count = 0xdeadbeef; + ret = GetNumberOfEventLogRecords(handle, &count); + todo_wine + { + ok(ret, "Expected success\n"); + ok(count != 0xdeadbeef, "Expected the number of records\n"); + } - CloseEventLog(handle); - DeleteFileA(backup); + CloseEventLog(handle); + DeleteFileA(backup); + } } static void test_oldest(void) @@ -262,23 +273,24 @@ CloseEventLog(handle); /* Make a backup eventlog to work with */ - create_backup(backup); - - handle = OpenBackupEventLogA(NULL, backup); - todo_wine - ok(handle != NULL, "Expected a handle\n"); - - /* Does GetOldestEventLogRecord work with backup eventlogs? */ - oldest = 0xdeadbeef; - ret = GetOldestEventLogRecord(handle, &oldest); - todo_wine + if (create_backup(backup)) { - ok(ret, "Expected success\n"); - ok(oldest != 0xdeadbeef, "Expected the number of the oldest record\n"); - } + handle = OpenBackupEventLogA(NULL, backup); + todo_wine + ok(handle != NULL, "Expected a handle\n"); + + /* Does GetOldestEventLogRecord work with backup eventlogs? */ + oldest = 0xdeadbeef; + ret = GetOldestEventLogRecord(handle, &oldest); + todo_wine + { + ok(ret, "Expected success\n"); + ok(oldest != 0xdeadbeef, "Expected the number of the oldest record\n"); + } - CloseEventLog(handle); - DeleteFileA(backup); + CloseEventLog(handle); + DeleteFileA(backup); + } } static void test_backup(void) @@ -306,6 +318,12 @@ ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); ret = BackupEventLogA(handle, backup); + if (!ret && GetLastError() == ERROR_PRIVILEGE_NOT_HELD) + { + skip("insufficient privileges for backup tests\n"); + CloseEventLog(handle); + return; + } ok(ret, "Expected success\n"); todo_wine ok(GetFileAttributesA(backup) != INVALID_FILE_ATTRIBUTES, "Expected a backup file\n"); @@ -516,38 +534,39 @@ "Expected RPC_S_SERVER_UNAVAILABLE, got %d\n", GetLastError()); /* Make a backup eventlog to work with */ - create_backup(backup); - - /* FIXME: Wine stops here */ - if (GetFileAttributesA(backup) == INVALID_FILE_ATTRIBUTES) + if (create_backup(backup)) { - skip("We don't have a backup eventlog to work with\n"); - return; - } - - SetLastError(0xdeadbeef); - handle = OpenBackupEventLogA("IDontExist", backup); - ok(handle == NULL, "Didn't expect a handle\n"); - ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE || - GetLastError() == RPC_S_INVALID_NET_ADDR, /* Some Vista and Win7 */ - "Expected RPC_S_SERVER_UNAVAILABLE, got %d\n", GetLastError()); - - /* Empty servername should be read as local server */ - handle = OpenBackupEventLogA("", backup); - ok(handle != NULL, "Expected a handle\n"); - CloseEventLog(handle); + /* FIXME: Wine stops here */ + if (GetFileAttributesA(backup) == INVALID_FILE_ATTRIBUTES) + { + skip("We don't have a backup eventlog to work with\n"); + return; + } + + SetLastError(0xdeadbeef); + handle = OpenBackupEventLogA("IDontExist", backup); + ok(handle == NULL, "Didn't expect a handle\n"); + ok(GetLastError() == RPC_S_SERVER_UNAVAILABLE || + GetLastError() == RPC_S_INVALID_NET_ADDR, /* Some Vista and Win7 */ + "Expected RPC_S_SERVER_UNAVAILABLE, got %d\n", GetLastError()); + + /* Empty servername should be read as local server */ + handle = OpenBackupEventLogA("", backup); + ok(handle != NULL, "Expected a handle\n"); + CloseEventLog(handle); - handle = OpenBackupEventLogA(NULL, backup); - ok(handle != NULL, "Expected a handle\n"); + handle = OpenBackupEventLogA(NULL, backup); + ok(handle != NULL, "Expected a handle\n"); - /* Can we open that same backup eventlog more than once? */ - handle2 = OpenBackupEventLogA(NULL, backup); - ok(handle2 != NULL, "Expected a handle\n"); - ok(handle2 != handle, "Didn't expect the same handle\n"); - CloseEventLog(handle2); + /* Can we open that same backup eventlog more than once? */ + handle2 = OpenBackupEventLogA(NULL, backup); + ok(handle2 != NULL, "Expected a handle\n"); + ok(handle2 != handle, "Didn't expect the same handle\n"); + CloseEventLog(handle2); - CloseEventLog(handle); - DeleteFileA(backup); + CloseEventLog(handle); + DeleteFileA(backup); + } /* Is there any content checking done? */ file = CreateFileA(backup, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL); @@ -585,7 +604,8 @@ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); /* Make a backup eventlog to work with */ - create_backup(backup); + if (!create_backup(backup)) + return; SetLastError(0xdeadbeef); ret = ClearEventLogA(NULL, backup); diff -Nru wine1.7-1.7.13/dlls/advapi32/tests/security.c wine1.7-1.7.16/dlls/advapi32/tests/security.c --- wine1.7-1.7.13/dlls/advapi32/tests/security.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/advapi32/tests/security.c 2014-04-04 19:13:44.000000000 +0000 @@ -855,7 +855,7 @@ ok(rc, "GetTempFileName error %d\n", GetLastError()); rc = GetFileAttributesA(file); - rc &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; + rc &= ~(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED|FILE_ATTRIBUTE_COMPRESSED); ok(rc == FILE_ATTRIBUTE_ARCHIVE, "expected FILE_ATTRIBUTE_ARCHIVE got %#x\n", rc); retSize = 0xdeadbeef; @@ -966,7 +966,7 @@ CloseHandle(fh); rc = GetFileAttributesA(file); - rc &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; + rc &= ~(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED|FILE_ATTRIBUTE_COMPRESSED); todo_wine ok(rc == (FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY), "expected FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY got %#x\n", rc); @@ -990,7 +990,7 @@ CloseHandle(fh); rc = GetFileAttributesA(file); - rc &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED; + rc &= ~(FILE_ATTRIBUTE_NOT_CONTENT_INDEXED|FILE_ATTRIBUTE_COMPRESSED); ok(rc == (FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY), "expected FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_READONLY got %#x\n", rc); diff -Nru wine1.7-1.7.13/dlls/api-ms-win-core-localization-l1-2-0/api-ms-win-core-localization-l1-2-0.spec wine1.7-1.7.16/dlls/api-ms-win-core-localization-l1-2-0/api-ms-win-core-localization-l1-2-0.spec --- wine1.7-1.7.13/dlls/api-ms-win-core-localization-l1-2-0/api-ms-win-core-localization-l1-2-0.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/api-ms-win-core-localization-l1-2-0/api-ms-win-core-localization-l1-2-0.spec 2014-04-04 19:13:44.000000000 +0000 @@ -9,7 +9,7 @@ @ stdcall GetACP() kernel32.GetACP @ stdcall GetCPInfo(long ptr) kernel32.GetCPInfo @ stdcall GetCPInfoExW(long long ptr) kernel32.GetCPInfoExW -@ stub GetCalendarInfoEx +@ stdcall GetCalendarInfoEx(wstr long ptr long ptr long ptr) kernel32.GetCalendarInfoEx @ stdcall GetCalendarInfoW(long long long ptr long ptr) kernel32.GetCalendarInfoW @ stub GetFileMUIInfo @ stub GetFileMUIPath diff -Nru wine1.7-1.7.13/dlls/api-ms-win-core-synch-l1-2-0/api-ms-win-core-synch-l1-2-0.spec wine1.7-1.7.16/dlls/api-ms-win-core-synch-l1-2-0/api-ms-win-core-synch-l1-2-0.spec --- wine1.7-1.7.13/dlls/api-ms-win-core-synch-l1-2-0/api-ms-win-core-synch-l1-2-0.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/api-ms-win-core-synch-l1-2-0/api-ms-win-core-synch-l1-2-0.spec 2014-04-04 19:13:44.000000000 +0000 @@ -39,7 +39,7 @@ @ stdcall SetCriticalSectionSpinCount(ptr long) kernel32.SetCriticalSectionSpinCount @ stdcall SetEvent(long) kernel32.SetEvent @ stdcall SetWaitableTimer(long ptr long ptr ptr long) kernel32.SetWaitableTimer -@ stub SetWaitableTimerEx +@ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long) kernel32.SetWaitableTimerEx @ stdcall SignalObjectAndWait(long long long long) kernel32.SignalObjectAndWait @ stdcall Sleep(long) kernel32.Sleep @ stdcall SleepConditionVariableCS(ptr ptr long) kernel32.SleepConditionVariableCS diff -Nru wine1.7-1.7.13/dlls/apphelp/apphelp.c wine1.7-1.7.16/dlls/apphelp/apphelp.c --- wine1.7-1.7.13/dlls/apphelp/apphelp.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/apphelp/apphelp.c 2014-04-04 19:13:44.000000000 +0000 @@ -33,6 +33,7 @@ /* FIXME: don't know where to place that typedef */ typedef HANDLE PDB; +typedef HANDLE HSDB; BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { @@ -81,3 +82,11 @@ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return TRUE; } + + +HSDB WINAPI SdbInitDatabase(DWORD flags, LPCWSTR path) +{ + FIXME("stub: %08x %s\n", flags, debugstr_w(path)); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return NULL; +} diff -Nru wine1.7-1.7.13/dlls/apphelp/apphelp.spec wine1.7-1.7.16/dlls/apphelp/apphelp.spec --- wine1.7-1.7.13/dlls/apphelp/apphelp.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/apphelp/apphelp.spec 2014-04-04 19:13:44.000000000 +0000 @@ -83,7 +83,7 @@ @ stub SdbGrabMatchingInfoEx @ stub SdbGUIDFromString @ stub SdbGUIDToString -@ stub SdbInitDatabase +@ stdcall SdbInitDatabase(long wstr) @ stub SdbInitDatabaseEx @ stub SdbIsNullGUID @ stub SdbIsStandardDatabase diff -Nru wine1.7-1.7.13/dlls/atl/tests/registrar.c wine1.7-1.7.16/dlls/atl/tests/registrar.c --- wine1.7-1.7.13/dlls/atl/tests/registrar.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/atl/tests/registrar.c 2014-04-04 19:13:44.000000000 +0000 @@ -37,36 +37,8 @@ #include #include - -static BOOL is_process_limited(void) -{ - static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE) = NULL; - HANDLE token; - - if (!pOpenProcessToken) - { - HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); - pOpenProcessToken = (void*)GetProcAddress(hadvapi32, "OpenProcessToken"); - if (!pOpenProcessToken) - return FALSE; - } - - if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) - { - BOOL ret; - TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; - DWORD size; - - ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); - CloseHandle(token); - return (ret && type == TokenElevationTypeLimited); - } - return FALSE; -} - - static const char textA[] = -"HKCR \n" +"HKCU \n" "{ \n" " ForceRemove eebf73c4-50fd-478f-bbcf-db212221227a \n" " { \n" @@ -96,7 +68,7 @@ hr = CoCreateInstance(&CLSID_Registrar, NULL, CLSCTX_INPROC_SERVER, &IID_IRegistrar, (void**)®istrar); if (FAILED(hr)) { - skip("creating IRegistrar failed, hr = 0x%08X\n", hr); + win_skip("creating IRegistrar failed, hr = 0x%08X\n", hr); return; } @@ -112,17 +84,14 @@ MultiByteToWideChar(CP_ACP, 0, textA, -1, textW, count); hr = IRegistrar_StringRegister(registrar, textW); + ok(hr == S_OK, "StringRegister failed: %08x\n", hr); if (FAILED(hr)) { - int is_limited = is_process_limited(); - ok(hr == DISP_E_EXCEPTION && is_limited, - "IRegistrar_StringRegister failed, hr = 0x%08X, is_limited=%d\n", hr, is_limited); - skip("Skipping registrar tests\n"); IRegistrar_Release(registrar); return; } - lret = RegOpenKeyA(HKEY_CLASSES_ROOT, "eebf73c4-50fd-478f-bbcf-db212221227a", &key); + lret = RegOpenKeyA(HKEY_CURRENT_USER, "eebf73c4-50fd-478f-bbcf-db212221227a", &key); ok(lret == ERROR_SUCCESS, "error %d opening registry key\n", lret); size = sizeof(dword); diff -Nru wine1.7-1.7.13/dlls/avifil32/avifile_private.h wine1.7-1.7.16/dlls/avifil32/avifile_private.h --- wine1.7-1.7.13/dlls/avifil32/avifile_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/avifil32/avifile_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -59,7 +59,7 @@ extern HMODULE AVIFILE_hModule DECLSPEC_HIDDEN; extern HRESULT AVIFILE_CreateAVIFile(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; -extern HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface) DECLSPEC_HIDDEN; extern HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; extern HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; extern PAVIEDITSTREAM AVIFILE_CreateEditStream(PAVISTREAM pstream) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/avifil32/factory.c wine1.7-1.7.16/dlls/avifil32/factory.c --- wine1.7-1.7.13/dlls/avifil32/factory.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/avifil32/factory.c 2014-04-04 19:13:44.000000000 +0000 @@ -149,14 +149,14 @@ if (IsEqualGUID(&CLSID_AVIFile, &This->clsid)) return AVIFILE_CreateAVIFile(pOuter, riid, ppobj); + if (IsEqualGUID(&CLSID_WAVFile, &This->clsid)) + return AVIFILE_CreateWAVFile(pOuter, riid, ppobj); if (pOuter) return CLASS_E_NOAGGREGATION; if (IsEqualGUID(&CLSID_ICMStream, &This->clsid)) return AVIFILE_CreateICMStream(riid,ppobj); - if (IsEqualGUID(&CLSID_WAVFile, &This->clsid)) - return AVIFILE_CreateWAVFile(riid,ppobj); if (IsEqualGUID(&CLSID_ACMStream, &This->clsid)) return AVIFILE_CreateACMStream(riid,ppobj); diff -Nru wine1.7-1.7.13/dlls/avifil32/tests/api.c wine1.7-1.7.16/dlls/avifil32/tests/api.c --- wine1.7-1.7.13/dlls/avifil32/tests/api.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/avifil32/tests/api.c 2014-04-04 19:13:44.000000000 +0000 @@ -29,6 +29,7 @@ /* ########################### */ +DEFINE_AVIGUID(CLSID_WAVFile, 0x00020003, 0, 0); static const CHAR winetest0[] = "winetest0"; static const CHAR winetest1[] = "winetest1"; static const CHAR testfilename[] = "wine_avifil32_test.avi"; @@ -648,6 +649,67 @@ while (IAVIFile_Release(avif)); } +static void test_COM_wavfile(void) +{ + struct unk_impl unk_obj = {{&unk_vtbl}, 19, NULL}; + IAVIFile *avif = NULL; + IPersistFile *pf; + IAVIStream *avis; + IUnknown *unk; + ULONG refcount; + HRESULT hr; + + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_WAVFile, &unk_obj.IUnknown_iface, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&unk_obj.inner_unk); + ok(hr == S_OK, "COM aggregation failed: %08x, expected S_OK\n", hr); + hr = IUnknown_QueryInterface(&unk_obj.IUnknown_iface, &IID_IAVIFile, (void**)&avif); + ok(hr == S_OK, "QueryInterface for IID_IAVIFile failed: %08x\n", hr); + refcount = IAVIFile_AddRef(avif); + ok(refcount == unk_obj.ref, "WAVFile just pretends to support COM aggregation\n"); + refcount = IAVIFile_Release(avif); + ok(refcount == unk_obj.ref, "WAVFile just pretends to support COM aggregation\n"); + hr = IAVIFile_QueryInterface(avif, &IID_IPersistFile, (void**)&pf); + ok(hr == S_OK, "QueryInterface for IID_IPersistFile failed: %08x\n", hr); + refcount = IPersistFile_Release(pf); + ok(refcount == unk_obj.ref, "WAVFile just pretends to support COM aggregation\n"); + refcount = IAVIFile_Release(avif); + ok(refcount == 19, "Outer ref count should be back at 19 but is %d\n", refcount); + refcount = IUnknown_Release(unk_obj.inner_unk); + ok(refcount == 0, "Inner ref count should be 0 but is %u\n", refcount); + + /* Invalid RIID */ + hr = CoCreateInstance(&CLSID_WAVFile, NULL, CLSCTX_INPROC_SERVER, &IID_IAVIStreaming, + (void**)&avif); + ok(hr == E_NOINTERFACE, "WAVFile create failed: %08x, expected E_NOINTERFACE\n", hr); + + /* Same refcount for all WAVFile interfaces */ + hr = CoCreateInstance(&CLSID_WAVFile, NULL, CLSCTX_INPROC_SERVER, &IID_IAVIFile, (void**)&avif); + ok(hr == S_OK, "WAVFile create failed: %08x, expected S_OK\n", hr); + refcount = IAVIFile_AddRef(avif); + ok(refcount == 2, "refcount == %u, expected 2\n", refcount); + + hr = IAVIFile_QueryInterface(avif, &IID_IPersistFile, (void**)&pf); + ok(hr == S_OK, "QueryInterface for IID_IPersistFile failed: %08x\n", hr); + refcount = IPersistFile_AddRef(pf); + ok(refcount == 4, "refcount == %u, expected 4\n", refcount); + refcount = IPersistFile_Release(pf); + + hr = IAVIFile_QueryInterface(avif, &IID_IAVIStream, (void**)&avis); + ok(hr == S_OK, "QueryInterface for IID_IAVIStream failed: %08x\n", hr); + refcount = IAVIStream_AddRef(avis); + ok(refcount == 5, "refcount == %u, expected 5\n", refcount); + refcount = IAVIStream_Release(avis); + + hr = IAVIFile_QueryInterface(avif, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); + refcount = IUnknown_AddRef(unk); + ok(refcount == 6, "refcount == %u, expected 6\n", refcount); + refcount = IUnknown_Release(unk); + + while (IAVIFile_Release(avif)); +} + START_TEST(api) { @@ -659,6 +721,7 @@ test_ash1_corruption(); test_ash1_corruption2(); test_COM(); + test_COM_wavfile(); AVIFileExit(); } diff -Nru wine1.7-1.7.13/dlls/avifil32/wavfile.c wine1.7-1.7.16/dlls/avifil32/wavfile.c --- wine1.7-1.7.13/dlls/avifil32/wavfile.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/avifil32/wavfile.c 2014-04-04 19:13:44.000000000 +0000 @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#define COBJMACROS #include #include @@ -86,111 +87,14 @@ /***********************************************************************/ -static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj); -static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface); -static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface); -static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size); -static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam); -static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi); -static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size); -static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size); -static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface); -static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam); - -static const struct IAVIFileVtbl iwavft = { - IAVIFile_fnQueryInterface, - IAVIFile_fnAddRef, - IAVIFile_fnRelease, - IAVIFile_fnInfo, - IAVIFile_fnGetStream, - IAVIFile_fnCreateStream, - IAVIFile_fnWriteData, - IAVIFile_fnReadData, - IAVIFile_fnEndRecord, - IAVIFile_fnDeleteStream -}; - -static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile*iface,REFIID refiid,LPVOID*obj); -static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile*iface); -static ULONG WINAPI IPersistFile_fnRelease(IPersistFile*iface); -static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile*iface,CLSID*pClassID); -static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile*iface); -static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile*iface,LPCOLESTR pszFileName,DWORD dwMode); -static HRESULT WINAPI IPersistFile_fnSave(IPersistFile*iface,LPCOLESTR pszFileName,BOOL fRemember); -static HRESULT WINAPI IPersistFile_fnSaveCompleted(IPersistFile*iface,LPCOLESTR pszFileName); -static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile*iface,LPOLESTR*ppszFileName); - -static const struct IPersistFileVtbl iwavpft = { - IPersistFile_fnQueryInterface, - IPersistFile_fnAddRef, - IPersistFile_fnRelease, - IPersistFile_fnGetClassID, - IPersistFile_fnIsDirty, - IPersistFile_fnLoad, - IPersistFile_fnSave, - IPersistFile_fnSaveCompleted, - IPersistFile_fnGetCurFile -}; - -static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj); -static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface); -static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface); -static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2); -static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size); -static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags); -static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize); -static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize); -static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread); -static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten); -static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples); -static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread); -static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size); -static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen); - -static const struct IAVIStreamVtbl iwavst = { - IAVIStream_fnQueryInterface, - IAVIStream_fnAddRef, - IAVIStream_fnRelease, - IAVIStream_fnCreate, - IAVIStream_fnInfo, - IAVIStream_fnFindSample, - IAVIStream_fnReadFormat, - IAVIStream_fnSetFormat, - IAVIStream_fnRead, - IAVIStream_fnWrite, - IAVIStream_fnDelete, - IAVIStream_fnReadData, - IAVIStream_fnWriteData, - IAVIStream_fnSetInfo -}; - -typedef struct _IAVIFileImpl IAVIFileImpl; - -typedef struct _IPersistFileImpl { - /* IUnknown stuff */ - const IPersistFileVtbl *lpVtbl; - - /* IPersistFile stuff */ - IAVIFileImpl *paf; -} IPersistFileImpl; - -typedef struct _IAVIStreamImpl { - /* IUnknown stuff */ - const IAVIStreamVtbl *lpVtbl; - - /* IAVIStream stuff */ - IAVIFileImpl *paf; -} IAVIStreamImpl; - -struct _IAVIFileImpl { - /* IUnknown stuff */ - const IAVIFileVtbl *lpVtbl; - LONG ref; - +typedef struct _IAVIFileImpl { + IUnknown IUnknown_inner; + IAVIFile IAVIFile_iface; + IPersistFile IPersistFile_iface; + IAVIStream IAVIStream_iface; + IUnknown *outer_unk; + LONG ref; /* IAVIFile, IAVIStream stuff... */ - IPersistFileImpl iPersistFile; - IAVIStreamImpl iAVIStream; - AVIFILEINFOW fInfo; AVISTREAMINFOW sInfo; @@ -206,7 +110,7 @@ LPWSTR szFileName; UINT uMode; BOOL fDirty; -}; +} IAVIFileImpl; /***********************************************************************/ @@ -214,108 +118,112 @@ static HRESULT AVIFILE_LoadSunFile(IAVIFileImpl *This); static HRESULT AVIFILE_SaveFile(const IAVIFileImpl *This); -HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppv) +static inline IAVIFileImpl *impl_from_IUnknown(IUnknown *iface) { - IAVIFileImpl *pfile; - HRESULT hr; + return CONTAINING_RECORD(iface, IAVIFileImpl, IUnknown_inner); +} - assert(riid != NULL && ppv != NULL); +static HRESULT WINAPI IUnknown_fnQueryInterface(IUnknown *iface, REFIID riid, void **ret_iface) +{ + IAVIFileImpl *This = impl_from_IUnknown(iface); - *ppv = NULL; + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ret_iface); - pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAVIFileImpl)); - if (pfile == NULL) - return AVIERR_MEMORY; + if (IsEqualGUID(&IID_IUnknown, riid)) + *ret_iface = &This->IUnknown_inner; + else if (IsEqualGUID(&IID_IAVIFile, riid)) + *ret_iface = &This->IAVIFile_iface; + else if (IsEqualGUID(&IID_IAVIStream, riid)) + *ret_iface = &This->IAVIStream_iface; + else if (IsEqualGUID(&IID_IPersistFile, riid)) + *ret_iface = &This->IPersistFile_iface; + else { + WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ret_iface); + *ret_iface = NULL; + return E_NOINTERFACE; + } - pfile->lpVtbl = &iwavft; - pfile->iPersistFile.lpVtbl = &iwavpft; - pfile->iAVIStream.lpVtbl = &iwavst; - pfile->ref = 0; - pfile->iPersistFile.paf = pfile; - pfile->iAVIStream.paf = pfile; + /* Violation of the COM aggregation ref counting rule */ + IUnknown_AddRef(&This->IUnknown_inner); + return S_OK; +} - hr = IAVIFile_QueryInterface((IAVIFile*)pfile, riid, ppv); - if (FAILED(hr)) - HeapFree(GetProcessHeap(), 0, pfile); +static ULONG WINAPI IUnknown_fnAddRef(IUnknown *iface) +{ + IAVIFileImpl *This = impl_from_IUnknown(iface); + ULONG ref = InterlockedIncrement(&This->ref); - return hr; + TRACE("(%p) ref=%d\n", This, ref); + + return ref; } -static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID refiid, - LPVOID *obj) +static ULONG WINAPI IUnknown_fnRelease(IUnknown *iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IUnknown(iface); + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj); + TRACE("(%p) ref=%d\n", This, ref); - if (IsEqualGUID(&IID_IUnknown, refiid) || - IsEqualGUID(&IID_IAVIFile, refiid)) { - *obj = iface; - IAVIFile_AddRef(iface); - return S_OK; - } else if (This->fInfo.dwStreams == 1 && - IsEqualGUID(&IID_IAVIStream, refiid)) { - *obj = &This->iAVIStream; - IAVIFile_AddRef(iface); - return S_OK; - } else if (IsEqualGUID(&IID_IPersistFile, refiid)) { - *obj = &This->iPersistFile; - IAVIFile_AddRef(iface); - return S_OK; - } + if (!ref) { + /* need to write headers to file */ + if (This->fDirty) + AVIFILE_SaveFile(This); + + HeapFree(GetProcessHeap(), 0, This->lpFormat); + This->lpFormat = NULL; + This->cbFormat = 0; + HeapFree(GetProcessHeap(), 0, This->extra.lp); + This->extra.lp = NULL; + This->extra.cb = 0; + HeapFree(GetProcessHeap(), 0, This->szFileName); + This->szFileName = NULL; + if (This->hmmio) { + mmioClose(This->hmmio, 0); + This->hmmio = NULL; + } + HeapFree(GetProcessHeap(), 0, This); + } - return OLE_E_ENUM_NOMORE; + return ref; } -static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface) +static const IUnknownVtbl unk_vtbl = { - IAVIFileImpl *This = (IAVIFileImpl *)iface; - - TRACE("(%p)\n",iface); + IUnknown_fnQueryInterface, + IUnknown_fnAddRef, + IUnknown_fnRelease +}; - return InterlockedIncrement(&This->ref); +static inline IAVIFileImpl *impl_from_IAVIFile(IAVIFile *iface) +{ + return CONTAINING_RECORD(iface, IAVIFileImpl, IAVIFile_iface); } -static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) +static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile *iface, REFIID riid, void **ret_iface) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; - ULONG ref = InterlockedDecrement(&This->ref); + IAVIFileImpl *This = impl_from_IAVIFile(iface); - TRACE("(%p)\n",iface); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); +} - if (!ref) { - if (This->fDirty) { - /* need to write headers to file */ - AVIFILE_SaveFile(This); - } +static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile *iface) +{ + IAVIFileImpl *This = impl_from_IAVIFile(iface); - if (This->lpFormat != NULL) { - HeapFree(GetProcessHeap(), 0, This->lpFormat); - This->lpFormat = NULL; - This->cbFormat = 0; - } - if (This->extra.lp != NULL) { - HeapFree(GetProcessHeap(), 0, This->extra.lp); - This->extra.lp = NULL; - This->extra.cb = 0; - } - HeapFree(GetProcessHeap(), 0, This->szFileName); - This->szFileName = NULL; - if (This->hmmio != NULL) { - mmioClose(This->hmmio, 0); - This->hmmio = NULL; - } + return IUnknown_AddRef(This->outer_unk); +} - HeapFree(GetProcessHeap(), 0, This); - return 0; - } - return ref; +static ULONG WINAPI IAVIFile_fnRelease(IAVIFile *iface) +{ + IAVIFileImpl *This = impl_from_IAVIFile(iface); + + return IUnknown_Release(This->outer_unk); } -static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi, - LONG size) +static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, AVIFILEINFOW *afi, LONG size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,%d)\n",iface,afi,size); @@ -346,10 +254,10 @@ return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis, - DWORD fccType, LONG lParam) +static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile *iface, IAVIStream **avis, DWORD fccType, + LONG lParam) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,0x%08X,%d)\n", iface, avis, fccType, lParam); @@ -365,16 +273,16 @@ if (fccType != 0 && fccType != streamtypeAUDIO) return AVIERR_NODATA; - *avis = (PAVISTREAM)&This->iAVIStream; - IAVIFile_AddRef(iface); + *avis = &This->IAVIStream_iface; + IAVIFile_AddRef(*avis); return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis, - LPAVISTREAMINFOW asi) +static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile *iface, IAVIStream **avis, + AVISTREAMINFOW *asi) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,%p,%p)\n", iface, avis, asi); @@ -416,16 +324,15 @@ This->ckData.dwDataOffset = 0; This->ckData.cksize = 0; - *avis = (PAVISTREAM)&This->iAVIStream; - IAVIFile_AddRef(iface); + *avis = &This->IAVIStream_iface; + IAVIFile_AddRef(*avis); return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, - LPVOID lpData, LONG size) +static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile *iface, DWORD ckid, void *lpData, LONG size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%p,%d)\n", iface, ckid, lpData, size); @@ -444,10 +351,9 @@ return WriteExtraChunk(&This->extra, ckid, lpData, size); } -static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, - LPVOID lpData, LONG *size) +static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile *iface, DWORD ckid, void *lpData, LONG *size) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%p,%p)\n", iface, ckid, lpData, size); @@ -464,10 +370,9 @@ return AVIERR_OK; } -static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, - LONG lParam) +static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile *iface, DWORD fccType, LONG lParam) { - IAVIFileImpl *This = (IAVIFileImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIFile(iface); TRACE("(%p,0x%08X,%d)\n", iface, fccType, lParam); @@ -505,34 +410,46 @@ return AVIERR_OK; } +static const struct IAVIFileVtbl iwavft = { + IAVIFile_fnQueryInterface, + IAVIFile_fnAddRef, + IAVIFile_fnRelease, + IAVIFile_fnInfo, + IAVIFile_fnGetStream, + IAVIFile_fnCreateStream, + IAVIFile_fnWriteData, + IAVIFile_fnReadData, + IAVIFile_fnEndRecord, + IAVIFile_fnDeleteStream +}; + /***********************************************************************/ -static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, - REFIID refiid, LPVOID *obj) +static inline IAVIFileImpl *impl_from_IPersistFile(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + return CONTAINING_RECORD(iface, IAVIFileImpl, IPersistFile_iface); +} - assert(This->paf != NULL); +static HRESULT WINAPI IPersistFile_fnQueryInterface(IPersistFile *iface, REFIID riid, + void **ret_iface) +{ + IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_QueryInterface((PAVIFILE)This->paf, refiid, obj); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); } static ULONG WINAPI IPersistFile_fnAddRef(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; - - assert(This->paf != NULL); + IAVIFileImpl *This = impl_from_IPersistFile(iface); - return IAVIFile_AddRef((PAVIFILE)This->paf); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI IPersistFile_fnRelease(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); - assert(This->paf != NULL); - - return IAVIFile_Release((PAVIFILE)This->paf); + return IUnknown_Release(This->outer_unk); } static HRESULT WINAPI IPersistFile_fnGetClassID(IPersistFile *iface, @@ -550,20 +467,16 @@ static HRESULT WINAPI IPersistFile_fnIsDirty(IPersistFile *iface) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; - - TRACE("(%p)\n", iface); + IAVIFileImpl *This = impl_from_IPersistFile(iface); - assert(This->paf != NULL); + TRACE("(%p)\n", iface); - return (This->paf->fDirty ? S_OK : S_FALSE); + return (This->fDirty ? S_OK : S_FALSE); } -static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, - LPCOLESTR pszFileName, DWORD dwMode) +static HRESULT WINAPI IPersistFile_fnLoad(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode) { - IAVIFileImpl *This = ((IPersistFileImpl*)iface)->paf; - + IAVIFileImpl *This = impl_from_IPersistFile(iface); WCHAR wszStreamFmt[50]; INT len; @@ -573,7 +486,6 @@ if (pszFileName == NULL) return AVIERR_BADPARAM; - assert(This != NULL); if (This->hmmio != NULL) return AVIERR_ERROR; /* No reuse of this object for another file! */ @@ -645,10 +557,9 @@ return AVIERR_OK; } -static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, - LPOLESTR *ppszFileName) +static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile *iface, LPOLESTR *ppszFileName) { - IPersistFileImpl *This = (IPersistFileImpl *)iface; + IAVIFileImpl *This = impl_from_IPersistFile(iface); TRACE("(%p,%p)\n", iface, ppszFileName); @@ -657,49 +568,57 @@ *ppszFileName = NULL; - assert(This->paf != NULL); - - if (This->paf->szFileName != NULL) { - int len = lstrlenW(This->paf->szFileName) + 1; + if (This->szFileName) { + int len = lstrlenW(This->szFileName) + 1; *ppszFileName = CoTaskMemAlloc(len * sizeof(WCHAR)); if (*ppszFileName == NULL) return AVIERR_MEMORY; - strcpyW(*ppszFileName, This->paf->szFileName); + strcpyW(*ppszFileName, This->szFileName); } return AVIERR_OK; } +static const struct IPersistFileVtbl iwavpft = { + IPersistFile_fnQueryInterface, + IPersistFile_fnAddRef, + IPersistFile_fnRelease, + IPersistFile_fnGetClassID, + IPersistFile_fnIsDirty, + IPersistFile_fnLoad, + IPersistFile_fnSave, + IPersistFile_fnSaveCompleted, + IPersistFile_fnGetCurFile +}; + /***********************************************************************/ -static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, - REFIID refiid, LPVOID *obj) +static inline IAVIFileImpl *impl_from_IAVIStream(IAVIStream *iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + return CONTAINING_RECORD(iface, IAVIFileImpl, IAVIStream_iface); +} - assert(This->paf != NULL); +static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream *iface, REFIID riid, void **ret_iface) +{ + IAVIFileImpl *This = impl_from_IAVIStream(iface); - return IAVIFile_QueryInterface((PAVIFILE)This->paf, refiid, obj); + return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface); } static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream *iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; - - assert(This->paf != NULL); + IAVIFileImpl *This = impl_from_IAVIStream(iface); - return IAVIFile_AddRef((PAVIFILE)This->paf); + return IUnknown_AddRef(This->outer_unk); } static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); - assert(This->paf != NULL); - - return IAVIFile_Release((PAVIFILE)This->paf); + return IUnknown_Release(This->outer_unk); } static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream *iface, LPARAM lParam1, @@ -711,10 +630,9 @@ return AVIERR_UNSUPPORTED; } -static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi, - LONG size) +static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface, AVISTREAMINFOW *psi, LONG size) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%p,%d)\n", iface, psi, size); @@ -723,17 +641,16 @@ if (size < 0) return AVIERR_BADSIZE; - memcpy(psi, &This->paf->sInfo, min((DWORD)size, sizeof(This->paf->sInfo))); + memcpy(psi, &This->sInfo, min((DWORD)size, sizeof(This->sInfo))); - if ((DWORD)size < sizeof(This->paf->sInfo)) + if ((DWORD)size < sizeof(This->sInfo)) return AVIERR_BUFFERTOOSMALL; return AVIERR_OK; } -static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, - LONG flags) +static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos, LONG flags) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,0x%08X)\n",iface,pos,flags); @@ -767,10 +684,10 @@ return pos; } -static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, - LPVOID format, LONG *formatsize) +static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos, void *format, + LONG *formatsize) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%p,%p)\n", iface, pos, format, formatsize); @@ -779,26 +696,26 @@ /* only interested in needed buffersize? */ if (format == NULL || *formatsize <= 0) { - *formatsize = This->paf->cbFormat; + *formatsize = This->cbFormat; return AVIERR_OK; } /* copy initial format (only as much as will fit) */ - memcpy(format, This->paf->lpFormat, min(*formatsize, This->paf->cbFormat)); - if (*formatsize < This->paf->cbFormat) { - *formatsize = This->paf->cbFormat; + memcpy(format, This->lpFormat, min(*formatsize, This->cbFormat)); + if (*formatsize < This->cbFormat) { + *formatsize = This->cbFormat; return AVIERR_BUFFERTOOSMALL; } - *formatsize = This->paf->cbFormat; + *formatsize = This->cbFormat; return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, - LPVOID format, LONG formatsize) +static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos, void *format, + LONG formatsize) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%p,%d)\n", iface, pos, format, formatsize); @@ -850,12 +767,10 @@ return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, - LONG samples, LPVOID buffer, - LONG buffersize, LPLONG bytesread, - LPLONG samplesread) +static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start, LONG samples, void *buffer, + LONG buffersize, LONG *bytesread, LONG *samplesread) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%d,%p,%d,%p,%p)\n", iface, start, samples, buffer, buffersize, bytesread, samplesread); @@ -923,13 +838,10 @@ return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, - LONG samples, LPVOID buffer, - LONG buffersize, DWORD flags, - LPLONG sampwritten, - LPLONG byteswritten) +static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start, LONG samples, void *buffer, + LONG buffersize, DWORD flags, LONG *sampwritten, LONG *byteswritten) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%d,%p,%d,0x%08X,%p,%p)\n", iface, start, samples, buffer, buffersize, flags, sampwritten, byteswritten); @@ -958,7 +870,7 @@ /* do we have anything to write? */ if (buffer != NULL && buffersize > 0) { - This->fDirty = 1; + This->fDirty = TRUE; if (mmioSeek(This->hmmio, This->ckData.dwDataOffset + start * This->sInfo.dwSampleSize, SEEK_SET) == -1) @@ -980,10 +892,9 @@ return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, - LONG samples) +static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start, LONG samples) { - IAVIFileImpl *This = ((IAVIStreamImpl*)iface)->paf; + IAVIFileImpl *This = impl_from_IAVIStream(iface); TRACE("(%p,%d,%d)\n", iface, start, samples); @@ -1021,27 +932,23 @@ return AVIERR_UNSUPPORTED; } - This->fDirty = 1; + This->fDirty = TRUE; return AVIERR_OK; } -static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, - LPVOID lp, LPLONG lpread) +static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream *iface, DWORD fcc, void *lp, LONG *lpread) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; - - assert(This->paf != NULL); + IAVIFileImpl *This = impl_from_IAVIStream(iface); - return IAVIFile_ReadData((PAVIFILE)This->paf, fcc, lp, lpread); + return IAVIFile_ReadData(&This->IAVIFile_iface, fcc, lp, lpread); } -static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, - LPVOID lp, LONG size) +static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream *iface, DWORD fcc, void *lp, LONG size) { - IAVIStreamImpl *This = (IAVIStreamImpl *)iface; + IAVIFileImpl *This = impl_from_IAVIStream(iface); - return IAVIFile_WriteData((PAVIFILE)This->paf, fcc, lp, size); + return IAVIFile_WriteData(&This->IAVIFile_iface, fcc, lp, size); } static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream *iface, @@ -1052,6 +959,50 @@ return E_FAIL; } +static const struct IAVIStreamVtbl iwavst = { + IAVIStream_fnQueryInterface, + IAVIStream_fnAddRef, + IAVIStream_fnRelease, + IAVIStream_fnCreate, + IAVIStream_fnInfo, + IAVIStream_fnFindSample, + IAVIStream_fnReadFormat, + IAVIStream_fnSetFormat, + IAVIStream_fnRead, + IAVIStream_fnWrite, + IAVIStream_fnDelete, + IAVIStream_fnReadData, + IAVIStream_fnWriteData, + IAVIStream_fnSetInfo +}; + +HRESULT AVIFILE_CreateWAVFile(IUnknown *outer_unk, REFIID riid, void **ret_iface) +{ + IAVIFileImpl *pfile; + HRESULT hr; + + *ret_iface = NULL; + + pfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pfile)); + if (!pfile) + return AVIERR_MEMORY; + + pfile->IUnknown_inner.lpVtbl = &unk_vtbl; + pfile->IAVIFile_iface.lpVtbl = &iwavft; + pfile->IPersistFile_iface.lpVtbl = &iwavpft; + pfile->IAVIStream_iface.lpVtbl = &iwavst; + pfile->ref = 1; + if (outer_unk) + pfile->outer_unk = outer_unk; + else + pfile->outer_unk = &pfile->IUnknown_inner; + + hr = IUnknown_QueryInterface(&pfile->IUnknown_inner, riid, ret_iface); + IUnknown_Release(&pfile->IUnknown_inner); + + return hr; +} + /***********************************************************************/ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This) @@ -1225,7 +1176,7 @@ This->lpFormat->nAvgBytesPerSec = This->lpFormat->nBlockAlign * This->lpFormat->nSamplesPerSec; - This->fDirty = 0; + This->fDirty = FALSE; This->sInfo.fccType = streamtypeAUDIO; This->sInfo.fccHandler = 0; diff -Nru wine1.7-1.7.13/dlls/comctl32/comctl32.spec wine1.7-1.7.16/dlls/comctl32/comctl32.spec --- wine1.7-1.7.13/dlls/comctl32/comctl32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comctl32/comctl32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -62,32 +62,32 @@ 341 stdcall -noname SendNotify(long long long ptr) 342 stdcall -noname SendNotifyEx(long long long ptr long) 345 stdcall -ordinal TaskDialogIndirect(ptr ptr ptr ptr) -350 stdcall -noname StrChrA(str str) -351 stdcall -noname StrRChrA(str str long) -352 stdcall -noname StrCmpNA(str str long) -353 stdcall -noname StrCmpNIA(str str long) -354 stdcall -noname StrStrA(str str) -355 stdcall -noname StrStrIA(str str) -356 stdcall -noname StrCSpnA(str str) -357 stdcall -noname StrToIntA(str) -358 stdcall -noname StrChrW(wstr long) -359 stdcall -noname StrRChrW(wstr wstr long) -360 stdcall -noname StrCmpNW(wstr wstr long) -361 stdcall -noname StrCmpNIW(wstr wstr long) -362 stdcall -noname StrStrW(wstr wstr) -363 stdcall -noname StrStrIW(wstr wstr) -364 stdcall -noname StrCSpnW(wstr wstr) -365 stdcall -noname StrToIntW(wstr) -366 stdcall -noname StrChrIA(str long) -367 stdcall -noname StrChrIW(wstr long) -368 stdcall -noname StrRChrIA(str str long) -369 stdcall -noname StrRChrIW(wstr wstr long) -372 stdcall -noname StrRStrIA(str str str) -373 stdcall -noname StrRStrIW(wstr wstr wstr) -374 stdcall -noname StrCSpnIA(str str) -375 stdcall -noname StrCSpnIW(wstr wstr) -376 stdcall -noname IntlStrEqWorkerA(long str str long) -377 stdcall -noname IntlStrEqWorkerW(long wstr wstr long) +350 stdcall -noname -private StrChrA(str str) +351 stdcall -noname -private StrRChrA(str str long) +352 stdcall -noname -private StrCmpNA(str str long) +353 stdcall -noname -private StrCmpNIA(str str long) +354 stdcall -noname -private StrStrA(str str) +355 stdcall -noname -private StrStrIA(str str) +356 stdcall -noname -private StrCSpnA(str str) +357 stdcall -noname -private StrToIntA(str) +358 stdcall -noname -private StrChrW(wstr long) +359 stdcall -noname -private StrRChrW(wstr wstr long) +360 stdcall -noname -private StrCmpNW(wstr wstr long) +361 stdcall -noname -private StrCmpNIW(wstr wstr long) +362 stdcall -noname -private StrStrW(wstr wstr) +363 stdcall -noname -private StrStrIW(wstr wstr) +364 stdcall -noname -private StrCSpnW(wstr wstr) +365 stdcall -noname -private StrToIntW(wstr) +366 stdcall -noname -private StrChrIA(str long) +367 stdcall -noname -private StrChrIW(wstr long) +368 stdcall -noname -private StrRChrIA(str str long) +369 stdcall -noname -private StrRChrIW(wstr wstr long) +372 stdcall -noname -private StrRStrIA(str str str) +373 stdcall -noname -private StrRStrIW(wstr wstr wstr) +374 stdcall -noname -private StrCSpnIA(str str) +375 stdcall -noname -private StrCSpnIW(wstr wstr) +376 stdcall -noname -private IntlStrEqWorkerA(long str str long) +377 stdcall -noname -private IntlStrEqWorkerW(long wstr wstr long) 382 stdcall -noname SmoothScrollWindow(ptr) 383 stub -noname DoReaderMode 384 stdcall -noname SetPathWordBreakProc(ptr long) diff -Nru wine1.7-1.7.13/dlls/comctl32/datetime.c wine1.7-1.7.16/dlls/comctl32/datetime.c --- wine1.7-1.7.13/dlls/comctl32/datetime.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comctl32/datetime.c 2014-04-04 19:13:44.000000000 +0000 @@ -217,7 +217,7 @@ return FALSE; /* Windows returns true if the date is valid but outside the limits set */ - if (DATETIME_IsDateInValidRange(infoPtr, systime) == FALSE) + if (!DATETIME_IsDateInValidRange(infoPtr, systime)) return TRUE; infoPtr->dateValid = TRUE; @@ -846,7 +846,8 @@ DATETIME_ApplySelectedField (DATETIME_INFO *infoPtr) { int fieldNum = infoPtr->select & DTHT_DATEFIELD; - int i, val=0, clamp_day=0; + int i, val = 0; + BOOL clamp_day = FALSE; SYSTEMTIME date = infoPtr->date; int oldyear; @@ -870,7 +871,7 @@ date.wYear = date.wYear - (date.wYear%100) + val; if (DATETIME_IsDateInValidRange(infoPtr, &date)) - clamp_day = 1; + clamp_day = TRUE; else date.wYear = oldyear; @@ -881,7 +882,7 @@ date.wYear = val; if (DATETIME_IsDateInValidRange(infoPtr, &date)) - clamp_day = 1; + clamp_day = TRUE; else date.wYear = oldyear; @@ -889,7 +890,7 @@ case ONEDIGITMONTH: case TWODIGITMONTH: date.wMonth = val; - clamp_day = 1; + clamp_day = TRUE; break; case ONEDIGITDAY: case TWODIGITDAY: diff -Nru wine1.7-1.7.13/dlls/comctl32/dpa.c wine1.7-1.7.16/dlls/comctl32/dpa.c --- wine1.7-1.7.13/dlls/comctl32/dpa.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comctl32/dpa.c 2014-04-04 19:13:44.000000000 +0000 @@ -129,8 +129,10 @@ if (!hDpa) return E_OUTOFMEMORY; - if (!DPA_Grow (hDpa, streamData.dwItems)) + if (!DPA_Grow (hDpa, streamData.dwItems)) { + DPA_Destroy (hDpa); return E_OUTOFMEMORY; + } /* load data from the stream into the dpa */ ptr = hDpa->ptrs; diff -Nru wine1.7-1.7.13/dlls/comctl32/tests/header.c wine1.7-1.7.16/dlls/comctl32/tests/header.c --- wine1.7-1.7.13/dlls/comctl32/tests/header.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comctl32/tests/header.c 2014-04-04 19:13:44.000000000 +0000 @@ -442,6 +442,7 @@ if (defwndproc_counter) msg.flags |= defwinproc; msg.wParam = wParam; msg.lParam = lParam; + msg.id = 0; add_message(sequences, PARENT_SEQ_INDEX, &msg); } diff -Nru wine1.7-1.7.13/dlls/comctl32/tests/toolbar.c wine1.7-1.7.16/dlls/comctl32/tests/toolbar.c --- wine1.7-1.7.13/dlls/comctl32/tests/toolbar.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comctl32/tests/toolbar.c 2014-04-04 19:13:44.000000000 +0000 @@ -1910,6 +1910,16 @@ ok(style == ptr->style_set, "%d: got style 0x%08x, expected 0x%08x\n", i, style, ptr->style_set); } + /* Windows sets CCS_VERT when TB_GETEXTENDEDSTYLE is set */ + oldstyle2 = SendMessageA(hwnd, TB_GETEXTENDEDSTYLE, 0, 0); + oldstyle = SendMessageA(hwnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_VERTICAL); + ok(oldstyle == oldstyle2, "got old style 0x%08x, expected 0x%08x\n", oldstyle, oldstyle2); + style = SendMessageA(hwnd, TB_GETEXTENDEDSTYLE, 0, 0); + ok(style == TBSTYLE_EX_VERTICAL, "got style 0x%08x, expected 0x%08x\n", style, TBSTYLE_EX_VERTICAL); + style = SendMessageA(hwnd, TB_GETSTYLE, 0, 0); + todo_wine + ok(style == CCS_VERT, "got style 0x%08x, expected 0x%08x\n", style, CCS_VERT); + DestroyWindow(hwnd); } diff -Nru wine1.7-1.7.13/dlls/comctl32/toolbar.c wine1.7-1.7.16/dlls/comctl32/toolbar.c --- wine1.7-1.7.13/dlls/comctl32/toolbar.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comctl32/toolbar.c 2014-04-04 19:13:44.000000000 +0000 @@ -219,7 +219,7 @@ /* Used to find undocumented extended styles */ #define TBSTYLE_EX_ALL (TBSTYLE_EX_DRAWDDARROWS | \ - TBSTYLE_EX_UNDOC1 | \ + TBSTYLE_EX_VERTICAL | \ TBSTYLE_EX_MIXEDBUTTONS | \ TBSTYLE_EX_DOUBLEBUFFER | \ TBSTYLE_EX_HIDECLIPPEDBUTTONS) @@ -857,8 +857,11 @@ /* empirical tests show that iBitmap can/will be non-zero */ /* when drawing the vertical bar... */ if ((dwStyle & TBSTYLE_FLAT) /* && (btnPtr->iBitmap == 0) */) { - if (dwStyle & CCS_VERT) - TOOLBAR_DrawFlatHorizontalSeparator (&rc, hdc, infoPtr); + if (dwStyle & CCS_VERT) { + RECT rcsep = rc; + InflateRect(&rcsep, -infoPtr->szPadding.cx, -infoPtr->szPadding.cy); + TOOLBAR_DrawFlatHorizontalSeparator (&rcsep, hdc, infoPtr); + } else TOOLBAR_DrawFlatSeparator (&rc, hdc, infoPtr); } @@ -1271,7 +1274,7 @@ * the toolbar wrapping on its own, it can use the TBSTYLE_WRAPABLE * flag, and set the TBSTATE_WRAP flags manually on the appropriate items. * -* Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_UNDOC1 can be used also to allow +* Note: TBSTYLE_WRAPABLE or TBSTYLE_EX_VERTICAL can be used also to allow * vertical toolbar lists. */ @@ -1287,7 +1290,7 @@ /* no layout is necessary. Applications may use this style */ /* to perform their own layout on the toolbar. */ if( !(infoPtr->dwStyle & TBSTYLE_WRAPABLE) && - !(infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1) ) return; + !(infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL) ) return; btnPtr = infoPtr->buttons; x = infoPtr->nIndent; @@ -1676,7 +1679,7 @@ if (btnPtr->fsStyle & BTNS_SEP) { if (infoPtr->dwStyle & CCS_VERT) { cy = (btnPtr->iBitmap > 0) ? btnPtr->iBitmap : SEPARATOR_WIDTH; - cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nWidth; + cx = (btnPtr->cx > 0) ? btnPtr->cx : infoPtr->nButtonWidth; } else cx = (btnPtr->cx > 0) ? btnPtr->cx : @@ -3037,7 +3040,7 @@ cy = TOP_BORDER + infoPtr->nRows * infoPtr->nButtonHeight + BOTTOM_BORDER; cx = parent_rect.right - parent_rect.left; - if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_UNDOC1)) + if ((infoPtr->dwStyle & TBSTYLE_WRAPABLE) || (infoPtr->dwExStyle & TBSTYLE_EX_VERTICAL)) { TOOLBAR_LayoutToolbar(infoPtr); InvalidateRect( infoPtr->hwndSelf, NULL, TRUE ); diff -Nru wine1.7-1.7.13/dlls/comdlg32/comdlg32.rc wine1.7-1.7.16/dlls/comdlg32/comdlg32.rc --- wine1.7-1.7.13/dlls/comdlg32/comdlg32.rc 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comdlg32/comdlg32.rc 2014-04-04 19:13:44.000000000 +0000 @@ -497,8 +497,10 @@ #define WINE_FILEDESCRIPTION_STR "Common Dialog Boxes" #define WINE_FILENAME_STR "comdlg32.dll" -#define WINE_FILEVERSION 4,0,0,950 /* Maybe 4.1.0.980 for win98?? */ -#define WINE_FILEVERSION_STR "4.0" +#define WINE_FILEVERSION 6,0,2900,5512 +#define WINE_FILEVERSION_STR "6.00.2900.5512" +#define WINE_PRODUCTVERSION 6,0,2900,5512 +#define WINE_PRODUCTVERSION_STR "6.00.2900.5512" #include "wine/wine_common_ver.rc" diff -Nru wine1.7-1.7.13/dlls/comdlg32/tests/filedlg.c wine1.7-1.7.16/dlls/comdlg32/tests/filedlg.c --- wine1.7-1.7.13/dlls/comdlg32/tests/filedlg.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/comdlg32/tests/filedlg.c 2014-04-04 19:13:44.000000000 +0000 @@ -325,7 +325,7 @@ { static RECT initrc, rc; static int index, count; - static int gotSWP_bottom, gotShowWindow; + static BOOL gotSWP_bottom, gotShowWindow; HWND parent = GetParent( dlg); int resize; #define MAXNRCTRLS 30 @@ -342,7 +342,7 @@ index = ((OPENFILENAMEA*)lParam)->lCustData; count = 0; - gotSWP_bottom = gotShowWindow = 0; + gotSWP_bottom = gotShowWindow = FALSE; /* test style */ style = GetWindowLongA( parent, GWL_STYLE); if( resize_testcases[index].flags & OFN_ENABLESIZING) @@ -515,16 +515,16 @@ { WINDOWPOS *pwp = (WINDOWPOS *)lParam; if( !index && pwp->hwndInsertAfter == HWND_BOTTOM){ - gotSWP_bottom = 1; - ok( gotShowWindow == 0, "The WM_WINDOWPOSCHANGING message came after a WM_SHOWWINDOW message\n"); + gotSWP_bottom = TRUE; + ok(!gotShowWindow, "The WM_WINDOWPOSCHANGING message came after a WM_SHOWWINDOW message\n"); } } break; case WM_SHOWWINDOW: { if( !index){ - gotShowWindow = 1; - ok( gotSWP_bottom == 1, "No WM_WINDOWPOSCHANGING message came before a WM_SHOWWINDOW message\n"); + gotShowWindow = TRUE; + ok(gotSWP_bottom, "No WM_WINDOWPOSCHANGING message came before a WM_SHOWWINDOW message\n"); } } break; diff -Nru wine1.7-1.7.13/dlls/crypt32/chain.c wine1.7-1.7.16/dlls/crypt32/chain.c --- wine1.7-1.7.13/dlls/crypt32/chain.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/crypt32/chain.c 2014-04-04 19:13:44.000000000 +0000 @@ -33,8 +33,6 @@ #define DEFAULT_CYCLE_MODULUS 7 -static HCERTCHAINENGINE CRYPT_defaultChainEngine; - /* This represents a subset of a certificate chain engine: it doesn't include * the "hOther" store described by MSDN, because I'm not sure how that's used. * It also doesn't include the "hTrust" store, because I don't yet implement @@ -114,45 +112,102 @@ return ret; } -HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, - PCERT_CHAIN_ENGINE_CONFIG pConfig) +HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, DWORD system_store, const CERT_CHAIN_ENGINE_CONFIG *config) { + CertificateChainEngine *engine; + HCERTSTORE worldStores[4]; + static const WCHAR caW[] = { 'C','A',0 }; static const WCHAR myW[] = { 'M','y',0 }; static const WCHAR trustW[] = { 'T','r','u','s','t',0 }; - CertificateChainEngine *engine = - CryptMemAlloc(sizeof(CertificateChainEngine)); - - if (engine) - { - HCERTSTORE worldStores[4]; - engine->ref = 1; - engine->hRoot = root; - engine->hWorld = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, - CERT_STORE_CREATE_NEW_FLAG, NULL); - worldStores[0] = CertDuplicateStore(engine->hRoot); - worldStores[1] = CertOpenSystemStoreW(0, caW); - worldStores[2] = CertOpenSystemStoreW(0, myW); - worldStores[3] = CertOpenSystemStoreW(0, trustW); - CRYPT_AddStoresToCollection(engine->hWorld, - sizeof(worldStores) / sizeof(worldStores[0]), worldStores); - CRYPT_AddStoresToCollection(engine->hWorld, - pConfig->cAdditionalStore, pConfig->rghAdditionalStore); - CRYPT_CloseStores(sizeof(worldStores) / sizeof(worldStores[0]), - worldStores); - engine->dwFlags = pConfig->dwFlags; - engine->dwUrlRetrievalTimeout = pConfig->dwUrlRetrievalTimeout; - engine->MaximumCachedCertificates = - pConfig->MaximumCachedCertificates; - if (pConfig->CycleDetectionModulus) - engine->CycleDetectionModulus = pConfig->CycleDetectionModulus; + if(!root) { + if(config->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) && config->hExclusiveRoot) + root = CertDuplicateStore(config->hExclusiveRoot); + else if (config->hRestrictedRoot) + root = CertDuplicateStore(config->hRestrictedRoot); else - engine->CycleDetectionModulus = DEFAULT_CYCLE_MODULUS; + root = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, rootW); + if(!root) + return NULL; + } + + engine = CryptMemAlloc(sizeof(CertificateChainEngine)); + if(!engine) { + CertCloseStore(root, 0); + return NULL; } + + engine->ref = 1; + engine->hRoot = root; + engine->hWorld = CertOpenStore(CERT_STORE_PROV_COLLECTION, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL); + worldStores[0] = CertDuplicateStore(engine->hRoot); + worldStores[1] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, caW); + worldStores[2] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, myW); + worldStores[3] = CertOpenStore(CERT_STORE_PROV_SYSTEM_W, 0, 0, system_store, trustW); + + CRYPT_AddStoresToCollection(engine->hWorld, sizeof(worldStores) / sizeof(worldStores[0]), worldStores); + CRYPT_AddStoresToCollection(engine->hWorld, config->cAdditionalStore, config->rghAdditionalStore); + CRYPT_CloseStores(sizeof(worldStores) / sizeof(worldStores[0]), worldStores); + + engine->dwFlags = config->dwFlags; + engine->dwUrlRetrievalTimeout = config->dwUrlRetrievalTimeout; + engine->MaximumCachedCertificates = config->MaximumCachedCertificates; + if(config->CycleDetectionModulus) + engine->CycleDetectionModulus = config->CycleDetectionModulus; + else + engine->CycleDetectionModulus = DEFAULT_CYCLE_MODULUS; + return engine; } +static CertificateChainEngine *default_cu_engine, *default_lm_engine; + +static CertificateChainEngine *get_chain_engine(HCERTCHAINENGINE handle, BOOL allow_default) +{ + const CERT_CHAIN_ENGINE_CONFIG config = { sizeof(config) }; + + if(handle == HCCE_CURRENT_USER) { + if(!allow_default) + return NULL; + + if(!default_cu_engine) { + handle = CRYPT_CreateChainEngine(NULL, CERT_SYSTEM_STORE_CURRENT_USER, &config); + InterlockedCompareExchangePointer((void**)&default_cu_engine, handle, NULL); + if(default_cu_engine != handle) + CertFreeCertificateChainEngine(handle); + } + + return default_cu_engine; + } + + if(handle == HCCE_LOCAL_MACHINE) { + if(!allow_default) + return NULL; + + if(!default_lm_engine) { + handle = CRYPT_CreateChainEngine(NULL, CERT_SYSTEM_STORE_LOCAL_MACHINE, &config); + InterlockedCompareExchangePointer((void**)&default_lm_engine, handle, NULL); + if(default_lm_engine != handle) + CertFreeCertificateChainEngine(handle); + } + + return default_lm_engine; + } + + return (CertificateChainEngine*)handle; +} + +static void free_chain_engine(CertificateChainEngine *engine) +{ + if(!engine || InterlockedDecrement(&engine->ref)) + return; + + CertCloseStore(engine->hWorld, 0); + CertCloseStore(engine->hRoot, 0); + CryptMemFree(engine); +} + typedef struct _CERT_CHAIN_ENGINE_CONFIG_NO_EXCLUSIVE_ROOT { DWORD cbSize; @@ -180,66 +235,27 @@ SetLastError(E_INVALIDARG); return FALSE; } - *phChainEngine = NULL; ret = CRYPT_CheckRestrictedRoot(pConfig->hRestrictedRoot); - if (ret) + if (!ret) { - HCERTSTORE root; - HCERTCHAINENGINE engine; - - if (pConfig->cbSize >= sizeof(CERT_CHAIN_ENGINE_CONFIG) && - pConfig->hExclusiveRoot) - root = CertDuplicateStore(pConfig->hExclusiveRoot); - else if (pConfig->hRestrictedRoot) - root = CertDuplicateStore(pConfig->hRestrictedRoot); - else - root = CertOpenSystemStoreW(0, rootW); - engine = CRYPT_CreateChainEngine(root, pConfig); - if (engine) - { - *phChainEngine = engine; - ret = TRUE; - } - else - ret = FALSE; + *phChainEngine = NULL; + return FALSE; } - return ret; -} - -VOID WINAPI CertFreeCertificateChainEngine(HCERTCHAINENGINE hChainEngine) -{ - CertificateChainEngine *engine = (CertificateChainEngine*)hChainEngine; - - TRACE("(%p)\n", hChainEngine); - if (engine && InterlockedDecrement(&engine->ref) == 0) - { - CertCloseStore(engine->hWorld, 0); - CertCloseStore(engine->hRoot, 0); - CryptMemFree(engine); - } + *phChainEngine = CRYPT_CreateChainEngine(NULL, CERT_SYSTEM_STORE_CURRENT_USER, pConfig); + return *phChainEngine != NULL; } -static HCERTCHAINENGINE CRYPT_GetDefaultChainEngine(void) +void WINAPI CertFreeCertificateChainEngine(HCERTCHAINENGINE hChainEngine) { - if (!CRYPT_defaultChainEngine) - { - CERT_CHAIN_ENGINE_CONFIG config = { 0 }; - HCERTCHAINENGINE engine; - - config.cbSize = sizeof(config); - CertCreateCertificateChainEngine(&config, &engine); - InterlockedCompareExchangePointer(&CRYPT_defaultChainEngine, engine, - NULL); - if (CRYPT_defaultChainEngine != engine) - CertFreeCertificateChainEngine(engine); - } - return CRYPT_defaultChainEngine; + TRACE("(%p)\n", hChainEngine); + free_chain_engine(get_chain_engine(hChainEngine, FALSE)); } void default_chain_engine_free(void) { - CertFreeCertificateChainEngine(CRYPT_defaultChainEngine); + free_chain_engine(default_cu_engine); + free_chain_engine(default_lm_engine); } typedef struct _CertificateChain @@ -2867,14 +2883,18 @@ PCERT_CHAIN_PARA pChainPara, DWORD dwFlags, LPVOID pvReserved, PCCERT_CHAIN_CONTEXT* ppChainContext) { - CertificateChainEngine *engine = (CertificateChainEngine*)hChainEngine; + CertificateChainEngine *engine; BOOL ret; CertificateChain *chain = NULL; - TRACE("(%p, %p, %s, %p, %p, %08x, %p, %p)\n", engine, pCertContext, + TRACE("(%p, %p, %s, %p, %p, %08x, %p, %p)\n", hChainEngine, pCertContext, debugstr_filetime(pTime), hAdditionalStore, pChainPara, dwFlags, pvReserved, ppChainContext); + engine = get_chain_engine(hChainEngine, TRUE); + if (!engine) + return FALSE; + if (ppChainContext) *ppChainContext = NULL; if (!pChainPara) @@ -2888,8 +2908,6 @@ return FALSE; } - if (!engine) - engine = CRYPT_GetDefaultChainEngine(); if (TRACE_ON(chain)) dump_chain_para(pChainPara); /* FIXME: what about HCCE_LOCAL_MACHINE? */ diff -Nru wine1.7-1.7.13/dlls/crypt32/crypt32_private.h wine1.7-1.7.16/dlls/crypt32/crypt32_private.h --- wine1.7-1.7.13/dlls/crypt32/crypt32_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/crypt32/crypt32_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -342,8 +342,7 @@ * the root store. Instead, it uses root, and assumes the caller has done any * checking necessary. */ -HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE root, - PCERT_CHAIN_ENGINE_CONFIG pConfig) DECLSPEC_HIDDEN; +HCERTCHAINENGINE CRYPT_CreateChainEngine(HCERTSTORE, DWORD, const CERT_CHAIN_ENGINE_CONFIG*) DECLSPEC_HIDDEN; /* Helper function for store reading functions and * CertAddSerializedElementToStore. Returns a context of the appropriate type diff -Nru wine1.7-1.7.13/dlls/crypt32/rootstore.c wine1.7-1.7.16/dlls/crypt32/rootstore.c --- wine1.7-1.7.13/dlls/crypt32/rootstore.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/crypt32/rootstore.c 2014-04-04 19:13:44.000000000 +0000 @@ -245,7 +245,7 @@ TRACE("\n"); CertDuplicateStore(to); - engine = CRYPT_CreateChainEngine(to, &chainEngineConfig); + engine = CRYPT_CreateChainEngine(to, CERT_SYSTEM_STORE_CURRENT_USER, &chainEngineConfig); if (engine) { PCCERT_CONTEXT cert = NULL; diff -Nru wine1.7-1.7.13/dlls/crypt32/tests/chain.c wine1.7-1.7.16/dlls/crypt32/tests/chain.c --- wine1.7-1.7.13/dlls/crypt32/tests/chain.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/crypt32/tests/chain.c 2014-04-04 19:13:44.000000000 +0000 @@ -3880,9 +3880,8 @@ ok(ret, "CertGetCertificateChain failed: %08x\n", GetLastError()); if (ret) { - ok(!(chain->TrustStatus.dwErrorStatus & - CERT_TRUST_IS_NOT_VALID_FOR_USAGE), - "didn't expect CERT_TRUST_IS_NOT_VALID_FOR_USAGE\n"); + ok(!(chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_NOT_VALID_FOR_USAGE), + "didn't expect CERT_TRUST_IS_NOT_VALID_FOR_USAGE, got %x\n", chain->TrustStatus.dwErrorStatus); pCertFreeCertificateChain(chain); } oids[1] = one_two_three; @@ -4041,6 +4040,13 @@ test_name_blob(&simple_chain->rgpElement[2]->pCertContext->pCertInfo->Subject, "US, GeoTrust Inc., GeoTrust Global CA"); pCertFreeCertificateChain(chain); + + /* Test HCCE_LOCAL_MACHINE */ + ret = CertGetCertificateChain(HCCE_LOCAL_MACHINE, cert, &fileTime, store, ¶, 0, NULL, &chain); + ok(ret, "CertGetCertificateChain failed: %u\n", GetLastError()); + pCertFreeCertificateChain(chain); + + CertFreeCertificateContext(cert); CertCloseStore(store, 0); } diff -Nru wine1.7-1.7.13/dlls/cryptnet/cryptnet_main.c wine1.7-1.7.16/dlls/cryptnet/cryptnet_main.c --- wine1.7-1.7.13/dlls/cryptnet/cryptnet_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/cryptnet/cryptnet_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -1424,61 +1424,24 @@ return ret; } -typedef BOOL (*get_object_expiration_func)(const void *pvContext, - FILETIME *expiration); - -static BOOL CRYPT_GetExpirationFromCert(const void *pvObject, FILETIME *expiration) -{ - PCCERT_CONTEXT cert = pvObject; - - *expiration = cert->pCertInfo->NotAfter; - return TRUE; -} - -static BOOL CRYPT_GetExpirationFromCRL(const void *pvObject, FILETIME *expiration) -{ - PCCRL_CONTEXT cert = pvObject; - - *expiration = cert->pCrlInfo->NextUpdate; - return TRUE; -} - -static BOOL CRYPT_GetExpirationFromCTL(const void *pvObject, FILETIME *expiration) -{ - PCCTL_CONTEXT cert = pvObject; - - *expiration = cert->pCtlInfo->NextUpdate; - return TRUE; -} - -static BOOL CRYPT_GetExpirationFunction(LPCSTR pszObjectOid, - get_object_expiration_func *getExpiration) +static BOOL CRYPT_GetExpiration(const void *object, const char *pszObjectOid, FILETIME *expiration) { - BOOL ret; + if (!IS_INTOID(pszObjectOid)) + return FALSE; - if (IS_INTOID(pszObjectOid)) - { - switch (LOWORD(pszObjectOid)) - { - case LOWORD(CONTEXT_OID_CERTIFICATE): - *getExpiration = CRYPT_GetExpirationFromCert; - ret = TRUE; - break; - case LOWORD(CONTEXT_OID_CRL): - *getExpiration = CRYPT_GetExpirationFromCRL; - ret = TRUE; - break; - case LOWORD(CONTEXT_OID_CTL): - *getExpiration = CRYPT_GetExpirationFromCTL; - ret = TRUE; - break; - default: - ret = FALSE; - } + switch (LOWORD(pszObjectOid)) { + case LOWORD(CONTEXT_OID_CERTIFICATE): + *expiration = ((const CERT_CONTEXT*)object)->pCertInfo->NotAfter; + return TRUE; + case LOWORD(CONTEXT_OID_CRL): + *expiration = ((const CRL_CONTEXT*)object)->pCrlInfo->NextUpdate; + return TRUE; + case LOWORD(CONTEXT_OID_CTL): + *expiration = ((const CTL_CONTEXT*)object)->pCtlInfo->NextUpdate; + return TRUE; } - else - ret = FALSE; - return ret; + + return FALSE; } /*********************************************************************** @@ -1511,22 +1474,18 @@ CRYPT_BLOB_ARRAY object = { 0, NULL }; PFN_FREE_ENCODED_OBJECT_FUNC freeObject; void *freeContext; + FILETIME expires; ret = retrieve(pszURL, pszObjectOid, dwRetrievalFlags, dwTimeout, &object, &freeObject, &freeContext, hAsyncRetrieve, pCredentials, pAuxInfo); if (ret) { - get_object_expiration_func getExpiration; - ret = create(pszObjectOid, dwRetrievalFlags, &object, ppvObject); if (ret && !(dwRetrievalFlags & CRYPT_DONT_CACHE_RESULT) && - CRYPT_GetExpirationFunction(pszObjectOid, &getExpiration)) + CRYPT_GetExpiration(*ppvObject, pszObjectOid, &expires)) { - FILETIME expires; - - if (getExpiration(*ppvObject, &expires)) - CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires); + CRYPT_CacheURL(pszURL, &object, dwRetrievalFlags, expires); } freeObject(pszObjectOid, &object, freeContext); } diff -Nru wine1.7-1.7.13/dlls/d3d10_1/d3d10_1_main.c wine1.7-1.7.16/dlls/d3d10_1/d3d10_1_main.c --- wine1.7-1.7.13/dlls/d3d10_1/d3d10_1_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d10_1/d3d10_1_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -31,7 +31,7 @@ #define WINE_D3D10_TO_STR(x) case x: return #x -const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type) +static const char *debug_d3d10_driver_type(D3D10_DRIVER_TYPE driver_type) { switch (driver_type) { @@ -46,7 +46,7 @@ } } -const char *debug_d3d10_feature_level(D3D10_FEATURE_LEVEL1 feature_level) +static const char *debug_d3d10_feature_level(D3D10_FEATURE_LEVEL1 feature_level) { switch (feature_level) { diff -Nru wine1.7-1.7.13/dlls/d3d8/buffer.c wine1.7-1.7.16/dlls/d3d8/buffer.c --- wine1.7-1.7.13/dlls/d3d8/buffer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/buffer.c 2014-04-04 19:13:44.000000000 +0000 @@ -48,7 +48,7 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -66,7 +66,7 @@ static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -104,52 +104,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid) { struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface, DWORD priority) @@ -274,7 +250,9 @@ static void STDMETHODCALLTYPE d3d8_vertexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_vertexbuffer *buffer = parent; + d3d8_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d8_vertexbuffer_wined3d_parent_ops = @@ -288,7 +266,7 @@ HRESULT hr; buffer->IDirect3DVertexBuffer8_iface.lpVtbl = &Direct3DVertexBuffer8_Vtbl; - buffer->refcount = 1; + d3d8_resource_init(&buffer->resource); buffer->fvf = fvf; wined3d_mutex_lock(); @@ -343,7 +321,7 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -361,7 +339,7 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -399,52 +377,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *iface, REFGUID guid) { struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, DWORD priority) @@ -568,7 +522,9 @@ static void STDMETHODCALLTYPE d3d8_indexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_indexbuffer *buffer = parent; + d3d8_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops = @@ -582,7 +538,7 @@ HRESULT hr; buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl; - buffer->refcount = 1; + d3d8_resource_init(&buffer->resource); buffer->format = wined3dformat_from_d3dformat(format); wined3d_mutex_lock(); diff -Nru wine1.7-1.7.13/dlls/d3d8/d3d8_main.c wine1.7-1.7.16/dlls/d3d8/d3d8_main.c --- wine1.7-1.7.13/dlls/d3d8/d3d8_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/d3d8_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -137,3 +137,81 @@ } return ret; } + +void d3d8_resource_cleanup(struct d3d8_resource *resource) +{ + wined3d_private_store_cleanup(&resource->private_store); +} + +HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid) +{ + struct wined3d_private_data *entry; + + wined3d_mutex_lock(); + entry = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!entry) + { + wined3d_mutex_unlock(); + return D3DERR_NOTFOUND; + } + + wined3d_private_store_free_private_data(&resource->private_store, entry); + wined3d_mutex_unlock(); + + return D3D_OK; +} + +HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid, + void *data, DWORD *data_size) +{ + const struct wined3d_private_data *stored_data; + DWORD size_in; + HRESULT hr; + + wined3d_mutex_lock(); + stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!stored_data) + { + hr = D3DERR_NOTFOUND; + goto done; + } + + size_in = *data_size; + *data_size = stored_data->size; + if (!data) + { + hr = D3D_OK; + goto done; + } + if (size_in < stored_data->size) + { + hr = D3DERR_MOREDATA; + goto done; + } + + if (stored_data->flags & WINED3DSPD_IUNKNOWN) + IUnknown_AddRef(stored_data->content.object); + memcpy(data, stored_data->content.data, stored_data->size); + hr = D3D_OK; + +done: + wined3d_mutex_unlock(); + return hr; +} + +void d3d8_resource_init(struct d3d8_resource *resource) +{ + resource->refcount = 1; + wined3d_private_store_init(&resource->private_store); +} + +HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) +{ + HRESULT hr; + + wined3d_mutex_lock(); + hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags); + wined3d_mutex_unlock(); + return hr; +} diff -Nru wine1.7-1.7.13/dlls/d3d8/d3d8_private.h wine1.7-1.7.16/dlls/d3d8/d3d8_private.h --- wine1.7-1.7.13/dlls/d3d8/d3d8_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/d3d8_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -174,10 +174,24 @@ HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN; +struct d3d8_resource +{ + LONG refcount; + struct wined3d_private_store private_store; +}; + +void d3d8_resource_cleanup(struct d3d8_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid) DECLSPEC_HIDDEN; +HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid, + void *data, DWORD *data_size) DECLSPEC_HIDDEN; +void d3d8_resource_init(struct d3d8_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN; + struct d3d8_volume { IDirect3DVolume8 IDirect3DVolume8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_volume *wined3d_volume; IUnknown *container; IUnknown *forwardReference; @@ -200,7 +214,7 @@ struct d3d8_surface { IDirect3DSurface8 IDirect3DSurface8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_surface *wined3d_surface; IDirect3DDevice8 *parent_device; @@ -218,7 +232,7 @@ struct d3d8_vertexbuffer { IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice8 *parent_device; DWORD fvf; @@ -231,7 +245,7 @@ struct d3d8_indexbuffer { IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice8 *parent_device; enum wined3d_format_id format; @@ -244,7 +258,7 @@ struct d3d8_texture { IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface; - LONG refcount; + struct d3d8_resource resource; struct wined3d_texture *wined3d_texture; IDirect3DDevice8 *parent_device; }; diff -Nru wine1.7-1.7.13/dlls/d3d8/device.c wine1.7-1.7.16/dlls/d3d8/device.c --- wine1.7-1.7.13/dlls/d3d8/device.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/device.c 2014-04-04 19:13:44.000000000 +0000 @@ -600,7 +600,7 @@ } surface = wined3d_resource_get_parent(resource); - if (surface->refcount) + if (surface->resource.refcount) { WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); return D3DERR_DEVICELOST; diff -Nru wine1.7-1.7.13/dlls/d3d8/directx.c wine1.7-1.7.16/dlls/d3d8/directx.c --- wine1.7-1.7.13/dlls/d3d8/directx.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/directx.c 2014-04-04 19:13:44.000000000 +0000 @@ -410,7 +410,7 @@ d3d8->refcount = 1; wined3d_mutex_lock(); - d3d8->wined3d = wined3d_create(8, flags); + d3d8->wined3d = wined3d_create(flags); wined3d_mutex_unlock(); if (!d3d8->wined3d) return FALSE; diff -Nru wine1.7-1.7.13/dlls/d3d8/surface.c wine1.7-1.7.16/dlls/d3d8/surface.c --- wine1.7-1.7.13/dlls/d3d8/surface.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/surface.c 2014-04-04 19:13:44.000000000 +0000 @@ -62,7 +62,7 @@ else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedIncrement(&surface->refcount); + ULONG ref = InterlockedIncrement(&surface->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -94,7 +94,7 @@ else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedDecrement(&surface->refcount); + ULONG ref = InterlockedDecrement(&surface->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -150,52 +150,28 @@ const void *data, DWORD data_size, DWORD flags) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&surface->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_surface_GetPrivateData(IDirect3DSurface8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&surface->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_surface_FreePrivateData(IDirect3DSurface8 *iface, REFGUID guid) { struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&surface->resource, guid); } static HRESULT WINAPI d3d8_surface_GetContainer(IDirect3DSurface8 *iface, REFIID riid, void **container) @@ -325,7 +301,9 @@ static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_surface *surface = parent; + d3d8_resource_cleanup(&surface->resource); + HeapFree(GetProcessHeap(), 0, surface); } static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops = @@ -337,7 +315,7 @@ struct d3d8_device *device, const struct wined3d_parent_ops **parent_ops) { surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl; - surface->refcount = 1; + d3d8_resource_init(&surface->resource); wined3d_surface_incref(wined3d_surface); surface->wined3d_surface = wined3d_surface; surface->parent_device = &device->IDirect3DDevice8_iface; diff -Nru wine1.7-1.7.13/dlls/d3d8/tests/device.c wine1.7-1.7.16/dlls/d3d8/tests/device.c --- wine1.7-1.7.13/dlls/d3d8/tests/device.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/tests/device.c 2014-04-04 19:13:44.000000000 +0000 @@ -180,101 +180,75 @@ static void test_mipmap_levels(void) { + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; - HRESULT hr; - HWND hwnd = NULL; - - IDirect3D8 *pD3d = NULL; - IDirect3DDevice8 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - - hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - if(FAILED(hr)) + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - check_mipmap_levels(pDevice, 32, 32, 6); - check_mipmap_levels(pDevice, 256, 1, 9); - check_mipmap_levels(pDevice, 1, 256, 9); - check_mipmap_levels(pDevice, 1, 1, 1); + check_mipmap_levels(device, 32, 32, 6); + check_mipmap_levels(device, 256, 1, 9); + check_mipmap_levels(device, 1, 256, 9); + check_mipmap_levels(device, 1, 1, 1); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pDevice) - { - UINT refcount = IDirect3DDevice8_Release( pDevice ); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D8_Release( pD3d ); - DestroyWindow( hwnd ); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static void test_swapchain(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D8 *pD3d = NULL; - IDirect3DDevice8 *pDevice = NULL; - IDirect3DSwapChain8 *swapchain1 = NULL; - IDirect3DSwapChain8 *swapchain2 = NULL; - IDirect3DSwapChain8 *swapchain3 = NULL; - IDirect3DSurface8 *backbuffer = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 0; + IDirect3DSwapChain8 *swapchain1; + IDirect3DSwapChain8 *swapchain2; + IDirect3DSwapChain8 *swapchain3; + IDirect3DSurface8 *backbuffer; + D3DPRESENT_PARAMETERS d3dpp; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; - hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - if(FAILED(hr)) + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - /* Check if the back buffer count was modified */ - ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount); + memset(&d3dpp, 0, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; /* Create a bunch of swapchains */ d3dpp.BackBufferCount = 0; - hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain1); + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); ok(SUCCEEDED(hr), "Failed to create a swapchain (%#08x)\n", hr); ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount); d3dpp.BackBufferCount = 1; - hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain2); + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain2); ok(SUCCEEDED(hr), "Failed to create a swapchain (%#08x)\n", hr); d3dpp.BackBufferCount = 2; - hr = IDirect3DDevice8_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain3); + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain3); ok(SUCCEEDED(hr), "Failed to create a swapchain (%#08x)\n", hr); if(SUCCEEDED(hr)) { /* Swapchain 3, created with backbuffercount 2 */ @@ -335,26 +309,18 @@ ok(backbuffer == (void *) 0xdeadbeef, "The back buffer pointer was modified (%p)\n", backbuffer); if(backbuffer && backbuffer != (void *) 0xdeadbeef) IDirect3DSurface8_Release(backbuffer); + IDirect3DSwapChain8_Release(swapchain3); + IDirect3DSwapChain8_Release(swapchain2); + IDirect3DSwapChain8_Release(swapchain1); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if(swapchain1) IDirect3DSwapChain8_Release(swapchain1); - if(swapchain2) IDirect3DSwapChain8_Release(swapchain2); - if(swapchain3) IDirect3DSwapChain8_Release(swapchain3); - if (pDevice) - { - UINT refcount = IDirect3DDevice8_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D8_Release(pD3d); - DestroyWindow( hwnd ); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static void test_refcount(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D8 *pD3d = NULL; - IDirect3D8 *pD3d2 = NULL; - IDirect3DDevice8 *pDevice = NULL; IDirect3DVertexBuffer8 *pVertexBuffer = NULL; IDirect3DIndexBuffer8 *pIndexBuffer = NULL; DWORD dVertexShader = -1; @@ -373,10 +339,12 @@ DWORD dStateBlock = -1; IDirect3DSwapChain8 *pSwapChain = NULL; D3DCAPS8 caps; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - int refcount = 0, tmp; + IDirect3DDevice8 *device = NULL; + ULONG refcount = 0, tmp; + IDirect3D8 *d3d, *d3d2; + HWND window; + HRESULT hr; DWORD decl[] = { @@ -386,43 +354,33 @@ D3DVSD_END() }; - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - CHECK_REFCOUNT( pD3d, 1 ); + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); - IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + CHECK_REFCOUNT(d3d, 1); - hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - if(FAILED(hr)) + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - IDirect3DDevice8_GetDeviceCaps(pDevice, &caps); - refcount = get_refcount( (IUnknown *)pDevice ); + IDirect3DDevice8_GetDeviceCaps(device, &caps); + + refcount = get_refcount((IUnknown *)device); ok(refcount == 1, "Invalid device RefCount %d\n", refcount); - CHECK_REFCOUNT( pD3d, 2 ); + CHECK_REFCOUNT(d3d, 2); - hr = IDirect3DDevice8_GetDirect3D(pDevice, &pD3d2); - CHECK_CALL( hr, "GetDirect3D", pDevice, refcount ); + hr = IDirect3DDevice8_GetDirect3D(device, &d3d2); + CHECK_CALL(hr, "GetDirect3D", device, refcount); - ok(pD3d2 == pD3d, "Expected IDirect3D8 pointers to be equal\n"); - CHECK_REFCOUNT( pD3d, 3 ); - CHECK_RELEASE_REFCOUNT( pD3d, 2 ); + ok(d3d2 == d3d, "Expected IDirect3D8 pointers to be equal.\n"); + CHECK_REFCOUNT(d3d, 3); + CHECK_RELEASE_REFCOUNT(d3d, 2); /** * Check refcount of implicit surfaces. Findings: @@ -432,35 +390,35 @@ * - they are not freed if refcount reaches 0. * - the refcount is not forwarded to the container. */ - hr = IDirect3DDevice8_GetRenderTarget(pDevice, &pRenderTarget); - CHECK_CALL( hr, "GetRenderTarget", pDevice, ++refcount); + hr = IDirect3DDevice8_GetRenderTarget(device, &pRenderTarget); + CHECK_CALL(hr, "GetRenderTarget", device, ++refcount); if(pRenderTarget) { - CHECK_SURFACE_CONTAINER( pRenderTarget, IID_IDirect3DDevice8, pDevice); + CHECK_SURFACE_CONTAINER(pRenderTarget, IID_IDirect3DDevice8, device); CHECK_REFCOUNT( pRenderTarget, 1); CHECK_ADDREF_REFCOUNT(pRenderTarget, 2); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); CHECK_RELEASE_REFCOUNT(pRenderTarget, 1); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); - hr = IDirect3DDevice8_GetRenderTarget(pDevice, &pRenderTarget); - CHECK_CALL( hr, "GetRenderTarget", pDevice, refcount); + hr = IDirect3DDevice8_GetRenderTarget(device, &pRenderTarget); + CHECK_CALL(hr, "GetRenderTarget", device, refcount); CHECK_REFCOUNT( pRenderTarget, 2); CHECK_RELEASE_REFCOUNT( pRenderTarget, 1); CHECK_RELEASE_REFCOUNT( pRenderTarget, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The render target is released with the device, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pRenderTarget, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pRenderTarget, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); } /* Render target and back buffer are identical. */ - hr = IDirect3DDevice8_GetBackBuffer(pDevice, 0, 0, &pBackBuffer); - CHECK_CALL( hr, "GetBackBuffer", pDevice, ++refcount); + hr = IDirect3DDevice8_GetBackBuffer(device, 0, 0, &pBackBuffer); + CHECK_CALL(hr, "GetBackBuffer", device, ++refcount); if(pBackBuffer) { CHECK_RELEASE_REFCOUNT(pBackBuffer, 0); @@ -468,46 +426,46 @@ pRenderTarget, pBackBuffer); pBackBuffer = NULL; } - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); - hr = IDirect3DDevice8_GetDepthStencilSurface(pDevice, &pStencilSurface); - CHECK_CALL( hr, "GetDepthStencilSurface", pDevice, ++refcount); + hr = IDirect3DDevice8_GetDepthStencilSurface(device, &pStencilSurface); + CHECK_CALL(hr, "GetDepthStencilSurface", device, ++refcount); if(pStencilSurface) { - CHECK_SURFACE_CONTAINER( pStencilSurface, IID_IDirect3DDevice8, pDevice); + CHECK_SURFACE_CONTAINER(pStencilSurface, IID_IDirect3DDevice8, device); CHECK_REFCOUNT( pStencilSurface, 1); CHECK_ADDREF_REFCOUNT(pStencilSurface, 2); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); CHECK_RELEASE_REFCOUNT(pStencilSurface, 1); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); CHECK_RELEASE_REFCOUNT( pStencilSurface, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The stencil surface is released with the device, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pStencilSurface, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pStencilSurface, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pStencilSurface = NULL; } /* Buffers */ - hr = IDirect3DDevice8_CreateIndexBuffer( pDevice, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer ); - CHECK_CALL( hr, "CreateIndexBuffer", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateIndexBuffer(device, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer); + CHECK_CALL(hr, "CreateIndexBuffer", device, ++refcount); if(pIndexBuffer) { tmp = get_refcount( (IUnknown *)pIndexBuffer ); - hr = IDirect3DDevice8_SetIndices(pDevice, pIndexBuffer, 0); + hr = IDirect3DDevice8_SetIndices(device, pIndexBuffer, 0); CHECK_CALL( hr, "SetIndices", pIndexBuffer, tmp); - hr = IDirect3DDevice8_SetIndices(pDevice, NULL, 0); + hr = IDirect3DDevice8_SetIndices(device, NULL, 0); CHECK_CALL( hr, "SetIndices", pIndexBuffer, tmp); } - hr = IDirect3DDevice8_CreateVertexBuffer( pDevice, 16, 0, D3DFVF_XYZ, D3DPOOL_DEFAULT, &pVertexBuffer ); - CHECK_CALL( hr, "CreateVertexBuffer", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateVertexBuffer(device, 16, 0, D3DFVF_XYZ, D3DPOOL_DEFAULT, &pVertexBuffer); + CHECK_CALL(hr, "CreateVertexBuffer", device, ++refcount); if(pVertexBuffer) { IDirect3DVertexBuffer8 *pVBuf = (void*)~0; @@ -515,41 +473,41 @@ tmp = get_refcount( (IUnknown *)pVertexBuffer ); - hr = IDirect3DDevice8_SetStreamSource(pDevice, 0, pVertexBuffer, 3 * sizeof(float)); + hr = IDirect3DDevice8_SetStreamSource(device, 0, pVertexBuffer, 3 * sizeof(float)); CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp); - hr = IDirect3DDevice8_SetStreamSource(pDevice, 0, NULL, 0); + hr = IDirect3DDevice8_SetStreamSource(device, 0, NULL, 0); CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp); - hr = IDirect3DDevice8_GetStreamSource(pDevice, 0, &pVBuf, &stride); + hr = IDirect3DDevice8_GetStreamSource(device, 0, &pVBuf, &stride); ok(SUCCEEDED(hr), "GetStreamSource did not succeed with NULL stream!\n"); ok(pVBuf==NULL, "pVBuf not NULL (%p)!\n", pVBuf); ok(stride==3*sizeof(float), "stride not 3 floats (got %u)!\n", stride); } /* Shaders */ - hr = IDirect3DDevice8_CreateVertexShader( pDevice, decl, simple_vs, &dVertexShader, 0 ); - CHECK_CALL( hr, "CreateVertexShader", pDevice, refcount ); + hr = IDirect3DDevice8_CreateVertexShader(device, decl, simple_vs, &dVertexShader, 0); + CHECK_CALL(hr, "CreateVertexShader", device, refcount); if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 0)) { - hr = IDirect3DDevice8_CreatePixelShader( pDevice, simple_ps, &dPixelShader ); - CHECK_CALL( hr, "CreatePixelShader", pDevice, refcount ); + hr = IDirect3DDevice8_CreatePixelShader(device, simple_ps, &dPixelShader); + CHECK_CALL(hr, "CreatePixelShader", device, refcount); } /* Textures */ - hr = IDirect3DDevice8_CreateTexture( pDevice, 32, 32, 3, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pTexture ); - CHECK_CALL( hr, "CreateTexture", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateTexture(device, 32, 32, 3, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pTexture); + CHECK_CALL(hr, "CreateTexture", device, ++refcount); if (pTexture) { tmp = get_refcount( (IUnknown *)pTexture ); /* SetTexture should not increase refcounts */ - hr = IDirect3DDevice8_SetTexture(pDevice, 0, (IDirect3DBaseTexture8 *) pTexture); + hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *) pTexture); CHECK_CALL( hr, "SetTexture", pTexture, tmp); - hr = IDirect3DDevice8_SetTexture(pDevice, 0, NULL); + hr = IDirect3DDevice8_SetTexture(device, 0, NULL); CHECK_CALL( hr, "SetTexture", pTexture, tmp); /* This should not increment device refcount */ hr = IDirect3DTexture8_GetSurfaceLevel( pTexture, 1, &pTextureLevel ); - CHECK_CALL( hr, "GetSurfaceLevel", pDevice, refcount ); + CHECK_CALL(hr, "GetSurfaceLevel", device, refcount); /* But should increment texture's refcount */ CHECK_REFCOUNT( pTexture, tmp+1 ); /* Because the texture and surface refcount are identical */ @@ -566,8 +524,8 @@ } if(caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP) { - hr = IDirect3DDevice8_CreateCubeTexture( pDevice, 32, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pCubeTexture ); - CHECK_CALL( hr, "CreateCubeTexture", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateCubeTexture(device, 32, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pCubeTexture); + CHECK_CALL(hr, "CreateCubeTexture", device, ++refcount); } else { @@ -575,8 +533,9 @@ } if(caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP) { - hr = IDirect3DDevice8_CreateVolumeTexture( pDevice, 32, 32, 2, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pVolumeTexture ); - CHECK_CALL( hr, "CreateVolumeTexture", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateVolumeTexture(device, 32, 32, 2, 0, 0, + D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pVolumeTexture); + CHECK_CALL(hr, "CreateVolumeTexture", device, ++refcount); } else { @@ -589,7 +548,7 @@ /* This should not increment device refcount */ hr = IDirect3DVolumeTexture8_GetVolumeLevel(pVolumeTexture, 0, &pVolumeLevel); - CHECK_CALL( hr, "GetVolumeLevel", pDevice, refcount ); + CHECK_CALL(hr, "GetVolumeLevel", device, refcount); /* But should increment volume texture's refcount */ CHECK_REFCOUNT( pVolumeTexture, tmp+1 ); /* Because the volume texture and volume refcount are identical */ @@ -605,38 +564,48 @@ } } /* Surfaces */ - hr = IDirect3DDevice8_CreateDepthStencilSurface( pDevice, 32, 32, D3DFMT_D16, D3DMULTISAMPLE_NONE, &pStencilSurface ); - CHECK_CALL( hr, "CreateDepthStencilSurface", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateDepthStencilSurface(device, 32, 32, + D3DFMT_D16, D3DMULTISAMPLE_NONE, &pStencilSurface); + CHECK_CALL(hr, "CreateDepthStencilSurface", device, ++refcount); CHECK_REFCOUNT( pStencilSurface, 1); - hr = IDirect3DDevice8_CreateImageSurface( pDevice, 32, 32, D3DFMT_X8R8G8B8, &pImageSurface ); - CHECK_CALL( hr, "CreateImageSurface", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateImageSurface(device, 32, 32, + D3DFMT_X8R8G8B8, &pImageSurface); + CHECK_CALL(hr, "CreateImageSurface", device, ++refcount); CHECK_REFCOUNT( pImageSurface, 1); - hr = IDirect3DDevice8_CreateRenderTarget( pDevice, 32, 32, D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, TRUE, &pRenderTarget3 ); - CHECK_CALL( hr, "CreateRenderTarget", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateRenderTarget(device, 32, 32, + D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, TRUE, &pRenderTarget3); + CHECK_CALL(hr, "CreateRenderTarget", device, ++refcount); CHECK_REFCOUNT( pRenderTarget3, 1); /* Misc */ - hr = IDirect3DDevice8_CreateStateBlock( pDevice, D3DSBT_ALL, &dStateBlock ); - CHECK_CALL( hr, "CreateStateBlock", pDevice, refcount ); - hr = IDirect3DDevice8_CreateAdditionalSwapChain( pDevice, &d3dpp, &pSwapChain ); - CHECK_CALL( hr, "CreateAdditionalSwapChain", pDevice, ++refcount ); + hr = IDirect3DDevice8_CreateStateBlock(device, D3DSBT_ALL, &dStateBlock); + CHECK_CALL(hr, "CreateStateBlock", device, refcount); + + memset(&d3dpp, 0, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; + d3dpp.EnableAutoDepthStencil = TRUE; + d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &pSwapChain); + CHECK_CALL(hr, "CreateAdditionalSwapChain", device, ++refcount); if(pSwapChain) { /* check implicit back buffer */ hr = IDirect3DSwapChain8_GetBackBuffer(pSwapChain, 0, 0, &pBackBuffer); - CHECK_CALL( hr, "GetBackBuffer", pDevice, ++refcount); + CHECK_CALL(hr, "GetBackBuffer", device, ++refcount); CHECK_REFCOUNT( pSwapChain, 1); if(pBackBuffer) { - CHECK_SURFACE_CONTAINER( pBackBuffer, IID_IDirect3DDevice8, pDevice); + CHECK_SURFACE_CONTAINER(pBackBuffer, IID_IDirect3DDevice8, device); CHECK_REFCOUNT( pBackBuffer, 1); CHECK_RELEASE_REFCOUNT( pBackBuffer, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The back buffer is released with the swapchain, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pBackBuffer, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pBackBuffer, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pBackBuffer = NULL; } CHECK_REFCOUNT( pSwapChain, 1); @@ -658,57 +627,58 @@ /* The implicit render target is not freed if refcount reaches 0. * Otherwise GetRenderTarget would re-allocate it and the pointer would change.*/ - hr = IDirect3DDevice8_GetRenderTarget(pDevice, &pRenderTarget2); - CHECK_CALL( hr, "GetRenderTarget", pDevice, ++refcount); + hr = IDirect3DDevice8_GetRenderTarget(device, &pRenderTarget2); + CHECK_CALL(hr, "GetRenderTarget", device, ++refcount); if(pRenderTarget2) { CHECK_RELEASE_REFCOUNT(pRenderTarget2, 0); ok(pRenderTarget == pRenderTarget2, "RenderTarget=%p and RenderTarget2=%p should be the same.\n", pRenderTarget, pRenderTarget2); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pRenderTarget2 = NULL; } pRenderTarget = NULL; cleanup: - CHECK_RELEASE(pDevice, pDevice, --refcount); + CHECK_RELEASE(device, device, --refcount); /* Buffers */ - CHECK_RELEASE(pVertexBuffer, pDevice, --refcount); - CHECK_RELEASE(pIndexBuffer, pDevice, --refcount); + CHECK_RELEASE(pVertexBuffer, device, --refcount); + CHECK_RELEASE(pIndexBuffer, device, --refcount); /* Shaders */ - if (dVertexShader != ~0U) IDirect3DDevice8_DeleteVertexShader( pDevice, dVertexShader ); - if (dPixelShader != ~0U) IDirect3DDevice8_DeletePixelShader( pDevice, dPixelShader ); + if (dVertexShader != ~0u) + IDirect3DDevice8_DeleteVertexShader(device, dVertexShader); + if (dPixelShader != ~0u) + IDirect3DDevice8_DeletePixelShader(device, dPixelShader); /* Textures */ - CHECK_RELEASE(pTexture, pDevice, --refcount); - CHECK_RELEASE(pCubeTexture, pDevice, --refcount); - CHECK_RELEASE(pVolumeTexture, pDevice, --refcount); + CHECK_RELEASE(pTexture, device, --refcount); + CHECK_RELEASE(pCubeTexture, device, --refcount); + CHECK_RELEASE(pVolumeTexture, device, --refcount); /* Surfaces */ - CHECK_RELEASE(pStencilSurface, pDevice, --refcount); - CHECK_RELEASE(pImageSurface, pDevice, --refcount); - CHECK_RELEASE(pRenderTarget3, pDevice, --refcount); + CHECK_RELEASE(pStencilSurface, device, --refcount); + CHECK_RELEASE(pImageSurface, device, --refcount); + CHECK_RELEASE(pRenderTarget3, device, --refcount); /* Misc */ - if (dStateBlock != ~0U) IDirect3DDevice8_DeleteStateBlock( pDevice, dStateBlock ); + if (dStateBlock != ~0u) + IDirect3DDevice8_DeleteStateBlock(device, dStateBlock); /* This will destroy device - cannot check the refcount here */ - if (pSwapChain) CHECK_RELEASE_REFCOUNT( pSwapChain, 0); - - if (pD3d) CHECK_RELEASE_REFCOUNT( pD3d, 0); - - DestroyWindow( hwnd ); + if (pSwapChain) + CHECK_RELEASE_REFCOUNT(pSwapChain, 0); + CHECK_RELEASE_REFCOUNT(d3d, 0); + DestroyWindow(window); } static void test_cursor(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D8 *pD3d = NULL; - IDirect3DDevice8 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - CURSORINFO info; + HMODULE user32_handle = GetModuleHandleA("user32.dll"); IDirect3DSurface8 *cursor = NULL; + IDirect3DDevice8 *device; + CURSORINFO info; + IDirect3D8 *d3d; + ULONG refcount; HCURSOR cur; - HMODULE user32_handle = GetModuleHandleA("user32.dll"); + HWND window; + HRESULT hr; pGetCursorInfo = (void *)GetProcAddress(user32_handle, "GetCursorInfo"); if (!pGetCursorInfo) @@ -722,43 +692,33 @@ ok(pGetCursorInfo(&info), "GetCursorInfo failed\n"); cur = info.hCursor; - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - - hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - if(FAILED(hr)) + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - IDirect3DDevice8_CreateImageSurface(pDevice, 32, 32, D3DFMT_A8R8G8B8, &cursor); - ok(cursor != NULL, "IDirect3DDevice8_CreateOffscreenPlainSurface failed with %#08x\n", hr); + hr = IDirect3DDevice8_CreateImageSurface(device, 32, 32, D3DFMT_A8R8G8B8, &cursor); + ok(SUCCEEDED(hr), "Failed to create cursor surface, hr %#x.\n", hr); /* Initially hidden */ - hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice8_ShowCursor(device, TRUE); ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr); /* Not enabled without a surface*/ - hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice8_ShowCursor(device, TRUE); ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr); /* Fails */ - hr = IDirect3DDevice8_SetCursorProperties(pDevice, 0, 0, NULL); + hr = IDirect3DDevice8_SetCursorProperties(device, 0, 0, NULL); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_SetCursorProperties returned %#08x\n", hr); - hr = IDirect3DDevice8_SetCursorProperties(pDevice, 0, 0, cursor); + hr = IDirect3DDevice8_SetCursorProperties(device, 0, 0, cursor); ok(hr == D3D_OK, "IDirect3DDevice8_SetCursorProperties returned %#08x\n", hr); IDirect3DSurface8_Release(cursor); @@ -770,11 +730,11 @@ ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */ /* Still hidden */ - hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice8_ShowCursor(device, TRUE); ok(hr == FALSE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr); /* Enabled now*/ - hr = IDirect3DDevice8_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice8_ShowCursor(device, TRUE); ok(hr == TRUE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr); /* GDI cursor unchanged */ @@ -784,14 +744,11 @@ ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags); ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */ + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pDevice) - { - UINT refcount = IDirect3DDevice8_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D8_Release(pD3d); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static const POINT *expect_pos; @@ -840,18 +797,14 @@ {0, 0}, }; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping cursor tests.\n"); - return; - } - wc.lpfnWndProc = test_cursor_proc; wc.lpszClassName = "d3d8_test_cursor_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); window = CreateWindowA("d3d8_test_cursor_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 320, 240, NULL, NULL, NULL, NULL); ShowWindow(window, SW_SHOW); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); device = create_device(d3d8, window, window, TRUE); if (!device) @@ -911,76 +864,62 @@ done: DestroyWindow(window); UnregisterClassA("d3d8_test_cursor_wc", GetModuleHandleA(NULL)); - if (d3d8) - IDirect3D8_Release(d3d8); + IDirect3D8_Release(d3d8); } static void test_states(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D8 *pD3d = NULL; - IDirect3DDevice8 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = screen_width; - d3dpp.BackBufferHeight = screen_height; - d3dpp.BackBufferFormat = d3ddm.Format; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; - hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - if(FAILED(hr)) + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, TRUE); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZVISIBLE, TRUE); ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, TRUE) returned %#08x\n", hr); - hr = IDirect3DDevice8_SetRenderState(pDevice, D3DRS_ZVISIBLE, FALSE); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZVISIBLE, FALSE); ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState(D3DRS_ZVISIBLE, FALSE) returned %#08x\n", hr); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pDevice) - { - UINT refcount = IDirect3DDevice8_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D8_Release(pD3d); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static void test_shader_versions(void) { - HRESULT hr; - IDirect3D8 *pD3d = NULL; - D3DCAPS8 d3dcaps; - - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - if (pD3d != NULL) { - hr = IDirect3D8_GetDeviceCaps(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3dcaps); - ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to get D3D8 caps (%#08x)\n", hr); - if (SUCCEEDED(hr)) { - ok(d3dcaps.VertexShaderVersion <= D3DVS_VERSION(1,1), "Unexpected VertexShaderVersion (%#x > %#x)\n", d3dcaps.VertexShaderVersion, D3DVS_VERSION(1,1)); - ok(d3dcaps.PixelShaderVersion <= D3DPS_VERSION(1,4), "Unexpected PixelShaderVersion (%#x > %#x)\n", d3dcaps.PixelShaderVersion, D3DPS_VERSION(1,4)); - } else { - skip("No Direct3D support\n"); - } - IDirect3D8_Release(pD3d); + IDirect3D8 *d3d; + D3DCAPS8 caps; + HRESULT hr; + + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + hr = IDirect3D8_GetDeviceCaps(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &caps); + ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to get device caps, hr %#x.\n", hr); + IDirect3D8_Release(d3d); + if (FAILED(hr)) + { + skip("No Direct3D support, skipping test.\n"); + return; } + + ok(caps.VertexShaderVersion <= D3DVS_VERSION(1,1), + "Got unexpected VertexShaderVersion %#x.\n", caps.VertexShaderVersion); + ok(caps.PixelShaderVersion <= D3DPS_VERSION(1,4), + "Got unexpected PixelShaderVersion %#x.\n", caps.PixelShaderVersion); } static void test_display_formats(void) @@ -1012,11 +951,8 @@ {"D3DFMT_UNKNOWN", D3DFMT_UNKNOWN, 0, FALSE, FALSE}, }; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create an IDirect3D8 object, skipping test.\n"); - return; - } + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); for (display = 0; display < sizeof(formats) / sizeof(*formats); ++display) { @@ -1068,20 +1004,20 @@ { UINT max_modes, i; D3DDISPLAYMODE dmode; + IDirect3D8 *d3d; HRESULT res; - IDirect3D8 *pD3d; - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - if(!pD3d) return; + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); - max_modes = IDirect3D8_GetAdapterModeCount(pD3d, D3DADAPTER_DEFAULT); + max_modes = IDirect3D8_GetAdapterModeCount(d3d, D3DADAPTER_DEFAULT); ok(max_modes > 0 || broken(max_modes == 0), /* VMware */ "GetAdapterModeCount(D3DADAPTER_DEFAULT) returned 0!\n"); - for(i=0; i= D3DPS_VERSION(1, 0)) { /* The same with a pixel shader */ - hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader); + hr = IDirect3DDevice8_CreatePixelShader(device, simple_ps, &hPixelShader); ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %#08x\n", hr); /* Msdn says that the new pixel shader is set immediately. This is wrong, apparently */ - hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); + hr = IDirect3DDevice8_GetPixelShader(device, &hTempHandle); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr); ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0); /* Assign the shader, then verify that GetPixelShader works */ - hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader); + hr = IDirect3DDevice8_SetPixelShader(device, hPixelShader); ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %#08x\n", hr); - hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); + hr = IDirect3DDevice8_GetPixelShader(device, &hTempHandle); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr); ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader); /* Verify that we can retrieve the shader function */ - hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, NULL, &data_size); + hr = IDirect3DDevice8_GetPixelShaderFunction(device, hPixelShader, NULL, &data_size); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %#08x\n", hr); ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size); data = HeapAlloc(GetProcessHeap(), 0, simple_ps_size); data_size = 1; - hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size); + hr = IDirect3DDevice8_GetPixelShaderFunction(device, hPixelShader, data, &data_size); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_GetPixelShaderFunction returned (%#08x), " "expected D3DERR_INVALIDCALL\n", hr); ok(data_size == 1, "Got data_size %u, expected 1\n", data_size); data_size = simple_ps_size; - hr = IDirect3DDevice8_GetPixelShaderFunction(pDevice, hPixelShader, data, &data_size); + hr = IDirect3DDevice8_GetPixelShaderFunction(device, hPixelShader, data, &data_size); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShaderFunction returned %#08x\n", hr); ok(data_size == simple_ps_size, "Got data_size %u, expected %u\n", data_size, simple_ps_size); ok(!memcmp(data, simple_ps, simple_ps_size), "data not equal to shader function\n"); HeapFree(GetProcessHeap(), 0, data); /* Delete the assigned shader. This is supposed to work */ - hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader); + hr = IDirect3DDevice8_DeletePixelShader(device, hPixelShader); ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr); /* The shader should be unset now */ - hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); + hr = IDirect3DDevice8_GetPixelShader(device, &hTempHandle); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr); ok(hTempHandle == 0, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, 0); /* What happens if a non-bound shader is deleted? */ - hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader); + hr = IDirect3DDevice8_CreatePixelShader(device, simple_ps, &hPixelShader); ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %#08x\n", hr); - hr = IDirect3DDevice8_CreatePixelShader(pDevice, simple_ps, &hPixelShader2); + hr = IDirect3DDevice8_CreatePixelShader(device, simple_ps, &hPixelShader2); ok(hr == D3D_OK, "IDirect3DDevice8_CreatePixelShader returned %#08x\n", hr); - hr = IDirect3DDevice8_SetPixelShader(pDevice, hPixelShader); + hr = IDirect3DDevice8_SetPixelShader(device, hPixelShader); ok(hr == D3D_OK, "IDirect3DDevice8_SetPixelShader returned %#08x\n", hr); - hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2); + hr = IDirect3DDevice8_DeletePixelShader(device, hPixelShader2); ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr); - hr = IDirect3DDevice8_GetPixelShader(pDevice, &hTempHandle); + hr = IDirect3DDevice8_GetPixelShader(device, &hTempHandle); ok(hr == D3D_OK, "IDirect3DDevice8_GetPixelShader returned %#08x\n", hr); ok(hTempHandle == hPixelShader, "Pixel Shader %d is set, expected shader %d\n", hTempHandle, hPixelShader); - hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader); + hr = IDirect3DDevice8_DeletePixelShader(device, hPixelShader); ok(hr == D3D_OK, "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr); /* Check for double delete. */ - hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader2); + hr = IDirect3DDevice8_DeletePixelShader(device, hPixelShader2); ok(hr == D3DERR_INVALIDCALL || broken(hr == D3D_OK), "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr); - hr = IDirect3DDevice8_DeletePixelShader(pDevice, hPixelShader); + hr = IDirect3DDevice8_DeletePixelShader(device, hPixelShader); ok(hr == D3DERR_INVALIDCALL || broken(hr == D3D_OK), "IDirect3DDevice8_DeletePixelShader returned %#08x\n", hr); } else @@ -1881,140 +1775,100 @@ } /* What happens if a non-bound shader is deleted? */ - hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader, 0); + hr = IDirect3DDevice8_CreateVertexShader(device, dwVertexDecl, NULL, &hVertexShader, 0); ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %#08x\n", hr); - hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, NULL, &hVertexShader2, 0); + hr = IDirect3DDevice8_CreateVertexShader(device, dwVertexDecl, NULL, &hVertexShader2, 0); ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %#08x\n", hr); - hr = IDirect3DDevice8_SetVertexShader(pDevice, hVertexShader); + hr = IDirect3DDevice8_SetVertexShader(device, hVertexShader); ok(hr == D3D_OK, "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr); - hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2); + hr = IDirect3DDevice8_DeleteVertexShader(device, hVertexShader2); ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr); - hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle); + hr = IDirect3DDevice8_GetVertexShader(device, &hTempHandle); ok(hr == D3D_OK, "IDirect3DDevice8_GetVertexShader returned %#08x\n", hr); ok(hTempHandle == hVertexShader, "Vertex Shader %d is set, expected shader %d\n", hTempHandle, hVertexShader); - hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader); + hr = IDirect3DDevice8_DeleteVertexShader(device, hVertexShader); ok(hr == D3D_OK, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr); /* Check for double delete. */ - hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader2); + hr = IDirect3DDevice8_DeleteVertexShader(device, hVertexShader2); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr); - hr = IDirect3DDevice8_DeleteVertexShader(pDevice, hVertexShader); + hr = IDirect3DDevice8_DeleteVertexShader(device, hVertexShader); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_DeleteVertexShader returned %#08x\n", hr); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pDevice) - { - UINT refcount = IDirect3DDevice8_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D8_Release(pD3d); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static void test_limits(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D8 *pD3d = NULL; - IDirect3DDevice8 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - IDirect3DTexture8 *pTexture = NULL; - int i; - - pD3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + IDirect3DTexture8 *texture; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; - hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL || broken(hr == D3DERR_NOTAVAILABLE), "IDirect3D8_CreateDevice failed with %#08x\n", hr); - if(!pDevice) + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - hr = IDirect3DDevice8_CreateTexture(pDevice, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture); + hr = IDirect3DDevice8_CreateTexture(device, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture); ok(hr == D3D_OK, "IDirect3DDevice8_CreateTexture failed with %#08x\n", hr); - if(!pTexture) goto cleanup; /* There are 8 texture stages. We should be able to access all of them */ - for(i = 0; i < 8; i++) { - hr = IDirect3DDevice8_SetTexture(pDevice, i, (IDirect3DBaseTexture8 *) pTexture); + for (i = 0; i < 8; ++i) + { + hr = IDirect3DDevice8_SetTexture(device, i, (IDirect3DBaseTexture8 *)texture); ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %#08x\n", i, hr); - hr = IDirect3DDevice8_SetTexture(pDevice, i, NULL); + hr = IDirect3DDevice8_SetTexture(device, i, NULL); ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %#08x\n", i, hr); - hr = IDirect3DDevice8_SetTextureStageState(pDevice, i, D3DTSS_COLOROP, D3DTOP_ADD); + hr = IDirect3DDevice8_SetTextureStageState(device, i, D3DTSS_COLOROP, D3DTOP_ADD); ok(hr == D3D_OK, "IDirect3DDevice8_SetTextureStageState for texture %d failed with %#08x\n", i, hr); } - /* Investigations show that accessing higher textures stage states does not return an error either. Writing - * to too high texture stages(approximately texture 40) causes memory corruption in windows, so there is no - * bounds checking but how do I test that? - */ - + /* Investigations show that accessing higher textures stage states does + * not return an error either. Writing to too high texture stages + * (approximately texture 40) causes memory corruption in windows, so + * there is no bounds checking. */ + IDirect3DTexture8_Release(texture); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if(pTexture) IDirect3DTexture8_Release(pTexture); - if (pDevice) - { - UINT refcount = IDirect3DDevice8_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D8_Release(pD3d); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static void test_lights(void) { - D3DPRESENT_PARAMETERS d3dpp; - IDirect3DDevice8 *device = NULL; + IDirect3DDevice8 *device; IDirect3D8 *d3d8; - HWND hwnd; + ULONG refcount; + HWND window; HRESULT hr; unsigned int i; BOOL enabled; D3DCAPS8 caps; - D3DDISPLAYMODE d3ddm; + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d8 || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( d3d8, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; - - hr = IDirect3D8_CreateDevice( d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL, - "IDirect3D8_CreateDevice failed with %08x\n", hr); - if(!device) + ok(!!d3d8, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d8, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } @@ -2045,24 +1899,20 @@ ok(hr == D3D_OK, "Disabling light %u failed with %08x\n", i, hr); } + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (device) - { - UINT refcount = IDirect3DDevice8_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (d3d8) IDirect3D8_Release(d3d8); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d8); + DestroyWindow(window); } static void test_render_zero_triangles(void) { - D3DPRESENT_PARAMETERS d3dpp; - IDirect3DDevice8 *device = NULL; + IDirect3DDevice8 *device; IDirect3D8 *d3d8; - HWND hwnd; + ULONG refcount; + HWND window; HRESULT hr; - D3DDISPLAYMODE d3ddm; struct nvertex { @@ -2077,30 +1927,14 @@ { 1.0f, -1.0f, 0.1f, 1.0f, 1.0f, 1.0f, 0xff0000ff}, }; + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d8 || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( d3d8, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; - - hr = IDirect3D8_CreateDevice( d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE, &d3dpp, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL, - "IDirect3D8_CreateDevice failed with %08x\n", hr); - if(!device) + ok(!!d3d8, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d8, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } @@ -2121,14 +1955,11 @@ IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (device) - { - UINT refcount = IDirect3DDevice8_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (d3d8) IDirect3D8_Release(d3d8); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d8); + DestroyWindow(window); } static void test_depth_stencil_reset(void) @@ -2142,12 +1973,11 @@ HRESULT hr; HWND hwnd; - d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d8 || !hwnd) goto cleanup; + ok(!!hwnd, "Failed to create a window.\n"); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); IDirect3D8_GetAdapterDisplayMode(d3d8, D3DADAPTER_DEFAULT, &display_mode); memset(&present_parameters, 0, sizeof(present_parameters)); @@ -2250,7 +2080,7 @@ refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); } - if (d3d8) IDirect3D8_Release(d3d8); + IDirect3D8_Release(d3d8); DestroyWindow(hwnd); } @@ -2367,11 +2197,8 @@ {0, 0}, }; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); wc.lpfnWndProc = test_proc; wc.lpszClassName = "d3d8_test_wndproc_wc"; @@ -2511,11 +2338,8 @@ DWORD res, tid; HWND tmp; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); wc.lpfnWndProc = test_proc; wc.lpszClassName = "d3d8_test_wndproc_wc"; @@ -2730,18 +2554,15 @@ D3DPRESENT_PARAMETERS present_parameters; IDirect3DDevice8 *device; D3DDISPLAYMODE d3ddm; - HWND window = NULL; IDirect3D8 *d3d8; + HWND window; HRESULT hr; WORD cw; - d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(!!d3d8, "Failed to create a d3d8 object.\n"); - if (!d3d8) return; - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); ok(!!window, "Failed to create a window.\n"); - if (!window) goto done; + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); hr = IDirect3D8_GetAdapterDisplayMode(d3d8, D3DADAPTER_DEFAULT, &d3ddm); ok(SUCCEEDED(hr), "GetAdapterDisplayMode failed, hr %#x.\n", hr); @@ -2787,45 +2608,27 @@ IDirect3DDevice8_Release(device); done: - if (window) DestroyWindow(window); - if (d3d8) IDirect3D8_Release(d3d8); + DestroyWindow(window); + IDirect3D8_Release(d3d8); #endif } static void test_ApplyStateBlock(void) { - D3DPRESENT_PARAMETERS d3dpp; - IDirect3DDevice8 *device = NULL; + IDirect3DDevice8 *device; IDirect3D8 *d3d8; - HWND hwnd; + HWND window; HRESULT hr; - D3DDISPLAYMODE d3ddm; DWORD received, token; + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d8 || !hwnd) goto cleanup; - - IDirect3D8_GetAdapterDisplayMode( d3d8, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; - - hr = IDirect3D8_CreateDevice( d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL, - "IDirect3D8_CreateDevice failed with %#x\n", hr); - if(!device) + ok(!!d3d8, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d8, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } @@ -2854,8 +2657,8 @@ IDirect3DDevice8_DeleteStateBlock(device, token); IDirect3DDevice8_Release(device); cleanup: - if (d3d8) IDirect3D8_Release(d3d8); - DestroyWindow(hwnd); + IDirect3D8_Release(d3d8); + DestroyWindow(window); } static void test_depth_stencil_size(void) @@ -2867,12 +2670,11 @@ HRESULT hr; HWND hwnd; - d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d8 != NULL, "Failed to create IDirect3D8 object\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d8 || !hwnd) goto cleanup; + ok(!!hwnd, "Failed to create a window.\n"); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); device = create_device(d3d8, hwnd, hwnd, TRUE); if (!device) goto cleanup; @@ -2919,7 +2721,7 @@ IDirect3DSurface8_Release(ds_bigger2); cleanup: - if (d3d8) IDirect3D8_Release(d3d8); + IDirect3D8_Release(d3d8); DestroyWindow(hwnd); } @@ -2934,17 +2736,12 @@ HRESULT hr; ULONG ref; - - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); device_style = GetWindowLongA(device_window, GWL_STYLE); device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE); @@ -3020,13 +2817,12 @@ static void test_wrong_shader(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D8 *d3d = NULL; - IDirect3DDevice8 *device = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; DWORD vs, ps; + HWND window; + HRESULT hr; static const DWORD vs_2_0[] = { @@ -3053,29 +2849,17 @@ D3DVSD_END() }; + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d != NULL, "Failed to create IDirect3D8 object\n"); - hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d || !hwnd) - goto cleanup; - - IDirect3D8_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &d3ddm); - ZeroMemory(&d3dpp, sizeof(d3dpp)); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - - hr = IDirect3D8_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device); - ok(hr == D3D_OK || hr == D3DERR_INVALIDCALL || broken(hr == D3DERR_NOTAVAILABLE), "IDirect3D8_CreateDevice failed with %#08x\n", hr); - if (!device) + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("could not create device, IDirect3D8_CreateDevice returned %#08x\n", hr); - goto cleanup; + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; } hr = IDirect3DDevice8_CreateVertexShader(device, decl, simple_ps, &vs, 0); @@ -3090,15 +2874,10 @@ hr = IDirect3DDevice8_CreatePixelShader(device, ps_2_0, &ps); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice8_CreatePixelShader returned %#08x\n", hr); -cleanup: - if (device) - { - UINT refcount = IDirect3DDevice8_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (d3d) - IDirect3D8_Release(d3d); - DestroyWindow(hwnd); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); } static void test_mode_change(void) @@ -3113,16 +2892,12 @@ HRESULT hr; DWORD ret; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping mode change tests.\n"); - return; - } - focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height); GetWindowRect(focus_window, &focus_rect); @@ -3180,8 +2955,7 @@ done: DestroyWindow(device_window); DestroyWindow(focus_window); - if (d3d8) - IDirect3D8_Release(d3d8); + IDirect3D8_Release(d3d8); memset(&devmode, 0, sizeof(devmode)); devmode.dmSize = sizeof(devmode); @@ -3201,12 +2975,6 @@ HRESULT hr; ULONG ref; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - wc.lpfnWndProc = test_proc; wc.lpszClassName = "d3d8_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -3215,6 +2983,8 @@ 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height); GetWindowRect(device_window, &device_rect); @@ -3280,21 +3050,19 @@ static void depth_blit_test(void) { - HWND hwnd = NULL; - IDirect3D8 *d3d8 = NULL; IDirect3DDevice8 *device = NULL; IDirect3DSurface8 *backbuffer, *ds1, *ds2, *ds3; RECT src_rect; const POINT dst_point = {0, 0}; + IDirect3D8 *d3d8; HRESULT hr; + HWND hwnd; - d3d8 = Direct3DCreate8(D3D_SDK_VERSION); - ok(d3d8 != NULL, "Direct3DCreate8 failed.\n"); hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "CreateWindow failed.\n"); - if (!d3d8 || !hwnd) - goto done; + ok(!!hwnd, "Failed to create a window.\n"); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); device = create_device(d3d8, hwnd, hwnd, TRUE); if (!device) @@ -3347,8 +3115,8 @@ done: if (device) IDirect3DDevice8_Release(device); - if (d3d8) IDirect3D8_Release(d3d8); - if (hwnd) DestroyWindow(hwnd); + IDirect3D8_Release(d3d8); + DestroyWindow(hwnd); } static void test_reset_resources(void) @@ -3363,13 +3131,8 @@ window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - DestroyWindow(window); - return; - } + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { @@ -3423,17 +3186,14 @@ HWND window; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D8_Release(d3d8); DestroyWindow(window); return; } @@ -3602,14 +3362,10 @@ HWND window; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -3704,14 +3460,10 @@ HRESULT hr; BYTE *data; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -3755,14 +3507,10 @@ HWND window; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -3848,14 +3596,10 @@ HWND window; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -3922,16 +3666,12 @@ IDirect3D8 *d3d8; ULONG refcount; HWND window; - HRESULT hr; - - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } + HRESULT hr; window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -3964,14 +3704,10 @@ HWND window; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4060,14 +3796,10 @@ BYTE *base; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4157,15 +3889,25 @@ HRESULT hr; DWORD size; DWORD data[4] = {1, 2, 3, 4}; - - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) + static const GUID d3d8_private_data_test_guid = { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } + 0xfdb37466, + 0x428f, + 0x4edf, + {0xa3,0x7f,0x9b,0x1d,0xf4,0x88,0xc5,0xfc} + }; + static const GUID d3d8_private_data_test_guid2 = + { + 0x2e5afac2, + 0x87b5, + 0x4c10, + {0x9b,0x4b,0x89,0xd7,0xd1,0x12,0xe7,0x2b} + }; window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4177,53 +3919,95 @@ hr = IDirect3DDevice8_CreateImageSurface(device, 4, 4, D3DFMT_A8R8G8B8, &surface); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8 /* Abuse this tag */, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, 0, D3DSPD_IUNKNOWN); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8 /* Abuse this tag */, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, 5, D3DSPD_IUNKNOWN); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8 /* Abuse this tag */, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, sizeof(IUnknown *) * 2, D3DSPD_IUNKNOWN); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + /* A failing SetPrivateData call does not clear the old data with the same tag. */ + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, + sizeof(device), D3DSPD_IUNKNOWN); + ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, + sizeof(device) * 2, D3DSPD_IUNKNOWN); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + size = sizeof(ptr); + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid, &ptr, &size); + ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr); + IUnknown_Release(ptr); + hr = IDirect3DSurface8_FreePrivateData(surface, &d3d8_private_data_test_guid); + ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); + refcount = get_refcount((IUnknown *)device); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8 /* Abuse this tag */, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, sizeof(IUnknown *), D3DSPD_IUNKNOWN); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); expected_refcount = refcount + 1; refcount = get_refcount((IUnknown *)device); ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); - hr = IDirect3DSurface8_FreePrivateData(surface, &IID_IDirect3DSurface8); + hr = IDirect3DSurface8_FreePrivateData(surface, &d3d8_private_data_test_guid); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); expected_refcount = refcount - 1; refcount = get_refcount((IUnknown *)device); ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, sizeof(IUnknown *), D3DSPD_IUNKNOWN); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, surface, sizeof(IUnknown *), D3DSPD_IUNKNOWN); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); refcount = get_refcount((IUnknown *)device); ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DSurface8, + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, device, sizeof(IUnknown *), D3DSPD_IUNKNOWN); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - size = sizeof(ptr); - hr = IDirect3DSurface8_GetPrivateData(surface, &IID_IDirect3DSurface8, &ptr, &size); + size = 2 * sizeof(ptr); + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid, &ptr, &size); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(device), "Got unexpected size %u.\n", size); expected_refcount = refcount + 2; refcount = get_refcount((IUnknown *)device); ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); ok(ptr == (IUnknown *)device, "Got unexpected ptr %p, expected %p.\n", ptr, device); IUnknown_Release(ptr); + expected_refcount--; + + ptr = (IUnknown *)0xdeadbeef; + size = 1; + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid, NULL, &size); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(device), "Got unexpected size %u.\n", size); + size = 2 * sizeof(ptr); + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid, NULL, &size); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(device), "Got unexpected size %u.\n", size); + refcount = get_refcount((IUnknown *)device); + ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); + size = 1; + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid, &ptr, &size); + ok(hr == D3DERR_MOREDATA, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(device), "Got unexpected size %u.\n", size); + ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid2, NULL, NULL); + ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + size = 0xdeadbabe; + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid2, &ptr, &size); + ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); + ok(size == 0xdeadbabe, "Got unexpected size %u.\n", size); + /* GetPrivateData with size = NULL causes an access violation on Windows if the + * requested data exists. */ /* Destroying the surface frees the held reference. */ IDirect3DSurface8_Release(surface); - expected_refcount = refcount - 3; + expected_refcount = refcount - 2; refcount = get_refcount((IUnknown *)device); ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); @@ -4234,26 +4018,26 @@ hr = IDirect3DTexture8_GetSurfaceLevel(texture, 1, &surface2); ok(SUCCEEDED(hr), "Failed to get texture level 1, hr %#x.\n", hr); - hr = IDirect3DTexture8_SetPrivateData(texture, &IID_IDirect3DVertexBuffer8, data, sizeof(data), 0); + hr = IDirect3DTexture8_SetPrivateData(texture, &d3d8_private_data_test_guid, data, sizeof(data), 0); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); memset(data, 0, sizeof(data)); size = sizeof(data); - hr = IDirect3DSurface8_GetPrivateData(surface, &IID_IDirect3DVertexBuffer8, data, &size); + hr = IDirect3DSurface8_GetPrivateData(surface, &d3d8_private_data_test_guid, data, &size); ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DTexture8_GetPrivateData(texture, &IID_IDirect3DVertexBuffer8, data, &size); + hr = IDirect3DTexture8_GetPrivateData(texture, &d3d8_private_data_test_guid, data, &size); ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr); ok(data[0] == 1 && data[1] == 2 && data[2] == 3 && data[3] == 4, "Got unexpected private data: %u, %u, %u, %u.\n", data[0], data[1], data[2], data[3]); - hr = IDirect3DTexture8_FreePrivateData(texture, &IID_IDirect3DVertexBuffer8); + hr = IDirect3DTexture8_FreePrivateData(texture, &d3d8_private_data_test_guid); ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); - hr = IDirect3DSurface8_SetPrivateData(surface, &IID_IDirect3DVertexBuffer8, data, sizeof(data), 0); + hr = IDirect3DSurface8_SetPrivateData(surface, &d3d8_private_data_test_guid, data, sizeof(data), 0); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); - hr = IDirect3DSurface8_GetPrivateData(surface2, &IID_IDirect3DVertexBuffer8, data, &size); + hr = IDirect3DSurface8_GetPrivateData(surface2, &d3d8_private_data_test_guid, data, &size); ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); - hr = IDirect3DSurface8_FreePrivateData(surface, &IID_IDirect3DVertexBuffer8); + hr = IDirect3DSurface8_FreePrivateData(surface, &d3d8_private_data_test_guid); ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); IDirect3DSurface8_Release(surface2); @@ -4275,14 +4059,10 @@ HWND window; HRESULT hr; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4316,11 +4096,8 @@ HWND window; HRESULT hr; - if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create D3D object, skipping tests.\n"); - return; - } + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); hr = IDirect3D8_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, D3DFMT_NULL); @@ -4413,14 +4190,10 @@ HWND window; HRESULT hr; - if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create D3D object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4556,14 +4329,10 @@ BOOL tex_pow2, cube_pow2; D3DCAPS8 caps; - if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create D3D object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4833,14 +4602,10 @@ unsigned int i; D3DCAPS8 caps; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -4902,14 +4667,10 @@ float x, y, z; } *ptr, *ptr2; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create d3d8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); present_parameters.Windowed = TRUE; present_parameters.hDeviceWindow = window; @@ -5007,14 +4768,10 @@ unsigned int i, levels; BOOL tex_pow2, cube_pow2, vol_pow2; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -5132,14 +4889,10 @@ { D3DPOOL_SCRATCH, D3DUSAGE_DYNAMIC, D3DERR_INVALIDCALL, D3D_OK }, }; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -5243,14 +4996,10 @@ { 8, 8, 4, 4, D3DFMT_A8R8G8B8, D3DFMT_X8R8G8B8 }, /* Different format */ }; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -5353,14 +5102,10 @@ IDirect3D8 *d3d8; IDirect3DSurface8 *surface; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -5467,14 +5212,10 @@ BOOL pow2; unsigned int offset, expected_offset; - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D8 object, skipping tests.\n"); - return; - } - window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d8, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -5788,14 +5529,10 @@ BYTE *base; HRESULT hr; - if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create D3D object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); if (!(device = create_device(d3d, window, window, TRUE))) { skip("Failed to create a D3D device, skipping tests.\n"); @@ -5873,6 +5610,353 @@ DestroyWindow(window); } +static void test_pixel_format(void) +{ + HWND hwnd, hwnd2 = NULL; + HDC hdc, hdc2 = NULL; + HMODULE gl = NULL; + int format, test_format; + PIXELFORMATDESCRIPTOR pfd; + IDirect3D8 *d3d8 = NULL; + IDirect3DDevice8 *device = NULL; + HRESULT hr; + static const float point[3] = {0.0, 0.0, 0.0}; + + hwnd = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + if (!hwnd) + { + skip("Failed to create window\n"); + return; + } + + hwnd2 = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + + hdc = GetDC(hwnd); + if (!hdc) + { + skip("Failed to get DC\n"); + goto cleanup; + } + + if (hwnd2) + hdc2 = GetDC(hwnd2); + + gl = LoadLibraryA("opengl32.dll"); + ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n"); + + format = GetPixelFormat(hdc); + ok(format == 0, "new window has pixel format %d\n", format); + + ZeroMemory(&pfd, sizeof(pfd)); + pfd.nSize = sizeof(pfd); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; + format = ChoosePixelFormat(hdc, &pfd); + if (format <= 0) + { + skip("no pixel format available\n"); + goto cleanup; + } + + if (!SetPixelFormat(hdc, format, &pfd) || GetPixelFormat(hdc) != format) + { + skip("failed to set pixel format\n"); + goto cleanup; + } + + if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format) + { + skip("failed to set pixel format on second window\n"); + if (hdc2) + { + ReleaseDC(hwnd2, hdc2); + hdc2 = NULL; + } + } + + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (!(device = create_device(d3d8, hwnd, hwnd, TRUE))) + { + skip("Failed to create device\n"); + goto cleanup; + } + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ); + ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed %#x\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_POINTLIST, 1, point, 3 * sizeof(float)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed %#x\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed %#x\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + hr = IDirect3DDevice8_Present(device, NULL, NULL, hwnd2, NULL); + ok(SUCCEEDED(hr), "Present failed %#x\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + +cleanup: + if (device) + { + UINT refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + } + if (d3d8) IDirect3D8_Release(d3d8); + if (gl) FreeLibrary(gl); + if (hdc) ReleaseDC(hwnd, hdc); + if (hdc2) ReleaseDC(hwnd2, hdc2); + if (hwnd) DestroyWindow(hwnd); + if (hwnd2) DestroyWindow(hwnd2); +} + +static void test_begin_end_state_block(void) +{ + IDirect3DDevice8 *device; + DWORD stateblock; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + /* Should succeed. */ + hr = IDirect3DDevice8_BeginStateBlock(device); + ok(SUCCEEDED(hr), "Failed to begin stateblock, hr %#x.\n", hr); + + /* Calling BeginStateBlock() while recording should return + * D3DERR_INVALIDCALL. */ + hr = IDirect3DDevice8_BeginStateBlock(device); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + /* Should succeed. */ + stateblock = 0xdeadbeef; + hr = IDirect3DDevice8_EndStateBlock(device, &stateblock); + ok(SUCCEEDED(hr), "Failed to end stateblock, hr %#x.\n", hr); + ok(!!stateblock && stateblock != 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock); + IDirect3DDevice8_DeleteStateBlock(device, stateblock); + + /* Calling EndStateBlock() while not recording should return + * D3DERR_INVALIDCALL. stateblock should not be touched. */ + stateblock = 0xdeadbeef; + hr = IDirect3DDevice8_EndStateBlock(device, &stateblock); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(stateblock == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + +static void test_shader_constant_apply(void) +{ + static const float vs_const[] = {1.0f, 2.0f, 3.0f, 4.0f}; + static const float ps_const[] = {5.0f, 6.0f, 7.0f, 8.0f}; + static const float initial[] = {0.0f, 0.0f, 0.0f, 0.0f}; + DWORD vs_version, ps_version; + IDirect3DDevice8 *device; + DWORD stateblock; + IDirect3D8 *d3d; + ULONG refcount; + D3DCAPS8 caps; + float ret[4]; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + vs_version = caps.VertexShaderVersion & 0xffff; + ps_version = caps.PixelShaderVersion & 0xffff; + + if (vs_version) + { + hr = IDirect3DDevice8_SetVertexShaderConstant(device, 0, initial, 1); + ok(SUCCEEDED(hr), "Failed to set vertex shader constant, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetVertexShaderConstant(device, 1, initial, 1); + ok(SUCCEEDED(hr), "Failed to set vertex shader constant, hr %#x.\n", hr); + + hr = IDirect3DDevice8_GetVertexShaderConstant(device, 0, ret, 1); + ok(SUCCEEDED(hr), "Failed to get vertex shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "Got unexpected vertex shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + hr = IDirect3DDevice8_GetVertexShaderConstant(device, 1, ret, 1); + ok(SUCCEEDED(hr), "Failed to get vertex shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "Got unexpected vertex shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + + hr = IDirect3DDevice8_SetVertexShaderConstant(device, 0, vs_const, 1); + ok(SUCCEEDED(hr), "Failed to set vertex shader constant, hr %#x.\n", hr); + } + if (ps_version) + { + hr = IDirect3DDevice8_SetPixelShaderConstant(device, 0, initial, 1); + ok(SUCCEEDED(hr), "Failed to set pixel shader constant, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetPixelShaderConstant(device, 1, initial, 1); + ok(SUCCEEDED(hr), "Failed to set pixel shader constant, hr %#x.\n", hr); + + hr = IDirect3DDevice8_GetPixelShaderConstant(device, 0, ret, 1); + ok(SUCCEEDED(hr), "Failed to get pixel shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "Got unexpected pixel shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + hr = IDirect3DDevice8_GetPixelShaderConstant(device, 1, ret, 1); + ok(SUCCEEDED(hr), "Failed to get pixel shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "Got unexpected pixel shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + + hr = IDirect3DDevice8_SetPixelShaderConstant(device, 0, ps_const, 1); + ok(SUCCEEDED(hr), "Failed to set pixel shader constant, hr %#x.\n", hr); + } + + hr = IDirect3DDevice8_BeginStateBlock(device); + ok(SUCCEEDED(hr), "Failed to begin stateblock, hr %#x.\n", hr); + + if (vs_version) + { + hr = IDirect3DDevice8_SetVertexShaderConstant(device, 1, vs_const, 1); + ok(SUCCEEDED(hr), "Failed to set vertex shader constant, hr %#x.\n", hr); + } + if (ps_version) + { + hr = IDirect3DDevice8_SetPixelShaderConstant(device, 1, ps_const, 1); + ok(SUCCEEDED(hr), "Failed to set pixel shader constant, hr %#x.\n", hr); + } + + hr = IDirect3DDevice8_EndStateBlock(device, &stateblock); + ok(SUCCEEDED(hr), "Failed to end stateblock, hr %#x.\n", hr); + + if (vs_version) + { + hr = IDirect3DDevice8_GetVertexShaderConstant(device, 0, ret, 1); + ok(SUCCEEDED(hr), "Failed to get vertex shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, vs_const, sizeof(vs_const)), + "Got unexpected vertex shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); + hr = IDirect3DDevice8_GetVertexShaderConstant(device, 1, ret, 1); + ok(SUCCEEDED(hr), "Failed to get vertex shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "Got unexpected vertex shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + } + if (ps_version) + { + hr = IDirect3DDevice8_GetPixelShaderConstant(device, 0, ret, 1); + ok(SUCCEEDED(hr), "Failed to get pixel shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, ps_const, sizeof(ps_const)), + "Got unexpected pixel shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); + hr = IDirect3DDevice8_GetPixelShaderConstant(device, 1, ret, 1); + ok(SUCCEEDED(hr), "Failed to get pixel shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "Got unexpected pixel shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + } + + /* Apply doesn't overwrite constants that aren't explicitly set on the + * source stateblock. */ + hr = IDirect3DDevice8_ApplyStateBlock(device, stateblock); + ok(SUCCEEDED(hr), "Failed to apply stateblock, hr %#x.\n", hr); + + if (vs_version) + { + hr = IDirect3DDevice8_GetVertexShaderConstant(device, 0, ret, 1); + ok(SUCCEEDED(hr), "Failed to get vertex shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, vs_const, sizeof(vs_const)), + "Got unexpected vertex shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); + hr = IDirect3DDevice8_GetVertexShaderConstant(device, 1, ret, 1); + ok(SUCCEEDED(hr), "Failed to get vertex shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, vs_const, sizeof(vs_const)), + "Got unexpected vertex shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); + } + if (ps_version) + { + hr = IDirect3DDevice8_GetPixelShaderConstant(device, 0, ret, 1); + ok(SUCCEEDED(hr), "Failed to get pixel shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, ps_const, sizeof(ps_const)), + "Got unexpected pixel shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); + hr = IDirect3DDevice8_GetPixelShaderConstant(device, 1, ret, 1); + ok(SUCCEEDED(hr), "Failed to get pixel shader constant, hr %#x.\n", hr); + ok(!memcmp(ret, ps_const, sizeof(ps_const)), + "Got unexpected pixel shader constant {%.8e, %.8e, %.8e, %.8e}, expected {%.8e, %.8e, %.8e, %.8e}.\n", + ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); + } + + IDirect3DDevice8_DeleteStateBlock(device, stateblock); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" ); @@ -5952,6 +6036,9 @@ test_create_rt_ds_fail(); test_volume_blocks(); test_lockbox_invalid(); + test_pixel_format(); + test_begin_end_state_block(); + test_shader_constant_apply(); UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); } diff -Nru wine1.7-1.7.13/dlls/d3d8/tests/Makefile.in wine1.7-1.7.16/dlls/d3d8/tests/Makefile.in --- wine1.7-1.7.13/dlls/d3d8/tests/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/tests/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -1,5 +1,5 @@ TESTDLL = d3d8.dll -IMPORTS = d3d8 user32 +IMPORTS = d3d8 user32 gdi32 C_SRCS = \ device.c \ diff -Nru wine1.7-1.7.13/dlls/d3d8/tests/stateblock.c wine1.7-1.7.16/dlls/d3d8/tests/stateblock.c --- wine1.7-1.7.13/dlls/d3d8/tests/stateblock.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/tests/stateblock.c 2014-04-04 19:13:44.000000000 +0000 @@ -23,80 +23,6 @@ static DWORD texture_stages; -static HWND create_window(void) -{ - WNDCLASSA wc = {0}; - wc.lpfnWndProc = DefWindowProcA; - wc.lpszClassName = "d3d8_test_wc"; - RegisterClassA(&wc); - - return CreateWindowA("d3d8_test_wc", "d3d8_test", 0, 0, 0, 0, 0, 0, 0, 0, 0); -} - -static IDirect3DDevice8 *init_d3d8(D3DPRESENT_PARAMETERS *present_parameters) -{ - IDirect3DDevice8 *device; - D3DDISPLAYMODE d3ddm; - IDirect3D8 *d3d8; - HWND window; - HRESULT hr; - - if (!(d3d8 = Direct3DCreate8(D3D_SDK_VERSION))) - { - skip("Failed to create D3D8 object.\n"); - return NULL; - } - - window = create_window(); - - IDirect3D8_GetAdapterDisplayMode(d3d8, D3DADAPTER_DEFAULT, &d3ddm); - memset(present_parameters, 0, sizeof(*present_parameters)); - present_parameters->Windowed = TRUE; - present_parameters->SwapEffect = D3DSWAPEFFECT_DISCARD; - present_parameters->BackBufferFormat = d3ddm.Format; - - hr = IDirect3D8_CreateDevice(d3d8, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, present_parameters, &device); - ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE || broken(hr == D3DERR_INVALIDCALL), - "IDirect3D8_CreateDevice failed, hr %#x.\n", hr); - if (SUCCEEDED(hr)) - return device; - - return NULL; -} - -static void test_begin_end_state_block(IDirect3DDevice8 *device) -{ - DWORD state_block; - HRESULT hr; - - /* Should succeed */ - hr = IDirect3DDevice8_BeginStateBlock(device); - ok(SUCCEEDED(hr), "BeginStateBlock failed, hr %#x.\n", hr); - if (FAILED(hr)) return; - - /* Calling BeginStateBlock while recording should return D3DERR_INVALIDCALL */ - hr = IDirect3DDevice8_BeginStateBlock(device); - ok(hr == D3DERR_INVALIDCALL, "BeginStateBlock returned %#x, expected %#x.\n", hr, D3DERR_INVALIDCALL); - if (hr != D3DERR_INVALIDCALL) return; - - /* Should succeed */ - state_block = 0xdeadbeef; - hr = IDirect3DDevice8_EndStateBlock(device, &state_block); - ok(SUCCEEDED(hr) && state_block && state_block != 0xdeadbeef, - "EndStateBlock returned: hr %#x, state_block %#x. " - "Expected hr %#x, state_block != 0, state_block != 0xdeadbeef.\n", hr, state_block, D3D_OK); - IDirect3DDevice8_DeleteStateBlock(device, state_block); - - /* Calling EndStateBlock while not recording should return D3DERR_INVALIDCALL. - * state_block should not be touched. */ - state_block = 0xdeadbeef; - hr = IDirect3DDevice8_EndStateBlock(device, &state_block); - ok(hr == D3DERR_INVALIDCALL && state_block == 0xdeadbeef, - "EndStateBlock returned: hr %#x, state_block %#x. " - "Expected hr %#x, state_block 0xdeadbeef.\n", hr, state_block, D3DERR_INVALIDCALL); -} - /* ============================ State Testing Framework ========================== */ struct state_test @@ -1846,9 +1772,19 @@ /* =================== Main state tests function =============================== */ -static void test_state_management(IDirect3DDevice8 *device, D3DPRESENT_PARAMETERS *device_pparams) +static void test_state_management(void) { + struct shader_constant_arg pshader_constant_arg; + struct shader_constant_arg vshader_constant_arg; + struct resource_test_arg resource_test_arg; + struct render_state_arg render_state_arg; + D3DPRESENT_PARAMETERS present_parameters; + struct light_arg light_arg; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; D3DCAPS8 caps; + HWND window; HRESULT hr; /* Test count: 2 for shader constants @@ -1860,15 +1796,30 @@ struct state_test tests[6]; unsigned int tcount = 0; - struct shader_constant_arg pshader_constant_arg; - struct shader_constant_arg vshader_constant_arg; - struct resource_test_arg resource_test_arg; - struct render_state_arg render_state_arg; - struct light_arg light_arg; + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + if (!(d3d = Direct3DCreate8(D3D_SDK_VERSION))) + { + skip("Failed to create a D3D object, skipping tests.\n"); + DestroyWindow(window); + return; + } + memset(&present_parameters, 0, sizeof(present_parameters)); + present_parameters.Windowed = TRUE; + present_parameters.hDeviceWindow = window; + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; + if (FAILED(IDirect3D8_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, + D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device))) + { + skip("Failed to create a 3D device, skipping test.\n"); + IDirect3D8_Release(d3d); + DestroyWindow(window); + return; + } hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); - ok(SUCCEEDED(hr), "GetDeviceCaps returned %#x.\n", hr); - if (FAILED(hr)) return; + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); texture_stages = caps.MaxTextureBlendStages; @@ -1894,7 +1845,7 @@ transform_queue_test(&tests[tcount++]); - render_state_arg.device_pparams = device_pparams; + render_state_arg.device_pparams = &present_parameters; render_state_arg.pointsize_max = caps.MaxPointSize; render_states_queue_test(&tests[tcount++], &render_state_arg); @@ -1905,158 +1856,14 @@ resource_test_queue(&tests[tcount++], &resource_test_arg); execute_test_chain_all(device, tests, tcount); -} - -static void test_shader_constant_apply(IDirect3DDevice8 *device) -{ - static const float initial[] = {0.0f, 0.0f, 0.0f, 0.0f}; - static const float vs_const[] = {1.0f, 2.0f, 3.0f, 4.0f}; - static const float ps_const[] = {5.0f, 6.0f, 7.0f, 8.0f}; - DWORD vs_version, ps_version; - DWORD stateblock; - D3DCAPS8 caps; - float ret[4]; - HRESULT hr; - - hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); - ok(SUCCEEDED(hr), "GetDeviceCaps returned %#x.\n", hr); - vs_version = caps.VertexShaderVersion & 0xffff; - ps_version = caps.PixelShaderVersion & 0xffff; - if (vs_version) - { - hr = IDirect3DDevice8_SetVertexShaderConstant(device, 0, initial, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstant returned %#x.\n", hr); - hr = IDirect3DDevice8_SetVertexShaderConstant(device, 1, initial, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstant returned %#x.\n", hr); - - hr = IDirect3DDevice8_GetVertexShaderConstant(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetVertexShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - hr = IDirect3DDevice8_GetVertexShaderConstant(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstant returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetVertexShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - - hr = IDirect3DDevice8_SetVertexShaderConstant(device, 0, vs_const, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstant returned %#x.\n", hr); - } - if (ps_version) - { - hr = IDirect3DDevice8_SetPixelShaderConstant(device, 0, initial, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstant returned %#x.\n", hr); - hr = IDirect3DDevice8_SetPixelShaderConstant(device, 1, initial, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstant returned %#x.\n", hr); - - hr = IDirect3DDevice8_GetPixelShaderConstant(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetpixelShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - hr = IDirect3DDevice8_GetPixelShaderConstant(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetPixelShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - - hr = IDirect3DDevice8_SetPixelShaderConstant(device, 0, ps_const, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstant returned %#x.\n", hr); - } - - hr = IDirect3DDevice8_BeginStateBlock(device); - ok(SUCCEEDED(hr), "BeginStateBlock returned %#x\n", hr); - - if (vs_version) - { - hr = IDirect3DDevice8_SetVertexShaderConstant(device, 1, vs_const, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstant returned %#x.\n", hr); - } - if (ps_version) - { - hr = IDirect3DDevice8_SetPixelShaderConstant(device, 1, ps_const, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstant returned %#x.\n", hr); - } - - hr = IDirect3DDevice8_EndStateBlock(device, &stateblock); - ok(SUCCEEDED(hr), "EndStateBlock returned %#x\n", hr); - - if (vs_version) - { - hr = IDirect3DDevice8_GetVertexShaderConstant(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, vs_const, sizeof(vs_const)), - "GetVertexShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); - hr = IDirect3DDevice8_GetVertexShaderConstant(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetVertexShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - } - if (ps_version) - { - hr = IDirect3DDevice8_GetPixelShaderConstant(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, ps_const, sizeof(ps_const)), - "GetPixelShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); - hr = IDirect3DDevice8_GetPixelShaderConstant(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetPixelShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - } - - /* Apply doesn't overwrite constants that aren't explicitly set on the source stateblock. */ - hr = IDirect3DDevice8_ApplyStateBlock(device, stateblock); - ok(SUCCEEDED(hr), "Apply returned %#x\n", hr); - - if (vs_version) - { - hr = IDirect3DDevice8_GetVertexShaderConstant(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, vs_const, sizeof(vs_const)), - "GetVertexShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); - hr = IDirect3DDevice8_GetVertexShaderConstant(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, vs_const, sizeof(vs_const)), - "GetVertexShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); - } - if (ps_version) - { - hr = IDirect3DDevice8_GetPixelShaderConstant(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, ps_const, sizeof(ps_const)), - "GetPixelShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); - hr = IDirect3DDevice8_GetPixelShaderConstant(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstant returned %#x.\n", hr); - ok(!memcmp(ret, ps_const, sizeof(ps_const)), - "GetPixelShaderConstant got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); - } - - IDirect3DDevice8_DeleteStateBlock(device, stateblock); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); } START_TEST(stateblock) { - D3DPRESENT_PARAMETERS device_pparams; - IDirect3DDevice8 *device; - ULONG refcount; - - if (!(device = init_d3d8(&device_pparams))) - return; - - test_begin_end_state_block(device); - test_state_management(device, &device_pparams); - test_shader_constant_apply(device); - - refcount = IDirect3DDevice8_Release(device); - ok(!refcount, "Device has %u references left\n", refcount); + test_state_management(); } diff -Nru wine1.7-1.7.13/dlls/d3d8/texture.c wine1.7-1.7.16/dlls/d3d8/texture.c --- wine1.7-1.7.13/dlls/d3d8/texture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/texture.c 2014-04-04 19:13:44.000000000 +0000 @@ -59,7 +59,7 @@ static ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -77,7 +77,7 @@ static ULONG WINAPI d3d8_texture_2d_Release(IDirect3DTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -113,52 +113,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_texture_2d_GetPrivateData(IDirect3DTexture8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_texture_2d_FreePrivateData(IDirect3DTexture8 *iface, REFGUID guid) { struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d8_texture_2d_SetPriority(IDirect3DTexture8 *iface, DWORD priority) @@ -427,7 +403,7 @@ static ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -445,7 +421,7 @@ static ULONG WINAPI d3d8_texture_cube_Release(IDirect3DCubeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -483,52 +459,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_texture_cube_GetPrivateData(IDirect3DCubeTexture8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_texture_cube_FreePrivateData(IDirect3DCubeTexture8 *iface, REFGUID guid) { struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d8_texture_cube_SetPriority(IDirect3DCubeTexture8 *iface, DWORD priority) @@ -820,7 +772,7 @@ static ULONG WINAPI d3d8_texture_3d_AddRef(IDirect3DVolumeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -838,7 +790,7 @@ static ULONG WINAPI d3d8_texture_3d_Release(IDirect3DVolumeTexture8 *iface) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -874,52 +826,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d8_texture_3d_GetPrivateData(IDirect3DVolumeTexture8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_texture_3d_FreePrivateData(IDirect3DVolumeTexture8 *iface, REFGUID guid) { struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d8_texture_3d_SetPriority(IDirect3DVolumeTexture8 *iface, DWORD priority) @@ -1174,7 +1102,9 @@ static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_texture *texture = parent; + d3d8_resource_cleanup(&texture->resource); + HeapFree(GetProcessHeap(), 0, texture); } static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops = @@ -1190,7 +1120,7 @@ HRESULT hr; texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl; - texture->refcount = 1; + d3d8_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1231,7 +1161,7 @@ HRESULT hr; texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl; - texture->refcount = 1; + d3d8_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1271,7 +1201,7 @@ HRESULT hr; texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl; - texture->refcount = 1; + d3d8_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); diff -Nru wine1.7-1.7.13/dlls/d3d8/volume.c wine1.7-1.7.16/dlls/d3d8/volume.c --- wine1.7-1.7.13/dlls/d3d8/volume.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d8/volume.c 2014-04-04 19:13:44.000000000 +0000 @@ -61,7 +61,7 @@ else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedIncrement(&volume->refcount); + ULONG ref = InterlockedIncrement(&volume->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -91,7 +91,7 @@ else { /* No container, handle our own refcounting */ - ULONG ref = InterlockedDecrement(&volume->refcount); + ULONG ref = InterlockedDecrement(&volume->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -130,52 +130,28 @@ const void *data, DWORD data_size, DWORD flags) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_set_private_data(&volume->resource, guid, data, data_size, flags); } -static HRESULT WINAPI d3d8_volume_GetPrivateData(IDirect3DVolume8 *iface, REFGUID guid, +static HRESULT WINAPI d3d8_volume_GetPrivateData(IDirect3DVolume8 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_get_private_data(&volume->resource, guid, data, data_size); } static HRESULT WINAPI d3d8_volume_FreePrivateData(IDirect3DVolume8 *iface, REFGUID guid) { struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d8_resource_free_private_data(&volume->resource, guid); } static HRESULT WINAPI d3d8_volume_GetContainer(IDirect3DVolume8 *iface, REFIID riid, void **container) @@ -275,7 +251,9 @@ static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d8_volume *volume = parent; + d3d8_resource_cleanup(&volume->resource); + HeapFree(GetProcessHeap(), 0, volume); } static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops = @@ -287,7 +265,7 @@ const struct wined3d_parent_ops **parent_ops) { volume->IDirect3DVolume8_iface.lpVtbl = &d3d8_volume_vtbl; - volume->refcount = 1; + d3d8_resource_init(&volume->resource); wined3d_volume_incref(wined3d_volume); volume->wined3d_volume = wined3d_volume; diff -Nru wine1.7-1.7.13/dlls/d3d9/buffer.c wine1.7-1.7.16/dlls/d3d9/buffer.c --- wine1.7-1.7.13/dlls/d3d9/buffer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/buffer.c 2014-04-04 19:13:44.000000000 +0000 @@ -50,7 +50,7 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -68,7 +68,7 @@ static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -105,52 +105,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid) { struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, DWORD priority) @@ -275,7 +251,9 @@ static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_vertexbuffer *buffer = parent; + d3d9_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops = @@ -289,8 +267,8 @@ HRESULT hr; buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl; - buffer->refcount = 1; buffer->fvf = fvf; + d3d9_resource_init(&buffer->resource); wined3d_mutex_lock(); hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, @@ -344,7 +322,7 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - ULONG refcount = InterlockedIncrement(&buffer->refcount); + ULONG refcount = InterlockedIncrement(&buffer->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -362,7 +340,7 @@ static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - ULONG refcount = InterlockedDecrement(&buffer->refcount); + ULONG refcount = InterlockedDecrement(&buffer->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -399,52 +377,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid) { struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_buffer_get_resource(buffer->wined3d_buffer); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&buffer->resource, guid); } static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, DWORD priority) @@ -567,7 +521,9 @@ static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_indexbuffer *buffer = parent; + d3d9_resource_cleanup(&buffer->resource); + HeapFree(GetProcessHeap(), 0, buffer); } static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops = @@ -581,8 +537,8 @@ HRESULT hr; buffer->IDirect3DIndexBuffer9_iface.lpVtbl = &d3d9_indexbuffer_vtbl; - buffer->refcount = 1; buffer->format = wined3dformat_from_d3dformat(format); + d3d9_resource_init(&buffer->resource); wined3d_mutex_lock(); hr = wined3d_buffer_create_ib(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, diff -Nru wine1.7-1.7.13/dlls/d3d9/d3d9_main.c wine1.7-1.7.16/dlls/d3d9/d3d9_main.c --- wine1.7-1.7.13/dlls/d3d9/d3d9_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/d3d9_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -162,3 +162,81 @@ { FIXME("color 0x%08x, name %s stub!\n", color, debugstr_w(name)); } + +void d3d9_resource_cleanup(struct d3d9_resource *resource) +{ + wined3d_private_store_cleanup(&resource->private_store); +} + +HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid) +{ + struct wined3d_private_data *entry; + + wined3d_mutex_lock(); + entry = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!entry) + { + wined3d_mutex_unlock(); + return D3DERR_NOTFOUND; + } + + wined3d_private_store_free_private_data(&resource->private_store, entry); + wined3d_mutex_unlock(); + + return D3D_OK; +} + +HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, + void *data, DWORD *data_size) +{ + const struct wined3d_private_data *stored_data; + DWORD size_in; + HRESULT hr; + + wined3d_mutex_lock(); + stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid); + if (!stored_data) + { + hr = D3DERR_NOTFOUND; + goto done; + } + + size_in = *data_size; + *data_size = stored_data->size; + if (!data) + { + hr = D3D_OK; + goto done; + } + if (size_in < stored_data->size) + { + hr = D3DERR_MOREDATA; + goto done; + } + + if (stored_data->flags & WINED3DSPD_IUNKNOWN) + IUnknown_AddRef(stored_data->content.object); + memcpy(data, stored_data->content.data, stored_data->size); + hr = D3D_OK; + +done: + wined3d_mutex_unlock(); + return hr; +} + +void d3d9_resource_init(struct d3d9_resource *resource) +{ + resource->refcount = 1; + wined3d_private_store_init(&resource->private_store); +} + +HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) +{ + HRESULT hr; + + wined3d_mutex_lock(); + hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags); + wined3d_mutex_unlock(); + return hr; +} diff -Nru wine1.7-1.7.13/dlls/d3d9/d3d9_private.h wine1.7-1.7.16/dlls/d3d9/d3d9_private.h --- wine1.7-1.7.13/dlls/d3d9/d3d9_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/d3d9_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -166,10 +166,24 @@ UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN; +struct d3d9_resource +{ + LONG refcount; + struct wined3d_private_store private_store; +}; + +void d3d9_resource_cleanup(struct d3d9_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid) DECLSPEC_HIDDEN; +HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid, + void *data, DWORD *data_size) DECLSPEC_HIDDEN; +void d3d9_resource_init(struct d3d9_resource *resource) DECLSPEC_HIDDEN; +HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid, + const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN; + struct d3d9_volume { IDirect3DVolume9 IDirect3DVolume9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_volume *wined3d_volume; IUnknown *container; IUnknown *forwardReference; @@ -192,7 +206,7 @@ struct d3d9_surface { IDirect3DSurface9 IDirect3DSurface9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_surface *wined3d_surface; IDirect3DDevice9Ex *parent_device; IUnknown *container; @@ -207,7 +221,7 @@ struct d3d9_vertexbuffer { IDirect3DVertexBuffer9 IDirect3DVertexBuffer9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice9Ex *parent_device; DWORD fvf; @@ -220,7 +234,7 @@ struct d3d9_indexbuffer { IDirect3DIndexBuffer9 IDirect3DIndexBuffer9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_buffer *wined3d_buffer; IDirect3DDevice9Ex *parent_device; enum wined3d_format_id format; @@ -233,7 +247,7 @@ struct d3d9_texture { IDirect3DBaseTexture9 IDirect3DBaseTexture9_iface; - LONG refcount; + struct d3d9_resource resource; struct wined3d_texture *wined3d_texture; IDirect3DDevice9Ex *parent_device; }; diff -Nru wine1.7-1.7.13/dlls/d3d9/device.c wine1.7-1.7.16/dlls/d3d9/device.c --- wine1.7-1.7.13/dlls/d3d9/device.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/device.c 2014-04-04 19:13:44.000000000 +0000 @@ -581,7 +581,7 @@ } surface = wined3d_resource_get_parent(resource); - if (surface->refcount) + if (surface->resource.refcount) { WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); return D3DERR_INVALIDCALL; @@ -3066,7 +3066,7 @@ return E_NOTIMPL; } -static HRESULT WINAPI d3d9_device_PresentEx(IDirect3DDevice9Ex *iface, +static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_PresentEx(IDirect3DDevice9Ex *iface, const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region, DWORD flags) { @@ -3185,7 +3185,7 @@ return E_NOTIMPL; } -static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, +static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_ResetEx(IDirect3DDevice9Ex *iface, D3DPRESENT_PARAMETERS *present_parameters, D3DDISPLAYMODEEX *mode) { struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); diff -Nru wine1.7-1.7.13/dlls/d3d9/directx.c wine1.7-1.7.16/dlls/d3d9/directx.c --- wine1.7-1.7.13/dlls/d3d9/directx.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/directx.c 2014-04-04 19:13:44.000000000 +0000 @@ -644,7 +644,7 @@ d3d9->refcount = 1; wined3d_mutex_lock(); - d3d9->wined3d = wined3d_create(9, flags); + d3d9->wined3d = wined3d_create(flags); wined3d_mutex_unlock(); if (!d3d9->wined3d) return FALSE; diff -Nru wine1.7-1.7.13/dlls/d3d9/surface.c wine1.7-1.7.16/dlls/d3d9/surface.c --- wine1.7-1.7.13/dlls/d3d9/surface.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/surface.c 2014-04-04 19:13:44.000000000 +0000 @@ -61,7 +61,7 @@ return IUnknown_AddRef(surface->forwardReference); } - refcount = InterlockedIncrement(&surface->refcount); + refcount = InterlockedIncrement(&surface->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); if (refcount == 1) @@ -89,7 +89,7 @@ return IUnknown_Release(surface->forwardReference); } - refcount = InterlockedDecrement(&surface->refcount); + refcount = InterlockedDecrement(&surface->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) @@ -143,52 +143,28 @@ const void *data, DWORD data_size, DWORD flags) { struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&surface->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_surface_GetPrivateData(IDirect3DSurface9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&surface->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_surface_FreePrivateData(IDirect3DSurface9 *iface, REFGUID guid) { struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&surface->resource, guid); } static DWORD WINAPI d3d9_surface_SetPriority(IDirect3DSurface9 *iface, DWORD priority) @@ -385,7 +361,9 @@ static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_surface *surface = parent; + d3d9_resource_cleanup(&surface->resource); + HeapFree(GetProcessHeap(), 0, surface); } static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops = @@ -399,7 +377,7 @@ struct wined3d_resource_desc desc; surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl; - surface->refcount = 1; + d3d9_resource_init(&surface->resource); wined3d_resource_get_desc(wined3d_surface_get_resource(wined3d_surface), &desc); switch (d3dformat_from_wined3dformat(desc.format)) diff -Nru wine1.7-1.7.13/dlls/d3d9/tests/device.c wine1.7-1.7.16/dlls/d3d9/tests/device.c --- wine1.7-1.7.13/dlls/d3d9/tests/device.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/tests/device.c 2014-04-04 19:13:44.000000000 +0000 @@ -182,153 +182,113 @@ static void test_mipmap_levels(void) { + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; - HRESULT hr; - HWND hwnd = NULL; - - IDirect3D9 *pD3d = NULL; - IDirect3DDevice9 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to create IDirect3D9Device (%08x)\n", hr); - if (FAILED(hr)) { - skip("failed to create a d3d device\n"); + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - check_mipmap_levels(pDevice, 32, 32, 6); - check_mipmap_levels(pDevice, 256, 1, 9); - check_mipmap_levels(pDevice, 1, 256, 9); - check_mipmap_levels(pDevice, 1, 1, 1); + check_mipmap_levels(device, 32, 32, 6); + check_mipmap_levels(device, 256, 1, 9); + check_mipmap_levels(device, 1, 256, 9); + check_mipmap_levels(device, 1, 1, 1); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pDevice) - { - UINT refcount = IDirect3DDevice9_Release( pDevice ); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D9_Release( pD3d ); - DestroyWindow( hwnd ); + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void test_checkdevicemultisampletype(void) { + IDirect3DDevice9 *device; + DWORD quality_levels; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; - HRESULT hr; - HWND hwnd = NULL; - - IDirect3D9 *pD3d = NULL; - IDirect3DDevice9 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - DWORD qualityLevels; - - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "Failed to create IDirect3D9Device (%08x)\n", hr); - if (FAILED(hr)) { - skip("failed to create a d3d device\n"); + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - qualityLevels = 0; - - hr = IDirect3D9_CheckDeviceMultiSampleType(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, TRUE, - D3DMULTISAMPLE_NONE, &qualityLevels); + quality_levels = 0; + hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONE, &quality_levels); ok(SUCCEEDED(hr) || hr == D3DERR_NOTAVAILABLE, "CheckDeviceMultiSampleType failed with (%08x)\n", hr); - if(hr == D3DERR_NOTAVAILABLE) + if (hr == D3DERR_NOTAVAILABLE) { skip("IDirect3D9_CheckDeviceMultiSampleType not available\n"); goto cleanup; } - ok(qualityLevels == 1,"qualitylevel is not 1 but %d\n",qualityLevels); + ok(quality_levels == 1, "Got unexpected quality_levels %u.\n", quality_levels); - hr = IDirect3D9_CheckDeviceMultiSampleType(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, FALSE, - D3DMULTISAMPLE_NONE, &qualityLevels); + hr = IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, FALSE, D3DMULTISAMPLE_NONE, &quality_levels); ok(SUCCEEDED(hr), "CheckDeviceMultiSampleType failed with (%08x)\n", hr); - ok(qualityLevels == 1,"qualitylevel is not 1 but %d\n",qualityLevels); + ok(quality_levels == 1, "Got unexpected quality_levels %u.\n", quality_levels); cleanup: - if (pDevice) + if (device) { - UINT refcount = IDirect3DDevice9_Release( pDevice ); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); } - if (pD3d) IDirect3D9_Release( pD3d ); - DestroyWindow( hwnd ); + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void test_swapchain(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D9 *pD3d = NULL; - IDirect3DDevice9 *pDevice = NULL; - IDirect3DSwapChain9 *swapchain0 = NULL; - IDirect3DSwapChain9 *swapchain1 = NULL; - IDirect3DSwapChain9 *swapchain2 = NULL; - IDirect3DSwapChain9 *swapchain3 = NULL; - IDirect3DSwapChain9 *swapchainX = NULL; - IDirect3DSurface9 *backbuffer = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.BackBufferCount = 0; - - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == S_OK || hr == D3DERR_NOTAVAILABLE, - "Failed to create IDirect3D9Device (%08x)\n", hr); - if (FAILED(hr)) goto cleanup; + IDirect3DSwapChain9 *swapchain0; + IDirect3DSwapChain9 *swapchain1; + IDirect3DSwapChain9 *swapchain2; + IDirect3DSwapChain9 *swapchain3; + IDirect3DSwapChain9 *swapchainX; + IDirect3DSurface9 *backbuffer; + D3DPRESENT_PARAMETERS d3dpp; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; - /* Check if the back buffer count was modified */ - ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount); + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a 3D device, skipping test.\n"); + goto cleanup; + } /* Get the implicit swapchain */ - hr = IDirect3DDevice9_GetSwapChain(pDevice, 0, &swapchain0); + hr = IDirect3DDevice9_GetSwapChain(device, 0, &swapchain0); ok(SUCCEEDED(hr), "Failed to get the implicit swapchain (%08x)\n", hr); - if(swapchain0) IDirect3DSwapChain9_Release(swapchain0); + /* Check if the back buffer count was modified */ + hr = IDirect3DSwapChain9_GetPresentParameters(swapchain0, &d3dpp); + ok(d3dpp.BackBufferCount == 1, "Got unexpected back buffer count %u.\n", d3dpp.BackBufferCount); + IDirect3DSwapChain9_Release(swapchain0); /* Check if there is a back buffer */ hr = IDirect3DSwapChain9_GetBackBuffer(swapchain0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); @@ -337,23 +297,23 @@ if(backbuffer) IDirect3DSurface9_Release(backbuffer); /* Try to get a nonexistent swapchain */ - hr = IDirect3DDevice9_GetSwapChain(pDevice, 1, &swapchainX); + hr = IDirect3DDevice9_GetSwapChain(device, 1, &swapchainX); ok(hr == D3DERR_INVALIDCALL, "GetSwapChain on an nonexistent swapchain returned (%08x)\n", hr); ok(swapchainX == NULL, "Swapchain 1 is %p\n", swapchainX); if(swapchainX) IDirect3DSwapChain9_Release(swapchainX); /* Create a bunch of swapchains */ d3dpp.BackBufferCount = 0; - hr = IDirect3DDevice9_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain1); + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); ok(SUCCEEDED(hr), "Failed to create a swapchain (%08x)\n", hr); ok(d3dpp.BackBufferCount == 1, "The back buffer count in the presentparams struct is %d\n", d3dpp.BackBufferCount); d3dpp.BackBufferCount = 1; - hr = IDirect3DDevice9_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain2); + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain2); ok(SUCCEEDED(hr), "Failed to create a swapchain (%08x)\n", hr); d3dpp.BackBufferCount = 2; - hr = IDirect3DDevice9_CreateAdditionalSwapChain(pDevice, &d3dpp, &swapchain3); + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain3); ok(SUCCEEDED(hr), "Failed to create a swapchain (%08x)\n", hr); if(SUCCEEDED(hr)) { /* Swapchain 3, created with backbuffercount 2 */ @@ -418,31 +378,23 @@ * it should fail, apparently GetSwapChain only returns implicit swapchains */ swapchainX = (void *) 0xdeadbeef; - hr = IDirect3DDevice9_GetSwapChain(pDevice, 1, &swapchainX); + hr = IDirect3DDevice9_GetSwapChain(device, 1, &swapchainX); ok(hr == D3DERR_INVALIDCALL, "Failed to get the second swapchain (%08x)\n", hr); ok(swapchainX == NULL, "The swapchain pointer is %p\n", swapchainX); if(swapchainX && swapchainX != (void *) 0xdeadbeef ) IDirect3DSwapChain9_Release(swapchainX); + IDirect3DSwapChain9_Release(swapchain3); + IDirect3DSwapChain9_Release(swapchain2); + IDirect3DSwapChain9_Release(swapchain1); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if(swapchain1) IDirect3DSwapChain9_Release(swapchain1); - if(swapchain2) IDirect3DSwapChain9_Release(swapchain2); - if(swapchain3) IDirect3DSwapChain9_Release(swapchain3); - if (pDevice) - { - UINT refcount = IDirect3DDevice9_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D9_Release(pD3d); - DestroyWindow( hwnd ); + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void test_refcount(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D9 *pD3d = NULL; - IDirect3D9 *pD3d2 = NULL; - IDirect3DDevice9 *pDevice = NULL; IDirect3DVertexBuffer9 *pVertexBuffer = NULL; IDirect3DIndexBuffer9 *pIndexBuffer = NULL; IDirect3DVertexDeclaration9 *pVertexDeclaration = NULL; @@ -464,48 +416,42 @@ IDirect3DSwapChain9 *pSwapChain = NULL; IDirect3DQuery9 *pQuery = NULL; D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - int refcount = 0, tmp; + IDirect3DDevice9 *device; + ULONG refcount = 0, tmp; + IDirect3D9 *d3d, *d3d2; + HWND window; + HRESULT hr; D3DVERTEXELEMENT9 decl[] = { D3DDECL_END() }; - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - CHECK_REFCOUNT( pD3d, 1 ); + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + CHECK_REFCOUNT(d3d, 1); - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == S_OK || hr == D3DERR_NOTAVAILABLE, - "Failed to create IDirect3D9Device (%08x)\n", hr); - if (FAILED(hr)) goto cleanup; + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a 3D device, skipping test.\n"); + goto cleanup; + } - refcount = get_refcount( (IUnknown *)pDevice ); + refcount = get_refcount((IUnknown *)device); ok(refcount == 1, "Invalid device RefCount %d\n", refcount); - CHECK_REFCOUNT( pD3d, 2 ); + CHECK_REFCOUNT(d3d, 2); - hr = IDirect3DDevice9_GetDirect3D(pDevice, &pD3d2); - CHECK_CALL( hr, "GetDirect3D", pDevice, refcount ); + hr = IDirect3DDevice9_GetDirect3D(device, &d3d2); + CHECK_CALL(hr, "GetDirect3D", device, refcount); - ok(pD3d2 == pD3d, "Expected IDirect3D9 pointers to be equal\n"); - CHECK_REFCOUNT( pD3d, 3 ); - CHECK_RELEASE_REFCOUNT( pD3d, 2 ); + ok(d3d2 == d3d, "Expected IDirect3D9 pointers to be equal.\n"); + CHECK_REFCOUNT(d3d, 3); + CHECK_RELEASE_REFCOUNT(d3d, 2); /** * Check refcount of implicit surfaces and implicit swapchain. Findings: @@ -515,14 +461,14 @@ * - they are not freed if refcount reaches 0. * - the refcount is not forwarded to the container. */ - hr = IDirect3DDevice9_GetSwapChain(pDevice, 0, &pSwapChain); - CHECK_CALL( hr, "GetSwapChain", pDevice, ++refcount); + hr = IDirect3DDevice9_GetSwapChain(device, 0, &pSwapChain); + CHECK_CALL(hr, "GetSwapChain", device, ++refcount); if (pSwapChain) { CHECK_REFCOUNT( pSwapChain, 1); - hr = IDirect3DDevice9_GetRenderTarget(pDevice, 0, &pRenderTarget); - CHECK_CALL( hr, "GetRenderTarget", pDevice, ++refcount); + hr = IDirect3DDevice9_GetRenderTarget(device, 0, &pRenderTarget); + CHECK_CALL(hr, "GetRenderTarget", device, ++refcount); CHECK_REFCOUNT( pSwapChain, 1); if(pRenderTarget) { @@ -530,27 +476,27 @@ CHECK_REFCOUNT( pRenderTarget, 1); CHECK_ADDREF_REFCOUNT(pRenderTarget, 2); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); CHECK_RELEASE_REFCOUNT(pRenderTarget, 1); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); - hr = IDirect3DDevice9_GetRenderTarget(pDevice, 0, &pRenderTarget); - CHECK_CALL( hr, "GetRenderTarget", pDevice, refcount); + hr = IDirect3DDevice9_GetRenderTarget(device, 0, &pRenderTarget); + CHECK_CALL(hr, "GetRenderTarget", device, refcount); CHECK_REFCOUNT( pRenderTarget, 2); CHECK_RELEASE_REFCOUNT( pRenderTarget, 1); CHECK_RELEASE_REFCOUNT( pRenderTarget, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The render target is released with the device, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pRenderTarget, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pRenderTarget, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); } /* Render target and back buffer are identical. */ - hr = IDirect3DDevice9_GetBackBuffer(pDevice, 0, 0, 0, &pBackBuffer); - CHECK_CALL( hr, "GetBackBuffer", pDevice, ++refcount); + hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, 0, &pBackBuffer); + CHECK_CALL(hr, "GetBackBuffer", device, ++refcount); if(pBackBuffer) { CHECK_RELEASE_REFCOUNT(pBackBuffer, 0); @@ -558,58 +504,58 @@ pRenderTarget, pBackBuffer); pBackBuffer = NULL; } - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); - hr = IDirect3DDevice9_GetDepthStencilSurface(pDevice, &pStencilSurface); - CHECK_CALL( hr, "GetDepthStencilSurface", pDevice, ++refcount); + hr = IDirect3DDevice9_GetDepthStencilSurface(device, &pStencilSurface); + CHECK_CALL(hr, "GetDepthStencilSurface", device, ++refcount); CHECK_REFCOUNT( pSwapChain, 1); if(pStencilSurface) { - CHECK_SURFACE_CONTAINER( pStencilSurface, IID_IDirect3DDevice9, pDevice); + CHECK_SURFACE_CONTAINER(pStencilSurface, IID_IDirect3DDevice9, device); CHECK_REFCOUNT( pStencilSurface, 1); CHECK_ADDREF_REFCOUNT(pStencilSurface, 2); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); CHECK_RELEASE_REFCOUNT(pStencilSurface, 1); - CHECK_REFCOUNT(pDevice, refcount); + CHECK_REFCOUNT(device, refcount); CHECK_RELEASE_REFCOUNT( pStencilSurface, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The stencil surface is released with the device, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pStencilSurface, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pStencilSurface, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pStencilSurface = NULL; } CHECK_RELEASE_REFCOUNT( pSwapChain, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The implicit swapchwin is released with the device, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pSwapChain, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pSwapChain, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pSwapChain = NULL; } /* Buffers */ - hr = IDirect3DDevice9_CreateIndexBuffer( pDevice, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer, NULL ); - CHECK_CALL( hr, "CreateIndexBuffer", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateIndexBuffer(device, 16, 0, D3DFMT_INDEX32, D3DPOOL_DEFAULT, &pIndexBuffer, NULL); + CHECK_CALL(hr, "CreateIndexBuffer", device, ++refcount ); if(pIndexBuffer) { tmp = get_refcount( (IUnknown *)pIndexBuffer ); - hr = IDirect3DDevice9_SetIndices(pDevice, pIndexBuffer); + hr = IDirect3DDevice9_SetIndices(device, pIndexBuffer); CHECK_CALL( hr, "SetIndices", pIndexBuffer, tmp); - hr = IDirect3DDevice9_SetIndices(pDevice, NULL); + hr = IDirect3DDevice9_SetIndices(device, NULL); CHECK_CALL( hr, "SetIndices", pIndexBuffer, tmp); } - hr = IDirect3DDevice9_CreateVertexBuffer( pDevice, 16, 0, D3DFVF_XYZ, D3DPOOL_DEFAULT, &pVertexBuffer, NULL ); - CHECK_CALL( hr, "CreateVertexBuffer", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateVertexBuffer(device, 16, 0, D3DFVF_XYZ, D3DPOOL_DEFAULT, &pVertexBuffer, NULL); + CHECK_CALL(hr, "CreateVertexBuffer", device, ++refcount); if(pVertexBuffer) { IDirect3DVertexBuffer9 *pVBuf = (void*)~0; @@ -618,40 +564,40 @@ tmp = get_refcount( (IUnknown *)pVertexBuffer ); - hr = IDirect3DDevice9_SetStreamSource(pDevice, 0, pVertexBuffer, 0, 3 * sizeof(float)); + hr = IDirect3DDevice9_SetStreamSource(device, 0, pVertexBuffer, 0, 3 * sizeof(float)); CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp); - hr = IDirect3DDevice9_SetStreamSource(pDevice, 0, NULL, 0, 0); + hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0); CHECK_CALL( hr, "SetStreamSource", pVertexBuffer, tmp); - hr = IDirect3DDevice9_GetStreamSource(pDevice, 0, &pVBuf, &offset, &stride); + hr = IDirect3DDevice9_GetStreamSource(device, 0, &pVBuf, &offset, &stride); ok(SUCCEEDED(hr), "GetStreamSource did not succeed with NULL stream!\n"); ok(pVBuf==NULL, "pVBuf not NULL (%p)!\n", pVBuf); ok(stride==3*sizeof(float), "stride not 3 floats (got %u)!\n", stride); ok(offset==0, "offset not 0 (got %u)!\n", offset); } /* Shaders */ - hr = IDirect3DDevice9_CreateVertexDeclaration( pDevice, decl, &pVertexDeclaration ); - CHECK_CALL( hr, "CreateVertexDeclaration", pDevice, ++refcount ); - hr = IDirect3DDevice9_CreateVertexShader( pDevice, simple_vs, &pVertexShader ); - CHECK_CALL( hr, "CreateVertexShader", pDevice, ++refcount ); - hr = IDirect3DDevice9_CreatePixelShader( pDevice, simple_ps, &pPixelShader ); - CHECK_CALL( hr, "CreatePixelShader", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl, &pVertexDeclaration); + CHECK_CALL(hr, "CreateVertexDeclaration", device, ++refcount); + hr = IDirect3DDevice9_CreateVertexShader(device, simple_vs, &pVertexShader); + CHECK_CALL(hr, "CreateVertexShader", device, ++refcount); + hr = IDirect3DDevice9_CreatePixelShader(device, simple_ps, &pPixelShader); + CHECK_CALL(hr, "CreatePixelShader", device, ++refcount); /* Textures */ - hr = IDirect3DDevice9_CreateTexture( pDevice, 32, 32, 3, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pTexture, NULL ); - CHECK_CALL( hr, "CreateTexture", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 3, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pTexture, NULL); + CHECK_CALL(hr, "CreateTexture", device, ++refcount); if (pTexture) { tmp = get_refcount( (IUnknown *)pTexture ); /* SetTexture should not increase refcounts */ - hr = IDirect3DDevice9_SetTexture(pDevice, 0, (IDirect3DBaseTexture9 *) pTexture); - CHECK_CALL( hr, "SetTexture", pTexture, tmp); - hr = IDirect3DDevice9_SetTexture(pDevice, 0, NULL); - CHECK_CALL( hr, "SetTexture", pTexture, tmp); + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)pTexture); + CHECK_CALL(hr, "SetTexture", pTexture, tmp); + hr = IDirect3DDevice9_SetTexture(device, 0, NULL); + CHECK_CALL(hr, "SetTexture", pTexture, tmp); /* This should not increment device refcount */ hr = IDirect3DTexture9_GetSurfaceLevel( pTexture, 1, &pTextureLevel ); - CHECK_CALL( hr, "GetSurfaceLevel", pDevice, refcount ); + CHECK_CALL(hr, "GetSurfaceLevel", device, refcount); /* But should increment texture's refcount */ CHECK_REFCOUNT( pTexture, tmp+1 ); /* Because the texture and surface refcount are identical */ @@ -666,17 +612,18 @@ CHECK_REFCOUNT ( pTextureLevel, tmp ); } } - hr = IDirect3DDevice9_CreateCubeTexture( pDevice, 32, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pCubeTexture, NULL ); - CHECK_CALL( hr, "CreateCubeTexture", pDevice, ++refcount ); - hr = IDirect3DDevice9_CreateVolumeTexture( pDevice, 32, 32, 2, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pVolumeTexture, NULL ); - CHECK_CALL( hr, "CreateVolumeTexture", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateCubeTexture(device, 32, 0, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pCubeTexture, NULL); + CHECK_CALL(hr, "CreateCubeTexture", device, ++refcount); + hr = IDirect3DDevice9_CreateVolumeTexture(device, 32, 32, 2, 0, 0, + D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pVolumeTexture, NULL); + CHECK_CALL(hr, "CreateVolumeTexture", device, ++refcount); if (pVolumeTexture) { tmp = get_refcount( (IUnknown *)pVolumeTexture ); /* This should not increment device refcount */ hr = IDirect3DVolumeTexture9_GetVolumeLevel(pVolumeTexture, 0, &pVolumeLevel); - CHECK_CALL( hr, "GetVolumeLevel", pDevice, refcount ); + CHECK_CALL(hr, "GetVolumeLevel", device, refcount); /* But should increment volume texture's refcount */ CHECK_REFCOUNT( pVolumeTexture, tmp+1 ); /* Because the volume texture and volume refcount are identical */ @@ -692,146 +639,146 @@ } } /* Surfaces */ - hr = IDirect3DDevice9_CreateDepthStencilSurface( pDevice, 32, 32, D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, TRUE, &pStencilSurface, NULL ); - CHECK_CALL( hr, "CreateDepthStencilSurface", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateDepthStencilSurface(device, 32, 32, + D3DFMT_D24S8, D3DMULTISAMPLE_NONE, 0, TRUE, &pStencilSurface, NULL); + CHECK_CALL(hr, "CreateDepthStencilSurface", device, ++refcount); CHECK_REFCOUNT( pStencilSurface, 1 ); - hr = IDirect3DDevice9_CreateOffscreenPlainSurface( pDevice, 32, 32, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pOffscreenSurface, NULL ); - CHECK_CALL( hr, "CreateOffscreenPlainSurface", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32, + D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &pOffscreenSurface, NULL); + CHECK_CALL(hr, "CreateOffscreenPlainSurface", device, ++refcount); CHECK_REFCOUNT( pOffscreenSurface, 1 ); - hr = IDirect3DDevice9_CreateRenderTarget( pDevice, 32, 32, D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &pRenderTarget3, NULL ); - CHECK_CALL( hr, "CreateRenderTarget", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateRenderTarget(device, 32, 32, + D3DFMT_X8R8G8B8, D3DMULTISAMPLE_NONE, 0, TRUE, &pRenderTarget3, NULL); + CHECK_CALL(hr, "CreateRenderTarget", device, ++refcount); CHECK_REFCOUNT( pRenderTarget3, 1 ); /* Misc */ - hr = IDirect3DDevice9_CreateStateBlock( pDevice, D3DSBT_ALL, &pStateBlock ); - CHECK_CALL( hr, "CreateStateBlock", pDevice, ++refcount ); - hr = IDirect3DDevice9_CreateAdditionalSwapChain( pDevice, &d3dpp, &pSwapChain ); - CHECK_CALL( hr, "CreateAdditionalSwapChain", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateStateBlock(device, D3DSBT_ALL, &pStateBlock); + CHECK_CALL(hr, "CreateStateBlock", device, ++refcount); + + memset(&d3dpp, 0, sizeof(d3dpp)); + d3dpp.Windowed = TRUE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferFormat = D3DFMT_A8R8G8B8; + d3dpp.EnableAutoDepthStencil = TRUE; + d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &pSwapChain); + CHECK_CALL(hr, "CreateAdditionalSwapChain", device, ++refcount); if(pSwapChain) { /* check implicit back buffer */ hr = IDirect3DSwapChain9_GetBackBuffer(pSwapChain, 0, 0, &pBackBuffer); - CHECK_CALL( hr, "GetBackBuffer", pDevice, ++refcount); + CHECK_CALL(hr, "GetBackBuffer", device, ++refcount); CHECK_REFCOUNT( pSwapChain, 1); if(pBackBuffer) { CHECK_SURFACE_CONTAINER( pBackBuffer, IID_IDirect3DSwapChain9, pSwapChain); CHECK_REFCOUNT( pBackBuffer, 1); CHECK_RELEASE_REFCOUNT( pBackBuffer, 0); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); /* The back buffer is released with the swapchain, so AddRef with refcount=0 is fine here. */ CHECK_ADDREF_REFCOUNT(pBackBuffer, 1); - CHECK_REFCOUNT(pDevice, ++refcount); + CHECK_REFCOUNT(device, ++refcount); CHECK_RELEASE_REFCOUNT(pBackBuffer, 0); - CHECK_REFCOUNT(pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pBackBuffer = NULL; } CHECK_REFCOUNT( pSwapChain, 1); } - hr = IDirect3DDevice9_CreateQuery( pDevice, D3DQUERYTYPE_EVENT, &pQuery ); - CHECK_CALL( hr, "CreateQuery", pDevice, ++refcount ); + hr = IDirect3DDevice9_CreateQuery(device, D3DQUERYTYPE_EVENT, &pQuery); + CHECK_CALL(hr, "CreateQuery", device, ++refcount); - hr = IDirect3DDevice9_BeginStateBlock( pDevice ); - CHECK_CALL( hr, "BeginStateBlock", pDevice, refcount ); - hr = IDirect3DDevice9_EndStateBlock( pDevice, &pStateBlock1 ); - CHECK_CALL( hr, "EndStateBlock", pDevice, ++refcount ); + hr = IDirect3DDevice9_BeginStateBlock(device); + CHECK_CALL(hr, "BeginStateBlock", device, refcount); + hr = IDirect3DDevice9_EndStateBlock(device, &pStateBlock1); + CHECK_CALL(hr, "EndStateBlock", device, ++refcount); /* The implicit render target is not freed if refcount reaches 0. * Otherwise GetRenderTarget would re-allocate it and the pointer would change.*/ - hr = IDirect3DDevice9_GetRenderTarget(pDevice, 0, &pRenderTarget2); - CHECK_CALL( hr, "GetRenderTarget", pDevice, ++refcount); + hr = IDirect3DDevice9_GetRenderTarget(device, 0, &pRenderTarget2); + CHECK_CALL(hr, "GetRenderTarget", device, ++refcount); if(pRenderTarget2) { CHECK_RELEASE_REFCOUNT(pRenderTarget2, 0); ok(pRenderTarget == pRenderTarget2, "RenderTarget=%p and RenderTarget2=%p should be the same.\n", pRenderTarget, pRenderTarget2); - CHECK_REFCOUNT( pDevice, --refcount); + CHECK_REFCOUNT(device, --refcount); pRenderTarget2 = NULL; } pRenderTarget = NULL; cleanup: - CHECK_RELEASE(pDevice, pDevice, --refcount); + CHECK_RELEASE(device, device, --refcount); /* Buffers */ - CHECK_RELEASE(pVertexBuffer, pDevice, --refcount); - CHECK_RELEASE(pIndexBuffer, pDevice, --refcount); + CHECK_RELEASE(pVertexBuffer, device, --refcount); + CHECK_RELEASE(pIndexBuffer, device, --refcount); /* Shaders */ - CHECK_RELEASE(pVertexDeclaration, pDevice, --refcount); - CHECK_RELEASE(pVertexShader, pDevice, --refcount); - CHECK_RELEASE(pPixelShader, pDevice, --refcount); + CHECK_RELEASE(pVertexDeclaration, device, --refcount); + CHECK_RELEASE(pVertexShader, device, --refcount); + CHECK_RELEASE(pPixelShader, device, --refcount); /* Textures */ - CHECK_RELEASE(pTextureLevel, pDevice, --refcount); - CHECK_RELEASE(pCubeTexture, pDevice, --refcount); - CHECK_RELEASE(pVolumeTexture, pDevice, --refcount); + CHECK_RELEASE(pTextureLevel, device, --refcount); + CHECK_RELEASE(pCubeTexture, device, --refcount); + CHECK_RELEASE(pVolumeTexture, device, --refcount); /* Surfaces */ - CHECK_RELEASE(pStencilSurface, pDevice, --refcount); - CHECK_RELEASE(pOffscreenSurface, pDevice, --refcount); - CHECK_RELEASE(pRenderTarget3, pDevice, --refcount); + CHECK_RELEASE(pStencilSurface, device, --refcount); + CHECK_RELEASE(pOffscreenSurface, device, --refcount); + CHECK_RELEASE(pRenderTarget3, device, --refcount); /* Misc */ - CHECK_RELEASE(pStateBlock, pDevice, --refcount); - CHECK_RELEASE(pSwapChain, pDevice, --refcount); - CHECK_RELEASE(pQuery, pDevice, --refcount); + CHECK_RELEASE(pStateBlock, device, --refcount); + CHECK_RELEASE(pSwapChain, device, --refcount); + CHECK_RELEASE(pQuery, device, --refcount); /* This will destroy device - cannot check the refcount here */ if (pStateBlock1) CHECK_RELEASE_REFCOUNT( pStateBlock1, 0); - - if (pD3d) CHECK_RELEASE_REFCOUNT( pD3d, 0); - - DestroyWindow( hwnd ); + CHECK_RELEASE_REFCOUNT(d3d, 0); + DestroyWindow(window); } static void test_cursor(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D9 *pD3d = NULL; - IDirect3DDevice9 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - CURSORINFO info; IDirect3DSurface9 *cursor = NULL; + IDirect3DDevice9 *device; + CURSORINFO info; + IDirect3D9 *d3d; + ULONG refcount; HCURSOR cur; + HWND window; + HRESULT hr; memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(GetCursorInfo(&info), "GetCursorInfo failed\n"); cur = info.hCursor; - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferFormat = d3ddm.Format; - - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == S_OK || hr == D3DERR_NOTAVAILABLE, - "Failed to create IDirect3D9Device (%08x)\n", hr); - if (FAILED(hr)) goto cleanup; + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a 3D device, skipping test.\n"); + goto cleanup; + } - IDirect3DDevice9_CreateOffscreenPlainSurface(pDevice, 32, 32, D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &cursor, 0); - ok(cursor != NULL, "IDirect3DDevice9_CreateOffscreenPlainSurface failed with %08x\n", hr); + hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32, + D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &cursor, NULL); + ok(SUCCEEDED(hr), "Failed to create cursor surface, hr %#x.\n", hr); /* Initially hidden */ - hr = IDirect3DDevice9_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice9_ShowCursor(device, TRUE); ok(hr == FALSE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr); /* Not enabled without a surface*/ - hr = IDirect3DDevice9_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice9_ShowCursor(device, TRUE); ok(hr == FALSE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr); /* Fails */ - hr = IDirect3DDevice9_SetCursorProperties(pDevice, 0, 0, NULL); + hr = IDirect3DDevice9_SetCursorProperties(device, 0, 0, NULL); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_SetCursorProperties returned %08x\n", hr); - hr = IDirect3DDevice9_SetCursorProperties(pDevice, 0, 0, cursor); + hr = IDirect3DDevice9_SetCursorProperties(device, 0, 0, cursor); ok(hr == D3D_OK, "IDirect3DDevice9_SetCursorProperties returned %08x\n", hr); IDirect3DSurface9_Release(cursor); @@ -843,11 +790,11 @@ ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */ /* Still hidden */ - hr = IDirect3DDevice9_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice9_ShowCursor(device, TRUE); ok(hr == FALSE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr); /* Enabled now*/ - hr = IDirect3DDevice9_ShowCursor(pDevice, TRUE); + hr = IDirect3DDevice9_ShowCursor(device, TRUE); ok(hr == TRUE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr); /* GDI cursor unchanged */ @@ -857,22 +804,17 @@ ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags); ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */ + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pDevice) - { - UINT refcount = IDirect3DDevice9_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D9_Release(pD3d); - DestroyWindow( hwnd ); + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void test_reset(void) { HRESULT hr; - HWND hwnd = NULL; RECT winrect; - IDirect3D9 *pD3d = NULL; D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm, d3ddm2; D3DVIEWPORT9 vp; @@ -886,8 +828,10 @@ D3DLOCKED_RECT lockrect; IDirect3DDevice9 *device1 = NULL; IDirect3DDevice9 *device2 = NULL; + IDirect3D9 *d3d; D3DCAPS9 caps; DWORD value; + HWND hwnd; struct { UINT w; @@ -895,21 +839,20 @@ } *modes = NULL; UINT mode_count = 0; - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; + ok(!!hwnd, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - adapter_mode_count = IDirect3D9_GetAdapterModeCount(pD3d, D3DADAPTER_DEFAULT, d3ddm.Format); + IDirect3D9_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &d3ddm); + adapter_mode_count = IDirect3D9_GetAdapterModeCount(d3d, D3DADAPTER_DEFAULT, d3ddm.Format); modes = HeapAlloc(GetProcessHeap(), 0, sizeof(*modes) * adapter_mode_count); for(i = 0; i < adapter_mode_count; ++i) { UINT j; ZeroMemory( &d3ddm2, sizeof(d3ddm2) ); - hr = IDirect3D9_EnumAdapterModes(pD3d, D3DADAPTER_DEFAULT, d3ddm.Format, i, &d3ddm2); + hr = IDirect3D9_EnumAdapterModes(d3d, D3DADAPTER_DEFAULT, d3ddm.Format, i, &d3ddm2); ok(hr == D3D_OK, "IDirect3D9_EnumAdapterModes returned %#x\n", hr); for (j = 0; j < mode_count; ++j) @@ -951,7 +894,7 @@ d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; - hr = IDirect3D9_CreateDevice(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device1); if (FAILED(hr)) { @@ -1307,7 +1250,7 @@ hr = IDirect3DDevice9_TestCooperativeLevel(device1); ok(hr == D3DERR_DEVICENOTRESET, "IDirect3DDevice9_TestCooperativeLevel after a failed reset returned %#x\n", hr); - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); + IDirect3D9_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &d3ddm); ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed = TRUE; @@ -1316,9 +1259,8 @@ d3dpp.EnableAutoDepthStencil = FALSE; d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; - hr = IDirect3D9_CreateDevice(pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device2); - if (FAILED(hr)) + if (FAILED(hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &device2))) { skip("could not create device, IDirect3D9_CreateDevice returned %#x\n", hr); goto cleanup; @@ -1356,22 +1298,21 @@ UINT refcount = IDirect3DDevice9_Release(device1); ok(!refcount, "Device has %u references left.\n", refcount); } - if (pD3d) IDirect3D9_Release(pD3d); - if (hwnd) DestroyWindow(hwnd); + IDirect3D9_Release(d3d); + DestroyWindow(hwnd); } /* Test adapter display modes */ static void test_display_modes(void) { D3DDISPLAYMODE dmode; - IDirect3D9 *pD3d; + IDirect3D9 *d3d; - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - if(!pD3d) return; + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); #define TEST_FMT(x,r) do { \ - HRESULT res = IDirect3D9_EnumAdapterModes(pD3d, 0, (x), 0, &dmode); \ + HRESULT res = IDirect3D9_EnumAdapterModes(d3d, 0, (x), 0, &dmode); \ ok(res==(r), "EnumAdapterModes("#x") did not return "#r" (got %08x)!\n", res); \ } while(0) @@ -1446,261 +1387,208 @@ TEST_FMT(0, D3DERR_INVALIDCALL); - IDirect3D9_Release(pD3d); + IDirect3D9_Release(d3d); } static void test_scene(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D9 *pD3d = NULL; - IDirect3DDevice9 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - IDirect3DSurface9 *pSurface1 = NULL, *pSurface2 = NULL, *pSurface3 = NULL, *pRenderTarget = NULL; - IDirect3DSurface9 *pBackBuffer = NULL, *pDepthStencil = NULL; + IDirect3DSurface9 *surface1, *surface2, *surface3; + IDirect3DSurface9 *backBuffer, *rt, *ds; RECT rect = {0, 0, 128, 128}; - D3DCAPS9 caps; - - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!pDevice) + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } /* Get the caps, they will be needed to tell if an operation is supposed to be valid */ memset(&caps, 0, sizeof(caps)); - hr = IDirect3DDevice9_GetDeviceCaps(pDevice, &caps); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(hr == D3D_OK, "IDirect3DDevice9_GetCaps failed with %08x\n", hr); - if(FAILED(hr)) goto cleanup; /* Test an EndScene without BeginScene. Should return an error */ - hr = IDirect3DDevice9_EndScene(pDevice); + hr = IDirect3DDevice9_EndScene(device); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_EndScene returned %08x\n", hr); /* Test a normal BeginScene / EndScene pair, this should work */ - hr = IDirect3DDevice9_BeginScene(pDevice); + hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr); - if(SUCCEEDED(hr)) - { - hr = IDirect3DDevice9_EndScene(pDevice); - ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr); - } + hr = IDirect3DDevice9_EndScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr); /* Test another EndScene without having begun a new scene. Should return an error */ - hr = IDirect3DDevice9_EndScene(pDevice); + hr = IDirect3DDevice9_EndScene(device); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_EndScene returned %08x\n", hr); /* Two nested BeginScene and EndScene calls */ - hr = IDirect3DDevice9_BeginScene(pDevice); + hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr); - hr = IDirect3DDevice9_BeginScene(pDevice); + hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_BeginScene returned %08x\n", hr); - hr = IDirect3DDevice9_EndScene(pDevice); + hr = IDirect3DDevice9_EndScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr); - hr = IDirect3DDevice9_EndScene(pDevice); + hr = IDirect3DDevice9_EndScene(device); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_EndScene returned %08x\n", hr); /* Create some surfaces to test stretchrect between the scenes */ - hr = IDirect3DDevice9_CreateOffscreenPlainSurface(pDevice, 128, 128, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pSurface1, NULL); + hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128, + D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surface1, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateOffscreenPlainSurface failed with %08x\n", hr); - hr = IDirect3DDevice9_CreateOffscreenPlainSurface(pDevice, 128, 128, D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &pSurface2, NULL); + hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128, + D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surface2, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateOffscreenPlainSurface failed with %08x\n", hr); - hr = IDirect3DDevice9_CreateDepthStencilSurface(pDevice, 800, 600, D3DFMT_D16, D3DMULTISAMPLE_NONE, 0, FALSE, &pSurface3, NULL); + hr = IDirect3DDevice9_CreateDepthStencilSurface(device, 800, 600, + D3DFMT_D16, D3DMULTISAMPLE_NONE, 0, FALSE, &surface3, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateDepthStencilSurface failed with %08x\n", hr); - hr = IDirect3DDevice9_CreateRenderTarget(pDevice, 128, 128, d3ddm.Format, D3DMULTISAMPLE_NONE, 0, FALSE, &pRenderTarget, NULL); + hr = IDirect3DDevice9_CreateRenderTarget(device, 128, 128, + D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, 0, FALSE, &rt, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateRenderTarget failed with %08x\n", hr); - hr = IDirect3DDevice9_GetBackBuffer(pDevice, 0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackBuffer); + hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backBuffer); ok(hr == D3D_OK, "IDirect3DDevice9_GetBackBuffer failed with %08x\n", hr); - hr = IDirect3DDevice9_GetDepthStencilSurface(pDevice, &pDepthStencil); + hr = IDirect3DDevice9_GetDepthStencilSurface(device, &ds); ok(hr == D3D_OK, "IDirect3DDevice9_GetBackBuffer failed with %08x\n", hr); /* First make sure a simple StretchRect call works */ - if(pSurface1 && pSurface2) { - hr = IDirect3DDevice9_StretchRect(pDevice, pSurface1, NULL, pSurface2, NULL, 0); - ok( hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); - } - if(pBackBuffer && pRenderTarget) { - hr = IDirect3DDevice9_StretchRect(pDevice, pBackBuffer, &rect, pRenderTarget, NULL, 0); - ok( hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); - } - if(pDepthStencil && pSurface3) { - HRESULT expected; - if(0) /* Disabled for now because it crashes in wine */ { - expected = caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES ? D3D_OK : D3DERR_INVALIDCALL; - hr = IDirect3DDevice9_StretchRect(pDevice, pDepthStencil, NULL, pSurface3, NULL, 0); - ok( hr == expected, "IDirect3DDevice9_StretchRect returned %08x, expected %08x\n", hr, expected); - } + hr = IDirect3DDevice9_StretchRect(device, surface1, NULL, surface2, NULL, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); + hr = IDirect3DDevice9_StretchRect(device, backBuffer, &rect, rt, NULL, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); + if (0) /* Disabled for now because it crashes in wine */ + { + HRESULT expected = caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES ? D3D_OK : D3DERR_INVALIDCALL; + hr = IDirect3DDevice9_StretchRect(device, ds, NULL, surface3, NULL, 0); + ok(hr == expected, "Got unexpected hr %#x, expected %#x.\n", hr, expected); } - /* Now try it in a BeginScene - EndScene pair. Seems to be allowed in a beginScene - Endscene pair - * with normal surfaces and render targets, but not depth stencil surfaces. - */ - hr = IDirect3DDevice9_BeginScene(pDevice); - ok( hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr); + /* Now try it in a BeginScene - EndScene pair. Seems to be allowed in a + * BeginScene - Endscene pair with normal surfaces and render targets, but + * not depth stencil surfaces. */ + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr); - if(pSurface1 && pSurface2) - { - hr = IDirect3DDevice9_StretchRect(pDevice, pSurface1, NULL, pSurface2, NULL, 0); - ok( hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); - } - if(pBackBuffer && pRenderTarget) - { - hr = IDirect3DDevice9_StretchRect(pDevice, pBackBuffer, &rect, pRenderTarget, NULL, 0); - ok( hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); - } - if(pDepthStencil && pSurface3) - { - /* This is supposed to fail inside a BeginScene - EndScene pair. */ - hr = IDirect3DDevice9_StretchRect(pDevice, pDepthStencil, NULL, pSurface3, NULL, 0); - ok( hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_StretchRect returned %08x, expected D3DERR_INVALIDCALL\n", hr); - } + hr = IDirect3DDevice9_StretchRect(device, surface1, NULL, surface2, NULL, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); + hr = IDirect3DDevice9_StretchRect(device, backBuffer, &rect, rt, NULL, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with %08x\n", hr); + /* This is supposed to fail inside a BeginScene - EndScene pair. */ + hr = IDirect3DDevice9_StretchRect(device, ds, NULL, surface3, NULL, 0); + ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_StretchRect returned %08x, expected D3DERR_INVALIDCALL\n", hr); - hr = IDirect3DDevice9_EndScene(pDevice); - ok( hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr); /* Does a SetRenderTarget influence BeginScene / EndScene ? * Set a new render target, then see if it started a new scene. Flip the rt back and see if that maybe * ended the scene. Expected result is that the scene is not affected by SetRenderTarget */ - hr = IDirect3DDevice9_SetRenderTarget(pDevice, 0, pRenderTarget); + hr = IDirect3DDevice9_SetRenderTarget(device, 0, rt); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderTarget failed with %08x\n", hr); - hr = IDirect3DDevice9_BeginScene(pDevice); + hr = IDirect3DDevice9_BeginScene(device); ok( hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with %08x\n", hr); - hr = IDirect3DDevice9_SetRenderTarget(pDevice, 0, pBackBuffer); + hr = IDirect3DDevice9_SetRenderTarget(device, 0, backBuffer); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderTarget failed with %08x\n", hr); - hr = IDirect3DDevice9_EndScene(pDevice); + hr = IDirect3DDevice9_EndScene(device); ok( hr == D3D_OK, "IDirect3DDevice9_EndScene failed with %08x\n", hr); + IDirect3DSurface9_Release(rt); + IDirect3DSurface9_Release(ds); + IDirect3DSurface9_Release(backBuffer); + IDirect3DSurface9_Release(surface1); + IDirect3DSurface9_Release(surface2); + IDirect3DSurface9_Release(surface3); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if(pRenderTarget) IDirect3DSurface9_Release(pRenderTarget); - if(pDepthStencil) IDirect3DSurface9_Release(pDepthStencil); - if(pBackBuffer) IDirect3DSurface9_Release(pBackBuffer); - if(pSurface1) IDirect3DSurface9_Release(pSurface1); - if(pSurface2) IDirect3DSurface9_Release(pSurface2); - if(pSurface3) IDirect3DSurface9_Release(pSurface3); - if (pDevice) - { - UINT refcount = IDirect3DDevice9_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D9_Release(pD3d); - if(hwnd) DestroyWindow(hwnd); + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void test_limits(void) { - HRESULT hr; - HWND hwnd = NULL; - IDirect3D9 *pD3d = NULL; - IDirect3DDevice9 *pDevice = NULL; - D3DPRESENT_PARAMETERS d3dpp; - D3DDISPLAYMODE d3ddm; - IDirect3DTexture9 *pTexture = NULL; - int i; - - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; - - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = TRUE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D16; + IDirect3DTexture9 *texture; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!pDevice) + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } - hr = IDirect3DDevice9_CreateTexture(pDevice, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &pTexture, NULL); + hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed with %08x\n", hr); - if(!pTexture) goto cleanup; /* There are 16 pixel samplers. We should be able to access all of them */ - for(i = 0; i < 16; i++) { - hr = IDirect3DDevice9_SetTexture(pDevice, i, (IDirect3DBaseTexture9 *) pTexture); + for (i = 0; i < 16; ++i) + { + hr = IDirect3DDevice9_SetTexture(device, i, (IDirect3DBaseTexture9 *)texture); ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture for sampler %d failed with %08x\n", i, hr); - hr = IDirect3DDevice9_SetTexture(pDevice, i, NULL); + hr = IDirect3DDevice9_SetTexture(device, i, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture for sampler %d failed with %08x\n", i, hr); - hr = IDirect3DDevice9_SetSamplerState(pDevice, i, D3DSAMP_SRGBTEXTURE, TRUE); + hr = IDirect3DDevice9_SetSamplerState(device, i, D3DSAMP_SRGBTEXTURE, TRUE); ok(hr == D3D_OK, "IDirect3DDevice9_SetSamplerState for sampler %d failed with %08x\n", i, hr); } /* Now test all 8 textures stage states */ - for(i = 0; i < 8; i++) { - hr = IDirect3DDevice9_SetTextureStageState(pDevice, i, D3DTSS_COLOROP, D3DTOP_ADD); + for (i = 0; i < 8; ++i) + { + hr = IDirect3DDevice9_SetTextureStageState(device, i, D3DTSS_COLOROP, D3DTOP_ADD); ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState for texture %d failed with %08x\n", i, hr); } - /* Investigations show that accessing higher samplers / textures stage states does not return an error either. Writing - * to too high samplers(approximately sampler 40) causes memory corruption in windows, so there is no bounds checking - * but how do I test that? - */ + /* Investigations show that accessing higher samplers / textures stage + * states does not return an error either. Writing to too high samplers + * (approximately sampler 40) causes memory corruption in Windows, so + * there is no bounds checking. */ + IDirect3DTexture9_Release(texture); + refcount = IDirect3D9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if(pTexture) IDirect3DTexture9_Release(pTexture); - if (pDevice) - { - UINT refcount = IDirect3D9_Release(pDevice); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (pD3d) IDirect3D9_Release(pD3d); - if(hwnd) DestroyWindow(hwnd); + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void test_depthstenciltest(void) { HRESULT hr; - HWND hwnd = NULL; - IDirect3D9 *pD3d = NULL; IDirect3DDevice9 *pDevice = NULL; D3DPRESENT_PARAMETERS d3dpp; D3DDISPLAYMODE d3ddm; IDirect3DSurface9 *pDepthStencil = NULL; IDirect3DSurface9 *pDepthStencil2 = NULL; - DWORD state; + IDirect3D9 *d3d; + DWORD state; + HWND hwnd; - pD3d = Direct3DCreate9(D3D_SDK_VERSION); - ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!pD3d || !hwnd) goto cleanup; + ok(!!hwnd, "Failed to create a window.\n"); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); - IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); + IDirect3D9_GetAdapterDisplayMode(d3d, D3DADAPTER_DEFAULT, &d3ddm); ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; @@ -1710,9 +1598,9 @@ d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, + hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice); + ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || broken(hr == D3DERR_INVALIDCALL), "IDirect3D9_CreateDevice failed with %08x\n", hr); if(!pDevice) { skip("Failed to create a d3d device\n"); @@ -1779,8 +1667,8 @@ d3dpp.EnableAutoDepthStencil = FALSE; d3dpp.AutoDepthStencilFormat = D3DFMT_UNKNOWN; - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, + hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice); ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); if(!pDevice) { @@ -1813,8 +1701,8 @@ d3dpp.EnableAutoDepthStencil = FALSE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; - hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, + hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice); ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); if(!pDevice) { @@ -1841,8 +1729,8 @@ UINT refcount = IDirect3D9_Release(pDevice); ok(!refcount, "Device has %u references left.\n", refcount); } - if (pD3d) IDirect3D9_Release(pD3d); - if(hwnd) DestroyWindow(hwnd); + IDirect3D9_Release(d3d); + DestroyWindow(hwnd); } static void test_get_rt(void) @@ -1856,14 +1744,10 @@ ULONG ref; UINT i; - if (!(d3d9 = Direct3DCreate9(D3D_SDK_VERSION))) - { - skip("Failed to create IDirect3D9 object, skipping tests.\n"); - return; - } - window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, 0, 0, 128, 128, 0, 0, 0, 0); + d3d9 = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d9, "Failed to create a D3D object.\n"); device = create_device(d3d9, window, window, TRUE); if (!device) { @@ -1915,41 +1799,24 @@ D3DDECL_END() }; - IDirect3DVertexDeclaration9 *vertex_declaration = NULL; - IDirect3DVertexBuffer9 *vertex_buffer = NULL; - IDirect3DIndexBuffer9 *index_buffer = NULL; - D3DPRESENT_PARAMETERS present_parameters; - IDirect3DDevice9 *device = NULL; + IDirect3DVertexDeclaration9 *vertex_declaration; + IDirect3DVertexBuffer9 *vertex_buffer; + IDirect3DIndexBuffer9 *index_buffer; + IDirect3DDevice9 *device; IDirect3D9 *d3d9; + ULONG refcount; + HWND window; HRESULT hr; - HWND hwnd; void *ptr; - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", 0, - 0, 0, 10, 10, 0, 0, 0, 0); - if (!hwnd) - { - skip("Failed to create window\n"); - return; - } - + window = CreateWindowA("d3d9_test_wc", "d3d9_test", 0, + 0, 0, 640, 480, 0, 0, 0, 0); + ok(!!window, "Failed to create a window.\n"); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); - if (!d3d9) - { - skip("Failed to create IDirect3D9 object\n"); - goto cleanup; - } - - ZeroMemory(&present_parameters, sizeof(present_parameters)); - present_parameters.Windowed = TRUE; - present_parameters.hDeviceWindow = hwnd; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - - hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - NULL, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device); - if (FAILED(hr) || !device) + ok(!!d3d9, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d9, window, window, TRUE))) { - skip("Failed to create device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } @@ -2012,24 +1879,20 @@ IDirect3DVertexBuffer9_Release(vertex_buffer); IDirect3DIndexBuffer9_Release(index_buffer); IDirect3DVertexDeclaration9_Release(vertex_declaration); - + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (device) - { - UINT refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if (d3d9) IDirect3D9_Release(d3d9); - if (hwnd) DestroyWindow(hwnd); + IDirect3D9_Release(d3d9); + DestroyWindow(window); } static void test_null_stream(void) { IDirect3DVertexBuffer9 *buffer = NULL; - D3DPRESENT_PARAMETERS present_parameters; - IDirect3DDevice9 *device = NULL; + IDirect3DDevice9 *device; IDirect3D9 *d3d9; - HWND hwnd; + ULONG refcount; + HWND window; HRESULT hr; IDirect3DVertexShader9 *shader = NULL; IDirect3DVertexDeclaration9 *decl = NULL; @@ -2046,24 +1909,14 @@ D3DDECL_END() }; + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); - ok(d3d9 != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d9 || !hwnd) goto cleanup; - - ZeroMemory(&present_parameters, sizeof(present_parameters)); - present_parameters.Windowed = TRUE; - present_parameters.hDeviceWindow = hwnd; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - - hr = IDirect3D9_CreateDevice( d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!device) + ok(!!d3d9, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d9, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } @@ -2110,46 +1963,36 @@ cleanup: if (buffer) IDirect3DVertexBuffer9_Release(buffer); - if(decl) IDirect3DVertexDeclaration9_Release(decl); - if(shader) IDirect3DVertexShader9_Release(shader); + if (decl) IDirect3DVertexDeclaration9_Release(decl); + if (shader) IDirect3DVertexShader9_Release(shader); if (device) { - UINT refcount = IDirect3DDevice9_Release(device); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); } - if(d3d9) IDirect3D9_Release(d3d9); + IDirect3D9_Release(d3d9); + DestroyWindow(window); } static void test_lights(void) { - D3DPRESENT_PARAMETERS present_parameters; - IDirect3DDevice9 *device = NULL; + IDirect3DDevice9 *device; IDirect3D9 *d3d9; - HWND hwnd; + ULONG refcount; + HWND window; HRESULT hr; unsigned int i; BOOL enabled; D3DCAPS9 caps; + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); - ok(d3d9 != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d9 || !hwnd) goto cleanup; - - ZeroMemory(&present_parameters, sizeof(present_parameters)); - present_parameters.Windowed = TRUE; - present_parameters.hDeviceWindow = hwnd; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - - hr = IDirect3D9_CreateDevice( d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL, - "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!device) + ok(!!d3d9, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d9, window, window, TRUE))) { - skip("Failed to create a d3d device\n"); + skip("Failed to create a 3D device, skipping test.\n"); goto cleanup; } @@ -2179,94 +2022,72 @@ ok(hr == D3D_OK, "Disabling light %u failed with %08x\n", i, hr); } + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (device) - { - UINT refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if(d3d9) IDirect3D9_Release(d3d9); + IDirect3D9_Release(d3d9); + DestroyWindow(window); } static void test_set_stream_source(void) { - D3DPRESENT_PARAMETERS present_parameters; - IDirect3DDevice9 *device = NULL; + IDirect3DVertexBuffer9 *vb; + IDirect3DDevice9 *device; IDirect3D9 *d3d9; - HWND hwnd; + ULONG refcount; + HWND window; HRESULT hr; - IDirect3DVertexBuffer9 *pVertexBuffer = NULL; + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); - ok(d3d9 != NULL, "Failed to create IDirect3D9 object\n"); - hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 100, 100, 160, 160, NULL, NULL, NULL, NULL); - ok(hwnd != NULL, "Failed to create window\n"); - if (!d3d9 || !hwnd) goto cleanup; + ok(!!d3d9, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d9, window, window, TRUE))) + { + skip("Failed to create a 3D device, skipping test.\n"); + goto cleanup; + } - ZeroMemory(&present_parameters, sizeof(present_parameters)); - present_parameters.Windowed = TRUE; - present_parameters.hDeviceWindow = hwnd; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + hr = IDirect3DDevice9_CreateVertexBuffer(device, 512, 0, 0, D3DPOOL_DEFAULT, &vb, NULL); + ok(SUCCEEDED(hr), "Failed to create a vertex buffer, hr %#x.\n", hr); - hr = IDirect3D9_CreateDevice( d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL, - "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!device) - { - hr = IDirect3D9_CreateDevice( d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_REF, hwnd, - D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device ); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE || hr == D3DERR_INVALIDCALL, - "IDirect3D9_CreateDevice failed with %08x\n", hr); - if(!device) - { - skip("Failed to create a d3d device\n"); - goto cleanup; - } - } + /* Some cards (GeForce 7400 at least) accept non-aligned offsets, others + * (Radeon 9000 verified) reject them, so accept both results. Wine + * currently rejects this to be able to optimize the vbo conversion, but + * writes a WARN. */ + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 0, 32); + ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 1, 32); + ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 2, 32); + ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 3, 32); + ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 4, 32); + ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr); - hr = IDirect3DDevice9_CreateVertexBuffer( device, 512, 0, 0, D3DPOOL_DEFAULT, &pVertexBuffer, NULL ); - ok(hr == D3D_OK, "Failed to create a vertex buffer, hr = %08x\n", hr); - if (SUCCEEDED(hr)) { - /* Some cards(Geforce 7400 at least) accept non-aligned offsets, others(radeon 9000 verified) reject it, - * so accept both results. Wine currently rejects this to be able to optimize the vbo conversion, but writes - * a WARN - */ - hr = IDirect3DDevice9_SetStreamSource(device, 0, pVertexBuffer, 0, 32); - ok(hr == D3D_OK, "Failed to set the stream source, offset 0, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetStreamSource(device, 0, pVertexBuffer, 1, 32); - ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Unexpected result when setting the stream source, offset 1, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetStreamSource(device, 0, pVertexBuffer, 2, 32); - ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Unexpected result when setting the stream source, offset 2, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetStreamSource(device, 0, pVertexBuffer, 3, 32); - ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Unexpected result when setting the stream source, offset 3, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetStreamSource(device, 0, pVertexBuffer, 4, 32); - ok(hr == D3D_OK, "Failed to set the stream source, offset 4, hr = %08x\n", hr); - } /* Try to set the NULL buffer with an offset and stride 0 */ hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0); - ok(hr == D3D_OK, "Failed to set the stream source, offset 0, hr = %08x\n", hr); + ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr); hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 1, 0); - ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Unexpected result when setting the stream source, offset 1, hr = %08x\n", hr); + ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 2, 0); - ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Unexpected result when setting the stream source, offset 2, hr = %08x\n", hr); + ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 3, 0); - ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Unexpected result when setting the stream source, offset 3, hr = %08x\n", hr); + ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 4, 0); - ok(hr == D3D_OK, "Failed to set the stream source, offset 4, hr = %08x\n", hr); + ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr); hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0); - ok(hr == D3D_OK, "Failed to set the stream source, offset 4, hr = %08x\n", hr); + ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr); + IDirect3DVertexBuffer9_Release(vb); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); cleanup: - if (pVertexBuffer) IDirect3DVertexBuffer9_Release(pVertexBuffer); - if (device) - { - UINT refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %u references left.\n", refcount); - } - if(d3d9) IDirect3D9_Release(d3d9); + IDirect3D9_Release(d3d9); + DestroyWindow(window); } /* Direct3D9 offers 4 display formats: R5G6B5, X1R5G5B5, X8R8G8B8 and @@ -2303,11 +2124,8 @@ {"D3DFMT_UNKNOWN", D3DFMT_UNKNOWN, 0, FALSE, FALSE}, }; - if (!(d3d9 = Direct3DCreate9(D3D_SDK_VERSION))) - { - skip("Failed to create an IDirect3D9 object, skipping test.\n"); - return; - } + d3d9 = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d9, "Failed to create a D3D object.\n"); for (display = 0; display < sizeof(formats) / sizeof(*formats); ++display) { @@ -2359,7 +2177,7 @@ static void test_scissor_size(void) { - IDirect3D9 *d3d9_ptr = 0; + IDirect3D9 *d3d9_ptr; unsigned int i; static struct { int winx; int winy; int backx; int backy; BOOL window; @@ -2371,11 +2189,7 @@ }; d3d9_ptr = Direct3DCreate9(D3D_SDK_VERSION); - ok(d3d9_ptr != NULL, "Failed to create IDirect3D9 object\n"); - if (!d3d9_ptr){ - skip("Failed to create IDirect3D9 object\n"); - return; - } + ok(!!d3d9_ptr, "Failed to create a D3D object.\n"); for(i=0; iWindowed = TRUE; - present_parameters->hDeviceWindow = window; - present_parameters->SwapEffect = D3DSWAPEFFECT_DISCARD; - - hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, - D3DCREATE_SOFTWARE_VERTEXPROCESSING, present_parameters, &device); - ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "Failed to create device, hr %#x.\n", hr); - if (SUCCEEDED(hr)) - return device; - - return NULL; -} - -static void test_begin_end_state_block(IDirect3DDevice9 *device_ptr) -{ - HRESULT hret = 0; - IDirect3DStateBlock9 *state_block_ptr = 0; - - /* Should succeed */ - hret = IDirect3DDevice9_BeginStateBlock(device_ptr); - ok(hret == D3D_OK, "BeginStateBlock returned: hret 0x%x. Expected hret 0x%x. Aborting.\n", hret, D3D_OK); - if (hret != D3D_OK) return; - - /* Calling BeginStateBlock while recording should return D3DERR_INVALIDCALL */ - hret = IDirect3DDevice9_BeginStateBlock(device_ptr); - ok(hret == D3DERR_INVALIDCALL, "BeginStateBlock returned: hret 0x%x. Expected hret 0x%x. Aborting.\n", hret, D3DERR_INVALIDCALL); - if (hret != D3DERR_INVALIDCALL) return; - - /* Should succeed */ - state_block_ptr = (IDirect3DStateBlock9 *)0xdeadbeef; - hret = IDirect3DDevice9_EndStateBlock(device_ptr, &state_block_ptr); - ok(hret == D3D_OK && state_block_ptr != 0 && state_block_ptr != (IDirect3DStateBlock9 *)0xdeadbeef, - "EndStateBlock returned: hret 0x%x, state_block_ptr %p. " - "Expected hret 0x%x, state_block_ptr != %p, state_block_ptr != 0xdeadbeef.\n", hret, state_block_ptr, D3D_OK, NULL); - IDirect3DStateBlock9_Release(state_block_ptr); - - /* Calling EndStateBlock while not recording should return D3DERR_INVALIDCALL. state_block_ptr should not be touched. */ - state_block_ptr = (IDirect3DStateBlock9 *)0xdeadbeef; - hret = IDirect3DDevice9_EndStateBlock(device_ptr, &state_block_ptr); - ok(hret == D3DERR_INVALIDCALL && state_block_ptr == (IDirect3DStateBlock9 *)0xdeadbeef, - "EndStateBlock returned: hret 0x%x, state_block_ptr %p. " - "Expected hret 0x%x, state_block_ptr 0xdeadbeef.\n", hret, state_block_ptr, D3DERR_INVALIDCALL); -} - /* ============================ State Testing Framework ========================== */ struct state_test @@ -2062,15 +1991,20 @@ /* =================== Main state tests function =============================== */ -static void test_state_management(IDirect3DDevice9 *device, D3DPRESENT_PARAMETERS *device_pparams) +static void test_state_management(void) { struct shader_constant_arg pshader_constant_arg; struct shader_constant_arg vshader_constant_arg; struct resource_test_arg resource_test_arg; struct render_state_arg render_state_arg; + D3DPRESENT_PARAMETERS present_parameters; struct light_arg light_arg; - HRESULT hret; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; + HWND window; + HRESULT hr; /* Test count: 2 for shader constants 1 for lights @@ -2081,9 +2015,29 @@ struct state_test tests[6]; unsigned int tcount = 0; - hret = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(hret == D3D_OK, "GetDeviceCaps returned %#x.\n", hret); - if (hret != D3D_OK) return; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION))) + { + skip("Failed to create a D3D object, skipping tests.\n"); + DestroyWindow(window); + return; + } + memset(&present_parameters, 0, sizeof(present_parameters)); + present_parameters.Windowed = TRUE; + present_parameters.hDeviceWindow = window; + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + if (FAILED(IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window, + D3DCREATE_SOFTWARE_VERTEXPROCESSING, &present_parameters, &device))) + { + skip("Failed to create a 3D device, skipping test.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); texture_stages = caps.MaxTextureBlendStages; @@ -2111,7 +2065,7 @@ transform_queue_test(&tests[tcount]); tcount++; - render_state_arg.device_pparams = device_pparams; + render_state_arg.device_pparams = &present_parameters; render_state_arg.pointsize_max = caps.MaxPointSize; render_states_queue_test(&tests[tcount], &render_state_arg); tcount++; @@ -2124,328 +2078,14 @@ tcount++; execute_test_chain_all(device, tests, tcount); -} - -static void test_shader_constant_apply(IDirect3DDevice9 *device) -{ - static const float initial[] = {0.0f, 0.0f, 0.0f, 0.0f}; - static const float vs_const[] = {1.0f, 2.0f, 3.0f, 4.0f}; - static const float ps_const[] = {5.0f, 6.0f, 7.0f, 8.0f}; - IDirect3DStateBlock9 *stateblock; - DWORD vs_version, ps_version; - D3DCAPS9 caps; - float ret[4]; - HRESULT hr; - - hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(SUCCEEDED(hr), "GetDeviceCaps returned %#x.\n", hr); - vs_version = caps.VertexShaderVersion & 0xffff; - ps_version = caps.PixelShaderVersion & 0xffff; - - if (vs_version) - { - hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, initial, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); - hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 1, initial, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); - - hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - - hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, vs_const, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); - } - if (ps_version) - { - hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 0, initial, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); - hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 1, initial, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); - - hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetpixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - - hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 0, ps_const, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); - } - - hr = IDirect3DDevice9_BeginStateBlock(device); - ok(SUCCEEDED(hr), "BeginStateBlock returned %#x\n", hr); - - if (vs_version) - { - hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 1, vs_const, 1); - ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); - } - if (ps_version) - { - hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 1, ps_const, 1); - ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); - } - - hr = IDirect3DDevice9_EndStateBlock(device, &stateblock); - ok(SUCCEEDED(hr), "EndStateBlock returned %#x\n", hr); - - if (vs_version) - { - hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, vs_const, sizeof(vs_const)), - "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); - hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - } - if (ps_version) - { - hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, ps_const, sizeof(ps_const)), - "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); - hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, initial, sizeof(initial)), - "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); - } - - /* Apply doesn't overwrite constants that aren't explicitly set on the source stateblock. */ - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply returned %#x\n", hr); - - if (vs_version) - { - hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, vs_const, sizeof(vs_const)), - "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); - hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, vs_const, sizeof(vs_const)), - "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); - } - if (ps_version) - { - hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, ps_const, sizeof(ps_const)), - "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); - hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 1, ret, 1); - ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); - ok(!memcmp(ret, ps_const, sizeof(ps_const)), - "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", - ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); - } - - IDirect3DStateBlock9_Release(stateblock); -} - -static void test_vdecl_apply(IDirect3DDevice9 *device) -{ - static const D3DVERTEXELEMENT9 decl1[] = - { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, - D3DDECL_END(), - }; - static const D3DVERTEXELEMENT9 decl2[] = - { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, - {0, 16, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, - D3DDECL_END(), - }; - - IDirect3DVertexDeclaration9 *declaration, *declaration1, *declaration2; - IDirect3DStateBlock9 *stateblock; - HRESULT hr; - - hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl1, &declaration1); - ok(SUCCEEDED(hr), "CreateVertexDeclaration failed, hr %#x.\n", hr); - - hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl2, &declaration2); - ok(SUCCEEDED(hr), "CreateVertexDeclaration failed, hr %#x.\n", hr); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_BeginStateBlock(device); - ok(SUCCEEDED(hr), "BeginStateBlock failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration1); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_EndStateBlock(device, &stateblock); - ok(SUCCEEDED(hr), "EndStateBlock failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration1, "Expected vertex declaration %p, received %p.\n", - declaration1, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration2); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration2, "Expected vertex declaration %p, received %p.\n", - declaration2, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration2); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration2, "Expected vertex declaration %p, received %p.\n", - declaration2, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == NULL, "Expected vertex declaration %p, received %p.\n", - NULL, declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration2); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration2, "Expected vertex declaration %p, received %p.\n", - declaration2, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - IDirect3DStateBlock9_Release(stateblock); - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration1); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_CreateStateBlock(device, D3DSBT_VERTEXSTATE, &stateblock); - ok(SUCCEEDED(hr), "CreateStateBlock failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration1, "Expected vertex declaration %p, received %p.\n", - declaration1, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration2); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration2, "Expected vertex declaration %p, received %p.\n", - declaration2, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration2); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration2, "Expected vertex declaration %p, received %p.\n", - declaration2, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == NULL, "Expected vertex declaration %p, received %p.\n", - NULL, declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, declaration2); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Capture(stateblock); - ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr); - hr = IDirect3DStateBlock9_Apply(stateblock); - ok(SUCCEEDED(hr), "Apply failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetVertexDeclaration(device, &declaration); - ok(SUCCEEDED(hr), "GetVertexDeclaration failed, hr %#x.\n", hr); - ok(declaration == declaration2, "Expected vertex declaration %p, received %p.\n", - declaration2, declaration); - IDirect3DVertexDeclaration9_Release(declaration); - - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed, hr %#x.\n", hr); - IDirect3DVertexDeclaration9_Release(declaration1); - IDirect3DVertexDeclaration9_Release(declaration2); - IDirect3DStateBlock9_Release(stateblock); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); } START_TEST(stateblock) { - D3DPRESENT_PARAMETERS device_pparams; - IDirect3DDevice9 *device; - ULONG refcount; - - if (!(device = init_d3d9(&device_pparams))) - return; - - test_begin_end_state_block(device); - test_state_management(device, &device_pparams); - test_shader_constant_apply(device); - test_vdecl_apply(device); - - refcount = IDirect3DDevice9_Release(device); - ok(!refcount, "Device has %u references left\n", refcount); + test_state_management(); } diff -Nru wine1.7-1.7.13/dlls/d3d9/tests/visual.c wine1.7-1.7.16/dlls/d3d9/tests/visual.c --- wine1.7-1.7.13/dlls/d3d9/tests/visual.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/tests/visual.c 2014-04-04 19:13:44.000000000 +0000 @@ -171,13 +171,13 @@ return ret; } -static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9) +static IDirect3DDevice9 *create_device(IDirect3D9 *d3d, HWND device_window, HWND focus_window, BOOL windowed) { D3DPRESENT_PARAMETERS present_parameters = {0}; IDirect3DDevice9 *device; - present_parameters.Windowed = TRUE; - present_parameters.hDeviceWindow = create_window(); + present_parameters.Windowed = windowed; + present_parameters.hDeviceWindow = device_window; present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; present_parameters.BackBufferWidth = 640; present_parameters.BackBufferHeight = 480; @@ -185,18 +185,19 @@ present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; - if (SUCCEEDED(IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device))) + if (SUCCEEDED(IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, focus_window, + D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device))) return device; - DestroyWindow(present_parameters.hDeviceWindow); return NULL; } static IDirect3DDevice9 *init_d3d9(void) { D3DADAPTER_IDENTIFIER9 identifier; + IDirect3DDevice9 *device; IDirect3D9 *d3d9; + HWND window; HRESULT hr; if (!(d3d9 = Direct3DCreate9(D3D_SDK_VERSION))) @@ -220,7 +221,13 @@ HIWORD(U(identifier.DriverVersion).HighPart), LOWORD(U(identifier.DriverVersion).HighPart), HIWORD(U(identifier.DriverVersion).LowPart), LOWORD(U(identifier.DriverVersion).LowPart)); - return create_device(d3d9); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + if ((device = create_device(d3d9, window, window, TRUE))) + return device; + + DestroyWindow(window); + return NULL; } static void cleanup_device(IDirect3DDevice9 *device) @@ -780,11 +787,6 @@ } } -typedef struct { - float in[4]; - DWORD out; -} test_data_t; - /* * c7 mova ARGB mov ARGB * -2.4 -2 0x00ffff00 -3 0x00ff0000 @@ -794,9 +796,21 @@ * 1.6 2 0x00ff00ff 1 0x000000ff * 2.4 2 0x00ff00ff 2 0x00ff00ff */ -static void test_mova(IDirect3DDevice9 *device) +static void test_mova(void) { - static const DWORD mova_test[] = { + IDirect3DVertexDeclaration9 *vertex_declaration; + IDirect3DVertexShader9 *mova_shader; + IDirect3DVertexShader9 *mov_shader; + IDirect3DDevice9 *device; + unsigned int i, j; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; + + static const DWORD mova_test[] = + { 0xfffe0200, /* vs_2_0 */ 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ 0x05000051, 0xa00f0000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, /* def c0, 1.0, 0.0, 0.0, 1.0 */ @@ -811,7 +825,8 @@ 0x02000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ 0x0000ffff /* END */ }; - static const DWORD mov_test[] = { + static const DWORD mov_test[] = + { 0xfffe0101, /* vs_1_1 */ 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position v0 */ 0x00000051, 0xa00f0000, 0x3f800000, 0x00000000, 0x00000000, 0x3f800000, /* def c0, 1.0, 0.0, 0.0, 1.0 */ @@ -826,8 +841,13 @@ 0x00000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ 0x0000ffff /* END */ }; - - static const test_data_t test_data[2][6] = { + static const struct + { + float in[4]; + DWORD out; + } + test_data[2][6] = + { { {{-2.4f, 0.0f, 0.0f, 0.0f}, 0x00ff0000}, {{-1.6f, 0.0f, 0.0f, 0.0f}, 0x00ffff00}, @@ -845,24 +865,37 @@ {{ 2.4f, 0.0f, 0.0f, 0.0f}, 0x00ff00ff} } }; - - static const float quad[][3] = { + static const struct vec3 quad[] = + { {-1.0f, -1.0f, 0.0f}, {-1.0f, 1.0f, 0.0f}, { 1.0f, -1.0f, 0.0f}, { 1.0f, 1.0f, 0.0f}, }; - - static const D3DVERTEXELEMENT9 decl_elements[] = { + static const D3DVERTEXELEMENT9 decl_elements[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, D3DDECL_END() }; - IDirect3DVertexDeclaration9 *vertex_declaration = NULL; - IDirect3DVertexShader9 *mova_shader = NULL; - IDirect3DVertexShader9 *mov_shader = NULL; - HRESULT hr; - UINT i, j; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) + { + skip("No vs_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_CreateVertexShader(device, mova_test, &mova_shader); ok(SUCCEEDED(hr), "CreateVertexShader failed (%08x)\n", hr); @@ -875,9 +908,9 @@ hr = IDirect3DDevice9_SetVertexShader(device, mov_shader); ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr); - for(j = 0; j < 2; ++j) + for (j = 0; j < sizeof(test_data) / sizeof(*test_data); ++j) { - for (i = 0; i < (sizeof(test_data[0]) / sizeof(test_data_t)); ++i) + for (i = 0; i < sizeof(*test_data) / sizeof(**test_data); ++i) { DWORD color; @@ -887,7 +920,7 @@ hr = IDirect3DDevice9_BeginScene(device); ok(SUCCEEDED(hr), "BeginScene failed (%08x)\n", hr); - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quad[0], 3 * sizeof(float)); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%08x)\n", hr); hr = IDirect3DDevice9_EndScene(device); @@ -907,12 +940,14 @@ ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr); } - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr); - IDirect3DVertexDeclaration9_Release(vertex_declaration); IDirect3DVertexShader9_Release(mova_shader); IDirect3DVertexShader9_Release(mov_shader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } struct sVertex { @@ -1739,17 +1774,25 @@ * linear table fog with non foggy vertex shader * vertex fog with foggy vertex shader, non-linear * fog with shader, non-linear fog with foggy shader, - * linear table fog with foggy shader - */ -static void fog_with_shader_test(IDirect3DDevice9 *device) + * linear table fog with foggy shader */ +static void fog_with_shader_test(void) { - HRESULT hr; + IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; + IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + IDirect3DDevice9 *device; + unsigned int i, j; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; - union { + HWND window; + HRESULT hr; + union + { float f; DWORD i; } start, end; - unsigned int i, j; /* basic vertex shader without fog computation ("non foggy") */ static const DWORD vertex_shader_code1[] = @@ -1801,32 +1844,31 @@ 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ 0x0000ffff }; - - static struct vertex quad[] = { + static struct vertex quad[] = + { {-1.0f, -1.0f, 0.0f, 0xffff0000 }, {-1.0f, 1.0f, 0.0f, 0xffff0000 }, { 1.0f, -1.0f, 0.0f, 0xffff0000 }, { 1.0f, 1.0f, 0.0f, 0xffff0000 }, }; - - static const D3DVERTEXELEMENT9 decl_elements[] = { + static const D3DVERTEXELEMENT9 decl_elements[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; - - IDirect3DVertexDeclaration9 *vertex_declaration = NULL; - IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; - IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; - - /* This reference data was collected on a nVidia GeForce 7600GS driver version 84.19 DirectX version 9.0c on Windows XP */ - static const struct test_data_t { + /* This reference data was collected on a nVidia GeForce 7600GS driver + * version 84.19 DirectX version 9.0c on Windows XP. */ + static const struct test_data_t + { int vshader; int pshader; D3DFOGMODE vfog; D3DFOGMODE tfog; unsigned int color[11]; - } test_data[] = { + } + test_data[] = + { /* only pixel shader: */ {0, 1, D3DFOG_NONE, D3DFOG_LINEAR, {0x00ff0000, 0x00ff0000, 0x00df2000, 0x00bf4000, 0x009f6000, 0x007f8000, @@ -2003,10 +2045,43 @@ {0x00ff0000, 0x00ff0000, 0x00df2000, 0x00bf4000, 0x009f6000, 0x007f8000, 0x005fa000, 0x0040bf00, 0x0020df00, 0x0000ff00, 0x0000ff00}}, }; + static const D3DMATRIX identity = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }}}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0) || caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) + { + skip("No shader model 2 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } - /* NOTE: changing these values will not affect the tests with foggy vertex shader, as the values are hardcoded in the shader*/ - start.f=0.1f; - end.f=0.9f; + /* NOTE: Changing these values will not affect the tests with foggy vertex + * shader, as the values are hardcoded in the shader. */ + start.f = 0.1f; + end.f = 0.9f; + + /* Some of the tests seem to depend on the projection matrix explicitly + * being set to an identity matrix, even though that's the default. + * (AMD Radeon HD 6310, Windows 7) */ + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &identity); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code1, &vertex_shader[1]); ok(SUCCEEDED(hr), "CreateVertexShader failed (%08x)\n", hr); @@ -2061,7 +2136,7 @@ quad[2].z = 0.001f + (float)j / 10.02f; quad[3].z = 0.001f + (float)j / 10.02f; - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff00ff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed (%08x)\n", hr); hr = IDirect3DDevice9_BeginScene(device); @@ -2083,22 +2158,17 @@ } } - /* reset states */ - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "SetPixelShader failed (%08x)\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%08x)\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, FALSE); - ok(hr == D3D_OK, "Turning off fog calculations failed (%08x)\n", hr); - IDirect3DVertexShader9_Release(vertex_shader[1]); IDirect3DVertexShader9_Release(vertex_shader[2]); IDirect3DVertexShader9_Release(vertex_shader[3]); IDirect3DPixelShader9_Release(pixel_shader[1]); IDirect3DPixelShader9_Release(pixel_shader[2]); IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void generate_bumpmap_textures(IDirect3DDevice9 *device) { @@ -2123,10 +2193,7 @@ DWORD *ptr = (DWORD *)(((BYTE *)locked_rect.pBits) + (y * locked_rect.Pitch)); for (x = 0; x < 128; ++x) { - if(y>62 && y<66 && x>62 && x<66) - *ptr++ = 0xffffffff; - else - *ptr++ = 0xff000000; + *ptr++ = D3DCOLOR_ARGB(0xff, x * 2, y * 2, 0); } } else @@ -2172,23 +2239,36 @@ } } -/* test the behavior of the texbem instruction - * with normal 2D and projective 2D textures - */ -static void texbem_test(IDirect3DDevice9 *device) +/* Test the behavior of the texbem instruction with normal 2D and projective + * 2D textures. */ +static void texbem_test(void) { - HRESULT hr; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + /* Use asymmetric matrix to test loading. */ + float bumpenvmat[4] = {0.0f, 0.5f, -0.5f, 0.0f}; + IDirect3DPixelShader9 *pixel_shader = NULL; + IDirect3DTexture9 *texture1, *texture2; + IDirect3DTexture9 *texture = NULL; + D3DLOCKED_RECT locked_rect; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; int i; - static const DWORD pixel_shader_code[] = { + static const DWORD pixel_shader_code[] = + { 0xffff0101, /* ps_1_1*/ 0x00000042, 0xb00f0000, /* tex t0*/ 0x00000043, 0xb00f0001, 0xb0e40000, /* texbem t1, t0*/ 0x00000001, 0x800f0000, 0xb0e40001, /* mov r0, t1*/ 0x0000ffff }; - static const DWORD double_texbem_code[] = { + static const DWORD double_texbem_code[] = + { 0xffff0103, /* ps_1_3 */ 0x00000042, 0xb00f0000, /* tex t0 */ 0x00000043, 0xb00f0001, 0xb0e40000, /* texbem t1, t0 */ @@ -2197,40 +2277,61 @@ 0x00000002, 0x800f0000, 0xb0e40001, 0xb0e40003, /* add r0, t1, t3 */ 0x0000ffff /* end */ }; - - - static const float quad[][7] = { - {-128.0f/640.0f, -128.0f/480.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f}, - {-128.0f/640.0f, 128.0f/480.0f, 0.1f, 0.0f, 1.0f, 0.0f, 1.0f}, - { 128.0f/640.0f, -128.0f/480.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f}, - { 128.0f/640.0f, 128.0f/480.0f, 0.1f, 1.0f, 1.0f, 1.0f, 1.0f}, - }; - static const float quad_proj[][9] = { - {-128.0f/640.0f, -128.0f/480.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 128.0f}, - {-128.0f/640.0f, 128.0f/480.0f, 0.1f, 0.0f, 1.0f, 0.0f, 128.0f, 0.0f, 128.0f}, - { 128.0f/640.0f, -128.0f/480.0f, 0.1f, 1.0f, 0.0f, 128.0f, 0.0f, 0.0f, 128.0f}, - { 128.0f/640.0f, 128.0f/480.0f, 0.1f, 1.0f, 1.0f, 128.0f, 128.0f, 0.0f, 128.0f}, + static const float quad[][7] = + { + {-1.0f, -1.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f}, + {-1.0f, 1.0f, 0.1f, 0.0f, 1.0f, 0.0f, 1.0f}, + { 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f}, + { 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 1.0f, 1.0f}, + }; + static const float quad_proj[][9] = + { + {-1.0f, -1.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 128.0f}, + {-1.0f, 1.0f, 0.1f, 0.0f, 1.0f, 0.0f, 128.0f, 0.0f, 128.0f}, + { 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 128.0f, 0.0f, 0.0f, 128.0f}, + { 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 128.0f, 128.0f, 0.0f, 128.0f}, + }; + static const float double_quad[] = + { + -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f, 0.5f, + -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f, 0.5f, + 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f, 0.5f, + 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.5f, 0.5f, 0.0f, 0.0f, 0.5f, 0.5f, + }; + static const D3DVERTEXELEMENT9 decl_elements[][4] = + { + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, + {0, 20, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, + D3DDECL_END() + }, + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, + {0, 20, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, + D3DDECL_END() + }, }; - static const D3DVERTEXELEMENT9 decl_elements[][4] = { { - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, - {0, 20, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, - D3DDECL_END() - },{ - {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, - {0, 20, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, - D3DDECL_END() - } }; - - /* use asymmetric matrix to test loading */ - float bumpenvmat[4] = {0.0,0.5,-0.5,0.0}; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - IDirect3DVertexDeclaration9 *vertex_declaration = NULL; - IDirect3DPixelShader9 *pixel_shader = NULL; - IDirect3DTexture9 *texture = NULL, *texture1, *texture2; - D3DLOCKED_RECT locked_rect; + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1)) + { + skip("No ps_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } generate_bumpmap_textures(device); @@ -2243,11 +2344,11 @@ hr = IDirect3DDevice9_SetVertexShader(device, NULL); ok(SUCCEEDED(hr), "SetVertexShader failed (%08x)\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff00ff, 0.0, 0); - ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed (%08x)\n", hr); - for(i=0; i<2; i++) { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed (%08x)\n", hr); + if(i) { hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT4|D3DTTFF_PROJECTED); @@ -2276,14 +2377,20 @@ hr = IDirect3DDevice9_EndScene(device); ok(SUCCEEDED(hr), "EndScene failed (0x%08x)\n", hr); - color = getPixelColor(device, 320-32, 240); - ok(color_match(color, 0x00ffffff, 4), "texbem failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320+32, 240); - ok(color_match(color, 0x00ffffff, 4), "texbem failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320, 240-32); - ok(color_match(color, 0x00ffffff, 4), "texbem failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320, 240+32); - ok(color_match(color, 0x00ffffff, 4), "texbem failed: Got color 0x%08x, expected 0x00ffffff.\n", color); + /* The Window 8 testbot (WARP) seems to use the transposed + * D3DTSS_BUMPENVMAT matrix. */ + color = getPixelColor(device, 160, 240); + ok(color_match(color, 0x007e8000, 4) || broken(color_match(color, 0x00007e00, 4)), + "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 480, 240); + ok(color_match(color, 0x007e8000, 4) || broken(color_match(color, 0x00fe7e00, 4)), + "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 320, 120); + ok(color_match(color, 0x007e8000, 4) || broken(color_match(color, 0x0080fe00, 4)), + "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 320, 360); + ok(color_match(color, 0x007e8000, 4) || broken(color_match(color, 0x00800000, 4)), + "Got unexpected color 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr); @@ -2420,33 +2527,16 @@ ok(SUCCEEDED(hr), "IDirect3DDevice9_SetSamplerState returned %#x.\n", hr); hr = IDirect3DDevice9_BeginScene(device); - ok(SUCCEEDED(hr), "BeginScene failed (0x%08x)\n", hr); - if(SUCCEEDED(hr)) { - static const float double_quad[] = { - -1.0, -1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.5, 0.5, - 1.0, -1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.5, 0.5, - -1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.5, 0.5, - 1.0, 1.0, 0.0, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.5, 0.5, - }; - - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, double_quad, sizeof(float) * 11); - ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (0x%08x)\n", hr); - hr = IDirect3DDevice9_EndScene(device); - ok(SUCCEEDED(hr), "EndScene failed (0x%08x)\n", hr); - } + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, double_quad, sizeof(float) * 11); + ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + /* The Window 8 testbot (WARP) seems to use the transposed + * D3DTSS_BUMPENVMAT matrix. */ color = getPixelColor(device, 320, 240); - ok(color == 0x00ffff00, "double texbem failed: Got color 0x%08x, expected 0x00ffff00.\n", color); - - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetTexture failed (0x%08x)\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 1, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetTexture failed (0x%08x)\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 2, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetTexture failed (0x%08x)\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 3, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetTexture failed (0x%08x)\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "Direct3DDevice9_SetPixelShader failed (0x%08x)\n", hr); + ok(color_match(color, 0x00ffff00, 1) || broken(color_match(color, 0x0000ffff, 1)), + "Got unexpected color 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr); @@ -2455,6 +2545,11 @@ IDirect3DTexture9_Release(texture); IDirect3DTexture9_Release(texture1); IDirect3DTexture9_Release(texture2); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void z_range_test(IDirect3DDevice9 *device) @@ -4672,17 +4767,24 @@ IDirect3DVertexDeclaration9_Release(decl4); } -static void texdepth_test(IDirect3DDevice9 *device) +static void texdepth_test(void) { IDirect3DPixelShader9 *shader; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; HRESULT hr; - const float texdepth_test_data1[] = { 0.25, 2.0, 0.0, 0.0}; - const float texdepth_test_data2[] = { 0.25, 0.5, 0.0, 0.0}; - const float texdepth_test_data3[] = {-1.00, 0.1, 0.0, 0.0}; - const float texdepth_test_data4[] = {-0.25, -0.5, 0.0, 0.0}; - const float texdepth_test_data5[] = { 1.00, -0.1, 0.0, 0.0}; - const float texdepth_test_data6[] = { 1.00, 0.5, 0.0, 0.0}; - const float texdepth_test_data7[] = { 0.50, 0.0, 0.0, 0.0}; + + static const float texdepth_test_data1[] = { 0.25f, 2.0f, 0.0f, 0.0f}; + static const float texdepth_test_data2[] = { 0.25f, 0.5f, 0.0f, 0.0f}; + static const float texdepth_test_data3[] = {-1.00f, 0.1f, 0.0f, 0.0f}; + static const float texdepth_test_data4[] = {-0.25f, -0.5f, 0.0f, 0.0f}; + static const float texdepth_test_data5[] = { 1.00f, -0.1f, 0.0f, 0.0f}; + static const float texdepth_test_data6[] = { 1.00f, 0.5f, 0.0f, 0.0f}; + static const float texdepth_test_data7[] = { 0.50f, 0.0f, 0.0f, 0.0f}; static const DWORD shader_code[] = { 0xffff0104, /* ps_1_4 */ @@ -4693,19 +4795,40 @@ 0x00000001, 0x800f0000, 0xa0e40001, /* mov r0, c1 */ 0x0000ffff /* end */ }; - DWORD color; - float vertex[] = { - -1.0, -1.0, 0.0, - 1.0, -1.0, 1.0, - -1.0, 1.0, 0.0, - 1.0, 1.0, 1.0 - }; + static const float vertex[] = + { + -1.0f, -1.0f, 0.0f, + -1.0f, 1.0f, 0.0f, + 1.0f, -1.0f, 1.0f, + 1.0f, 1.0f, 1.0f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1)) + { + skip("No ps_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_CreatePixelShader(device, shader_code, &shader); ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr); hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffff00, 0.0, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_TRUE); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZWRITEENABLE, TRUE); @@ -4890,31 +5013,33 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - /* Cleanup */ - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed (%08x)\n", hr); IDirect3DPixelShader9_Release(shader); - - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZWRITEENABLE, TRUE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState returned %08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void texkill_test(IDirect3DDevice9 *device) +static void texkill_test(void) { IDirect3DPixelShader9 *shader; - HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; - const float vertex[] = { - /* bottom top right left */ - -1.0, -1.0, 1.0, -0.1, 0.9, 0.9, -0.1, - 1.0, -1.0, 0.0, 0.9, -0.1, 0.9, -0.1, - -1.0, 1.0, 1.0, -0.1, 0.9, -0.1, 0.9, - 1.0, 1.0, 0.0, 0.9, -0.1, -0.1, 0.9, + static const float vertex[] = + { + /* bottom top right left */ + -1.0f, -1.0f, 1.0f, -0.1f, 0.9f, 0.9f, -0.1f, + -1.0f, 1.0f, 1.0f, -0.1f, 0.9f, -0.1f, 0.9f, + 1.0f, -1.0f, 0.0f, 0.9f, -0.1f, 0.9f, -0.1f, + 1.0f, 1.0f, 0.0f, 0.9f, -0.1f, -0.1f, 0.9f, }; - static const DWORD shader_code_11[] = { 0xffff0101, /* ps_1_1 */ @@ -4933,7 +5058,26 @@ 0x0000ffff /* end */ }; - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ff00, 0.0, 0); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1)) + { + skip("No ps_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ff00, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr); hr = IDirect3DDevice9_CreatePixelShader(device, shader_code_11, &shader); ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr); @@ -4996,10 +5140,11 @@ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffff00, 0.0, 0); ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr); - hr = IDirect3DDevice9_CreatePixelShader(device, shader_code_20, &shader); - if(FAILED(hr)) { - skip("Failed to create 2.0 test shader, most likely not supported\n"); - return; + if (FAILED(IDirect3DDevice9_CreatePixelShader(device, shader_code_20, &shader))) + { + skip("Failed to create 2.0 test shader, most likely not supported.\n"); + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_SetPixelShader(device, shader); @@ -5053,21 +5198,28 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - /* Cleanup */ - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "SetPixelShader failed (%08x)\n", hr); IDirect3DPixelShader9_Release(shader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void x8l8v8u8_test(IDirect3DDevice9 *device) +static void x8l8v8u8_test(void) { - IDirect3D9 *d3d9; - HRESULT hr; - IDirect3DTexture9 *texture; - IDirect3DPixelShader9 *shader; IDirect3DPixelShader9 *shader2; + IDirect3DPixelShader9 *shader; + IDirect3DTexture9 *texture; + IDirect3DDevice9 *device; D3DLOCKED_RECT lr; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; + static const DWORD shader_code[] = { 0xffff0101, /* ps_1_1 */ @@ -5082,29 +5234,46 @@ 0x00000001, 0x800f0000, 0xb0ff0000, /* mov r0, t0.w */ 0x0000ffff /* end */ }; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, 0.5f, 0.5f, + -1.0f, 1.0f, 0.1f, 0.5f, 0.5f, + 1.0f, -1.0f, 0.1f, 0.5f, 0.5f, + 1.0f, 1.0f, 0.1f, 0.5f, 0.5f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - float quad[] = { - -1.0, -1.0, 0.1, 0.5, 0.5, - 1.0, -1.0, 0.1, 0.5, 0.5, - -1.0, 1.0, 0.1, 0.5, 0.5, - 1.0, 1.0, 0.1, 0.5, 0.5, - }; - - memset(&lr, 0, sizeof(lr)); - IDirect3DDevice9_GetDirect3D(device, &d3d9); - hr = IDirect3D9_CheckDeviceFormat(d3d9, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - 0, D3DRTYPE_TEXTURE, D3DFMT_X8L8V8U8); - IDirect3D9_Release(d3d9); - if(FAILED(hr)) { - skip("No D3DFMT_X8L8V8U8 support\n"); - return; - }; + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1)) + { + skip("No ps_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_X8L8V8U8))) + { + skip("No D3DFMT_X8L8V8U8 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_CreateTexture(device, 1, 1, 1, 0, D3DFMT_X8L8V8U8, D3DPOOL_MANAGED, &texture, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed (%08x)\n", hr); + memset(&lr, 0, sizeof(lr)); hr = IDirect3DTexture9_LockRect(texture, 0, &lr, NULL, 0); ok(hr == D3D_OK, "IDirect3DTexture9_LockRect failed (%08x)\n", hr); *((DWORD *) lr.pBits) = 0x11ca3141; @@ -5156,13 +5325,14 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed (%08x)\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed (%08x)\n", hr); IDirect3DPixelShader9_Release(shader); IDirect3DPixelShader9_Release(shader2); IDirect3DTexture9_Release(texture); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void autogen_mipmap_test(IDirect3DDevice9 *device) @@ -5274,12 +5444,18 @@ ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); } -static void test_constant_clamp_vs(IDirect3DDevice9 *device) +static void test_constant_clamp_vs(void) { IDirect3DVertexShader9 *shader_11, *shader_11_2, *shader_20, *shader_20_2; IDirect3DVertexDeclaration9 *decl; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + D3DCAPS9 caps; + HWND window; HRESULT hr; - DWORD color; + static const DWORD shader_code_11[] = { 0xfffe0101, /* vs_1_1 */ @@ -5320,38 +5496,62 @@ 0x02000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ 0x0000ffff /* end */ }; - static const D3DVERTEXELEMENT9 decl_elements[] = { + static const D3DVERTEXELEMENT9 decl_elements[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, D3DDECL_END() }; - float quad1[] = { - -1.0, -1.0, 0.1, - 0.0, -1.0, 0.1, - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1 + static const float quad1[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 0.0f, 0.1f, + 0.0f, -1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, }; - float quad2[] = { - 0.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1 + static const float quad2[] = + { + 0.0f, -1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, }; - float quad3[] = { - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1, - 0.0, 1.0, 0.1, - 1.0, 1.0, 0.1 + static const float quad3[] = + { + 0.0f, 0.0f, 0.1f, + 0.0f, 1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, + 1.0f, 1.0f, 0.1f, }; - float quad4[] = { - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1, - -1.0, 1.0, 0.1, - 0.0, 1.0, 0.1 - }; - float test_data_c1[4] = { 1.25, -0.50, -1.50, 1.0}; - float test_data_c2[4] = { -0.50, 1.25, 2.00, 1.0}; + static const float quad4[] = + { + -1.0f, 0.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, + 0.0f, 1.0f, 0.1f, + }; + static const float test_data_c1[4] = { 1.25f, -0.50f, -1.50f, 1.0f}; + static const float test_data_c2[4] = {-0.50f, 1.25f, 2.00f, 1.0f}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ffff, 0.0, 0); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(1, 1)) + { + skip("No vs_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_CreateVertexShader(device, shader_code_11, &shader_11); @@ -5404,11 +5604,6 @@ ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); } - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexDeclaration returned %08x\n", hr); - color = getPixelColor(device, 160, 360); ok(color_match(color, D3DCOLOR_ARGB(0x00, 0xbf, 0xbf, 0x80), 1), "quad 1 has color %08x, expected 0x00bfbf80\n", color); @@ -5433,13 +5628,24 @@ if(shader_20) IDirect3DVertexShader9_Release(shader_20); IDirect3DVertexShader9_Release(shader_11_2); IDirect3DVertexShader9_Release(shader_11); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void constant_clamp_ps_test(IDirect3DDevice9 *device) +static void constant_clamp_ps_test(void) { IDirect3DPixelShader9 *shader_11, *shader_12, *shader_14, *shader_20; - HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; + static const DWORD shader_code_11[] = { 0xffff0101, /* ps_1_1 */ @@ -5476,34 +5682,57 @@ 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */ 0x0000ffff /* end */ }; - float quad1[] = { - -1.0, -1.0, 0.1, - 0.0, -1.0, 0.1, - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1 - }; - float quad2[] = { - 0.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1 + static const float quad1[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 0.0f, 0.1f, + 0.0f, -1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, }; - float quad3[] = { - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1, - 0.0, 1.0, 0.1, - 1.0, 1.0, 0.1 + static const float quad2[] = + { + 0.0f, -1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, }; - float quad4[] = { - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1, - -1.0, 1.0, 0.1, - 0.0, 1.0, 0.1 + static const float quad3[] = + { + 0.0f, 0.0f, 0.1f, + 0.0f, 1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, + 1.0f, 1.0f, 0.1f, }; - float test_data_c1[4] = { 1.25, -0.50, -1.50, 1.0}; - float test_data_c2[4] = { -0.50, 1.25, 2.00, 1.0}; + static const float quad4[] = + { + -1.0f, 0.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, + 0.0f, 1.0f, 0.1f, + }; + static const float test_data_c1[4] = { 1.25f, -0.50f, -1.50f, 1.0f}; + static const float test_data_c2[4] = {-0.50f, 1.25f, 2.00f, 1.0f}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ffff, 0.0, 0); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 4)) + { + skip("No ps_1_4 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_CreatePixelShader(device, shader_code_11, &shader_11); @@ -5551,8 +5780,6 @@ hr = IDirect3DDevice9_EndScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); } - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr); color = getPixelColor(device, 160, 360); ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x80, 0x80, 0x00), 1), @@ -5575,14 +5802,24 @@ IDirect3DPixelShader9_Release(shader_14); IDirect3DPixelShader9_Release(shader_12); IDirect3DPixelShader9_Release(shader_11); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void dp2add_ps_test(IDirect3DDevice9 *device) +static void dp2add_ps_test(void) { - IDirect3DPixelShader9 *shader_dp2add = NULL; - IDirect3DPixelShader9 *shader_dp2add_sat = NULL; - HRESULT hr; + IDirect3DPixelShader9 *shader_dp2add_sat; + IDirect3DPixelShader9 *shader_dp2add; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; /* DP2ADD is defined as: (src0.r * src1.r) + (src0.g * src1.g) + src2. * One D3D restriction of all shader instructions except SINCOS is that no more than 2 @@ -5619,16 +5856,34 @@ 0x02000001, 0x800f0800, 0x80e40000, /* mov oC0, r0 */ 0x0000ffff /* end */ }; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 1.0f, 0.1f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - const float quad[] = { - -1.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 1.0, 0.1 - }; - + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) + { + skip("No ps_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_CreatePixelShader(device, shader_code_dp2add, &shader_dp2add); @@ -5640,73 +5895,58 @@ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF returned %08x\n", hr); - if (shader_dp2add) { - - hr = IDirect3DDevice9_SetPixelShader(device, shader_dp2add); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned %08x\n", hr); - - hr = IDirect3DDevice9_BeginScene(device); - ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %08x\n", hr); - if(SUCCEEDED(hr)) - { - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); - ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr); - - hr = IDirect3DDevice9_EndScene(device); - ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); - } - - color = getPixelColor(device, 360, 240); - ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x7f, 0x7f, 0x7f), 1), - "dp2add pixel has color %08x, expected ~0x007f7f7f\n", color); - - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - - IDirect3DPixelShader9_Release(shader_dp2add); - } else { - skip("dp2add shader creation failed\n"); - } - - if (shader_dp2add_sat) { - - hr = IDirect3DDevice9_SetPixelShader(device, shader_dp2add_sat); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned %08x\n", hr); + hr = IDirect3DDevice9_SetPixelShader(device, shader_dp2add); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); + ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); - hr = IDirect3DDevice9_BeginScene(device); - ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %08x\n", hr); - if(SUCCEEDED(hr)) - { - hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); - ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr); + color = getPixelColor(device, 360, 240); + ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x7f, 0x7f, 0x7f), 1), "Got unexpected color 0x%08x.\n", color); - hr = IDirect3DDevice9_EndScene(device); - ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); - } + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present frame, hr %#x.\n", hr); + IDirect3DPixelShader9_Release(shader_dp2add); - color = getPixelColor(device, 360, 240); - ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x7f, 0x7f, 0x7f), 1), - "dp2add pixel has color %08x, expected ~0x007f7f7f\n", color); + hr = IDirect3DDevice9_SetPixelShader(device, shader_dp2add_sat); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); + ok(SUCCEEDED(hr), "Failed to draw primitive, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); - hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); + color = getPixelColor(device, 360, 240); + ok(color_match(color, D3DCOLOR_ARGB(0x00, 0x7f, 0x7f, 0x7f), 1), "Got unexpected color 0x%08x.\n", color); - IDirect3DPixelShader9_Release(shader_dp2add_sat); - } else { - skip("dp2add shader creation failed\n"); - } + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present frame, hr %#x.\n", hr); + IDirect3DPixelShader9_Release(shader_dp2add_sat); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void cnd_test(IDirect3DDevice9 *device) +static void cnd_test(void) { - IDirect3DPixelShader9 *shader_11, *shader_12, *shader_13, *shader_14; - IDirect3DPixelShader9 *shader_11_coissue, *shader_12_coissue, *shader_13_coissue, *shader_14_coissue; IDirect3DPixelShader9 *shader_11_coissue_2, *shader_12_coissue_2, *shader_13_coissue_2, *shader_14_coissue_2; - HRESULT hr; + IDirect3DPixelShader9 *shader_11_coissue, *shader_12_coissue, *shader_13_coissue, *shader_14_coissue; + IDirect3DPixelShader9 *shader_11, *shader_12, *shader_13, *shader_14; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + HWND window; DWORD color; + HRESULT hr; + /* ps 1.x shaders are rather picky with writemasks and source swizzles. * The dp3 is used to copy r0.r to all components of r1, then copy r1.a to * r0.a. Essentially it does a mov r0.a, r0.r, which isn't allowed as-is @@ -5879,36 +6119,59 @@ 0x00000001, 0x80080000, 0xa0ff0000, /* mov r0.a, c0.a */ 0x0000ffff /* end */ }; - float quad1[] = { - -1.0, -1.0, 0.1, 0.0, 0.0, 1.0, - 0.0, -1.0, 0.1, 1.0, 0.0, 1.0, - -1.0, 0.0, 0.1, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.1, 1.0, 1.0, 0.0 - }; - float quad2[] = { - 0.0, -1.0, 0.1, 0.0, 0.0, 1.0, - 1.0, -1.0, 0.1, 1.0, 0.0, 1.0, - 0.0, 0.0, 0.1, 0.0, 1.0, 0.0, - 1.0, 0.0, 0.1, 1.0, 1.0, 0.0 - }; - float quad3[] = { - 0.0, 0.0, 0.1, 0.0, 0.0, 1.0, - 1.0, 0.0, 0.1, 1.0, 0.0, 1.0, - 0.0, 1.0, 0.1, 0.0, 1.0, 0.0, - 1.0, 1.0, 0.1, 1.0, 1.0, 0.0 - }; - float quad4[] = { - -1.0, 0.0, 0.1, 0.0, 0.0, 1.0, - 0.0, 0.0, 0.1, 1.0, 0.0, 1.0, - -1.0, 1.0, 0.1, 0.0, 1.0, 0.0, - 0.0, 1.0, 0.1, 1.0, 1.0, 0.0 - }; - float test_data_c1[4] = { 0.0, 0.0, 0.0, 0.0}; - float test_data_c2[4] = { 1.0, 1.0, 1.0, 1.0}; - float test_data_c1_coi[4] = { 0.0, 1.0, 0.0, 0.0}; - float test_data_c2_coi[4] = { 1.0, 0.0, 1.0, 1.0}; + static const float quad1[] = + { + -1.0f, -1.0f, 0.1f, 0.0f, 0.0f, 1.0f, + -1.0f, 0.0f, 0.1f, 0.0f, 1.0f, 0.0f, + 0.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, 0.0f, + }; + static const float quad2[] = + { + 0.0f, -1.0f, 0.1f, 0.0f, 0.0f, 1.0f, + 0.0f, 0.0f, 0.1f, 0.0f, 1.0f, 0.0f, + 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, + 1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 0.0f, + }; + static const float quad3[] = + { + 0.0f, 0.0f, 0.1f, 0.0f, 0.0f, 1.0f, + 0.0f, 1.0f, 0.1f, 0.0f, 1.0f, 0.0f, + 1.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 0.0f, + }; + static const float quad4[] = + { + -1.0f, 0.0f, 0.1f, 0.0f, 0.0f, 1.0f, + -1.0f, 1.0f, 0.1f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, + 0.0f, 1.0f, 0.1f, 1.0f, 1.0f, 0.0f, + }; + static const float test_data_c1[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + static const float test_data_c2[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float test_data_c1_coi[4] = {0.0f, 1.0f, 0.0f, 0.0f}; + static const float test_data_c2_coi[4] = {1.0f, 0.0f, 1.0f, 1.0f}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ffff, 0.0, 0); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 4)) + { + skip("No ps_1_4 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_CreatePixelShader(device, shader_code_11, &shader_11); @@ -6114,7 +6377,9 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - /* Retest with the coissue flag on the alpha instruction instead. This works "as expected". */ + /* Retest with the coissue flag on the alpha instruction instead. This + * works "as expected". The Windows 8 testbot (WARP) seems to handle this + * the same as coissue on .rgb. */ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ffff, 0.0, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); @@ -6146,9 +6411,6 @@ ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); } - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned %08x\n", hr); - /* 1.4 shader */ color = getPixelColor(device, 158, 118); ok(color == 0x00ffffff, "pixel 158, 118 has color %08x, expected 0x00ffffff\n", color); @@ -6161,13 +6423,13 @@ /* 1.1 shader */ color = getPixelColor(device, 238, 358); - ok(color_match(color, 0x00ffffff, 1), + ok(color_match(color, 0x00ffffff, 1) || broken(color_match(color, 0x00000000, 1)), "pixel 238, 358 has color %08x, expected 0x00ffffff\n", color); color = getPixelColor(device, 242, 358); ok(color_match(color, 0x00000000, 1), "pixel 242, 358 has color %08x, expected 0x00000000\n", color); color = getPixelColor(device, 238, 362); - ok(color_match(color, 0x00ffffff, 1), + ok(color_match(color, 0x00ffffff, 1) || broken(color_match(color, 0x00000000, 1)), "pixel 238, 362 has color %08x, expected 0x00ffffff\n", color); color = getPixelColor(device, 242, 362); ok(color_match(color, 0x00000000, 1), @@ -6175,13 +6437,13 @@ /* 1.2 shader */ color = getPixelColor(device, 558, 358); - ok(color_match(color, 0x00ffffff, 1), + ok(color_match(color, 0x00ffffff, 1) || broken(color_match(color, 0x00000000, 1)), "pixel 558, 358 has color %08x, expected 0x00ffffff\n", color); color = getPixelColor(device, 562, 358); ok(color_match(color, 0x00000000, 1), "pixel 562, 358 has color %08x, expected 0x00000000\n", color); color = getPixelColor(device, 558, 362); - ok(color_match(color, 0x00ffffff, 1), + ok(color_match(color, 0x00ffffff, 1) || broken(color_match(color, 0x00000000, 1)), "pixel 558, 362 has color %08x, expected 0x00ffffff\n", color); color = getPixelColor(device, 562, 362); ok(color_match(color, 0x00000000, 1), @@ -6189,13 +6451,13 @@ /* 1.3 shader */ color = getPixelColor(device, 558, 118); - ok(color_match(color, 0x00ffffff, 1), + ok(color_match(color, 0x00ffffff, 1) || broken(color_match(color, 0x00000000, 1)), "pixel 558, 118 has color %08x, expected 0x00ffffff\n", color); color = getPixelColor(device, 562, 118); ok(color_match(color, 0x00000000, 1), "pixel 562, 118 has color %08x, expected 0x00000000\n", color); color = getPixelColor(device, 558, 122); - ok(color_match(color, 0x00ffffff, 1), + ok(color_match(color, 0x00ffffff, 1) || broken(color_match(color, 0x00000000, 1)), "pixel 558, 122 has color %08x, expected 0x00ffffff\n", color); color = getPixelColor(device, 562, 122); ok(color_match(color, 0x00000000, 1), @@ -6216,10 +6478,25 @@ IDirect3DPixelShader9_Release(shader_13); IDirect3DPixelShader9_Release(shader_12); IDirect3DPixelShader9_Release(shader_11); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void nested_loop_test(IDirect3DDevice9 *device) +static void nested_loop_test(void) { + IDirect3DVertexShader9 *vshader; + IDirect3DPixelShader9 *shader; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + static const DWORD shader_code[] = { 0xffff0300, /* ps_3_0 */ @@ -6243,16 +6520,32 @@ 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */ 0x0000ffff /* end */ }; - IDirect3DPixelShader9 *shader; - IDirect3DVertexShader9 *vshader; - HRESULT hr; - DWORD color; - const float quad[] = { - -1.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 1.0, 0.1 - }; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 1.0f, 0.1f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0) || caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No shader model 3 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_CreatePixelShader(device, shader_code, &shader); ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader failed with %08x\n", hr); @@ -6264,7 +6557,7 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed with %08x\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x0000ff00, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x0000ff00, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_BeginScene(device); @@ -6284,15 +6577,16 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed with %08x\n", hr); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr); IDirect3DPixelShader9_Release(shader); IDirect3DVertexShader9_Release(vshader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void pretransformed_varying_test(IDirect3DDevice9 *device) +static void pretransformed_varying_test(void) { /* dcl_position: fails to compile */ static const DWORD blendweight_code[] = @@ -6476,9 +6770,33 @@ }, }; IDirect3DVertexDeclaration9 *decl; - HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; unsigned int i; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0) || caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No shader model 3 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &decl); ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexDeclaration returned %08x\n", hr); @@ -6491,7 +6809,7 @@ { IDirect3DPixelShader9 *shader; - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_CreatePixelShader(device, tests[i].shader_code, &shader); @@ -6533,10 +6851,27 @@ } IDirect3DVertexDeclaration9_Release(decl); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void test_compare_instructions(IDirect3DDevice9 *device) +static void test_compare_instructions(void) { + IDirect3DVertexShader9 *shader_slt_scalar; + IDirect3DVertexShader9 *shader_sge_scalar; + IDirect3DVertexShader9 *shader_slt_vec; + IDirect3DVertexShader9 *shader_sge_vec; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; + static const DWORD shader_sge_vec_code[] = { 0xfffe0101, /* vs_1_1 */ @@ -6577,39 +6912,57 @@ 0x0000000c, 0xd0040000, 0x80aa0000, 0xa0550001, /* slt oD0.b, r0.b, c1.g */ 0x0000ffff /* end */ }; - IDirect3DVertexShader9 *shader_sge_vec; - IDirect3DVertexShader9 *shader_slt_vec; - IDirect3DVertexShader9 *shader_sge_scalar; - IDirect3DVertexShader9 *shader_slt_scalar; - HRESULT hr, color; - float quad1[] = { - -1.0, -1.0, 0.1, - 0.0, -1.0, 0.1, - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1 - }; - float quad2[] = { - 0.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1 + static const float quad1[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 0.0f, 0.1f, + 0.0f, -1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, }; - float quad3[] = { - -1.0, 0.0, 0.1, - 0.0, 0.0, 0.1, - -1.0, 1.0, 0.1, - 0.0, 1.0, 0.1 + static const float quad2[] = + { + 0.0f, -1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, }; - float quad4[] = { - 0.0, 0.0, 0.1, - 1.0, 0.0, 0.1, - 0.0, 1.0, 0.1, - 1.0, 1.0, 0.1 + static const float quad3[] = + { + -1.0f, 0.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 0.0f, 0.0f, 0.1f, + 0.0f, 1.0f, 0.1f, }; - const float const0[4] = {0.8, 0.2, 0.2, 0.2}; - const float const1[4] = {0.2, 0.8, 0.2, 0.2}; + static const float quad4[] = + { + 0.0f, 0.0f, 0.1f, + 0.0f, 1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, + 1.0f, 1.0f, 0.1f, + }; + static const float const0[4] = {0.8f, 0.2f, 0.2f, 0.2f}; + static const float const1[4] = {0.2f, 0.8f, 0.2f, 0.2f}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(1, 1)) + { + skip("No vs_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); ok(SUCCEEDED(hr), "IDirect3DDevice9_Clear returned %#x.\n", hr); hr = IDirect3DDevice9_CreateVertexShader(device, shader_sge_vec_code, &shader_sge_vec); @@ -6658,9 +7011,6 @@ ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); } - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr); - color = getPixelColor(device, 160, 360); ok(color == 0x00ff00ff, "Compare test: Quad 1(sge vec) returned color 0x%08x, expected 0x00ff00ff\n", color); color = getPixelColor(device, 480, 360); @@ -6677,10 +7027,30 @@ IDirect3DVertexShader9_Release(shader_slt_vec); IDirect3DVertexShader9_Release(shader_sge_scalar); IDirect3DVertexShader9_Release(shader_slt_scalar); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void test_vshader_input(IDirect3DDevice9 *device) +static void test_vshader_input(void) { + IDirect3DVertexDeclaration9 *decl_twotexcrd, *decl_onetexcrd, *decl_twotex_wrongidx, *decl_twotexcrd_rightorder; + IDirect3DVertexDeclaration9 *decl_texcoord_color, *decl_color_color, *decl_color_ubyte, *decl_color_float; + IDirect3DVertexShader9 *swapped_shader, *texcoord_color_shader, *color_color_shader; + D3DADAPTER_IDENTIFIER9 identifier; + IDirect3DPixelShader9 *ps; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + unsigned int i; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + BOOL warp; + static const DWORD swapped_shader_code_3[] = { 0xfffe0300, /* vs_3_0 */ @@ -6781,107 +7151,152 @@ 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ 0x0000ffff /* end */ }; - IDirect3DVertexShader9 *swapped_shader, *texcoord_color_shader, *color_color_shader; - IDirect3DPixelShader9 *ps; - HRESULT hr; - DWORD color; - float quad1[] = { - -1.0, -1.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - 0.0, -1.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - -1.0, 0.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - 0.0, 0.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - }; - float quad2[] = { - 0.0, -1.0, 0.1, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 1.0, -1.0, 0.1, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.1, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 1.0, 0.0, 0.1, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - }; - float quad3[] = { - -1.0, 0.0, 0.1, -1.0, 0.0, 0.0, 0.0, 1.0, -1.0, 0.0, 0.0, - 0.0, 0.0, 0.1, -1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, - -1.0, 1.0, 0.1, -1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 1.0, 0.0, - 0.0, 1.0, 0.1, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, - }; - float quad4[] = { - 0.0, 0.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - 1.0, 0.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - 0.0, 1.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, - 1.0, 1.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.5, 0.0, + static const float quad1[] = + { + -1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + -1.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + 0.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + }; + static const float quad2[] = + { + 0.0f, -1.0f, 0.1f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.1f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.1f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + }; + static const float quad3[] = + { + -1.0f, 0.0f, 0.1f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 0.0f, 0.0f, + -1.0f, 1.0f, 0.1f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.1f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.1f, -1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, + }; + static const float quad4[] = + { + 0.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + 0.0f, 1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + 1.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.5f, 0.0f, + }; + static const float quad1_modified[] = + { + -1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, + -1.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -1.0f, 0.0f, + 0.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, -1.0f, 0.0f, + }; + static const float quad2_modified[] = + { + 0.0f, -1.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 1.0f, -1.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + }; + static const struct vertex quad1_color[] = + { + {-1.0f, -1.0f, 0.1f, 0x00ff8040}, + {-1.0f, 0.0f, 0.1f, 0x00ff8040}, + { 0.0f, -1.0f, 0.1f, 0x00ff8040}, + { 0.0f, 0.0f, 0.1f, 0x00ff8040}, }; - static const D3DVERTEXELEMENT9 decl_elements_twotexcrd[] = { + static const struct vertex quad2_color[] = + { + { 0.0f, -1.0f, 0.1f, 0x00ff8040}, + { 0.0f, 0.0f, 0.1f, 0x00ff8040}, + { 1.0f, -1.0f, 0.1f, 0x00ff8040}, + { 1.0f, 0.0f, 0.1f, 0x00ff8040}, + }; + static const struct vertex quad3_color[] = + { + {-1.0f, 0.0f, 0.1f, 0x00ff8040}, + {-1.0f, 1.0f, 0.1f, 0x00ff8040}, + { 0.0f, 0.0f, 0.1f, 0x00ff8040}, + { 0.0f, 1.0f, 0.1f, 0x00ff8040}, + }; + static const float quad4_color[] = + { + 0.0f, 0.0f, 0.1f, 1.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.1f, 1.0f, 1.0f, 0.0f, 0.0f, + 1.0f, 0.0f, 0.1f, 1.0f, 1.0f, 0.0f, 1.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 0.0f, 1.0f, + }; + static const D3DVERTEXELEMENT9 decl_elements_twotexcrd[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, {0, 28, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_twotexcrd_rightorder[] = { + static const D3DVERTEXELEMENT9 decl_elements_twotexcrd_rightorder[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, {0, 28, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_onetexcrd[] = { + static const D3DVERTEXELEMENT9 decl_elements_onetexcrd[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_twotexcrd_wrongidx[] = { + static const D3DVERTEXELEMENT9 decl_elements_twotexcrd_wrongidx[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1}, {0, 28, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_texcoord_color[] = { + static const D3DVERTEXELEMENT9 decl_elements_texcoord_color[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_color_color[] = { + static const D3DVERTEXELEMENT9 decl_elements_color_color[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_color_ubyte[] = { + static const D3DVERTEXELEMENT9 decl_elements_color_ubyte[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; - static const D3DVERTEXELEMENT9 decl_elements_color_float[] = { + static const D3DVERTEXELEMENT9 decl_elements_color_float[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() }; - IDirect3DVertexDeclaration9 *decl_twotexcrd, *decl_onetexcrd, *decl_twotex_wrongidx, *decl_twotexcrd_rightorder; - IDirect3DVertexDeclaration9 *decl_texcoord_color, *decl_color_color, *decl_color_ubyte, *decl_color_float; - unsigned int i; - float normalize[4] = {1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0}; - float no_normalize[4] = {1.0, 1.0, 1.0, 1.0}; + static const float normalize[4] = {1.0f / 256.0f, 1.0f / 256.0f, 1.0f / 256.0f, 1.0f / 256.0f}; + static const float no_normalize[4] = {1.0f, 1.0f, 1.0f, 1.0f}; - struct vertex quad1_color[] = { - {-1.0, -1.0, 0.1, 0x00ff8040}, - { 0.0, -1.0, 0.1, 0x00ff8040}, - {-1.0, 0.0, 0.1, 0x00ff8040}, - { 0.0, 0.0, 0.1, 0x00ff8040} - }; - struct vertex quad2_color[] = { - { 0.0, -1.0, 0.1, 0x00ff8040}, - { 1.0, -1.0, 0.1, 0x00ff8040}, - { 0.0, 0.0, 0.1, 0x00ff8040}, - { 1.0, 0.0, 0.1, 0x00ff8040} - }; - struct vertex quad3_color[] = { - {-1.0, 0.0, 0.1, 0x00ff8040}, - { 0.0, 0.0, 0.1, 0x00ff8040}, - {-1.0, 1.0, 0.1, 0x00ff8040}, - { 0.0, 1.0, 0.1, 0x00ff8040} - }; - float quad4_color[] = { - 0.0, 0.0, 0.1, 1.0, 1.0, 0.0, 0.0, - 1.0, 0.0, 0.1, 1.0, 1.0, 0.0, 1.0, - 0.0, 1.0, 0.1, 1.0, 1.0, 0.0, 0.0, - 1.0, 1.0, 0.1, 1.0, 1.0, 0.0, 1.0, - }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No vs_3_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3D9_GetAdapterIdentifier(d3d, D3DADAPTER_DEFAULT, 0, &identifier); + ok(SUCCEEDED(hr), "Failed to get adapter identifier, hr %#x.\n", hr); + warp = !strcmp(identifier.Description, "Microsoft Basic Render Driver"); hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements_twotexcrd, &decl_twotexcrd); ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexDeclaration returned %08x\n", hr); @@ -6904,8 +7319,9 @@ hr = IDirect3DDevice9_CreatePixelShader(device, ps3_code, &ps); ok(hr == D3D_OK, "IDirect3DDevice9_CreatePixelShader returned %08x\n", hr); - for(i = 1; i <= 3; i++) { - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0); + for (i = 1; i <= 3; ++i) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 1.0f, 0); ok(SUCCEEDED(hr), "IDirect3DDevice9_Clear returned %#x.\n", hr); if(i == 3) { hr = IDirect3DDevice9_CreateVertexShader(device, swapped_shader_code_3, &swapped_shader); @@ -6967,8 +7383,10 @@ /* The last value of the read but undefined stream is used, it is 0x00. The defined input is vec4(1, 0, 0, 0) */ color = getPixelColor(device, 480, 360); - ok(color == 0x00ffff00 || color ==0x00ff0000, - "Input test: Quad 2(1crd) returned color 0x%08x, expected 0x00ffff00\n", color); + /* On the Windows 8 testbot (WARP) the draw succeeds, but uses + * mostly random data as input. */ + ok(color == 0x00ffff00 || color == 0x00ff0000 || broken(warp), + "Got unexpected color 0x%08x for quad 2 (1crd).\n", color); color = getPixelColor(device, 160, 120); /* Same as above, accept both the last used value and 0.0 for the undefined streams */ ok(color_match(color, D3DCOLOR_ARGB(0x00, 0xff, 0x00, 0x80), 1) || color == D3DCOLOR_ARGB(0x00, 0xff, 0x00, 0x00), @@ -6981,8 +7399,11 @@ ok(color_match(color, D3DCOLOR_ARGB(0x00, 0xff, 0xff, 0x80), 1), "Input test: Quad 1(2crd) returned color 0x%08x, expected 0x00ffff80\n", color); color = getPixelColor(device, 480, 360); - /* Accept the clear color as well in this case, since SW VP returns an error */ - ok(color == 0x00ffff00 || color == 0x00ff0000, "Input test: Quad 2(1crd) returned color 0x%08x, expected 0x00ffff00\n", color); + /* Accept the clear color as well in this case, since SW VP + * returns an error. On the Windows 8 testbot (WARP) the draw + * succeeds, but uses mostly random data as input. */ + ok(color == 0x00ffff00 || color == 0x00ff0000 || broken(warp), + "Got unexpected color 0x%08x for quad 2 (1crd).\n", color); color = getPixelColor(device, 160, 120); ok(color_match(color, D3DCOLOR_ARGB(0x00, 0xff, 0x00, 0x80), 1) || color == D3DCOLOR_ARGB(0x00, 0xff, 0x00, 0x00), "Input test: Quad 3(2crd-wrongidx) returned color 0x%08x, expected 0x00ff0080\n", color); @@ -7003,19 +7424,6 @@ ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %08x\n", hr); if(SUCCEEDED(hr)) { - float quad1_modified[] = { - -1.0, -1.0, 0.1, 1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, 0.0, - 0.0, -1.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, -1.0, 0.0, 0.0, - -1.0, 0.0, 0.1, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, -1.0, 0.0, - 0.0, 0.0, 0.1, 1.0, 0.0, 1.0, 0.0, -1.0, -1.0, -1.0, 0.0, - }; - float quad2_modified[] = { - 0.0, -1.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 1.0, -1.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - 1.0, 0.0, 0.1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, - }; - hr = IDirect3DDevice9_SetVertexShader(device, swapped_shader); ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader returned %08x\n", hr); @@ -7049,8 +7457,9 @@ * * A test app for this behavior is Half Life 2 Episode 2 in dxlevel 95, and related games(Portal, TF2). */ - ok(color == 0x000000ff || color == 0x00808080 || color == 0x00000000, - "Input test: Quad 2(different colors) returned color 0x%08x, expected 0x000000ff, 0x00808080 or 0x00000000\n", color); + ok(color == 0x000000ff || color == 0x00808080 || color == 0x00000000 + || broken(color_match(color, D3DCOLOR_ARGB(0x00, 0x0b, 0x75, 0x80), 1)), + "Got unexpected color 0x%08x for quad 2 (different colors).\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); @@ -7062,8 +7471,9 @@ IDirect3DVertexShader9_Release(swapped_shader); } - for(i = 1; i <= 3; i++) { - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff0000ff, 0.0, 0); + for (i = 1; i <= 3; ++i) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); ok(SUCCEEDED(hr), "IDirect3DDevice9_Clear returned %#x.\n", hr); if(i == 3) { hr = IDirect3DDevice9_CreateVertexShader(device, texcoord_color_shader_code_3, &texcoord_color_shader); @@ -7155,6 +7565,11 @@ IDirect3DVertexDeclaration9_Release(decl_color_float); IDirect3DPixelShader9_Release(ps); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void srgbtexture_test(IDirect3DDevice9 *device) @@ -8060,24 +8475,26 @@ if(dcl_positiont) IDirect3DVertexDeclaration9_Release(dcl_positiont); } -struct vertex_float16color { - float x, y, z; - DWORD c1, c2; -}; - -static void test_vshader_float16(IDirect3DDevice9 *device) +static void test_vshader_float16(void) { - HRESULT hr; + IDirect3DVertexDeclaration9 *vdecl = NULL; + IDirect3DVertexBuffer9 *buffer = NULL; + IDirect3DVertexShader9 *shader; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; void *data; - static const D3DVERTEXELEMENT9 decl_elements[] = { + HRESULT hr; + + static const D3DVERTEXELEMENT9 decl_elements[] = + { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT16_4,D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, D3DDECL_END() - }; - IDirect3DVertexDeclaration9 *vdecl = NULL; - IDirect3DVertexBuffer9 *buffer = NULL; - IDirect3DVertexShader9 *shader; + }; static const DWORD shader_code[] = { 0xfffe0101, /* vs_1_1 */ @@ -8087,7 +8504,13 @@ 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ 0x0000ffff, }; - struct vertex_float16color quad[] = { + static const struct vertex_float16color + { + float x, y, z; + DWORD c1, c2; + } + quad[] = + { { -1.0, -1.0, 0.1, 0x3c000000, 0x00000000 }, /* green */ { -1.0, 0.0, 0.1, 0x3c000000, 0x00000000 }, { 0.0, -1.0, 0.1, 0x3c000000, 0x00000000 }, @@ -8109,7 +8532,26 @@ { 0.0, 1.0, 0.1, 0x00000000, 0x3c000000 }, }; - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff102030, 0.0, 0); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No vs_3_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff102030, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr); hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vdecl); @@ -8194,16 +8636,14 @@ "Input 0x00000000, 0x00003c00 returned color %08x, expected 0x000000ff\n", color); IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0); - ok(hr == D3D_OK, "IDirect3DDevice9_SetStreamSource failed, hr=%08x\n", hr); - hr = IDirect3DDevice9_SetVertexDeclaration(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexDeclaration failed, hr=%08x\n", hr); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetVertexShader failed hr=%08x\n", hr); - IDirect3DVertexDeclaration9_Release(vdecl); IDirect3DVertexShader9_Release(shader); IDirect3DVertexBuffer9_Release(buffer); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void conditional_np2_repeat_test(IDirect3DDevice9 *device) @@ -8330,10 +8770,20 @@ IDirect3DTexture9_Release(texture); } -static void vFace_register_test(IDirect3DDevice9 *device) +static void vface_register_test(void) { - HRESULT hr; + IDirect3DSurface9 *surface, *backbuffer; + IDirect3DVertexShader9 *vshader; + IDirect3DPixelShader9 *shader; + IDirect3DTexture9 *texture; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; + static const DWORD shader_code[] = { 0xffff0300, /* ps_3_0 */ @@ -8353,34 +8803,51 @@ 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */ 0x0000ffff /* end */ }; - IDirect3DPixelShader9 *shader; - IDirect3DVertexShader9 *vshader; - IDirect3DTexture9 *texture; - IDirect3DSurface9 *surface, *backbuffer; - const float quad[] = { - -1.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - -1.0, 0.0, 0.1, + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + -1.0f, 0.0f, 0.1f, - 1.0, -1.0, 0.1, - 1.0, 0.0, 0.1, - -1.0, 0.0, 0.1, + 1.0f, -1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, + -1.0f, 0.0f, 0.1f, - -1.0, 0.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 0.0, 0.1, + -1.0f, 0.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, 0.0f, 0.1f, - 1.0, 0.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 1.0, 0.1, + 1.0f, 0.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, 1.0f, 0.1f, }; - const float blit[] = { - 0.0, -1.0, 0.1, 0.0, 0.0, - 1.0, -1.0, 0.1, 1.0, 0.0, - 0.0, 1.0, 0.1, 0.0, 1.0, - 1.0, 1.0, 0.1, 1.0, 1.0, + static const float blit[] = + { + 0.0f, -1.0f, 0.1f, 0.0f, 0.0f, + 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.1f, 0.0f, 1.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0) || caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No shader model 3 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + hr = IDirect3DDevice9_CreateVertexShader(device, vshader_code, &vshader); ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexShader failed hr=%08x\n", hr); hr = IDirect3DDevice9_CreatePixelShader(device, shader_code, &shader); @@ -8389,6 +8856,8 @@ ok(hr == D3D_OK, "IDirect3DDevice9_CreateTexture failed hr=%08x\n", hr); hr = IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); ok(hr == D3D_OK, "IDirect3DTexture9_GetSurfaceLevel failed hr=%08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CULLMODE, D3DCULL_NONE); + ok(SUCCEEDED(hr), "Failed to set cull mode, hr %#x.\n", hr); hr = IDirect3DDevice9_SetPixelShader(device, shader); ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed hr=%08x\n", hr); hr = IDirect3DDevice9_SetVertexShader(device, vshader); @@ -8398,7 +8867,7 @@ hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); ok(hr == D3D_OK, "IDirect3DDevice9_GetBackBuffer failed hr=%08x\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff0000ff, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr); hr = IDirect3DDevice9_BeginScene(device); @@ -8448,12 +8917,16 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr); - IDirect3DDevice9_SetTexture(device, 0, NULL); IDirect3DPixelShader9_Release(shader); IDirect3DVertexShader9_Release(vshader); IDirect3DSurface9_Release(surface); IDirect3DSurface9_Release(backbuffer); IDirect3DTexture9_Release(texture); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void fixed_function_bumpmap_test(IDirect3DDevice9 *device) @@ -8466,11 +8939,12 @@ IDirect3DTexture9 *tex1, *tex2; D3DLOCKED_RECT locked_rect; - static const float quad[][7] = { - {-128.0f/640.0f, -128.0f/480.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f}, - {-128.0f/640.0f, 128.0f/480.0f, 0.1f, 0.0f, 1.0f, 0.0f, 1.0f}, - { 128.0f/640.0f, -128.0f/480.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f}, - { 128.0f/640.0f, 128.0f/480.0f, 0.1f, 1.0f, 1.0f, 1.0f, 1.0f}, + static const float quad[][7] = + { + {-1.0f, -1.0f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f}, + {-1.0f, 1.0f, 0.1f, 0.0f, 1.0f, 0.0f, 1.0f}, + { 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, 1.0f, 0.0f}, + { 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, 1.0f, 1.0f}, }; static const D3DVERTEXELEMENT9 decl_elements[] = { @@ -8563,28 +9037,22 @@ hr = IDirect3DDevice9_EndScene(device); ok(SUCCEEDED(hr), "EndScene failed (0x%08x)\n", hr); - /* on MacOS(10.5.4, radeon X1600), the white dots are have color 0x00fbfbfb rather than 0x00ffffff. This is - * kinda strange since no calculations are done on the sampled colors, only on the texture coordinates. - * But since testing the color match is not the purpose of the test don't be too picky - */ - color = getPixelColor(device, 320-32, 240); - ok(color_match(color, 0x00ffffff, 4), "bumpmap failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320+32, 240); - ok(color_match(color, 0x00ffffff, 4), "bumpmap failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320, 240-32); - ok(color_match(color, 0x00ffffff, 4), "bumpmap failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320, 240+32); - ok(color_match(color, 0x00ffffff, 4), "bumpmap failed: Got color 0x%08x, expected 0x00ffffff.\n", color); - color = getPixelColor(device, 320, 240); - ok(color_match(color, 0x00000000, 4), "bumpmap failed: Got color 0x%08x, expected 0x00000000.\n", color); - color = getPixelColor(device, 320+32, 240+32); - ok(color_match(color, 0x00000000, 4), "bumpmap failed: Got color 0x%08x, expected 0x00000000.\n", color); - color = getPixelColor(device, 320-32, 240+32); - ok(color_match(color, 0x00000000, 4), "bumpmap failed: Got color 0x%08x, expected 0x00000000.\n", color); - color = getPixelColor(device, 320+32, 240-32); - ok(color_match(color, 0x00000000, 4), "bumpmap failed: Got color 0x%08x, expected 0x00000000.\n", color); - color = getPixelColor(device, 320-32, 240-32); - ok(color_match(color, 0x00000000, 4), "bumpmap failed: Got color 0x%08x, expected 0x00000000.\n", color); + color = getPixelColor(device, 240, 60); + ok(color_match(color, 0x005ea000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 400, 60); + ok(color_match(color, 0x009ea000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 80, 180); + ok(color_match(color, 0x005ea000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 560, 180); + ok(color_match(color, 0x009ea000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 80, 300); + ok(color_match(color, 0x005e6000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 560, 300); + ok(color_match(color, 0x009e6000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 240, 420); + ok(color_match(color, 0x005e6000, 4), "Got unexpected color 0x%08x.\n", color); + color = getPixelColor(device, 400, 420); + ok(color_match(color, 0x009e6000, 4), "Got unexpected color 0x%08x.\n", color); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr); @@ -8723,10 +9191,13 @@ IDirect3DVertexDeclaration9_Release(vertex_declaration); } -static void stencil_cull_test(IDirect3D9 *d3d9) +static void stencil_cull_test(void) { IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; static const float quad1[] = { @@ -8768,10 +9239,15 @@ unsigned int i; DWORD color; - device = create_device(d3d9); - if (!device) + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) { skip("Cannot create a device with a D24S8 stencil buffer.\n"); + DestroyWindow(window); + IDirect3D9_Release(d3d); return; } hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); @@ -8922,13 +9398,27 @@ ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); cleanup: - cleanup_device(device); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void vpos_register_test(IDirect3DDevice9 *device) +static void vpos_register_test(void) { - HRESULT hr; + IDirect3DSurface9 *surface = NULL, *backbuffer; + IDirect3DPixelShader9 *shader, *shader_frac; + IDirect3DVertexShader9 *vshader; + IDirect3DDevice9 *device; + D3DLOCKED_RECT lr; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; DWORD color; + HWND window; + HRESULT hr; + DWORD *pos; + static const DWORD shader_code[] = { 0xffff0300, /* ps_3_0 */ @@ -8960,20 +9450,35 @@ 0x02000001, 0xe00f0000, 0x90e40000, /* mov o0, v0 */ 0x0000ffff /* end */ }; - IDirect3DVertexShader9 *vshader; - IDirect3DPixelShader9 *shader, *shader_frac; - IDirect3DSurface9 *surface = NULL, *backbuffer; - const float quad[] = { - -1.0, -1.0, 0.1, 0.0, 0.0, - 1.0, -1.0, 0.1, 1.0, 0.0, - -1.0, 1.0, 0.1, 0.0, 1.0, - 1.0, 1.0, 0.1, 1.0, 1.0, + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, 0.0f, 0.0f, + -1.0f, 1.0f, 0.1f, 0.0f, 1.0f, + 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, }; - D3DLOCKED_RECT lr; float constant[4] = {1.0, 0.0, 320, 240}; - DWORD *pos; - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff0000ff, 0.0, 0); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0) || caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No shader model 3 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr); hr = IDirect3DDevice9_CreateVertexShader(device, vshader_code, &vshader); ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexShader failed hr=%08x\n", hr); @@ -9084,6 +9589,11 @@ IDirect3DVertexShader9_Release(vshader); if(surface) IDirect3DSurface9_Release(surface); IDirect3DSurface9_Release(backbuffer); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static BOOL point_match(IDirect3DDevice9 *device, UINT x, UINT y, UINT r) @@ -9392,8 +9902,21 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetTransform failed, hr=%08x\n", hr); } -static void multiple_rendertargets_test(IDirect3DDevice9 *device) +static void multiple_rendertargets_test(void) { + IDirect3DSurface9 *surf1, *surf2, *backbuf, *readback; + IDirect3DPixelShader9 *ps1, *ps2; + IDirect3DTexture9 *tex1, *tex2; + IDirect3DVertexShader9 *vs; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + UINT i, j; + static const DWORD vshader_code[] = { 0xfffe0300, /* vs_3_0 */ @@ -9418,42 +9941,52 @@ 0x02000001, 0x800f0801, 0xa0e40001, /* mov oC1, c1 */ 0x0000ffff /* end */ }; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 1.0f, 0.1f, + }; + static const float texquad[] = + { + -1.0f, -1.0f, 0.1f, 0.0f, 0.0f, + -1.0f, 1.0f, 0.1f, 0.0f, 1.0f, + 0.0f, -1.0f, 0.1f, 1.0f, 0.0f, + 0.0f, 1.0f, 0.1f, 1.0f, 1.0f, + + 0.0f, -1.0f, 0.1f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.1f, 0.0f, 1.0f, + 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - HRESULT hr; - IDirect3DVertexShader9 *vs; - IDirect3DPixelShader9 *ps1, *ps2; - IDirect3DTexture9 *tex1, *tex2; - IDirect3DSurface9 *surf1, *surf2, *backbuf, *readback; - D3DCAPS9 caps; - DWORD color; - UINT i, j; - float quad[] = { - -1.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 1.0, 0.1, - }; - float texquad[] = { - -1.0, -1.0, 0.1, 0.0, 0.0, - 0.0, -1.0, 0.1, 1.0, 0.0, - -1.0, 1.0, 0.1, 0.0, 1.0, - 0.0, 1.0, 0.1, 1.0, 1.0, - - 0.0, -1.0, 0.1, 0.0, 0.0, - 1.0, -1.0, 0.1, 1.0, 0.0, - 0.0, 1.0, 0.1, 0.0, 1.0, - 1.0, 1.0, 0.1, 1.0, 1.0, - }; - - memset(&caps, 0, sizeof(caps)); hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(hr == D3D_OK, "IDirect3DDevice9_GetCaps failed, hr=%08x\n", hr); - if(caps.NumSimultaneousRTs < 2) { - skip("Only 1 simultaneous render target supported, skipping MRT test\n"); - return; + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.NumSimultaneousRTs < 2) + { + skip("Only 1 simultaneous render target supported, skipping MRT test.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + if (caps.PixelShaderVersion < D3DPS_VERSION(3, 0) || caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No shader model 3 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffff0000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed, hr=%08x\n", hr); hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 16, 16, @@ -9550,6 +10083,8 @@ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); ok(hr == D3D_OK, "IDirect3DDevice9_DrawPrimitiveUP failed, hr=%08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetVertexShader(device, NULL); ok(SUCCEEDED(hr), "SetVertexShader failed, hr %#x.\n", hr); hr = IDirect3DDevice9_SetPixelShader(device, NULL); @@ -9571,9 +10106,6 @@ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &texquad[20], 5 * sizeof(float)); ok(hr == D3D_OK, "IDirect3DDevice9_DrawPrimitiveUP failed, hr=%08x\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed, hr=%08x\n", hr); - hr = IDirect3DDevice9_EndScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_EndScene failed, hr=%08x\n", hr); } @@ -9593,6 +10125,11 @@ IDirect3DSurface9_Release(surf2); IDirect3DSurface9_Release(backbuf); IDirect3DSurface9_Release(readback); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } struct formats { @@ -9781,27 +10318,44 @@ } } -static void tssargtemp_test(IDirect3DDevice9 *device) +static void tssargtemp_test(void) { + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + D3DCAPS9 caps; + HWND window; HRESULT hr; - DWORD color; - static const struct vertex quad[] = { - {-1.0, -1.0, 0.1, 0x00ff0000}, - { 1.0, -1.0, 0.1, 0x00ff0000}, - {-1.0, 1.0, 0.1, 0x00ff0000}, - { 1.0, 1.0, 0.1, 0x00ff0000} + + static const struct vertex quad[] = + { + {-1.0f, -1.0f, 0.1f, 0x00ff0000}, + {-1.0f, 1.0f, 0.1f, 0x00ff0000}, + { 1.0f, -1.0f, 0.1f, 0x00ff0000}, + { 1.0f, 1.0f, 0.1f, 0x00ff0000}, }; - D3DCAPS9 caps; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } memset(&caps, 0, sizeof(caps)); hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(hr == D3D_OK, "IDirect3DDevice9_GetDeviceCaps failed with %08x\n", hr); if(!(caps.PrimitiveMiscCaps & D3DPMISCCAPS_TSSARGTEMP)) { skip("D3DPMISCCAPS_TSSARGTEMP not supported\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff000000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed with %08x\n", hr); hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); @@ -9828,6 +10382,8 @@ hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0x0000ff00); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed, hr = %08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed, hr = %08x\n", hr); @@ -9843,74 +10399,71 @@ ok(color == 0x00ffff00, "TSSARGTEMP test returned color 0x%08x, expected 0x00ffff00\n", color); IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); - /* Set stage 1 back to default */ - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_RESULTARG, D3DTA_CURRENT); - ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 2, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 3, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "SetTextureStageState failed, hr = %08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -struct testdata -{ - DWORD idxVertex; /* number of instances in the first stream */ - DWORD idxColor; /* number of instances in the second stream */ - DWORD idxInstance; /* should be 1 ?? */ - DWORD color1; /* color 1 instance */ - DWORD color2; /* color 2 instance */ - DWORD color3; /* color 3 instance */ - DWORD color4; /* color 4 instance */ - WORD strVertex; /* specify which stream to use 0-2*/ - WORD strColor; - WORD strInstance; -}; - -static const struct testdata testcases[]= -{ - {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 0 */ - {3, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ffffff, 0, 1, 2}, /* 1 */ - {2, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0, 1, 2}, /* 2 */ - {1, 4, 1, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0, 1, 2}, /* 3 */ - {4, 3, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 4 */ - {4, 2, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 5 */ - {4, 1, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 6 */ - {4, 0, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 7 */ - {3, 3, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ffffff, 0, 1, 2}, /* 8 */ - {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 1, 0, 2}, /* 9 */ - {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 2, 1}, /* 10 */ - {4, 4, 1, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 2, 3, 1}, /* 11 */ - {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 2, 0, 1}, /* 12 */ - {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 1, 2, 3}, /* 13 */ -/* - This draws one instance on some machines, no instance on others - {0, 4, 1, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0, 1, 2}, -*/ -/* - This case is handled in a stand alone test, SetStreamSourceFreq(0,(D3DSTREAMSOURCE_INSTANCEDATA | 1)) has to return D3DERR_INVALIDCALL! - {4, 4, 1, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 2, 1, 0, D3DERR_INVALIDCALL}, -*/ -}; - /* Drawing Indexed Geometry with instances*/ -static void stream_test(IDirect3DDevice9 *device) +static void stream_test(void) { - IDirect3DVertexBuffer9 *vb = NULL; - IDirect3DVertexBuffer9 *vb2 = NULL; - IDirect3DVertexBuffer9 *vb3 = NULL; - IDirect3DIndexBuffer9 *ib = NULL; IDirect3DVertexDeclaration9 *pDecl = NULL; IDirect3DVertexShader9 *shader = NULL; + IDirect3DVertexBuffer9 *vb3 = NULL; + IDirect3DVertexBuffer9 *vb2 = NULL; + IDirect3DVertexBuffer9 *vb = NULL; + IDirect3DIndexBuffer9 *ib = NULL; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + unsigned i; HRESULT hr; BYTE *data; - DWORD color; DWORD ind; - unsigned i; + static const struct testdata + { + DWORD idxVertex; /* number of instances in the first stream */ + DWORD idxColor; /* number of instances in the second stream */ + DWORD idxInstance; /* should be 1 ?? */ + DWORD color1; /* color 1 instance */ + DWORD color2; /* color 2 instance */ + DWORD color3; /* color 3 instance */ + DWORD color4; /* color 4 instance */ + WORD strVertex; /* specify which stream to use 0-2*/ + WORD strColor; + WORD strInstance; + } + testcases[]= + { + {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 0 */ + {3, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ffffff, 0, 1, 2}, /* 1 */ + {2, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0, 1, 2}, /* 2 */ + {1, 4, 1, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0, 1, 2}, /* 3 */ + {4, 3, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 4 */ + {4, 2, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 5 */ + {4, 1, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 6 */ + {4, 0, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 1, 2}, /* 7 */ + {3, 3, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ffffff, 0, 1, 2}, /* 8 */ + {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 1, 0, 2}, /* 9 */ + {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0, 2, 1}, /* 10 */ + {4, 4, 1, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 2, 3, 1}, /* 11 */ + {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 2, 0, 1}, /* 12 */ + {4, 4, 1, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 1, 2, 3}, /* 13 */ +#if 0 + /* This draws one instance on some machines, no instance on others. */ + {0, 4, 1, 0x00ff0000, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0, 1, 2}, /* 14 */ + /* This case is handled in a stand alone test, + * SetStreamSourceFreq(0, (D3DSTREAMSOURCE_INSTANCEDATA | 1)) has to + * return D3DERR_INVALIDCALL. */ + {4, 4, 1, 0x00ffffff, 0x00ffffff, 0x00ffffff, 0x00ffffff, 2, 1, 0}, /* 15 */ +#endif + }; static const DWORD shader_code[] = { 0xfffe0101, /* vs_1_1 */ @@ -9922,34 +10475,29 @@ 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ 0x0000ffff }; - - const float quad[][3] = + static const float quad[][3] = { {-0.5f, -0.5f, 1.1f}, /*0 */ {-0.5f, 0.5f, 1.1f}, /*1 */ { 0.5f, -0.5f, 1.1f}, /*2 */ { 0.5f, 0.5f, 1.1f}, /*3 */ }; - - const float vertcolor[][4] = + static const float vertcolor[][4] = { {1.0f, 0.0f, 0.0f, 1.0f}, /*0 */ {1.0f, 0.0f, 0.0f, 1.0f}, /*1 */ {1.0f, 0.0f, 0.0f, 1.0f}, /*2 */ {1.0f, 0.0f, 0.0f, 1.0f}, /*3 */ }; - /* 4 position for 4 instances */ - const float instancepos[][3] = + static const float instancepos[][3] = { {-0.6f,-0.6f, 0.0f}, { 0.6f,-0.6f, 0.0f}, { 0.6f, 0.6f, 0.0f}, {-0.6f, 0.6f, 0.0f}, }; - - short indices[] = {0, 1, 2, 1, 2, 3}; - + static const short indices[] = {0, 1, 2, 2, 1, 3}; D3DVERTEXELEMENT9 decl[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, @@ -9958,6 +10506,25 @@ D3DDECL_END() }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(3, 0)) + { + skip("No vs_3_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + /* set the default value because it isn't done in wine? */ hr = IDirect3DDevice9_SetStreamSourceFreq(device, 1, 1); ok(hr == D3D_OK, "IDirect3DDevice9_SetStreamSourceFreq failed with %08x\n", hr); @@ -9997,7 +10564,8 @@ ok(hr == D3D_OK, "CreateVertexBuffer failed with %08x\n", hr); if(!vb) { skip("Failed to create a vertex buffer\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_CreateVertexBuffer(device, sizeof(vertcolor), 0, 0, D3DPOOL_MANAGED, &vb2, NULL); ok(hr == D3D_OK, "CreateVertexBuffer failed with %08x\n", hr); @@ -10067,7 +10635,7 @@ hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl, &pDecl); ok(SUCCEEDED(hr), "IDirect3DDevice9_CreateVertexDeclaration failed hr=%08x (case %i)\n", hr, i); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed with %08x (case %i)\n", hr, i); hr = IDirect3DDevice9_BeginScene(device); @@ -10128,32 +10696,51 @@ ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x (case %i)\n", hr, i); } - hr = IDirect3DDevice9_SetIndices(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetIndices failed with %08x\n", hr); - out: if(vb) IDirect3DVertexBuffer9_Release(vb); if(vb2)IDirect3DVertexBuffer9_Release(vb2); if(vb3)IDirect3DVertexBuffer9_Release(vb3); if(ib)IDirect3DIndexBuffer9_Release(ib); if(shader)IDirect3DVertexShader9_Release(shader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void np2_stretch_rect_test(IDirect3DDevice9 *device) { +static void np2_stretch_rect_test(void) +{ IDirect3DSurface9 *src = NULL, *dst = NULL, *backbuffer = NULL; IDirect3DTexture9 *dsttex = NULL; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + HWND window; HRESULT hr; - DWORD color; - D3DRECT r1 = {0, 0, 50, 50 }; - D3DRECT r2 = {50, 0, 100, 50 }; - D3DRECT r3 = {50, 50, 100, 100}; - D3DRECT r4 = {0, 50, 50, 100}; - const float quad[] = { - -1.0, -1.0, 0.1, 0.0, 0.0, - 1.0, -1.0, 0.1, 1.0, 0.0, - -1.0, 1.0, 0.1, 0.0, 1.0, - 1.0, 1.0, 0.1, 1.0, 1.0, - }; + + static const D3DRECT r1 = {0, 0, 50, 50 }; + static const D3DRECT r2 = {50, 0, 100, 50 }; + static const D3DRECT r3 = {50, 50, 100, 100}; + static const D3DRECT r4 = {0, 50, 50, 100}; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, 0.0f, 0.0f, + -1.0f, 1.0f, 0.1f, 0.0f, 1.0f, + 1.0f, -1.0f, 0.1f, 1.0f, 0.0f, + 1.0f, 1.0f, 0.1f, 1.0f, 1.0f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); ok(hr == D3D_OK, "IDirect3DDevice9_GetBackBuffer failed with %08x\n", hr); @@ -10171,7 +10758,7 @@ hr = IDirect3DTexture9_GetSurfaceLevel(dsttex, 0, &dst); ok(hr == D3D_OK, "IDirect3DTexture9_GetSurfaceLevel failed with %08x\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff00ffff, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ffff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed with %08x\n", hr); /* Clear the StretchRect destination for debugging */ @@ -10231,24 +10818,28 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed with %08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTexture failed with %08x\n", hr); - cleanup: if(src) IDirect3DSurface9_Release(src); if(backbuffer) IDirect3DSurface9_Release(backbuffer); if(dsttex) IDirect3DTexture9_Release(dsttex); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void texop_test(IDirect3DDevice9 *device) +static void texop_test(void) { IDirect3DVertexDeclaration9 *vertex_declaration = NULL; IDirect3DTexture9 *texture = NULL; D3DLOCKED_RECT locked_rect; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; unsigned i; @@ -10301,6 +10892,16 @@ {D3DTOP_LERP, "LERP", D3DTEXOPCAPS_LERP, D3DCOLOR_ARGB(0x00, 0x00, 0x33, 0x33)}, }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + memset(&caps, 0, sizeof(caps)); hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "GetDeviceCaps failed with 0x%08x\n", hr); @@ -10368,12 +10969,16 @@ ok(SUCCEEDED(hr), "Present failed with 0x%08x\n", hr); } - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); IDirect3DTexture9_Release(texture); IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void yuv_color_test(IDirect3DDevice9 *device) +static void yuv_color_test(void) { HRESULT hr; IDirect3DSurface9 *surface, *target; @@ -10382,7 +10987,10 @@ IDirect3D9 *d3d; D3DCOLOR color; D3DFORMAT skip_once = D3DFMT_UNKNOWN; + IDirect3DDevice9 *device; D3DSURFACE_DESC desc; + ULONG refcount; + HWND window; static const struct { @@ -10432,8 +11040,16 @@ {0x1c6b1cff, D3DFMT_YUY2, "D3DFMT_YUY2", 0x006dff45, 0x0000d500}, }; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d); - ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_GetRenderTarget(device, 0, &target); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); hr = IDirect3DSurface9_GetDesc(target, &desc); @@ -10505,10 +11121,14 @@ } IDirect3DSurface9_Release(target); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void yuv_layout_test(IDirect3DDevice9 *device) +static void yuv_layout_test(void) { HRESULT hr; IDirect3DSurface9 *surface, *target; @@ -10521,9 +11141,11 @@ DWORD ref_color; BYTE *buf, *chroma_buf, *u_buf, *v_buf; UINT width = 20, height = 16; + IDirect3DDevice9 *device; + ULONG refcount; D3DCAPS9 caps; - D3DFORMAT skip_once = D3DFMT_UNKNOWN; D3DSURFACE_DESC desc; + HWND window; static const struct { @@ -10555,17 +11177,26 @@ { MAKEFOURCC('N','V','1','2'), "D3DFMT_NV12", }, }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr); if (caps.TextureCaps & D3DPTEXTURECAPS_POW2 && !(caps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL)) { skip("No NP2 texture support, skipping YUV texture layout test.\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } - hr = IDirect3DDevice9_GetDirect3D(device, &d3d); - ok(hr == D3D_OK, "IDirect3DDevice9_GetDirect3D failed, hr = %#x.\n", hr); hr = IDirect3DDevice9_GetRenderTarget(device, 0, &target); ok(hr == D3D_OK, "IDirect3DDevice9_GetRenderTarget failed, hr = %#x.\n", hr); hr = IDirect3DSurface9_GetDesc(target, &desc); @@ -10582,21 +11213,13 @@ if (IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE, format) != D3D_OK) { - if (skip_once != format) - { - skip("%s is not supported.\n", fmt_string); - skip_once = format; - } + skip("%s is not supported.\n", fmt_string); continue; } if (FAILED(IDirect3D9_CheckDeviceFormatConversion(d3d, 0, D3DDEVTYPE_HAL, format, desc.Format))) { - if (skip_once != format) - { - skip("Driver cannot blit %s surfaces.\n", fmt_string); - skip_once = format; - } + skip("Driver cannot blit %s surfaces.\n", fmt_string); continue; } @@ -10688,40 +11311,68 @@ } IDirect3DSurface9_Release(target); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void texop_range_test(IDirect3DDevice9 *device) +static void texop_range_test(void) { - static const struct { + IDirect3DTexture9 *texture; + D3DLOCKED_RECT locked_rect; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + + static const struct + { float x, y, z; D3DCOLOR diffuse; - } quad[] = { + } + quad[] = + { {-1.0f, -1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)}, {-1.0f, 1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)}, { 1.0f, -1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)}, { 1.0f, 1.0f, 0.1f, D3DCOLOR_ARGB(0xff, 0xff, 0xff, 0xff)} }; - HRESULT hr; - IDirect3DTexture9 *texture; - D3DLOCKED_RECT locked_rect; - D3DCAPS9 caps; - DWORD color; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } /* We need ADD and SUBTRACT operations */ hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "GetDeviceCaps failed with 0x%08x\n", hr); - if (!(caps.TextureOpCaps & D3DTEXOPCAPS_ADD)) { - skip("D3DTOP_ADD is not supported, skipping value range test\n"); - return; + if (!(caps.TextureOpCaps & D3DTEXOPCAPS_ADD)) + { + skip("D3DTOP_ADD is not supported, skipping value range test.\n"); + IDirect3DDevice9_Release(device); + goto done; } - if (!(caps.TextureOpCaps & D3DTEXOPCAPS_SUBTRACT)) { - skip("D3DTEXOPCAPS_SUBTRACT is not supported, skipping value range test\n"); - return; + if (!(caps.TextureOpCaps & D3DTEXOPCAPS_SUBTRACT)) + { + skip("D3DTEXOPCAPS_SUBTRACT is not supported, skipping value range test.\n"); + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); ok(SUCCEEDED(hr), "SetFVF failed with 0x%08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); /* Stage 1: result = diffuse(=1.0) + diffuse * stage 2: result = result - tfactor(= 0.5) */ @@ -10740,6 +11391,8 @@ hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_SUBTRACT); ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear device, hr %#x.\n\n", hr); hr = IDirect3DDevice9_BeginScene(device); ok(SUCCEEDED(hr), "BeginScene failed with 0x%08x\n", hr); hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); @@ -10794,24 +11447,40 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "SetTextureStageState failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "SetTexture failed with 0x%08x\n", hr); IDirect3DTexture9_Release(texture); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void alphareplicate_test(IDirect3DDevice9 *device) { - struct vertex quad[] = { - { -1.0, -1.0, 0.1, 0x80ff00ff }, - { 1.0, -1.0, 0.1, 0x80ff00ff }, - { -1.0, 1.0, 0.1, 0x80ff00ff }, - { 1.0, 1.0, 0.1, 0x80ff00ff }, - }; - HRESULT hr; +static void alphareplicate_test(void) +{ + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; DWORD color; + HWND window; + HRESULT hr; + + static const struct vertex quad[] = + { + {-1.0f, -1.0f, 0.1f, 0x80ff00ff}, + {-1.0f, 1.0f, 0.1f, 0x80ff00ff}, + { 1.0f, -1.0f, 0.1f, 0x80ff00ff}, + { 1.0f, 1.0f, 0.1f, 0x80ff00ff}, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed with 0x%08x\n", hr); @@ -10839,28 +11508,49 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed with 0x%08x\n", hr); - + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void dp3_alpha_test(IDirect3DDevice9 *device) { - HRESULT hr; +static void dp3_alpha_test(void) +{ + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; DWORD color; - struct vertex quad[] = { - { -1.0, -1.0, 0.1, 0x408080c0 }, - { 1.0, -1.0, 0.1, 0x408080c0 }, - { -1.0, 1.0, 0.1, 0x408080c0 }, - { 1.0, 1.0, 0.1, 0x408080c0 }, + HWND window; + HRESULT hr; + + static const struct vertex quad[] = + { + {-1.0f, -1.0f, 0.1f, 0x408080c0}, + {-1.0f, 1.0f, 0.1f, 0x408080c0}, + { 1.0f, -1.0f, 0.1f, 0x408080c0}, + { 1.0f, 1.0f, 0.1f, 0x408080c0}, }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + memset(&caps, 0, sizeof(caps)); hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(SUCCEEDED(hr), "GetDeviceCaps failed with 0x%08x\n", hr); - if (!(caps.TextureOpCaps & D3DTEXOPCAPS_DOTPRODUCT3)) { + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.TextureOpCaps & D3DTEXOPCAPS_DOTPRODUCT3)) + { skip("D3DTOP_DOTPRODUCT3 not supported\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0); @@ -10895,6 +11585,8 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed with 0x%08x\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0xffffffff); ok(SUCCEEDED(hr), "IDirect3DDevice9_SetRenderState failed with 0x%08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with 0x%08x\n", hr); @@ -10911,30 +11603,47 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "IDirect3DDevice9_Present failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetTextureStageState failed with 0x%08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void zwriteenable_test(IDirect3DDevice9 *device) { +static void zwriteenable_test(void) +{ + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + HWND window; HRESULT hr; - DWORD color; - struct vertex quad1[] = { - { -1.0, -1.0, 0.1, 0x00ff0000}, - { -1.0, 1.0, 0.1, 0x00ff0000}, - { 1.0, -1.0, 0.1, 0x00ff0000}, - { 1.0, 1.0, 0.1, 0x00ff0000}, - }; - struct vertex quad2[] = { - { -1.0, -1.0, 0.9, 0x0000ff00}, - { -1.0, 1.0, 0.9, 0x0000ff00}, - { 1.0, -1.0, 0.9, 0x0000ff00}, - { 1.0, 1.0, 0.9, 0x0000ff00}, + + static const struct vertex quad1[] = + { + {-1.0f, -1.0f, 0.1f, 0x00ff0000}, + {-1.0f, 1.0f, 0.1f, 0x00ff0000}, + { 1.0f, -1.0f, 0.1f, 0x00ff0000}, + { 1.0f, 1.0f, 0.1f, 0x00ff0000}, + }; + static const struct vertex quad2[] = + { + {-1.0f, -1.0f, 0.9f, 0x0000ff00}, + {-1.0f, 1.0f, 0.9f, 0x0000ff00}, + { 1.0f, -1.0f, 0.9f, 0x0000ff00}, + { 1.0f, 1.0f, 0.9f, 0x0000ff00}, }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x000000ff, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed with 0x%08x\n", hr); @@ -10946,6 +11655,8 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed with 0x%08x\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZFUNC, D3DCMP_LESSEQUAL); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed with 0x%08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); hr = IDirect3DDevice9_BeginScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene failed with 0x%08x\n", hr); @@ -10974,39 +11685,67 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "IDirect3DDevice9_Present failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed with 0x%08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void alphatest_test(IDirect3DDevice9 *device) { +static void alphatest_test(void) +{ #define ALPHATEST_PASSED 0x0000ff00 #define ALPHATEST_FAILED 0x00ff0000 - struct { - D3DCMPFUNC func; - DWORD color_less; - DWORD color_equal; - DWORD color_greater; - } testdata[] = { - { D3DCMP_NEVER, ALPHATEST_FAILED, ALPHATEST_FAILED, ALPHATEST_FAILED }, - { D3DCMP_LESS, ALPHATEST_PASSED, ALPHATEST_FAILED, ALPHATEST_FAILED }, - { D3DCMP_EQUAL, ALPHATEST_FAILED, ALPHATEST_PASSED, ALPHATEST_FAILED }, - { D3DCMP_LESSEQUAL, ALPHATEST_PASSED, ALPHATEST_PASSED, ALPHATEST_FAILED }, - { D3DCMP_GREATER, ALPHATEST_FAILED, ALPHATEST_FAILED, ALPHATEST_PASSED }, - { D3DCMP_NOTEQUAL, ALPHATEST_PASSED, ALPHATEST_FAILED, ALPHATEST_PASSED }, - { D3DCMP_GREATEREQUAL, ALPHATEST_FAILED, ALPHATEST_PASSED, ALPHATEST_PASSED }, - { D3DCMP_ALWAYS, ALPHATEST_PASSED, ALPHATEST_PASSED, ALPHATEST_PASSED }, - }; + IDirect3DDevice9 *device; unsigned int i, j; + IDirect3D9 *d3d; + D3DCOLOR color; + ULONG refcount; + D3DCAPS9 caps; + HWND window; HRESULT hr; - DWORD color; - struct vertex quad[] = { - { -1.0, -1.0, 0.1, ALPHATEST_PASSED | 0x80000000 }, - { 1.0, -1.0, 0.1, ALPHATEST_PASSED | 0x80000000 }, - { -1.0, 1.0, 0.1, ALPHATEST_PASSED | 0x80000000 }, - { 1.0, 1.0, 0.1, ALPHATEST_PASSED | 0x80000000 }, + + static const struct + { + D3DCMPFUNC func; + D3DCOLOR color_less; + D3DCOLOR color_equal; + D3DCOLOR color_greater; + } + testdata[] = + { + {D3DCMP_NEVER, ALPHATEST_FAILED, ALPHATEST_FAILED, ALPHATEST_FAILED}, + {D3DCMP_LESS, ALPHATEST_PASSED, ALPHATEST_FAILED, ALPHATEST_FAILED}, + {D3DCMP_EQUAL, ALPHATEST_FAILED, ALPHATEST_PASSED, ALPHATEST_FAILED}, + {D3DCMP_LESSEQUAL, ALPHATEST_PASSED, ALPHATEST_PASSED, ALPHATEST_FAILED}, + {D3DCMP_GREATER, ALPHATEST_FAILED, ALPHATEST_FAILED, ALPHATEST_PASSED}, + {D3DCMP_NOTEQUAL, ALPHATEST_PASSED, ALPHATEST_FAILED, ALPHATEST_PASSED}, + {D3DCMP_GREATEREQUAL, ALPHATEST_FAILED, ALPHATEST_PASSED, ALPHATEST_PASSED}, + {D3DCMP_ALWAYS, ALPHATEST_PASSED, ALPHATEST_PASSED, ALPHATEST_PASSED}, }; - D3DCAPS9 caps; + static const struct vertex quad[] = + { + {-1.0f, -1.0f, 0.1f, ALPHATEST_PASSED | 0x80000000}, + {-1.0f, 1.0f, 0.1f, ALPHATEST_PASSED | 0x80000000}, + { 1.0f, -1.0f, 0.1f, ALPHATEST_PASSED | 0x80000000}, + { 1.0f, 1.0f, 0.1f, ALPHATEST_PASSED | 0x80000000}, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, TRUE); ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed with 0x%08x\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); @@ -11102,14 +11841,25 @@ } } - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, FALSE); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderState failed with 0x%08x\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader failed with 0x%08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void sincos_test(IDirect3DDevice9 *device) +static void sincos_test(void) { + IDirect3DVertexShader9 *sin_shader, *cos_shader; + IDirect3DDevice9 *device; + struct vec3 data[1280]; + IDirect3D9 *d3d; + unsigned int i; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; + static const DWORD sin_shader_code[] = { 0xfffe0200, /* vs_2_0 */ @@ -11134,14 +11884,27 @@ 0x02000001, 0xd00f0000, 0xa0a90002, /* mov oD0, c2.yzzz */ 0x0000ffff /* end */ }; - IDirect3DVertexShader9 *sin_shader, *cos_shader; - HRESULT hr; - struct { - float x, y, z; - } data[1280]; - unsigned int i; - float sincosc1[4] = {D3DSINCOSCONST1}; - float sincosc2[4] = {D3DSINCOSCONST2}; + static const float sincosc1[4] = {D3DSINCOSCONST1}; + static const float sincosc2[4] = {D3DSINCOSCONST2}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) + { + skip("No vs_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear failed with 0x%08x\n", hr); @@ -11183,13 +11946,27 @@ ok(SUCCEEDED(hr), "IDirect3DDevice9_Present returned %#x.\n", hr); /* TODO: Find a way to properly validate the lines. Precicion issues make this a kinda nasty task */ - IDirect3DDevice9_SetVertexShader(device, NULL); IDirect3DVertexShader9_Release(sin_shader); IDirect3DVertexShader9_Release(cos_shader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void loop_index_test(IDirect3DDevice9 *device) +static void loop_index_test(void) { + IDirect3DVertexShader9 *shader; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + float values[4]; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + static const DWORD shader_code[] = { 0xfffe0200, /* vs_2_0 */ @@ -11202,19 +11979,35 @@ 0x02000001, 0xd00f0000, 0x80e40000, /* mov oD0, r0 */ 0x0000ffff /* END */ }; - IDirect3DVertexShader9 *shader; - HRESULT hr; - DWORD color; - const float quad[] = { - -1.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 1.0, 0.1 - }; - const float zero[4] = {0, 0, 0, 0}; - const float one[4] = {1, 1, 1, 1}; - int i0[4] = {2, 10, -3, 0}; - float values[4]; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 1.0f, 0.1f, + }; + static const float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + static const float one[4] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const int i0[4] = {2, 10, -3, 0}; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) + { + skip("No vs_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_CreateVertexShader(device, shader_code, &shader); ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexShader failed with %08x\n", hr); @@ -11222,7 +12015,7 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed with %08x\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff0000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, zero, 1); @@ -11284,13 +12077,25 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr); IDirect3DVertexShader9_Release(shader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void sgn_test(IDirect3DDevice9 *device) +static void sgn_test(void) { + IDirect3DVertexShader9 *shader; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; + static const DWORD shader_code[] = { 0xfffe0200, /* vs_2_0 */ @@ -11302,15 +12107,32 @@ 0x03000002, 0xd00f0000, 0x80e40000, 0xa0e40001, /* add oD0, r0, c1 */ 0x0000ffff /* end */ }; - IDirect3DVertexShader9 *shader; - HRESULT hr; - DWORD color; - const float quad[] = { - -1.0, -1.0, 0.1, - 1.0, -1.0, 0.1, - -1.0, 1.0, 0.1, - 1.0, 1.0, 0.1 - }; + static const float quad[] = + { + -1.0f, -1.0f, 0.1f, + -1.0f, 1.0f, 0.1f, + 1.0f, -1.0f, 0.1f, + 1.0f, 1.0f, 0.1f, + }; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) + { + skip("No vs_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_CreateVertexShader(device, shader_code, &shader); ok(hr == D3D_OK, "IDirect3DDevice9_CreateVertexShader failed with %08x\n", hr); @@ -11318,7 +12140,7 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF failed with %08x\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff0000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); hr = IDirect3DDevice9_BeginScene(device); @@ -11336,29 +12158,44 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed with %08x\n", hr); IDirect3DVertexShader9_Release(shader); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void viewport_test(IDirect3DDevice9 *device) { - HRESULT hr; - DWORD color; - D3DVIEWPORT9 vp, old_vp; +static void viewport_test(void) +{ + IDirect3DDevice9 *device; BOOL draw_failed = TRUE; - const float quad[] = + D3DVIEWPORT9 vp; + IDirect3D9 *d3d; + ULONG refcount; + DWORD color; + HWND window; + HRESULT hr; + + static const float quad[] = { - -0.5, -0.5, 0.1, - 0.5, -0.5, 0.1, - -0.5, 0.5, 0.1, - 0.5, 0.5, 0.1 + -0.5f, -0.5f, 0.1f, + -0.5f, 0.5f, 0.1f, + 0.5f, -0.5f, 0.1f, + 0.5f, 0.5f, 0.1f, }; - memset(&old_vp, 0, sizeof(old_vp)); - hr = IDirect3DDevice9_GetViewport(device, &old_vp); - ok(hr == D3D_OK, "IDirect3DDevice9_GetViewport failed with %08x\n", hr); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff0000, 1.0f, 0); ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); /* Test a viewport with Width and Height bigger than the surface dimensions @@ -11386,6 +12223,9 @@ hr = IDirect3DDevice9_SetViewport(device, &vp); ok(hr == D3D_OK, "IDirect3DDevice9_SetViewport failed with %08x\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF returned %08x\n", hr); hr = IDirect3DDevice9_BeginScene(device); @@ -11423,8 +12263,11 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - hr = IDirect3DDevice9_SetViewport(device, &old_vp); - ok(hr == D3D_OK, "IDirect3DDevice9_SetViewport failed with %08x\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } /* This test tests depth clamping / clipping behaviour: @@ -11596,7 +12439,7 @@ ok(SUCCEEDED(hr), "SetViewport failed, hr %#x.\n", hr); } -static void depth_bounds_test(IDirect3DDevice9 *device) +static void depth_bounds_test(void) { const struct tvertex quad1[] = { @@ -11625,19 +12468,29 @@ float f; } tmpvalue; - IDirect3D9 *d3d = NULL; IDirect3DSurface9 *offscreen_surface = NULL; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; + HWND window; HRESULT hr; - IDirect3DDevice9_GetDirect3D(device, &d3d); - if(IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - 0, D3DRTYPE_SURFACE, MAKEFOURCC('N','V','D','B')) != D3D_OK) { - skip("No NVDB (depth bounds test) support\n"); - IDirect3D9_Release(d3d); - return; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_SURFACE, MAKEFOURCC('N','V','D','B')) != D3D_OK) + { + skip("No NVDB (depth bounds test) support, skipping tests.\n"); + goto done; + } + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; } - IDirect3D9_Release(d3d); hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32, MAKEFOURCC('N','V','D','B'), D3DPOOL_DEFAULT, &offscreen_surface, NULL); @@ -11710,9 +12563,14 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void depth_buffer_test(IDirect3DDevice9 *device) +static void depth_buffer_test(void) { static const struct vertex quad1[] = { @@ -11744,11 +12602,25 @@ }; IDirect3DSurface9 *backbuffer, *rt1, *rt2, *rt3; + IDirect3DDevice9 *device; unsigned int i, j; D3DVIEWPORT9 vp; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; + HWND window; HRESULT hr; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + vp.X = 0; vp.Y = 0; vp.Width = 640; @@ -11840,12 +12712,17 @@ IDirect3DSurface9_Release(rt3); IDirect3DSurface9_Release(rt2); IDirect3DSurface9_Release(rt1); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } /* Test that partial depth copies work the way they're supposed to. The clear * on rt2 only needs a partial copy of the onscreen depth/stencil buffer, and * the following draw should only copy back the part that was modified. */ -static void depth_buffer2_test(IDirect3DDevice9 *device) +static void depth_buffer2_test(void) { static const struct vertex quad[] = { @@ -11856,11 +12733,25 @@ }; IDirect3DSurface9 *backbuffer, *rt1, *rt2; + IDirect3DDevice9 *device; unsigned int i, j; D3DVIEWPORT9 vp; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; + HWND window; HRESULT hr; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + vp.X = 0; vp.Y = 0; vp.Width = 640; @@ -11937,9 +12828,14 @@ IDirect3DSurface9_Release(backbuffer); IDirect3DSurface9_Release(rt2); IDirect3DSurface9_Release(rt1); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void depth_blit_test(IDirect3DDevice9 *device) +static void depth_blit_test(void) { static const struct vertex quad1[] = { @@ -11964,12 +12860,26 @@ }; IDirect3DSurface9 *backbuffer, *ds1, *ds2, *ds3; + IDirect3DDevice9 *device; RECT src_rect, dst_rect; unsigned int i, j; D3DVIEWPORT9 vp; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; + HWND window; HRESULT hr; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + vp.X = 0; vp.Y = 0; vp.Width = 640; @@ -12073,9 +12983,14 @@ IDirect3DSurface9_Release(ds3); IDirect3DSurface9_Release(ds2); IDirect3DSurface9_Release(ds1); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void intz_test(IDirect3DDevice9 *device) +static void intz_test(void) { static const DWORD ps_code[] = { @@ -12134,45 +13049,51 @@ {560, 450, D3DCOLOR_ARGB(0x00, 0xdf, 0xbf, 0x00)}, }; - IDirect3DSurface9 *original_ds, *original_rt, *rt; + IDirect3DSurface9 *original_rt, *rt; IDirect3DTexture9 *texture; IDirect3DPixelShader9 *ps; + IDirect3DDevice9 *device; IDirect3DSurface9 *ds; - IDirect3D9 *d3d9; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; UINT i; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('I','N','T','Z')))) + { + skip("No INTZ support, skipping INTZ test.\n"); + goto done; + } + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr); if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) { skip("No pixel shader 2.0 support, skipping INTZ test.\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } if (caps.TextureCaps & D3DPTEXTURECAPS_POW2) { skip("No unconditional NP2 texture support, skipping INTZ test.\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } - hr = IDirect3DDevice9_GetDirect3D(device, &d3d9); - ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr); - - hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('I','N','T','Z')); - if (FAILED(hr)) - { - skip("No INTZ support, skipping INTZ test.\n"); - return; - } - - IDirect3D9_Release(d3d9); - hr = IDirect3DDevice9_GetRenderTarget(device, 0, &original_rt); ok(SUCCEEDED(hr), "GetRenderTarget failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_GetDepthStencilSurface(device, &original_ds); - ok(SUCCEEDED(hr), "GetDepthStencilSurface failed, hr %#x.\n", hr); hr = IDirect3DDevice9_CreateTexture(device, 640, 480, 1, D3DUSAGE_DEPTHSTENCIL, MAKEFOURCC('I','N','T','Z'), D3DPOOL_DEFAULT, &texture, NULL); @@ -12371,22 +13292,19 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr); - - hr = IDirect3DDevice9_SetDepthStencilSurface(device, original_ds); - ok(SUCCEEDED(hr), "SetDepthStencilSurface failed, hr %#x.\n", hr); - IDirect3DSurface9_Release(original_ds); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr); + IDirect3DTexture9_Release(texture); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr); IDirect3DPixelShader9_Release(ps); - IDirect3DSurface9_Release(original_rt); IDirect3DSurface9_Release(rt); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void shadow_test(IDirect3DDevice9 *device) +static void shadow_test(void) { static const DWORD ps_code[] = { @@ -12450,21 +13368,33 @@ IDirect3DSurface9 *original_ds, *original_rt, *rt; IDirect3DPixelShader9 *ps; - IDirect3D9 *d3d9; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; UINT i; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr); if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) { skip("No pixel shader 2.0 support, skipping shadow test.\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } - hr = IDirect3DDevice9_GetDirect3D(device, &d3d9); - ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr); hr = IDirect3DDevice9_GetRenderTarget(device, 0, &original_rt); ok(SUCCEEDED(hr), "GetRenderTarget failed, hr %#x.\n", hr); hr = IDirect3DDevice9_GetDepthStencilSurface(device, &original_ds); @@ -12505,9 +13435,9 @@ IDirect3DSurface9 *ds; unsigned int j; - hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, format); - if (FAILED(hr)) continue; + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, format))) + continue; hr = IDirect3DDevice9_CreateTexture(device, 1024, 1024, 1, D3DUSAGE_DEPTHSTENCIL, format, D3DPOOL_DEFAULT, &texture, NULL); @@ -12574,34 +13504,31 @@ ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr); } - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr); IDirect3DPixelShader9_Release(ps); - - hr = IDirect3DDevice9_SetDepthStencilSurface(device, original_ds); - ok(SUCCEEDED(hr), "SetDepthStencilSurface failed, hr %#x.\n", hr); IDirect3DSurface9_Release(original_ds); - IDirect3DSurface9_Release(original_rt); IDirect3DSurface9_Release(rt); - - IDirect3D9_Release(d3d9); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void clip_planes(IDirect3DDevice9 *device, const char *test_name) { - const struct vertex quad1[] = + static const struct vertex quad1[] = { {-1.0f, -1.0f, 0.0f, 0xfff9e814}, - { 1.0f, -1.0f, 0.0f, 0xfff9e814}, {-1.0f, 1.0f, 0.0f, 0xfff9e814}, + { 1.0f, -1.0f, 0.0f, 0xfff9e814}, { 1.0f, 1.0f, 0.0f, 0xfff9e814}, }; - const struct vertex quad2[] = + static const struct vertex quad2[] = { {-1.0f, -1.0f, 0.0f, 0xff002b7f}, - { 1.0f, -1.0f, 0.0f, 0xff002b7f}, {-1.0f, 1.0f, 0.0f, 0xff002b7f}, + { 1.0f, -1.0f, 0.0f, 0xff002b7f}, { 1.0f, 1.0f, 0.0f, 0xff002b7f}, }; D3DCOLOR color; @@ -12640,10 +13567,19 @@ ok(color_match(color, 0x00f9e814, 1), "%s test: color 0x%08x.\n", test_name, color); } -static void clip_planes_test(IDirect3DDevice9 *device) +static void clip_planes_test(void) { - const float plane0[4] = {0.0f, 1.0f, 0.0f, 0.5f / 480.0f}; /* a quarter-pixel offset */ + IDirect3DSurface9 *offscreen_surface, *original_rt; + IDirect3DTexture9 *offscreen = NULL; + IDirect3DVertexShader9 *shader; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + HWND window; + HRESULT hr; + static const float plane0[4] = {0.0f, 1.0f, 0.0f, 0.5f / 480.0f}; /* a quarter-pixel offset */ static const DWORD shader_code[] = { 0xfffe0200, /* vs_2_0 */ @@ -12653,11 +13589,25 @@ 0x02000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ 0x0000ffff /* end */ }; - IDirect3DVertexShader9 *shader; - IDirect3DTexture9 *offscreen = NULL; - IDirect3DSurface9 *offscreen_surface, *original_rt; - HRESULT hr; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) + { + skip("No vs_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } hr = IDirect3DDevice9_GetRenderTarget(device, 0, &original_rt); ok(SUCCEEDED(hr), "GetRenderTarget failed, hr %#x.\n", hr); @@ -12710,18 +13660,18 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed (0x%08x)\n", hr); - IDirect3DDevice9_SetRenderState(device, D3DRS_CLIPPLANEENABLE, 0); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(hr == D3D_OK, "IDirect3DDevice9_SetVertexShader failed, hr=%08x\n", hr); IDirect3DVertexShader9_Release(shader); - hr = IDirect3DDevice9_SetRenderTarget(device, 0, original_rt); - ok(hr == D3D_OK, "IDirect3DDevice9_SetRenderTarget failed, hr=%08x\n", hr); IDirect3DSurface9_Release(original_rt); IDirect3DSurface9_Release(offscreen_surface); IDirect3DTexture9_Release(offscreen); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void fp_special_test(IDirect3DDevice9 *device) +static void fp_special_test(void) { /* Microsoft's assembler generates nan and inf with "1.#QNAN" and "1.#INF." respectively */ static const DWORD vs_header[] = @@ -12776,6 +13726,7 @@ D3DCOLOR r600; D3DCOLOR nv40; D3DCOLOR nv50; + D3DCOLOR warp; } vs_body[] = { @@ -12790,18 +13741,19 @@ * written to the blue component. * * There are considerable differences between graphics cards in how - * these are handled, but pow and nrm never generate INF or NAN. */ - {"log", vs_log, sizeof(vs_log), 0x00000000, 0x00000000, 0x00ff0000, 0x00ff7f00}, - {"pow", vs_pow, sizeof(vs_pow), 0x000000ff, 0x000000ff, 0x0000ff00, 0x000000ff}, - {"nrm", vs_nrm, sizeof(vs_nrm), 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x00ff0000}, - {"rcp1", vs_rcp1, sizeof(vs_rcp1), 0x000000ff, 0x000000ff, 0x00ff00ff, 0x00ff7f00}, - {"rcp2", vs_rcp2, sizeof(vs_rcp2), 0x000000ff, 0x00000000, 0x00ff0000, 0x00ff7f00}, - {"rsq1", vs_rsq1, sizeof(vs_rsq1), 0x000000ff, 0x000000ff, 0x00ff00ff, 0x00ff7f00}, - {"rsq2", vs_rsq2, sizeof(vs_rsq2), 0x000000ff, 0x000000ff, 0x00ff00ff, 0x00ff7f00}, - {"lit", vs_lit, sizeof(vs_lit), 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000}, - {"def1", vs_def1, sizeof(vs_def1), 0x000000ff, 0x00007f00, 0x0000ff00, 0x00007f00}, - {"def2", vs_def2, sizeof(vs_def2), 0x00ff0000, 0x00ff7f00, 0x00ff0000, 0x00ff7f00}, - {"def3", vs_def3, sizeof(vs_def3), 0x00ff00ff, 0x00ff7f00, 0x00ff00ff, 0x00ff7f00}, + * these are handled, but pow and nrm never generate INF or NAN on + * real hardware. */ + {"log", vs_log, sizeof(vs_log), 0x00000000, 0x00000000, 0x00ff0000, 0x00ff7f00, 0x00ff8000}, + {"pow", vs_pow, sizeof(vs_pow), 0x000000ff, 0x000000ff, 0x0000ff00, 0x000000ff, 0x00008000}, + {"nrm", vs_nrm, sizeof(vs_nrm), 0x00ff0000, 0x00ff0000, 0x0000ff00, 0x00ff0000, 0x00008000}, + {"rcp1", vs_rcp1, sizeof(vs_rcp1), 0x000000ff, 0x000000ff, 0x00ff00ff, 0x00ff7f00, 0x00ff8000}, + {"rcp2", vs_rcp2, sizeof(vs_rcp2), 0x000000ff, 0x00000000, 0x00ff0000, 0x00ff7f00, 0x00ff8000}, + {"rsq1", vs_rsq1, sizeof(vs_rsq1), 0x000000ff, 0x000000ff, 0x00ff00ff, 0x00ff7f00, 0x00ff8000}, + {"rsq2", vs_rsq2, sizeof(vs_rsq2), 0x000000ff, 0x000000ff, 0x00ff00ff, 0x00ff7f00, 0x00ff8000}, + {"lit", vs_lit, sizeof(vs_lit), 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000}, + {"def1", vs_def1, sizeof(vs_def1), 0x000000ff, 0x00007f00, 0x0000ff00, 0x00007f00, 0x00008000}, + {"def2", vs_def2, sizeof(vs_def2), 0x00ff0000, 0x00ff7f00, 0x00ff0000, 0x00ff7f00, 0x00ff8000}, + {"def3", vs_def3, sizeof(vs_def3), 0x00ff00ff, 0x00ff7f00, 0x00ff00ff, 0x00ff7f00, 0x00ff8000}, }; static const DWORD ps_code[] = @@ -12846,18 +13798,33 @@ }; IDirect3DPixelShader9 *ps; + IDirect3DDevice9 *device; UINT body_size = 0; + IDirect3D9 *d3d; DWORD *vs_code; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; UINT i; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr); if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0) || caps.VertexShaderVersion < D3DVS_VERSION(2, 0)) { skip("No shader model 2.0 support, skipping floating point specials test.\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE1(0)); @@ -12908,7 +13875,8 @@ ok(color_match(color, vs_body[i].r500, 1) || color_match(color, vs_body[i].r600, 1) || color_match(color, vs_body[i].nv40, 1) - || color_match(color, vs_body[i].nv50, 1), + || color_match(color, vs_body[i].nv50, 1) + || broken(color_match(color, vs_body[i].warp, 1)), "Expected color 0x%08x, 0x%08x, 0x%08x or 0x%08x for instruction \"%s\", got 0x%08x.\n", vs_body[i].r500, vs_body[i].r600, vs_body[i].nv40, vs_body[i].nv50, vs_body[i].name, color); @@ -12925,13 +13893,21 @@ hr = IDirect3DDevice9_SetPixelShader(device, NULL); ok(SUCCEEDED(hr), "SetPixelShader failed, hr %#x.\n", hr); IDirect3DPixelShader9_Release(ps); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void srgbwrite_format_test(IDirect3DDevice9 *device) +static void srgbwrite_format_test(void) { IDirect3D9 *d3d; IDirect3DSurface9 *rt, *backbuffer; IDirect3DTexture9 *texture; + IDirect3DDevice9 *device; + ULONG refcount; + HWND window; HRESULT hr; int i; DWORD color_rgb = 0x00808080, color_srgb = 0x00bcbcbc, color; @@ -12961,8 +13937,16 @@ { 1.0f, 1.0f, 0.1f, 1.0f, 1.0f} }; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d); - ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr); + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1); ok(SUCCEEDED(hr), "SetFVF failed, hr %#x.\n", hr); hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); @@ -12982,10 +13966,10 @@ continue; } - hr = IDirect3DDevice9_CreateTexture(device, 8, 8, 1, D3DUSAGE_RENDERTARGET, formats[i].fmt, - D3DPOOL_DEFAULT, &texture, NULL); + hr = IDirect3DDevice9_CreateTexture(device, 8, 8, 1, D3DUSAGE_RENDERTARGET, + formats[i].fmt, D3DPOOL_DEFAULT, &texture, NULL); ok(SUCCEEDED(hr), "CreateTexture failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0f, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff0000, 1.0f, 0); ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr); hr = IDirect3DTexture9_GetSurfaceLevel(texture, 0, &rt); @@ -13046,11 +14030,12 @@ ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr); } - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "SetTextureStageState failed, hr %#x.\n", hr); - - IDirect3D9_Release(d3d); IDirect3DSurface9_Release(backbuffer); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void ds_size_test(IDirect3DDevice9 *device) @@ -13152,13 +14137,17 @@ IDirect3DSurface9_Release(old_ds); } -static void unbound_sampler_test(IDirect3DDevice9 *device) +static void unbound_sampler_test(void) { - HRESULT hr; IDirect3DPixelShader9 *ps, *ps_cube, *ps_volume; IDirect3DSurface9 *rt, *old_rt; - DWORD color; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; + DWORD color; + HWND window; + HRESULT hr; static const DWORD ps_code[] = { @@ -13201,12 +14190,29 @@ { 1.0f, 1.0f, 0.1f, 1.0f, 1.0f} }; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); - ok(SUCCEEDED(hr), "GetDeviceCaps failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(2, 0)) + { + skip("No ps_2_0 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } if (!(caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP) || !(caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP)) { - skip("No cube / volume textures support, skipping the unbound sampler test.\n"); - return; + skip("No cube / volume texture support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_SetTexture(device, 0, NULL); @@ -13231,7 +14237,7 @@ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 ); ok(SUCCEEDED(hr), "IDirect3DDevice9_SetFVF failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x56ffffff, 0, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x56ffffff, 1.0f, 0); ok(SUCCEEDED(hr), "IDirect3DDevice9_Clear failed, hr %#x.\n", hr); hr = IDirect3DDevice9_SetPixelShader(device, ps); @@ -13287,20 +14293,19 @@ color = getPixelColorFromSurface(rt, 32, 32); ok(color == 0xff000000, "Unbound sampler color is %#x.\n", color); - hr = IDirect3DDevice9_SetRenderTarget(device, 0, old_rt); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetRenderTarget failed, hr %#x.\n", hr); - - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "IDirect3DDevice9_SetPixelShader failed, hr %#x.\n", hr); - IDirect3DSurface9_Release(rt); IDirect3DSurface9_Release(old_rt); IDirect3DPixelShader9_Release(ps); IDirect3DPixelShader9_Release(ps_cube); IDirect3DPixelShader9_Release(ps_volume); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void update_surface_test(IDirect3DDevice9 *device) +static void update_surface_test(void) { static const BYTE blocks[][8] = { @@ -13358,23 +14363,28 @@ IDirect3DSurface9 *src_surface, *dst_surface; IDirect3DTexture9 *src_tex, *dst_tex; + IDirect3DDevice9 *device; IDirect3D9 *d3d; + ULONG refcount; UINT count, i; + HWND window; HRESULT hr; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d); - ok(SUCCEEDED(hr), "GetDirect3D failed, hr %#x.\n", hr); - - hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1); - IDirect3D9_Release(d3d); - if (FAILED(hr)) + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1))) { - skip("DXT1 not supported, skipping test.\n"); - return; + skip("DXT1 not supported, skipping tests.\n"); + goto done; + } + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; } - - IDirect3D9_Release(d3d); hr = IDirect3DDevice9_CreateTexture(device, 64, 64, 0, 0, D3DFMT_DXT1, D3DPOOL_SYSTEMMEM, &src_tex, NULL); ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); @@ -13479,29 +14489,38 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Present failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "SetTexture failed, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "SetTextureStageState failed, hr %#x.\n", hr); IDirect3DTexture9_Release(dst_tex); IDirect3DTexture9_Release(src_tex); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void multisample_get_rtdata_test(IDirect3DDevice9 *device) +static void multisample_get_rtdata_test(void) { IDirect3DSurface9 *original_ds, *original_rt, *rt, *readback; - IDirect3D9 *d3d9; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; HRESULT hr; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d9); - ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr); - hr = IDirect3D9_CheckDeviceMultiSampleType(d3d9, D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL); - IDirect3D9_Release(d3d9); - if (FAILED(hr)) + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (FAILED(IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL))) { - skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisampled CopyRects test.\n"); - return; + skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping tests.\n"); + goto done; + } + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; } hr = IDirect3DDevice9_CreateRenderTarget(device, 256, 256, D3DFMT_A8R8G8B8, @@ -13535,12 +14554,18 @@ IDirect3DSurface9_Release(original_rt); IDirect3DSurface9_Release(readback); IDirect3DSurface9_Release(rt); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void multisampled_depth_buffer_test(IDirect3D9 *d3d9) +static void multisampled_depth_buffer_test(void) { IDirect3DDevice9 *device = 0; IDirect3DSurface9 *original_rt, *rt, *readback, *ds, *original_ds; + IDirect3D9 *d3d; D3DCAPS9 caps; HRESULT hr; D3DPRESENT_PARAMETERS present_parameters; @@ -13581,18 +14606,21 @@ {560, 450, D3DCOLOR_ARGB(0xff, 0x00, 0x00, 0xff)}, }; - hr = IDirect3D9_CheckDeviceMultiSampleType(d3d9, D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL); - if (FAILED(hr)) + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (FAILED(IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL))) { skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping multisampled depth buffer test.\n"); + IDirect3D9_Release(d3d); return; } - hr = IDirect3D9_CheckDeviceMultiSampleType(d3d9, D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, D3DFMT_D24S8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL); - if (FAILED(hr)) + if (FAILED(IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, D3DFMT_D24S8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL))) { skip("Multisampling not supported for D3DFMT_D24S8, skipping multisampled depth buffer test.\n"); + IDirect3D9_Release(d3d); return; } @@ -13607,7 +14635,7 @@ present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; present_parameters.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES; - hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device); ok(hr == D3D_OK, "Failed to create a device, hr %#x.\n", hr); @@ -13744,7 +14772,7 @@ present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; present_parameters.MultiSampleType = D3DMULTISAMPLE_NONE; - hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device); ok(hr == D3D_OK, "Failed to create a device, hr %#x.\n", hr); @@ -13837,9 +14865,10 @@ IDirect3DSurface9_Release(rt); cleanup: cleanup_device(device); + IDirect3D9_Release(d3d); } -static void resz_test(IDirect3D9 *d3d9) +static void resz_test(void) { IDirect3DDevice9 *device = 0; IDirect3DSurface9 *rt, *original_rt, *ds, *readback, *intz_ds; @@ -13891,36 +14920,40 @@ }; IDirect3DTexture9 *texture; IDirect3DPixelShader9 *ps; + IDirect3D9 *d3d; DWORD value; - hr = IDirect3D9_CheckDeviceMultiSampleType(d3d9, D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL); - if (FAILED(hr)) + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + + if (FAILED(IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, D3DFMT_A8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL))) { skip("Multisampling not supported for D3DFMT_A8R8G8B8, skipping RESZ test.\n"); + IDirect3D9_Release(d3d); return; } - hr = IDirect3D9_CheckDeviceMultiSampleType(d3d9, D3DADAPTER_DEFAULT, - D3DDEVTYPE_HAL, D3DFMT_D24S8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL); - if (FAILED(hr)) + if (FAILED(IDirect3D9_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, + D3DDEVTYPE_HAL, D3DFMT_D24S8, TRUE, D3DMULTISAMPLE_2_SAMPLES, NULL))) { skip("Multisampling not supported for D3DFMT_D24S8, skipping RESZ test.\n"); + IDirect3D9_Release(d3d); return; } - hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('I','N','T','Z')); - if (FAILED(hr)) + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, + D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, MAKEFOURCC('I','N','T','Z')))) { skip("No INTZ support, skipping RESZ test.\n"); + IDirect3D9_Release(d3d); return; } - hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, MAKEFOURCC('R','E','S','Z')); - if (FAILED(hr)) + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, + D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, MAKEFOURCC('R','E','S','Z')))) { skip("No RESZ support, skipping RESZ test.\n"); + IDirect3D9_Release(d3d); return; } @@ -13935,7 +14968,7 @@ present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; present_parameters.MultiSampleType = D3DMULTISAMPLE_NONE; - hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device); ok(hr == D3D_OK, "Failed to create a device, hr %#x.\n", hr); @@ -13945,12 +14978,14 @@ { skip("No pixel shader 2.0 support, skipping INTZ test.\n"); cleanup_device(device); + IDirect3D9_Release(d3d); return; } if (caps.TextureCaps & D3DPTEXTURECAPS_POW2) { skip("No unconditional NP2 texture support, skipping INTZ test.\n"); cleanup_device(device); + IDirect3D9_Release(d3d); return; } @@ -14091,7 +15126,7 @@ present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; present_parameters.MultiSampleType = D3DMULTISAMPLE_2_SAMPLES; - hr = IDirect3D9_CreateDevice(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + hr = IDirect3D9_CreateDevice(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, present_parameters.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &present_parameters, &device); ok(hr == D3D_OK, "Failed to create a device, hr %#x.\n", hr); @@ -14310,9 +15345,10 @@ IDirect3DSurface9_Release(readback); IDirect3DSurface9_Release(original_rt); cleanup_device(device); + IDirect3D9_Release(d3d); } -static void zenable_test(IDirect3DDevice9 *device) +static void zenable_test(void) { static const struct { @@ -14326,12 +15362,26 @@ {{640.0f, 480.0f, 1.5f, 1.0f}, 0xff00ff00}, {{640.0f, 0.0f, 1.5f, 1.0f}, 0xff00ff00}, }; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; D3DCAPS9 caps; + HWND window; HRESULT hr; UINT x, y; UINT i, j; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); ok(SUCCEEDED(hr), "Failed to disable z-buffering, hr %#x.\n", hr); hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZRHW | D3DFVF_DIFFUSE); @@ -14395,6 +15445,15 @@ 0x00ff0000, 0x00606060, 0x009f609f, 0x00ff0000, 0x00ff0000, 0x00602060, 0x009f209f, 0x00ff0000, }; + /* The Windows 8 testbot (WARP) appears to not clip z for regular + * vertices either. */ + static const D3DCOLOR expected_broken[] = + { + 0x0020df20, 0x0060df60, 0x009fdf9f, 0x00dfdfdf, + 0x00209f20, 0x00609f60, 0x009f9f9f, 0x00df9fdf, + 0x00206020, 0x00606060, 0x009f609f, 0x00df60df, + 0x00202020, 0x00602060, 0x009f209f, 0x00df20df, + }; IDirect3DVertexShader9 *vs; IDirect3DPixelShader9 *ps; @@ -14426,7 +15485,8 @@ x = 80 * ((2 * j) + 1); y = 60 * ((2 * i) + 1); color = getPixelColor(device, x, y); - ok(color_match(color, expected[i * 4 + j], 1), + ok(color_match(color, expected[i * 4 + j], 1) + || broken(color_match(color, expected_broken[i * 4 + j], 1)), "Expected color 0x%08x at %u, %u, got 0x%08x.\n", expected[i * 4 + j], x, y, color); } } @@ -14434,16 +15494,18 @@ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present backbuffer, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr); IDirect3DPixelShader9_Release(ps); IDirect3DVertexShader9_Release(vs); } + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void fog_special_test(IDirect3DDevice9 *device) +static void fog_special_test(void) { static const struct { @@ -14453,8 +15515,8 @@ quad[] = { {{ -1.0f, -1.0f, 0.0f}, 0xff00ff00}, - {{ 1.0f, -1.0f, 1.0f}, 0xff00ff00}, {{ -1.0f, 1.0f, 0.0f}, 0xff00ff00}, + {{ 1.0f, -1.0f, 1.0f}, 0xff00ff00}, {{ 1.0f, 1.0f, 1.0f}, 0xff00ff00} }; static const struct @@ -14490,6 +15552,13 @@ 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ 0x0000ffff }; + static const D3DMATRIX identity = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }}}; union { float f; @@ -14500,7 +15569,21 @@ unsigned int i; IDirect3DPixelShader9 *ps; IDirect3DVertexShader9 *vs; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; D3DCAPS9 caps; + HWND window; + + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); @@ -14525,8 +15608,16 @@ ps = NULL; } + /* The table fog tests seem to depend on the projection matrix explicitly + * being set to an identity matrix, even though that's the default. + * (AMD Radeon HD 6310, Windows 7) */ + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &identity); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0xffff0000); @@ -14540,7 +15631,7 @@ for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff0000ff, 0.0f, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff0000ff, 1.0f, 0); ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr); if (!tests[i].vs) @@ -14596,27 +15687,30 @@ ok(SUCCEEDED(hr), "Failed to present backbuffer, hr %#x.\n", hr); } - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, FALSE); - ok(SUCCEEDED(hr), "Failed to disable fog, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetVertexShader(device, NULL); - ok(SUCCEEDED(hr), "Failed to set vertex shader, hr %#x.\n", hr); if (vs) IDirect3DVertexShader9_Release(vs); if (ps) IDirect3DPixelShader9_Release(ps); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void volume_srgb_test(IDirect3DDevice9 *device) +static void volume_srgb_test(void) { HRESULT hr; - IDirect3D9 *d3d9; unsigned int i, j; IDirect3DVolumeTexture9 *tex1, *tex2; D3DPOOL pool; D3DLOCKED_BOX locked_box; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; D3DCOLOR color; + ULONG refcount; + HWND window; + static const struct { BOOL srgb; @@ -14636,22 +15730,26 @@ } quad[] = { - { {-1.0, -1.0, 0.0}, {0.0, 0.0, 0.0} }, - { { 1.0, -1.0, 0.0}, {0.0, 0.0, 0.0} }, - { {-1.0, 1.0, 0.0}, {0.0, 0.0, 0.0} }, - { { 1.0, 1.0, 0.0}, {0.0, 0.0, 0.0} }, + {{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}, + {{-1.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}, + {{ 1.0f, -1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}, + {{ 1.0f, 1.0f, 0.0f}, {0.0f, 0.0f, 0.0f}}, }; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d9); - ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr); - - hr = IDirect3D9_CheckDeviceFormat(d3d9, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_QUERY_SRGBREAD, D3DRTYPE_VOLUMETEXTURE, D3DFMT_A8R8G8B8); - if (hr != D3D_OK) + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, + D3DUSAGE_QUERY_SRGBREAD, D3DRTYPE_VOLUMETEXTURE, D3DFMT_A8R8G8B8) != D3D_OK) { skip("D3DFMT_A8R8G8B8 volume textures with SRGBREAD not supported.\n"); - IDirect3D9_Release(d3d9); - return; + goto done; + } + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; } hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); @@ -14719,22 +15817,25 @@ } } - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "Failed to set color op 0, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_SRGBTEXTURE, FALSE); - ok(SUCCEEDED(hr), "Failed to set srgb state, hr %#x.\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void volume_dxt5_test(IDirect3DDevice9 *device) +static void volume_dxt5_test(void) { - HRESULT hr; - IDirect3D9 *d3d9; IDirect3DVolumeTexture9 *texture; + IDirect3DDevice9 *device; D3DLOCKED_BOX box; + IDirect3D9 *d3d; unsigned int i; + ULONG refcount; DWORD color; + HWND window; + HRESULT hr; + static const char texture_data[] = { /* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. */ @@ -14751,26 +15852,31 @@ quads[] = { {{ -1.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.25f}}, - {{ 0.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.25f}}, {{ -1.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.25f}}, + {{ 0.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.25f}}, {{ 0.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.25f}}, {{ 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.75f}}, - {{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}}, {{ 0.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.75f}}, + {{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}}, {{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}}, }; static const DWORD expected_colors[] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff}; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d9); - ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr); - hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_DXT5); - IDirect3D9_Release(d3d9); - if (FAILED(hr)) + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_DXT5))) { - skip("Volume dxt5 textures are not supported, skipping test.\n"); - return; + skip("DXT5 volume textures are not supported, skipping test.\n"); + goto done; + } + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; } hr = IDirect3DDevice9_CreateVolumeTexture(device, 8, 4, 2, 1, 0, D3DFMT_DXT5, @@ -14796,7 +15902,7 @@ hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT); ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff00ff, 0.0f, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); hr = IDirect3DDevice9_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); @@ -14816,23 +15922,29 @@ "Expected color 0x%08x, got 0x%08x, case %u.\n", expected_colors[i], color, i); } - hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_DISABLE); - ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); IDirect3DVolumeTexture9_Release(texture); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } -static void volume_v16u16_test(IDirect3DDevice9 *device) +static void volume_v16u16_test(void) { - HRESULT hr; - IDirect3D9 *d3d9; IDirect3DVolumeTexture9 *texture; IDirect3DPixelShader9 *shader; + IDirect3DDevice9 *device; D3DLOCKED_BOX box; + IDirect3D9 *d3d; unsigned int i; - DWORD color; + ULONG refcount; + D3DCAPS9 caps; SHORT *texel; + DWORD color; + HWND window; + HRESULT hr; + static const struct { struct vec3 position; @@ -14841,13 +15953,13 @@ quads[] = { {{ -1.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.25f}}, - {{ 0.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.25f}}, {{ -1.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.25f}}, + {{ 0.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.25f}}, {{ 0.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.25f}}, {{ 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 0.75f}}, - {{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}}, {{ 0.0f, 1.0f, 0.0f}, { 0.0f, 1.0f, 0.75f}}, + {{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}}, {{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}}, }; static const DWORD shader_code[] = @@ -14860,15 +15972,30 @@ 0x0000ffff /* end */ }; - hr = IDirect3DDevice9_GetDirect3D(device, &d3d9); - ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr); - hr = IDirect3D9_CheckDeviceFormat(d3d9, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, - D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_V16U16); - IDirect3D9_Release(d3d9); - if (FAILED(hr)) + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (caps.PixelShaderVersion < D3DPS_VERSION(1, 1)) + { + skip("No ps_1_1 support, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_V16U16))) { skip("Volume V16U16 textures are not supported, skipping test.\n"); - return; + IDirect3DDevice9_Release(device); + goto done; } hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0)); @@ -14931,7 +16058,7 @@ hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *) texture); ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); - hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff00ff, 0.0f, 0); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); hr = IDirect3DDevice9_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); @@ -14961,11 +16088,12 @@ IDirect3DVolumeTexture9_Release(texture); } - hr = IDirect3DDevice9_SetPixelShader(device, NULL); - ok(SUCCEEDED(hr), "Failed to set pixel shader, hr %#x.\n", hr); IDirect3DPixelShader9_Release(shader); - hr = IDirect3DDevice9_SetTexture(device, 0, NULL); - ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); } static void add_dirty_rect_test_draw(IDirect3DDevice9 *device) @@ -14979,8 +16107,8 @@ quad[] = { {{-1.0, -1.0, 0.0}, {0.0, 0.0}}, - {{ 1.0, -1.0, 0.0}, {1.0, 0.0}}, {{-1.0, 1.0, 0.0}, {0.0, 1.0}}, + {{ 1.0, -1.0, 0.0}, {1.0, 0.0}}, {{ 1.0, 1.0, 0.0}, {1.0, 1.0}}, }; @@ -14992,17 +16120,33 @@ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); } -static void add_dirty_rect_test(IDirect3DDevice9 *device) +static void add_dirty_rect_test(void) { HRESULT hr; IDirect3DTexture9 *tex_dst1, *tex_dst2, *tex_src_red, *tex_src_green, *tex_managed; IDirect3DSurface9 *surface_dst2, *surface_src_green, *surface_src_red, *surface_managed; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; unsigned int i; + ULONG refcount; DWORD *texel; + HWND window; D3DLOCKED_RECT locked_rect; static const RECT part_rect = {96, 96, 160, 160}; DWORD color; + window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate9(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, window, TRUE))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + hr = IDirect3DDevice9_CreateTexture(device, 256, 256, 1, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &tex_dst1, NULL); ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); @@ -15290,11 +16434,14 @@ IDirect3DTexture9_Release(tex_dst1); IDirect3DTexture9_Release(tex_dst2); IDirect3DTexture9_Release(tex_managed); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); } START_TEST(visual) { - IDirect3D9 *d3d9; IDirect3DDevice9 *device_ptr; D3DCAPS9 caps; HRESULT hr; @@ -15377,103 +16524,64 @@ conditional_np2_repeat_test(device_ptr); fixed_function_bumpmap_test(device_ptr); pointsize_test(device_ptr); - tssargtemp_test(device_ptr); - np2_stretch_rect_test(device_ptr); - yuv_color_test(device_ptr); - yuv_layout_test(device_ptr); - zwriteenable_test(device_ptr); - alphatest_test(device_ptr); - viewport_test(device_ptr); - - if (caps.VertexShaderVersion >= D3DVS_VERSION(1, 1)) - { - test_constant_clamp_vs(device_ptr); - test_compare_instructions(device_ptr); - } - else skip("No vs_1_1 support\n"); - - if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0)) - { - test_mova(device_ptr); - loop_index_test(device_ptr); - sincos_test(device_ptr); - sgn_test(device_ptr); - clip_planes_test(device_ptr); - if (caps.VertexShaderVersion >= D3DVS_VERSION(3, 0)) { - test_vshader_input(device_ptr); - test_vshader_float16(device_ptr); - stream_test(device_ptr); - } else { - skip("No vs_3_0 support\n"); - } - } - else skip("No vs_2_0 support\n"); - - if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) - { - fog_with_shader_test(device_ptr); - } - else skip("No vs_2_0 and ps_2_0 support\n"); - - if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 1)) - { - texbem_test(device_ptr); - texdepth_test(device_ptr); - texkill_test(device_ptr); - x8l8v8u8_test(device_ptr); - volume_v16u16_test(device_ptr); - if (caps.PixelShaderVersion >= D3DPS_VERSION(1, 4)) { - constant_clamp_ps_test(device_ptr); - cnd_test(device_ptr); - if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) { - dp2add_ps_test(device_ptr); - unbound_sampler_test(device_ptr); - if (caps.PixelShaderVersion >= D3DPS_VERSION(3, 0) && caps.VertexShaderVersion >= D3DVS_VERSION(3, 0)) { - nested_loop_test(device_ptr); - pretransformed_varying_test(device_ptr); - vFace_register_test(device_ptr); - vpos_register_test(device_ptr); - multiple_rendertargets_test(device_ptr); - } else { - skip("No ps_3_0 or vs_3_0 support\n"); - } - } else { - skip("No ps_2_0 support\n"); - } - } - } - else skip("No ps_1_1 support\n"); - texop_test(device_ptr); - texop_range_test(device_ptr); - alphareplicate_test(device_ptr); - dp3_alpha_test(device_ptr); - depth_buffer_test(device_ptr); - depth_buffer2_test(device_ptr); - depth_blit_test(device_ptr); - intz_test(device_ptr); - shadow_test(device_ptr); - fp_special_test(device_ptr); - depth_bounds_test(device_ptr); - srgbwrite_format_test(device_ptr); - update_surface_test(device_ptr); - multisample_get_rtdata_test(device_ptr); - zenable_test(device_ptr); - fog_special_test(device_ptr); - volume_srgb_test(device_ptr); - volume_dxt5_test(device_ptr); - add_dirty_rect_test(device_ptr); - - hr = IDirect3DDevice9_GetDirect3D(device_ptr, &d3d9); - ok(SUCCEEDED(hr), "Failed to get d3d9 interface, hr %#x.\n", hr); cleanup_device(device_ptr); device_ptr = NULL; - multisampled_depth_buffer_test(d3d9); - resz_test(d3d9); - stencil_cull_test(d3d9); - - IDirect3D9_Release(d3d9); + tssargtemp_test(); + np2_stretch_rect_test(); + yuv_color_test(); + yuv_layout_test(); + zwriteenable_test(); + alphatest_test(); + viewport_test(); + test_constant_clamp_vs(); + test_compare_instructions(); + test_mova(); + loop_index_test(); + sincos_test(); + sgn_test(); + clip_planes_test(); + test_vshader_input(); + test_vshader_float16(); + stream_test(); + fog_with_shader_test(); + texbem_test(); + texdepth_test(); + texkill_test(); + x8l8v8u8_test(); + volume_v16u16_test(); + constant_clamp_ps_test(); + cnd_test(); + dp2add_ps_test(); + unbound_sampler_test(); + nested_loop_test(); + pretransformed_varying_test(); + vface_register_test(); + vpos_register_test(); + multiple_rendertargets_test(); + texop_test(); + texop_range_test(); + alphareplicate_test(); + dp3_alpha_test(); + depth_buffer_test(); + depth_buffer2_test(); + depth_blit_test(); + intz_test(); + shadow_test(); + fp_special_test(); + depth_bounds_test(); + srgbwrite_format_test(); + update_surface_test(); + multisample_get_rtdata_test(); + zenable_test(); + fog_special_test(); + volume_srgb_test(); + volume_dxt5_test(); + add_dirty_rect_test(); + multisampled_depth_buffer_test(); + resz_test(); + stencil_cull_test(); cleanup: cleanup_device(device_ptr); diff -Nru wine1.7-1.7.13/dlls/d3d9/texture.c wine1.7-1.7.16/dlls/d3d9/texture.c --- wine1.7-1.7.13/dlls/d3d9/texture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/texture.c 2014-04-04 19:13:44.000000000 +0000 @@ -61,7 +61,7 @@ static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -79,7 +79,7 @@ static ULONG WINAPI d3d9_texture_2d_Release(IDirect3DTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -115,52 +115,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_texture_2d_GetPrivateData(IDirect3DTexture9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_texture_2d_FreePrivateData(IDirect3DTexture9 *iface, REFGUID guid) { struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d9_texture_2d_SetPriority(IDirect3DTexture9 *iface, DWORD priority) @@ -472,7 +448,7 @@ static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -490,7 +466,7 @@ static ULONG WINAPI d3d9_texture_cube_Release(IDirect3DCubeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -528,52 +504,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_texture_cube_GetPrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_texture_cube_FreePrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid) { struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d9_texture_cube_SetPriority(IDirect3DCubeTexture9 *iface, DWORD priority) @@ -911,7 +863,7 @@ static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - ULONG ref = InterlockedIncrement(&texture->refcount); + ULONG ref = InterlockedIncrement(&texture->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -929,7 +881,7 @@ static ULONG WINAPI d3d9_texture_3d_Release(IDirect3DVolumeTexture9 *iface) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - ULONG ref = InterlockedDecrement(&texture->refcount); + ULONG ref = InterlockedDecrement(&texture->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -965,52 +917,28 @@ REFGUID guid, const void *data, DWORD data_size, DWORD flags) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_texture_3d_GetPrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_texture_3d_FreePrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid) { struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_texture_get_resource(texture->wined3d_texture); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&texture->resource, guid); } static DWORD WINAPI d3d9_texture_3d_SetPriority(IDirect3DVolumeTexture9 *iface, DWORD priority) @@ -1298,7 +1226,9 @@ static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_texture *texture = parent; + d3d9_resource_cleanup(&texture->resource); + HeapFree(GetProcessHeap(), 0, texture); } static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops = @@ -1314,7 +1244,7 @@ HRESULT hr; texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl; - texture->refcount = 1; + d3d9_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1355,7 +1285,7 @@ HRESULT hr; texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl; - texture->refcount = 1; + d3d9_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); @@ -1395,7 +1325,7 @@ HRESULT hr; texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl; - texture->refcount = 1; + d3d9_resource_init(&texture->resource); desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE; desc.format = wined3dformat_from_d3dformat(format); diff -Nru wine1.7-1.7.13/dlls/d3d9/volume.c wine1.7-1.7.16/dlls/d3d9/volume.c --- wine1.7-1.7.13/dlls/d3d9/volume.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3d9/volume.c 2014-04-04 19:13:44.000000000 +0000 @@ -60,7 +60,7 @@ return IUnknown_AddRef(volume->forwardReference); } - refcount = InterlockedIncrement(&volume->refcount); + refcount = InterlockedIncrement(&volume->resource.refcount); TRACE("%p increasing refcount to %u.\n", iface, refcount); if (refcount == 1) @@ -86,7 +86,7 @@ return IUnknown_Release(volume->forwardReference); } - refcount = InterlockedDecrement(&volume->refcount); + refcount = InterlockedDecrement(&volume->resource.refcount); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) @@ -123,52 +123,28 @@ const void *data, DWORD data_size, DWORD flags) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(guid), data, data_size, flags); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_set_private_data(&volume->resource, guid, data, data_size, flags); } static HRESULT WINAPI d3d9_volume_GetPrivateData(IDirect3DVolume9 *iface, REFGUID guid, void *data, DWORD *data_size) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(guid), data, data_size); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_get_private_data(resource, guid, data, data_size); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_get_private_data(&volume->resource, guid, data, data_size); } static HRESULT WINAPI d3d9_volume_FreePrivateData(IDirect3DVolume9 *iface, REFGUID guid) { struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface); - struct wined3d_resource *resource; - HRESULT hr; - TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - wined3d_mutex_lock(); - resource = wined3d_volume_get_resource(volume->wined3d_volume); - hr = wined3d_resource_free_private_data(resource, guid); - wined3d_mutex_unlock(); - - return hr; + return d3d9_resource_free_private_data(&volume->resource, guid); } static HRESULT WINAPI d3d9_volume_GetContainer(IDirect3DVolume9 *iface, REFIID riid, void **container) @@ -266,7 +242,9 @@ static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent) { - HeapFree(GetProcessHeap(), 0, parent); + struct d3d9_volume *volume = parent; + d3d9_resource_cleanup(&volume->resource); + HeapFree(GetProcessHeap(), 0, volume); } static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops = @@ -278,7 +256,7 @@ const struct wined3d_parent_ops **parent_ops) { volume->IDirect3DVolume9_iface.lpVtbl = &d3d9_volume_vtbl; - volume->refcount = 1; + d3d9_resource_init(&volume->resource); wined3d_volume_incref(wined3d_volume); volume->wined3d_volume = wined3d_volume; diff -Nru wine1.7-1.7.13/dlls/d3dcompiler_43/tests/hlsl.c wine1.7-1.7.16/dlls/d3dcompiler_43/tests/hlsl.c --- wine1.7-1.7.13/dlls/d3dcompiler_43/tests/hlsl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dcompiler_43/tests/hlsl.c 2014-04-04 19:13:44.000000000 +0000 @@ -235,7 +235,7 @@ ok(hr == D3D_OK, "IDirect3DDevice9_SetPixelShader returned: %08x\n", hr); } -static int colors_match(D3DXCOLOR a, D3DXCOLOR b, float epsilon) +static BOOL colors_match(D3DXCOLOR a, D3DXCOLOR b, float epsilon) { return (fabs(a.r - b.r) < epsilon && fabs(a.g - b.g) < epsilon && fabs(a.b - b.b) < epsilon && fabs(a.a - b.a) < epsilon); diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/d3dx9_36_private.h wine1.7-1.7.16/dlls/d3dx9_36/d3dx9_36_private.h --- wine1.7-1.7.13/dlls/d3dx9_36/d3dx9_36_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/d3dx9_36_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -88,7 +88,8 @@ const struct pixel_format_desc *dst_format, D3DCOLOR color_key, const PALETTEENTRY *palette) DECLSPEC_HIDDEN; HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const PALETTEENTRY *palette, - DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; + DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info, unsigned int skip_levels, + unsigned int *loaded_miplevels) DECLSPEC_HIDDEN; HRESULT load_cube_texture_from_dds(IDirect3DCubeTexture9 *cube_texture, const void *src_data, const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; HRESULT load_volume_from_dds(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette, diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/effect.c wine1.7-1.7.16/dlls/d3dx9_36/effect.c --- wine1.7-1.7.13/dlls/d3dx9_36/effect.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/effect.c 2014-04-04 19:13:44.000000000 +0000 @@ -26,11 +26,14 @@ #include "windef.h" #include "wingdi.h" #include "d3dx9_36_private.h" +#include "d3dcompiler.h" /* Constants for special INT/FLOAT conversation */ #define INT_FLOAT_MULTI 255.0f #define INT_FLOAT_MULTI_INVERSE (1/INT_FLOAT_MULTI) +#define INITIAL_PARAM_TABLE_SIZE 16 + WINE_DEFAULT_DEBUG_CHANNEL(d3dx); enum STATE_CLASS @@ -93,6 +96,7 @@ ST_CONSTANT, ST_PARAMETER, ST_FXLC, + ST_ARRAY_SELECTOR, }; struct d3dx_parameter @@ -111,8 +115,12 @@ UINT bytes; DWORD object_id; + D3DXHANDLE handle; + struct d3dx_parameter *annotations; struct d3dx_parameter *members; + + struct d3dx_parameter *referenced_param; }; struct d3dx_object @@ -156,6 +164,12 @@ struct d3dx_pass *passes; }; +struct param_table +{ + struct d3dx_parameter **table; + unsigned int count, size; +}; + struct d3dx9_base_effect { struct ID3DXEffectImpl *effect; @@ -167,6 +181,8 @@ struct d3dx_parameter *parameters; struct d3dx_technique *techniques; struct d3dx_object *objects; + + struct param_table param_table; }; struct ID3DXEffectImpl @@ -197,8 +213,8 @@ struct d3dx_parameter *parameter, const char *name); static struct d3dx_parameter *get_annotation_by_name(UINT count, struct d3dx_parameter *parameters, const char *name); -static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, - struct d3dx_object *objects); +static HRESULT d3dx9_parse_state(struct d3dx9_base_effect *base, struct d3dx_state *state, + const char *data, const char **ptr, struct d3dx_object *objects); static void free_parameter(struct d3dx_parameter *param, BOOL element, BOOL child); static const struct @@ -425,7 +441,7 @@ static inline D3DXHANDLE get_parameter_handle(struct d3dx_parameter *parameter) { - return (D3DXHANDLE) parameter; + return parameter ? parameter->handle : NULL; } static inline D3DXHANDLE get_technique_handle(struct d3dx_technique *technique) @@ -484,74 +500,12 @@ return NULL; } -static struct d3dx_parameter *get_valid_sub_parameter(struct d3dx_parameter *param, D3DXHANDLE parameter) -{ - unsigned int i, count; - struct d3dx_parameter *p; - - for (i = 0; i < param->annotation_count; ++i) - { - if (get_parameter_handle(¶m->annotations[i]) == parameter) - return ¶m->annotations[i]; - - p = get_valid_sub_parameter(¶m->annotations[i], parameter); - if (p) return p; - } - - count = param->element_count ? param->element_count : param->member_count; - for (i = 0; i < count; ++i) - { - if (get_parameter_handle(¶m->members[i]) == parameter) - return ¶m->members[i]; - - p = get_valid_sub_parameter(¶m->members[i], parameter); - if (p) return p; - } - - return NULL; -} - static struct d3dx_parameter *get_valid_parameter(struct d3dx9_base_effect *base, D3DXHANDLE parameter) { - unsigned int i, k, m; - struct d3dx_parameter *p; - - for (i = 0; i < base->parameter_count; ++i) - { - if (get_parameter_handle(&base->parameters[i]) == parameter) - return &base->parameters[i]; + struct d3dx_parameter **handle_param = (struct d3dx_parameter **)parameter; - p = get_valid_sub_parameter(&base->parameters[i], parameter); - if (p) return p; - } - - for (i = 0; i < base->technique_count; ++i) - { - struct d3dx_technique *technique = &base->techniques[i]; - - for (k = 0; k < technique->pass_count; ++k) - { - struct d3dx_pass *pass = &technique->passes[k]; - - for (m = 0; m < pass->annotation_count; ++m) - { - if (get_parameter_handle(&pass->annotations[m]) == parameter) - return &pass->annotations[m]; - - p = get_valid_sub_parameter(&pass->annotations[m], parameter); - if (p) return p; - } - } - - for (k = 0; k < technique->annotation_count; ++k) - { - if (get_parameter_handle(&technique->annotations[k]) == parameter) - return &technique->annotations[k]; - - p = get_valid_sub_parameter(&technique->annotations[k], parameter); - if (p) return p; - } - } + if (handle_param >= base->param_table.table && handle_param < base->param_table.table + base->param_table.count) + return *handle_param; return get_parameter_by_name(base, NULL, parameter); } @@ -610,6 +564,7 @@ switch (param->type) { case D3DXPT_STRING: + HeapFree(GetProcessHeap(), 0, *(char **)param->data); break; case D3DXPT_TEXTURE: @@ -713,6 +668,8 @@ TRACE("base %p.\n", base); + HeapFree(GetProcessHeap(), 0, base->param_table.table); + if (base->parameters) { for (i = 0; i < base->parameter_count; ++i) @@ -807,16 +764,40 @@ } } -static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix, BOOL transpose) +static void set_matrix(struct d3dx_parameter *param, const D3DXMATRIX *matrix) { UINT i, k; + if (param->type == D3DXPT_FLOAT) + { + if (param->columns == 4) + memcpy(param->data, matrix->u.m, param->rows * 4 * sizeof(float)); + else + for (i = 0; i < param->rows; ++i) + memcpy((float *)param->data + i * param->columns, matrix->u.m + i, param->columns * sizeof(float)); + return; + } + for (i = 0; i < param->rows; ++i) { for (k = 0; k < param->columns; ++k) { set_number((FLOAT *)param->data + i * param->columns + k, param->type, - transpose ? &matrix->u.m[k][i] : &matrix->u.m[i][k], D3DXPT_FLOAT); + &matrix->u.m[i][k], D3DXPT_FLOAT); + } + } +} + +static void set_matrix_transpose(struct d3dx_parameter *param, const D3DXMATRIX *matrix) +{ + UINT i, k; + + for (i = 0; i < param->rows; ++i) + { + for (k = 0; k < param->columns; ++k) + { + set_number((FLOAT *)param->data + i * param->columns + k, param->type, + &matrix->u.m[k][i], D3DXPT_FLOAT); } } } @@ -1083,7 +1064,7 @@ } } - WARN("Invalid argument specified.\n"); + WARN("Parameter not found.\n"); return NULL; } @@ -1161,7 +1142,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return NULL; } @@ -1188,7 +1169,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return NULL; } @@ -1217,7 +1198,7 @@ return t; } - WARN("Invalid argument specified.\n"); + WARN("Technique not found.\n"); return NULL; } @@ -1233,7 +1214,7 @@ return get_pass_handle(&tech->passes[index]); } - WARN("Invalid argument specified.\n"); + WARN("Pass not found.\n"); return NULL; } @@ -1259,7 +1240,7 @@ } } - WARN("Invalid argument specified.\n"); + WARN("Pass not found.\n"); return NULL; } @@ -1321,7 +1302,7 @@ return get_parameter_handle(&annotations[index]); } - WARN("Invalid argument specified\n"); + WARN("Annotation not found.\n"); return NULL; } @@ -1348,7 +1329,7 @@ return get_parameter_handle(annotation); } - WARN("Invalid argument specified\n"); + WARN("Annotation not found.\n"); return NULL; } @@ -1459,7 +1440,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1474,7 +1455,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1490,7 +1471,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1528,7 +1509,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1552,7 +1533,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1589,7 +1570,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1627,7 +1608,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1664,7 +1645,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1688,7 +1669,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1703,7 +1684,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1719,7 +1700,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1756,7 +1737,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1780,7 +1761,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1825,7 +1806,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1866,7 +1847,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1903,7 +1884,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1942,7 +1923,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -1959,7 +1940,7 @@ switch (param->class) { case D3DXPC_MATRIX_ROWS: - set_matrix(param, matrix, FALSE); + set_matrix(param, matrix); return D3D_OK; case D3DXPC_SCALAR: @@ -1974,7 +1955,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2006,7 +1987,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2027,7 +2008,7 @@ case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], &matrix[i], FALSE); + set_matrix(¶m->members[i], &matrix[i]); } return D3D_OK; @@ -2043,7 +2024,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2082,7 +2063,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2101,7 +2082,7 @@ case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], matrix[i], FALSE); + set_matrix(¶m->members[i], matrix[i]); } return D3D_OK; @@ -2116,7 +2097,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2154,7 +2135,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2171,7 +2152,7 @@ switch (param->class) { case D3DXPC_MATRIX_ROWS: - set_matrix(param, matrix, TRUE); + set_matrix_transpose(param, matrix); return D3D_OK; case D3DXPC_SCALAR: @@ -2186,7 +2167,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2221,7 +2202,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2242,7 +2223,7 @@ case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], &matrix[i], TRUE); + set_matrix_transpose(¶m->members[i], &matrix[i]); } return D3D_OK; @@ -2258,7 +2239,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2297,7 +2278,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2316,7 +2297,7 @@ case D3DXPC_MATRIX_ROWS: for (i = 0; i < count; ++i) { - set_matrix(¶m->members[i], matrix[i], TRUE); + set_matrix_transpose(¶m->members[i], matrix[i]); } return D3D_OK; @@ -2331,7 +2312,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2369,7 +2350,7 @@ } } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2394,7 +2375,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2419,7 +2400,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2440,7 +2421,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2458,7 +2439,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -2476,7 +2457,7 @@ return D3D_OK; } - WARN("Invalid argument specified\n"); + WARN("Parameter not found.\n"); return D3DERR_INVALIDCALL; } @@ -3098,7 +3079,7 @@ return D3D_OK; } - WARN("Invalid argument supplied.\n"); + WARN("Technique not found.\n"); return D3DERR_INVALIDCALL; } @@ -3144,7 +3125,7 @@ struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); struct d3dx_technique *technique = This->active_technique; - FIXME("iface %p, passes %p, flags %#x partial stub\n", iface, passes, flags); + TRACE("iface %p, passes %p, flags %#x.\n", iface, passes, flags); if (passes && technique) { @@ -3199,6 +3180,12 @@ FIXME("(%p)->(): stub\n", This); + if (!This->active_pass) + { + WARN("Called without an active pass.\n"); + return D3D_OK; + } + return E_NOTIMPL; } @@ -3223,7 +3210,7 @@ { struct ID3DXEffectImpl *This = impl_from_ID3DXEffect(iface); - FIXME("iface %p partial stub\n", iface); + TRACE("iface %p.\n", iface); if (!This->started) return D3D_OK; @@ -4140,8 +4127,8 @@ ID3DXEffectCompilerImpl_CompileShader, }; -static HRESULT d3dx9_parse_sampler(struct d3dx_sampler *sampler, const char *data, const char **ptr, - struct d3dx_object *objects) +static HRESULT d3dx9_parse_sampler(struct d3dx9_base_effect *base, struct d3dx_sampler *sampler, + const char *data, const char **ptr, struct d3dx_object *objects) { HRESULT hr; UINT i; @@ -4158,7 +4145,7 @@ for (i = 0; i < sampler->state_count; ++i) { - hr = d3dx9_parse_state(&sampler->states[i], data, ptr, objects); + hr = d3dx9_parse_state(base, &sampler->states[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse state %u\n", i); @@ -4180,8 +4167,8 @@ return hr; } -static HRESULT d3dx9_parse_value(struct d3dx_parameter *param, void *value, const char *data, - const char **ptr, struct d3dx_object *objects) +static HRESULT d3dx9_parse_value(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + void *value, const char *data, const char **ptr, struct d3dx_object *objects) { unsigned int i; HRESULT hr; @@ -4195,7 +4182,7 @@ { struct d3dx_parameter *member = ¶m->members[i]; - hr = d3dx9_parse_value(member, value ? (char *)value + old_size : NULL, data, ptr, objects); + hr = d3dx9_parse_value(base, member, value ? (char *)value + old_size : NULL, data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse value %u\n", i); @@ -4224,7 +4211,7 @@ { struct d3dx_parameter *member = ¶m->members[i]; - hr = d3dx9_parse_value(member, (char *)value + old_size, data, ptr, objects); + hr = d3dx9_parse_value(base, member, (char *)value + old_size, data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse value %u\n", i); @@ -4264,7 +4251,7 @@ if (!sampler) return E_OUTOFMEMORY; - hr = d3dx9_parse_sampler(sampler, data, ptr, objects); + hr = d3dx9_parse_sampler(base, sampler, data, ptr, objects); if (hr != D3D_OK) { HeapFree(GetProcessHeap(), 0, sampler); @@ -4290,8 +4277,8 @@ return D3D_OK; } -static HRESULT d3dx9_parse_init_value(struct d3dx_parameter *param, const char *data, const char *ptr, - struct d3dx_object *objects) +static HRESULT d3dx9_parse_init_value(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + const char *data, const char *ptr, struct d3dx_object *objects) { UINT size = param->bytes; HRESULT hr; @@ -4328,7 +4315,7 @@ } } - hr = d3dx9_parse_value(param, value, data, &ptr, objects); + hr = d3dx9_parse_value(base, param, value, data, &ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4372,10 +4359,13 @@ read_dword(ptr, &object->size); TRACE("Data size: %#x\n", object->size); + if (!object->size) + return D3D_OK; + object->data = HeapAlloc(GetProcessHeap(), 0, object->size); if (!object->data) { - ERR("Failed to allocate name memory.\n"); + ERR("Failed to allocate object memory.\n"); return E_OUTOFMEMORY; } @@ -4387,8 +4377,63 @@ return D3D_OK; } -static HRESULT d3dx9_parse_effect_typedef(struct d3dx_parameter *param, const char *data, const char **ptr, - struct d3dx_parameter *parent, UINT flags) +static void add_param_to_table(struct d3dx9_base_effect *base, struct d3dx_parameter *param) +{ + struct param_table *table = &base->param_table; + + if (table->count >= table->size) + { + unsigned int new_size; + struct d3dx_parameter **new_alloc; + + if (!table->size) + { + new_size = INITIAL_PARAM_TABLE_SIZE; + new_alloc = HeapAlloc(GetProcessHeap(), 0, sizeof(*table->table) * new_size); + if (!new_alloc) + { + ERR("Out of memory.\n"); + return; + } + } + else + { + new_size = table->size * 2; + new_alloc = HeapReAlloc(GetProcessHeap(), 0, table->table, sizeof(*table->table) * new_size); + if (!new_alloc) + { + ERR("Out of memory.\n"); + return; + } + } + table->table = new_alloc; + table->size = new_size; + } + + table->table[table->count++] = param; +} + +static void sync_param_handles(struct d3dx9_base_effect *base) +{ + struct param_table *table = &base->param_table; + struct d3dx_parameter **new_alloc; + unsigned int i; + + if (table->count) + { + new_alloc = HeapReAlloc(GetProcessHeap(), 0, table->table, sizeof(*table->table) * table->count); + if (new_alloc) + table->table = new_alloc; + else + ERR("Out of memory.\n"); + } + + for (i = 0; i < table->count; ++i) + table->table[i]->handle = (D3DXHANDLE)&table->table[i]; +} + +static HRESULT d3dx9_parse_effect_typedef(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + const char *data, const char **ptr, struct d3dx_parameter *parent, UINT flags) { DWORD offset; HRESULT hr; @@ -4521,7 +4566,8 @@ { *ptr = save_ptr; - hr = d3dx9_parse_effect_typedef(¶m->members[i], data, ptr, param, flags); + add_param_to_table(base, ¶m->members[i]); + hr = d3dx9_parse_effect_typedef(base, ¶m->members[i], data, ptr, param, flags); if (hr != D3D_OK) { WARN("Failed to parse member %u\n", i); @@ -4545,7 +4591,8 @@ for (i = 0; i < param->member_count; ++i) { - hr = d3dx9_parse_effect_typedef(¶m->members[i], data, ptr, NULL, flags); + add_param_to_table(base, ¶m->members[i]); + hr = d3dx9_parse_effect_typedef(base, ¶m->members[i], data, ptr, NULL, flags); if (hr != D3D_OK) { WARN("Failed to parse member %u\n", i); @@ -4580,8 +4627,8 @@ return hr; } -static HRESULT d3dx9_parse_effect_annotation(struct d3dx_parameter *anno, const char *data, - const char **ptr, struct d3dx_object *objects) +static HRESULT d3dx9_parse_effect_annotation(struct d3dx9_base_effect *base, struct d3dx_parameter *anno, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; const char *ptr2; @@ -4592,7 +4639,7 @@ read_dword(ptr, &offset); TRACE("Typedef offset: %#x\n", offset); ptr2 = data + offset; - hr = d3dx9_parse_effect_typedef(anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION); + hr = d3dx9_parse_effect_typedef(base, anno, data, &ptr2, NULL, D3DX_PARAMETER_ANNOTATION); if (hr != D3D_OK) { WARN("Failed to parse type definition\n"); @@ -4601,7 +4648,7 @@ read_dword(ptr, &offset); TRACE("Value offset: %#x\n", offset); - hr = d3dx9_parse_init_value(anno, data, data + offset, objects); + hr = d3dx9_parse_init_value(base, anno, data, data + offset, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4611,8 +4658,8 @@ return D3D_OK; } -static HRESULT d3dx9_parse_state(struct d3dx_state *state, const char *data, const char **ptr, - struct d3dx_object *objects) +static HRESULT d3dx9_parse_state(struct d3dx9_base_effect *base, struct d3dx_state *state, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; const char *ptr2; @@ -4629,7 +4676,7 @@ read_dword(ptr, &offset); TRACE("Typedef offset: %#x\n", offset); ptr2 = data + offset; - hr = d3dx9_parse_effect_typedef(&state->parameter, data, &ptr2, NULL, 0); + hr = d3dx9_parse_effect_typedef(base, &state->parameter, data, &ptr2, NULL, 0); if (hr != D3D_OK) { WARN("Failed to parse type definition\n"); @@ -4638,7 +4685,7 @@ read_dword(ptr, &offset); TRACE("Value offset: %#x\n", offset); - hr = d3dx9_parse_init_value(&state->parameter, data, data + offset, objects); + hr = d3dx9_parse_init_value(base, &state->parameter, data, data + offset, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4654,8 +4701,8 @@ return hr; } -static HRESULT d3dx9_parse_effect_parameter(struct d3dx_parameter *param, const char *data, - const char **ptr, struct d3dx_object *objects) +static HRESULT d3dx9_parse_effect_parameter(struct d3dx9_base_effect *base, struct d3dx_parameter *param, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; HRESULT hr; @@ -4675,14 +4722,14 @@ read_dword(ptr, ¶m->annotation_count); TRACE("Annotation count: %u\n", param->annotation_count); - hr = d3dx9_parse_effect_typedef(param, data, &ptr2, NULL, param->flags); + hr = d3dx9_parse_effect_typedef(base, param, data, &ptr2, NULL, param->flags); if (hr != D3D_OK) { WARN("Failed to parse type definition\n"); return hr; } - hr = d3dx9_parse_init_value(param, data, data + offset, objects); + hr = d3dx9_parse_init_value(base, param, data, data + offset, objects); if (hr != D3D_OK) { WARN("Failed to parse value\n"); @@ -4702,7 +4749,8 @@ for (i = 0; i < param->annotation_count; ++i) { - hr = d3dx9_parse_effect_annotation(¶m->annotations[i], data, ptr, objects); + add_param_to_table(base, ¶m->annotations[i]); + hr = d3dx9_parse_effect_annotation(base, ¶m->annotations[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation\n"); @@ -4726,8 +4774,8 @@ return hr; } -static HRESULT d3dx9_parse_effect_pass(struct d3dx_pass *pass, const char *data, const char **ptr, - struct d3dx_object *objects) +static HRESULT d3dx9_parse_effect_pass(struct d3dx9_base_effect *base, struct d3dx_pass *pass, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; HRESULT hr; @@ -4763,7 +4811,8 @@ for (i = 0; i < pass->annotation_count; ++i) { - hr = d3dx9_parse_effect_annotation(&pass->annotations[i], data, ptr, objects); + add_param_to_table(base, &pass->annotations[i]); + hr = d3dx9_parse_effect_annotation(base, &pass->annotations[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation %u\n", i); @@ -4784,7 +4833,7 @@ for (i = 0; i < pass->state_count; ++i) { - hr = d3dx9_parse_state(&states[i], data, ptr, objects); + hr = d3dx9_parse_state(base, &states[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation %u\n", i); @@ -4822,8 +4871,8 @@ return hr; } -static HRESULT d3dx9_parse_effect_technique(struct d3dx_technique *technique, const char *data, - const char **ptr, struct d3dx_object *objects) +static HRESULT d3dx9_parse_effect_technique(struct d3dx9_base_effect *base, struct d3dx_technique *technique, + const char *data, const char **ptr, struct d3dx_object *objects) { DWORD offset; HRESULT hr; @@ -4858,7 +4907,8 @@ for (i = 0; i < technique->annotation_count; ++i) { - hr = d3dx9_parse_effect_annotation(&technique->annotations[i], data, ptr, objects); + add_param_to_table(base, &technique->annotations[i]); + hr = d3dx9_parse_effect_annotation(base, &technique->annotations[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse annotation %u\n", i); @@ -4880,7 +4930,7 @@ for (i = 0; i < technique->pass_count; ++i) { - hr = d3dx9_parse_effect_pass(&technique->passes[i], data, ptr, objects); + hr = d3dx9_parse_effect_pass(base, &technique->passes[i], data, ptr, objects); if (hr != D3D_OK) { WARN("Failed to parse pass %u\n", i); @@ -4916,12 +4966,81 @@ return hr; } +static HRESULT d3dx9_create_object(struct d3dx9_base_effect *base, struct d3dx_object *object) +{ + struct d3dx_parameter *param = object->param; + struct IDirect3DDevice9 *device = base->effect->device; + HRESULT hr; + + if (*(char **)param->data) + ERR("Parameter data already allocated.\n"); + + switch (param->type) + { + case D3DXPT_STRING: + *(char **)param->data = HeapAlloc(GetProcessHeap(), 0, object->size); + if (!*(char **)param->data) + { + ERR("Out of memory.\n"); + return E_OUTOFMEMORY; + } + memcpy(*(char **)param->data, object->data, object->size); + break; + case D3DXPT_VERTEXSHADER: + if (FAILED(hr = IDirect3DDevice9_CreateVertexShader(device, object->data, + (IDirect3DVertexShader9 **)param->data))) + { + WARN("Failed to create vertex shader.\n"); + return hr; + } + break; + case D3DXPT_PIXELSHADER: + if (FAILED(hr = IDirect3DDevice9_CreatePixelShader(device, object->data, + (IDirect3DPixelShader9 **)param->data))) + { + WARN("Failed to create pixel shader.\n"); + return hr; + } + break; + default: + break; + } + return D3D_OK; +} + +static HRESULT d3dx9_parse_array_selector(struct d3dx9_base_effect *base, struct d3dx_parameter *param) +{ + DWORD string_size; + struct d3dx_object *object = &base->objects[param->object_id]; + char *ptr = object->data; + + TRACE("Parsing array entry selection state for parameter %p.\n", param); + + string_size = *(DWORD *)ptr; + param->referenced_param = get_parameter_by_name(base, NULL, ptr + 4); + if (param->referenced_param) + { + TRACE("Mapping to parameter %s.\n", debugstr_a(param->referenced_param->name)); + } + else + { + FIXME("Referenced parameter %s not found.\n", ptr + 4); + return D3DXERR_INVALIDDATA; + } + TRACE("Unknown DWORD: 0x%.8x.\n", *(DWORD *)(ptr + string_size)); + + FIXME("Parse preshader.\n"); + + return D3D_OK; +} + static HRESULT d3dx9_parse_resource(struct d3dx9_base_effect *base, const char *data, const char **ptr) { DWORD technique_index; DWORD index, state_index, usage, element_index; struct d3dx_state *state; struct d3dx_parameter *param; + struct d3dx_object *object; HRESULT hr = E_FAIL; read_dword(ptr, &technique_index); @@ -4999,21 +5118,26 @@ state = &pass->states[state_index]; } + TRACE("State operation %#x (%s).\n", state->operation, state_table[state->operation].name); param = &state->parameter; + TRACE("Using object id %u.\n", param->object_id); + object = &base->objects[param->object_id]; - /* - * TODO: Do we need to create the shader/string here or later when we access them? - */ + TRACE("Usage %u: class %s, type %s.\n", usage, debug_d3dxparameter_class(param->class), + debug_d3dxparameter_type(param->type)); switch (usage) { case 0: - TRACE("usage 0: type %s\n", debug_d3dxparameter_type(param->type)); switch (param->type) { case D3DXPT_VERTEXSHADER: case D3DXPT_PIXELSHADER: state->type = ST_CONSTANT; - hr = d3dx9_copy_data(&base->objects[param->object_id], ptr); + if (FAILED(hr = d3dx9_copy_data(&base->objects[param->object_id], ptr))) + return hr; + + if (object->data) + hr = d3dx9_create_object(base, object); break; case D3DXPT_BOOL: @@ -5032,7 +5156,27 @@ case 1: state->type = ST_PARAMETER; - hr = d3dx9_copy_data(&base->objects[param->object_id], ptr); + if (FAILED(hr = d3dx9_copy_data(&base->objects[param->object_id], ptr))) + return hr; + + TRACE("Looking for parameter %s.\n", debugstr_a(object->data)); + param->referenced_param = get_parameter_by_name(base, NULL, object->data); + if (param->referenced_param) + { + TRACE("Mapping to parameter %p.\n", param->referenced_param); + } + else + { + FIXME("Referenced parameter %s not found.\n", (char *)object->data); + return D3DXERR_INVALIDDATA; + } + break; + + case 2: + state->type = ST_ARRAY_SELECTOR; + if (FAILED(hr = d3dx9_copy_data(object, ptr))) + return hr; + hr = d3dx9_parse_array_selector(base, param); break; default: @@ -5082,7 +5226,8 @@ for (i = 0; i < base->parameter_count; ++i) { - hr = d3dx9_parse_effect_parameter(&base->parameters[i], data, &ptr, base->objects); + add_param_to_table(base, &base->parameters[i]); + hr = d3dx9_parse_effect_parameter(base, &base->parameters[i], data, &ptr, base->objects); if (hr != D3D_OK) { WARN("Failed to parse parameter %u\n", i); @@ -5104,7 +5249,8 @@ for (i = 0; i < base->technique_count; ++i) { - hr = d3dx9_parse_effect_technique(&base->techniques[i], data, &ptr, base->objects); + TRACE("Parsing technique %u.\n", i); + hr = d3dx9_parse_effect_technique(base, &base->techniques[i], data, &ptr, base->objects); if (hr != D3D_OK) { WARN("Failed to parse technique %u\n", i); @@ -5113,6 +5259,8 @@ } } + sync_param_handles(base); + read_dword(&ptr, &stringcount); TRACE("String count: %u\n", stringcount); @@ -5126,11 +5274,13 @@ read_dword(&ptr, &id); TRACE("Id: %u\n", id); - hr = d3dx9_copy_data(&base->objects[id], &ptr); - if (hr != D3D_OK) - { - WARN("Failed to parse data %u\n", i); + if (FAILED(hr = d3dx9_copy_data(&base->objects[id], &ptr))) goto err_out; + + if (base->objects[id].data) + { + if (FAILED(hr = d3dx9_create_object(base, &base->objects[id]))) + goto err_out; } } @@ -5182,11 +5332,13 @@ } static HRESULT d3dx9_base_effect_init(struct d3dx9_base_effect *base, - const char *data, SIZE_T data_size, struct ID3DXEffectImpl *effect) + const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, + UINT eflags, ID3DBlob **errors, struct ID3DXEffectImpl *effect) { DWORD tag, offset; const char *ptr = data; HRESULT hr; + ID3DBlob *bytecode = NULL, *temp_errors = NULL; TRACE("base %p, data %p, data_size %lu, effect %p\n", base, data, data_size, effect); @@ -5197,30 +5349,55 @@ if (tag != d3dx9_effect_version(9, 1)) { - /* todo: compile hlsl ascii code */ - FIXME("HLSL ascii effects not supported, yet\n"); + TRACE("HLSL ASCII effect, trying to compile it.\n"); + hr = D3DCompile(data, data_size, NULL, defines, include, + "main", "fx_2_0", 0, eflags, &bytecode, &temp_errors); + if (FAILED(hr)) + { + WARN("Failed to compile ASCII effect.\n"); + if (bytecode) + ID3D10Blob_Release(bytecode); + if (temp_errors) + TRACE("%s\n", (char *)ID3D10Blob_GetBufferPointer(temp_errors)); + if (errors) + *errors = temp_errors; + else if (temp_errors) + ID3D10Blob_Release(temp_errors); + return hr; + } + if (!bytecode) + { + FIXME("No output from effect compilation.\n"); + return D3DERR_INVALIDCALL; + } + if (errors) + *errors = temp_errors; + else if (temp_errors) + ID3D10Blob_Release(temp_errors); - /* Show the start of the shader for debugging info. */ - TRACE("effect:\n%s\n", debugstr_an(data, data_size > 40 ? 40 : data_size)); + ptr = ID3D10Blob_GetBufferPointer(bytecode); + read_dword(&ptr, &tag); + TRACE("Tag: %x\n", tag); } - else - { - read_dword(&ptr, &offset); - TRACE("Offset: %x\n", offset); - hr = d3dx9_parse_effect(base, ptr, data_size, offset); - if (hr != D3D_OK) - { - FIXME("Failed to parse effect.\n"); - return hr; - } + read_dword(&ptr, &offset); + TRACE("Offset: %x\n", offset); + + hr = d3dx9_parse_effect(base, ptr, data_size, offset); + if (bytecode) + ID3D10Blob_Release(bytecode); + if (hr != D3D_OK) + { + FIXME("Failed to parse effect.\n"); + return hr; } return D3D_OK; } static HRESULT d3dx9_effect_init(struct ID3DXEffectImpl *effect, struct IDirect3DDevice9 *device, - const char *data, SIZE_T data_size, struct ID3DXEffectPool *pool) + const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, + UINT eflags, ID3DBlob **error_messages, struct ID3DXEffectPool *pool) { HRESULT hr; @@ -5235,7 +5412,8 @@ IDirect3DDevice9_AddRef(device); effect->device = device; - if (FAILED(hr = d3dx9_base_effect_init(&effect->base_effect, data, data_size, effect))) + if (FAILED(hr = d3dx9_base_effect_init(&effect->base_effect, data, data_size, defines, include, + eflags, error_messages, effect))) { FIXME("Failed to parse effect, hr %#x.\n", hr); free_effect(effect); @@ -5259,8 +5437,10 @@ struct ID3DXEffectImpl *object; HRESULT hr; - FIXME("(%p, %p, %u, %p, %p, %p, %#x, %p, %p, %p): semi-stub\n", device, srcdata, srcdatalen, defines, include, - skip_constants, flags, pool, effect, compilation_errors); + TRACE("device %p, srcdata %p, srcdatalen %u, defines %p, include %p," + " skip_constants %p, flags %#x, pool %p, effect %p, compilation_errors %p.\n", + device, srcdata, srcdatalen, defines, include, + skip_constants, flags, pool, effect, compilation_errors); if (compilation_errors) *compilation_errors = NULL; @@ -5275,14 +5455,18 @@ if (!effect) return D3D_OK; + if (skip_constants) + FIXME("skip_constants is not NULL, not supported yet.\n"); + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) return E_OUTOFMEMORY; - hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, pool); + hr = d3dx9_effect_init(object, device, srcdata, srcdatalen, (const D3D_SHADER_MACRO *)defines, + (ID3DInclude *)include, flags, (ID3DBlob **)compilation_errors, pool); if (FAILED(hr)) { - WARN("Failed to initialize shader reflection\n"); + WARN("Failed to create effect object.\n"); HeapFree(GetProcessHeap(), 0, object); return hr; } @@ -5304,7 +5488,9 @@ return D3DXCreateEffectEx(device, srcdata, srcdatalen, defines, include, NULL, flags, pool, effect, compilation_errors); } -static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, const char *data, SIZE_T data_size) +static HRESULT d3dx9_effect_compiler_init(struct ID3DXEffectCompilerImpl *compiler, + const char *data, SIZE_T data_size, const D3D_SHADER_MACRO *defines, ID3DInclude *include, + UINT eflags, ID3DBlob **error_messages) { HRESULT hr; @@ -5313,7 +5499,8 @@ compiler->ID3DXEffectCompiler_iface.lpVtbl = &ID3DXEffectCompiler_Vtbl; compiler->ref = 1; - if (FAILED(hr = d3dx9_base_effect_init(&compiler->base_effect, data, data_size, NULL))) + if (FAILED(hr = d3dx9_base_effect_init(&compiler->base_effect, data, data_size, defines, + include, eflags, error_messages, NULL))) { FIXME("Failed to parse effect, hr %#x.\n", hr); free_effect_compiler(compiler); @@ -5342,7 +5529,8 @@ if (!object) return E_OUTOFMEMORY; - hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen); + hr = d3dx9_effect_compiler_init(object, srcdata, srcdatalen, (const D3D_SHADER_MACRO *)defines, + (ID3DInclude *)include, flags, (ID3DBlob **)parse_errors); if (FAILED(hr)) { WARN("Failed to initialize effect compiler\n"); diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/mesh.c wine1.7-1.7.16/dlls/d3dx9_36/mesh.c --- wine1.7-1.7.13/dlls/d3dx9_36/mesh.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/mesh.c 2014-04-04 19:13:44.000000000 +0000 @@ -4525,20 +4525,106 @@ return hr; } -HRESULT WINAPI D3DXCreateBox(struct IDirect3DDevice9 *device, float width, float height, - float depth, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency) -{ - FIXME("(%p, %f, %f, %f, %p, %p): stub\n", device, width, height, depth, mesh, adjacency); - - return E_NOTIMPL; -} - struct vertex { D3DXVECTOR3 position; D3DXVECTOR3 normal; }; +HRESULT WINAPI D3DXCreateBox(struct IDirect3DDevice9 *device, float width, float height, + float depth, struct ID3DXMesh **mesh, struct ID3DXBuffer **adjacency) +{ + HRESULT hr; + ID3DXMesh *box; + struct vertex *vertices; + WORD (*faces)[3]; + DWORD *adjacency_buf; + unsigned int i, face; + static const D3DXVECTOR3 unit_box[] = + { + {-0.5f, -0.5f, -0.5f}, {-0.5f, -0.5f, 0.5f}, {-0.5f, 0.5f, 0.5f}, {-0.5f, 0.5f, -0.5f}, + {-0.5f, 0.5f, -0.5f}, {-0.5f, 0.5f, 0.5f}, { 0.5f, 0.5f, 0.5f}, { 0.5f, 0.5f, -0.5f}, + { 0.5f, 0.5f, -0.5f}, { 0.5f, 0.5f, 0.5f}, { 0.5f, -0.5f, 0.5f}, { 0.5f, -0.5f, -0.5f}, + {-0.5f, -0.5f, 0.5f}, {-0.5f, -0.5f, -0.5f}, { 0.5f, -0.5f, -0.5f}, { 0.5f, -0.5f, 0.5f}, + {-0.5f, -0.5f, 0.5f}, { 0.5f, -0.5f, 0.5f}, { 0.5f, 0.5f, 0.5f}, {-0.5f, 0.5f, 0.5f}, + {-0.5f, -0.5f, -0.5f}, {-0.5f, 0.5f, -0.5f}, { 0.5f, 0.5f, -0.5f}, { 0.5f, -0.5f, -0.5f} + }; + static const D3DXVECTOR3 normals[] = + { + {-1.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f}, { 1.0f, 0.0f, 0.0f}, + { 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 1.0f}, { 0.0f, 0.0f, -1.0f} + }; + static const DWORD adjacency_table[] = + { + 6, 9, 1, 2, 10, 0, 1, 9, 3, 4, 10, 2, + 3, 8, 5, 7, 11, 4, 0, 11, 7, 5, 8, 6, + 7, 4, 9, 2, 0, 8, 1, 3, 11, 5, 6, 10 + }; + + TRACE("device %p, width %f, height %f, depth %f, mesh %p, adjacency %p\n", + device, width, height, depth, mesh, adjacency); + + if (!device || width < 0.0f || height < 0.0f || depth < 0.0f || !mesh) + { + return D3DERR_INVALIDCALL; + } + + if (FAILED(hr = D3DXCreateMeshFVF(12, 24, D3DXMESH_MANAGED, D3DFVF_XYZ | D3DFVF_NORMAL, device, &box))) + { + return hr; + } + + if (FAILED(hr = box->lpVtbl->LockVertexBuffer(box, 0, (void **)&vertices))) + { + box->lpVtbl->Release(box); + return hr; + } + + if (FAILED(hr = box->lpVtbl->LockIndexBuffer(box, 0, (void **)&faces))) + { + box->lpVtbl->UnlockVertexBuffer(box); + box->lpVtbl->Release(box); + return hr; + } + + for (i = 0; i < 24; i++) + { + vertices[i].position.x = width * unit_box[i].x; + vertices[i].position.y = height * unit_box[i].y; + vertices[i].position.z = depth * unit_box[i].z; + vertices[i].normal.x = normals[i / 4].x; + vertices[i].normal.y = normals[i / 4].y; + vertices[i].normal.z = normals[i / 4].z; + } + + face = 0; + for (i = 0; i < 12; i++) + { + faces[i][0] = face++; + faces[i][1] = face++; + faces[i][2] = (i % 2) ? face - 4 : face; + } + + box->lpVtbl->UnlockIndexBuffer(box); + box->lpVtbl->UnlockVertexBuffer(box); + + if (adjacency) + { + if (FAILED(hr = D3DXCreateBuffer(sizeof(adjacency_table), adjacency))) + { + box->lpVtbl->Release(box); + return hr; + } + + adjacency_buf = ID3DXBuffer_GetBufferPointer(*adjacency); + memcpy(adjacency_buf, adjacency_table, sizeof(adjacency_table)); + } + + *mesh = box; + + return D3D_OK; +} + typedef WORD face[3]; struct sincos_table diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/shader.c wine1.7-1.7.16/dlls/d3dx9_36/shader.c --- wine1.7-1.7.13/dlls/d3dx9_36/shader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/shader.c 2014-04-04 19:13:44.000000000 +0000 @@ -1775,7 +1775,7 @@ }; static HRESULT parse_ctab_constant_type(const char *ctab, DWORD typeoffset, struct ctab_constant *constant, - BOOL is_element, WORD index, WORD max, DWORD *offset, DWORD nameoffset, UINT regset) + BOOL is_element, WORD index, WORD max_index, DWORD *offset, DWORD nameoffset, UINT regset) { const D3DXSHADER_TYPEINFO *type = (LPD3DXSHADER_TYPEINFO)(ctab + typeoffset); const D3DXSHADER_STRUCTMEMBERINFO *memberinfo = NULL; @@ -1824,7 +1824,7 @@ for (i = 0; i < count; ++i) { hr = parse_ctab_constant_type(ctab, memberinfo ? memberinfo[i].TypeInfo : typeoffset, - &constant->constants[i], memberinfo == NULL, index + size, max, offset, + &constant->constants[i], memberinfo == NULL, index + size, max_index, offset, memberinfo ? memberinfo[i].Name : nameoffset, regset); if (hr != D3D_OK) goto error; @@ -1859,7 +1859,7 @@ case D3DXPC_MATRIX_ROWS: offsetdiff = type->Rows * 4; - size = is_element ? type->Rows : max(type->Rows, type->Columns); + size = type->Rows; break; case D3DXPC_MATRIX_COLUMNS: @@ -1893,7 +1893,7 @@ if (offset) *offset += offsetdiff * 4; } - constant->desc.RegisterCount = max(0, min(max - index, size)); + constant->desc.RegisterCount = max(0, min(max_index - index, size)); constant->desc.Bytes = 4 * constant->desc.Elements * type->Rows * type->Columns; return D3D_OK; diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/surface.c wine1.7-1.7.16/dlls/d3dx9_36/surface.c --- wine1.7-1.7.13/dlls/d3dx9_36/surface.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/surface.c 2014-04-04 19:13:44.000000000 +0000 @@ -539,8 +539,8 @@ } HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const PALETTEENTRY *palette, - DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) - + DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info, unsigned int skip_levels, + unsigned int *loaded_miplevels) { HRESULT hr; RECT src_rect; @@ -553,31 +553,45 @@ const struct dds_header *header = src_data; const BYTE *pixels = (BYTE *)(header + 1); - /* Loading a cube texture as a simple texture is also supported (only first face texture is taken) */ - if ((src_info->ResourceType != D3DRTYPE_TEXTURE) && (src_info->ResourceType != D3DRTYPE_CUBETEXTURE)) + /* Loading a cube texture as a simple texture is also supported + * (only first face texture is taken). Same with volume textures. */ + if ((src_info->ResourceType != D3DRTYPE_TEXTURE) + && (src_info->ResourceType != D3DRTYPE_CUBETEXTURE) + && (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE)) + { + WARN("Trying to load a %u resource as a 2D texture, returning failure.\n", src_info->ResourceType); return D3DXERR_INVALIDDATA; + } width = src_info->Width; height = src_info->Height; mip_levels = min(src_info->MipLevels, IDirect3DTexture9_GetLevelCount(texture)); - for (mip_level = 0; mip_level < mip_levels; mip_level++) + if (src_info->ResourceType == D3DRTYPE_VOLUMETEXTURE) + mip_levels = 1; + for (mip_level = 0; mip_level < mip_levels + skip_levels; ++mip_level) { hr = calculate_dds_surface_size(src_info->Format, width, height, &src_pitch, &mip_level_size); if (FAILED(hr)) return hr; - SetRect(&src_rect, 0, 0, width, height); + if (mip_level >= skip_levels) + { + SetRect(&src_rect, 0, 0, width, height); - IDirect3DTexture9_GetSurfaceLevel(texture, mip_level, &surface); - hr = D3DXLoadSurfaceFromMemory(surface, palette, NULL, pixels, src_info->Format, src_pitch, - NULL, &src_rect, filter, color_key); - IDirect3DSurface9_Release(surface); - if (FAILED(hr)) return hr; + IDirect3DTexture9_GetSurfaceLevel(texture, mip_level - skip_levels, &surface); + hr = D3DXLoadSurfaceFromMemory(surface, palette, NULL, pixels, src_info->Format, src_pitch, + NULL, &src_rect, filter, color_key); + IDirect3DSurface9_Release(surface); + if (FAILED(hr)) + return hr; + } pixels += mip_level_size; width = max(1, width / 2); height = max(1, height / 2); } + *loaded_miplevels = mip_levels - skip_levels; + return D3D_OK; } @@ -1025,7 +1039,7 @@ const RECT *pSrcRect, DWORD dwFilter, D3DCOLOR Colorkey, D3DXIMAGE_INFO *pSrcInfo) { D3DXIMAGE_INFO imginfo; - HRESULT hr; + HRESULT hr, com_init; IWICImagingFactory *factory = NULL; IWICBitmapDecoder *decoder; @@ -1078,7 +1092,7 @@ if (imginfo.ImageFileFormat == D3DXIFF_DIB) convert_dib_to_bmp((void**)&pSrcData, &SrcDataSize); - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); + com_init = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (FAILED(CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, (void**)&factory))) goto cleanup_err; @@ -1181,7 +1195,8 @@ if (factory) IWICImagingFactory_Release(factory); - CoUninitialize(); + if (SUCCEEDED(com_init)) + CoUninitialize(); if (imginfo.ImageFileFormat == D3DXIFF_DIB) HeapFree(GetProcessHeap(), 0, (void*)pSrcData); diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/tests/effect.c wine1.7-1.7.16/dlls/d3dx9_36/tests/effect.c --- wine1.7-1.7.13/dlls/d3dx9_36/tests/effect.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/tests/effect.c 2014-04-04 19:13:44.000000000 +0000 @@ -156,7 +156,12 @@ ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); hr = D3DXCreateEffect(device, effect_desc, sizeof(effect_desc), NULL, NULL, 0, NULL, &effect, NULL); - ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); + todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); + if (FAILED(hr)) + { + skip("Failed to compile effect, skipping test.\n"); + return; + } hr = effect->lpVtbl->QueryInterface(effect, &IID_ID3DXBaseEffect, (void **)&base); ok(hr == E_NOINTERFACE, "QueryInterface failed, got %x, expected %x (E_NOINTERFACE)\n", hr, E_NOINTERFACE); @@ -265,7 +270,12 @@ ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3D_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL); hr = D3DXCreateEffectCompiler(effect_desc, 0, NULL, NULL, 0, &compiler, NULL); - ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK); + todo_wine ok(hr == D3D_OK, "Got result %x, expected %x (D3D_OK)\n", hr, D3D_OK); + if (FAILED(hr)) + { + skip("D3DXCreateEffectCompiler failed, skipping test.\n"); + return; + } count = compiler->lpVtbl->Release(compiler); ok(count == 0, "Release failed %u\n", count); @@ -1673,9 +1683,9 @@ UINT res_value_offset = res[k].value_offset; D3DXHANDLE parameter; D3DXPARAMETER_DESC pdesc; - BOOL bvalue; - INT ivalue; - FLOAT fvalue; + BOOL bvalue = TRUE; + INT ivalue = 42; + FLOAT fvalue = 2.71828f; DWORD input_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE]; DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE]; UINT l, n, m, element; diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/tests/mesh.c wine1.7-1.7.16/dlls/d3dx9_36/tests/mesh.c --- wine1.7-1.7.13/dlls/d3dx9_36/tests/mesh.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/tests/mesh.c 2014-04-04 19:13:44.000000000 +0000 @@ -2424,6 +2424,85 @@ if (wnd) DestroyWindow(wnd); } +static BOOL compute_box(struct mesh *mesh, float width, float height, float depth) +{ + unsigned int i, face; + static const D3DXVECTOR3 unit_box[] = + { + {-1.0f, -1.0f, -1.0f}, {-1.0f, -1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, -1.0f}, + {-1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, -1.0f}, + { 1.0f, 1.0f, -1.0f}, { 1.0f, 1.0f, 1.0f}, { 1.0f, -1.0f, 1.0f}, { 1.0f, -1.0f, -1.0f}, + {-1.0f, -1.0f, 1.0f}, {-1.0f, -1.0f, -1.0f}, { 1.0f, -1.0f, -1.0f}, { 1.0f, -1.0f, 1.0f}, + {-1.0f, -1.0f, 1.0f}, { 1.0f, -1.0f, 1.0f}, { 1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, + {-1.0f, -1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, { 1.0f, 1.0f, -1.0f}, { 1.0f, -1.0f, -1.0f} + }; + static const D3DXVECTOR3 normals[] = + { + {-1.0f, 0.0f, 0.0f}, { 0.0f, 1.0f, 0.0f}, { 1.0f, 0.0f, 0.0f}, + { 0.0f, -1.0f, 0.0f}, { 0.0f, 0.0f, 1.0f}, { 0.0f, 0.0f, -1.0f} + }; + + if (!new_mesh(mesh, 24, 12)) + { + return FALSE; + } + + width /= 2.0f; + height /= 2.0f; + depth /= 2.0f; + + for (i = 0; i < 24; i++) + { + mesh->vertices[i].position.x = width * unit_box[i].x; + mesh->vertices[i].position.y = height * unit_box[i].y; + mesh->vertices[i].position.z = depth * unit_box[i].z; + mesh->vertices[i].normal.x = normals[i / 4].x; + mesh->vertices[i].normal.y = normals[i / 4].y; + mesh->vertices[i].normal.z = normals[i / 4].z; + } + + face = 0; + for (i = 0; i < 12; i++) + { + mesh->faces[i][0] = face++; + mesh->faces[i][1] = face++; + mesh->faces[i][2] = (i % 2) ? face - 4 : face; + } + + return TRUE; +} + +static void test_box(IDirect3DDevice9 *device, float width, float height, float depth) +{ + HRESULT hr; + ID3DXMesh *box; + struct mesh mesh; + char name[256]; + + hr = D3DXCreateBox(device, width, height, depth, &box, NULL); + ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n", hr); + if (hr != D3D_OK) + { + skip("Couldn't create box\n"); + return; + } + + if (!compute_box(&mesh, width, height, depth)) + { + skip("Couldn't create mesh\n"); + box->lpVtbl->Release(box); + return; + } + + mesh.fvf = D3DFVF_XYZ | D3DFVF_NORMAL; + + sprintf(name, "box (%g, %g, %g)", width, height, depth); + compare_mesh(name, box, &mesh); + + free_mesh(&mesh); + + box->lpVtbl->Release(box); +} static void D3DXCreateBoxTest(void) { HRESULT hr; @@ -2482,23 +2561,23 @@ } hr = D3DXCreateBox(device,2.0f,20.0f,4.9f,NULL, &ppBuffer); - todo_wine ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); hr = D3DXCreateBox(NULL,22.0f,20.0f,4.9f,&box, &ppBuffer); - todo_wine ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); hr = D3DXCreateBox(device,-2.0f,20.0f,4.9f,&box, &ppBuffer); - todo_wine ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); hr = D3DXCreateBox(device,22.0f,-20.0f,4.9f,&box, &ppBuffer); - todo_wine ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); hr = D3DXCreateBox(device,22.0f,20.0f,-4.9f,&box, &ppBuffer); - todo_wine ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); + ok(hr==D3DERR_INVALIDCALL, "Expected D3DERR_INVALIDCALL, received %#x\n", hr); ppBuffer = NULL; hr = D3DXCreateBox(device,10.9f,20.0f,4.9f,&box, &ppBuffer); - todo_wine ok(hr==D3D_OK, "Expected D3D_OK, received %#x\n", hr); + ok(hr==D3D_OK, "Expected D3D_OK, received %#x\n", hr); if (FAILED(hr)) { @@ -2508,10 +2587,12 @@ buffer = ID3DXBuffer_GetBufferPointer(ppBuffer); for(i=0; i<36; i++) - todo_wine ok(adjacency[i]==buffer[i], "expected adjacency %d: %#x, received %#x\n",i,adjacency[i], buffer[i]); + ok(adjacency[i]==buffer[i], "expected adjacency %d: %#x, received %#x\n",i,adjacency[i], buffer[i]); box->lpVtbl->Release(box); + test_box(device, 10.9f, 20.0f, 4.9f); + end: IDirect3DDevice9_Release(device); IDirect3D9_Release(d3d); @@ -6368,11 +6449,6 @@ D3DXVECTOR3 position; SHORT normal[4]; }; - struct vertex_color_float4 - { - D3DXVECTOR3 position; - D3DXVECTOR4 color; - }; struct vertex_texcoord_float16_2 { D3DXVECTOR3 position; @@ -6400,7 +6476,6 @@ UINT vertex_size_color_ubyte4 = sizeof(struct vertex_color_ubyte4); UINT vertex_size_texcoord_short2 = sizeof(struct vertex_texcoord_short2); UINT vertex_size_normal_short4 = sizeof(struct vertex_normal_short4); - UINT vertex_size_color_float4 = sizeof(struct vertex_color_float4); UINT vertex_size_texcoord_float16_2 = sizeof(struct vertex_texcoord_float16_2); UINT vertex_size_texcoord_float16_4 = sizeof(struct vertex_texcoord_float16_4); UINT vertex_size_normal_udec3 = sizeof(struct vertex_normal_udec3); @@ -6495,10 +6570,10 @@ {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 2}, D3DDECL_END() }; - D3DVERTEXELEMENT9 declaration_color2_float4[] = + D3DVERTEXELEMENT9 declaration_color1[] = { {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, - {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 2}, + {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1}, D3DDECL_END() }; D3DVERTEXELEMENT9 declaration_texcoord_float16_2[] = @@ -7362,34 +7437,38 @@ const DWORD exp_face_remap26[] = {0, 1}; const DWORD exp_vertex_remap26[] = {0, 1, 2, 3, 4, 5}; const DWORD exp_new_num_vertices26 = ARRAY_SIZE(exp_vertices26); - /* Test 27. Weld color with usage index larger than 1. Check that the - * default epsilon of 1e-6f is used. */ - D3DXVECTOR4 zero_float4 = {0.0f, 0.0f, 0.0f, 0.0f}; - D3DXVECTOR4 almost_zero_float4 = {0.0f + FLT_EPSILON, 0.0f + FLT_EPSILON, 0.0f + FLT_EPSILON, 0.0f + FLT_EPSILON}; - const struct vertex_color_float4 vertices27[] = - { - {{ 0.0f, 3.0f, 0.f}, zero_float4}, - {{ 2.0f, 3.0f, 0.f}, zero_float4}, - {{ 0.0f, 0.0f, 0.f}, zero_float4}, - - {{ 3.0f, 3.0f, 0.f}, almost_zero_float4}, - {{ 3.0f, 0.0f, 0.f}, zero_float4}, - {{ 1.0f, 0.0f, 0.f}, almost_zero_float4}, + /* Test 27. Weld color with usage index 1 (specular). */ + /* Previously this test used float color values and index > 1 but that case + * appears to be effectively unhandled in native so the test gave + * inconsistent results. */ + const struct vertex_color vertices27[] = + { + {{ 0.0f, 3.0f, 0.0f}, 0x00000000}, + {{ 2.0f, 3.0f, 0.0f}, 0x10203040}, + {{ 0.0f, 0.0f, 0.0f}, 0x50607080}, + + {{ 3.0f, 3.0f, 0.0f}, 0x11213141}, + {{ 3.0f, 0.0f, 0.0f}, 0xffffffff}, + {{ 1.0f, 0.0f, 0.0f}, 0x51617181}, }; const DWORD indices27[] = {0, 1, 2, 3, 4, 5}; const DWORD attributes27[] = {0, 0}; const UINT num_vertices27 = ARRAY_SIZE(vertices27); const UINT num_faces27 = ARRAY_SIZE(indices27) / VERTS_PER_FACE; DWORD flags27 = D3DXWELDEPSILONS_WELDPARTIALMATCHES; - const D3DXWELDEPSILONS epsilons27 = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, 0.0f, 0.0f, 0.0f}; + const D3DXWELDEPSILONS epsilons27 = + { + 1.1f, 0.0f, 0.0f, 0.0f, 2.0f / 255.0f, 0.0f, + {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, 0.0f, 0.0f, 0.0f + }; const DWORD adjacency27[] = {-1, 1, -1, -1, -1, 0}; - const struct vertex_color_float4 exp_vertices27[] = + const struct vertex_color exp_vertices27[] = { - {{ 0.0f, 3.0f, 0.f}, zero_float4}, - {{ 2.0f, 3.0f, 0.f}, zero_float4}, - {{ 0.0f, 0.0f, 0.f}, zero_float4}, + {{ 0.0f, 3.0f, 0.0f}, 0x00000000}, + {{ 2.0f, 3.0f, 0.0f}, 0x10203040}, + {{ 0.0f, 0.0f, 0.0f}, 0x50607080}, - {{ 3.0f, 0.0f, 0.f}, zero_float4}, + {{ 3.0f, 0.0f, 0.0f}, 0xffffffff}, }; const DWORD exp_indices27[] = {0, 1, 2, 1, 3, 2}; const DWORD exp_face_remap27[] = {0, 1}; @@ -7983,8 +8062,8 @@ num_vertices27, num_faces27, options, - declaration_color2_float4, - vertex_size_color_float4, + declaration_color1, + vertex_size_color, flags27, &epsilons27, adjacency27, @@ -8063,7 +8142,7 @@ goto cleanup; } face_remap = HeapAlloc(GetProcessHeap(), 0, tc[i].num_faces * sizeof(*face_remap)); - if (!adjacency_out) + if (!face_remap) { skip("Couldn't allocate face_remap array.\n"); goto cleanup; diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/tests/shader.c wine1.7-1.7.16/dlls/d3dx9_36/tests/shader.c --- wine1.7-1.7.13/dlls/d3dx9_36/tests/shader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/tests/shader.c 2014-04-04 19:13:44.000000000 +0000 @@ -120,7 +120,7 @@ 0x000000ac, 0x00000058, 0x00070002, 0x00000001, 0x00000064, 0x00000000, /* Constant 1 desc (fmatrix3x1) */ 0x00000074, 0x00000002, 0x00000004, 0x00000080, 0x00000000, /* Constant 2 desc (fmatrix4x4) */ - 0x00000090, 0x00040002, 0x00000003, 0x0000009c, 0x00000000, /* Constant 3 desc (imatrix2x3) */ + 0x00000090, 0x00040002, 0x00000002, 0x0000009c, 0x00000000, /* Constant 3 desc (imatrix2x3) */ 0x74616D66, 0x33786972, 0xab003178, /* Constant 1 name */ 0x00030003, 0x00010003, 0x00000001, 0x00000000, /* Constant 1 type desc */ 0x74616D66, 0x34786972, 0xab003478, /* Constant 2 name */ @@ -133,8 +133,9 @@ static const D3DXCONSTANT_DESC ctab_matrices_expected[] = { {"fmatrix4x4", D3DXRS_FLOAT4, 0, 4, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 4, 4, 1, 0, 64, NULL}, - {"imatrix2x3", D3DXRS_FLOAT4, 4, 3, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, NULL}, - {"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}}; + {"imatrix2x3", D3DXRS_FLOAT4, 4, 2, D3DXPC_MATRIX_ROWS, D3DXPT_INT, 2, 3, 1, 0, 24, NULL}, + {"fmatrix3x1", D3DXRS_FLOAT4, 7, 1, D3DXPC_MATRIX_COLUMNS, D3DXPT_FLOAT, 3, 1, 1, 0, 12, NULL}, +}; static const DWORD ctab_matrices2[] = { 0xfffe0200, /* vs_2_0 */ diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/tests/texture.c wine1.7-1.7.16/dlls/d3dx9_36/tests/texture.c --- wine1.7-1.7.13/dlls/d3dx9_36/tests/texture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/tests/texture.c 2014-04-04 19:13:44.000000000 +0000 @@ -25,7 +25,7 @@ #include "d3dx9tex.h" #include "resources.h" -static int has_2d_dxt5, has_cube_dxt5; +static int has_2d_dxt3, has_2d_dxt5, has_cube_dxt5; /* 2x2 16-bit dds, no mipmaps */ static const unsigned char dds_16bit[] = { @@ -304,14 +304,14 @@ if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_R3G3B2))) expected = D3DFMT_R3G3B2; + else if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, + mode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_X4R4G4B4))) + expected = D3DFMT_X4R4G4B4; + else if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, + mode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_X1R5G5B5))) + expected = D3DFMT_X1R5G5B5; else - { - if (SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, - mode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_X4R4G4B4))) - expected = D3DFMT_X4R4G4B4; - else - expected = D3DFMT_X1R5G5B5; - } + expected = D3DFMT_R5G6B5; format = D3DFMT_R3G3B2; hr = D3DXCheckTextureRequirements(device, NULL, NULL, NULL, 0, &format, D3DPOOL_DEFAULT); @@ -341,15 +341,22 @@ ok(format == expected, "Returned format %u, expected %u\n", format, expected); /* Block-based texture formats and size < block size. */ - format = D3DFMT_DXT1; - width = 2; height = 2; - mipmaps = 1; - hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, &format, D3DPOOL_DEFAULT); - ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); - ok(width == 4, "Returned width %d, expected %d\n", width, 4); - ok(height == 4, "Returned height %d, expected %d\n", height, 4); - ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1); - ok(format == D3DFMT_DXT1, "Returned format %u, expected %u\n", format, D3DFMT_DXT1); + if (has_2d_dxt5) + { + format = D3DFMT_DXT5; + width = 2; height = 2; + mipmaps = 1; + hr = D3DXCheckTextureRequirements(device, &width, &height, &mipmaps, 0, &format, D3DPOOL_DEFAULT); + ok(hr == D3D_OK, "D3DXCheckTextureRequirements returned %#x, expected %#x\n", hr, D3D_OK); + ok(width == 4, "Returned width %d, expected %d\n", width, 4); + ok(height == 4, "Returned height %d, expected %d\n", height, 4); + ok(mipmaps == 1, "Returned mipmaps %d, expected %d\n", mipmaps, 1); + ok(format == D3DFMT_DXT5, "Returned format %u, expected %u\n", format, D3DFMT_DXT5); + } + else + { + skip("D3DFMT_DXT5 textures are not supported, skipping a test.\n"); + } IDirect3D9_Release(d3d); } @@ -1433,6 +1440,7 @@ D3DSURFACE_DESC desc; D3DLOCKED_RECT lock_rect; int i; + DWORD level_count; hr = D3DXCreateTextureFromFileInMemory(device, dds_16bit, sizeof(dds_16bit), &texture); ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); @@ -1464,18 +1472,55 @@ if (SUCCEEDED(hr)) { for (i = 0; i < 16; i++) - ok(((BYTE*)lock_rect.pBits)[i] == dds_cube_map[128+i], "Byte at index %u is 0x%02x, expected 0x%02x\n", i, ((BYTE*)lock_rect.pBits)[i], dds_cube_map[144+i]); + ok(((BYTE *)lock_rect.pBits)[i] == dds_cube_map[128 + i], + "Byte at index %u is 0x%02x, expected 0x%02x.\n", + i, ((BYTE *)lock_rect.pBits)[i], dds_cube_map[128 + i]); IDirect3DTexture9_UnlockRect(texture, 0); } IDirect3DTexture9_Release(texture); } + + /* Volume textures work too. */ + hr = D3DXCreateTextureFromFileInMemory(device, dds_volume_map, sizeof(dds_volume_map), &texture); + if (has_2d_dxt3) + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n", hr, D3D_OK); + else + todo_wine ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemory returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + type = IDirect3DTexture9_GetType(texture); + ok(type == D3DRTYPE_TEXTURE, "IDirect3DTexture9_GetType returned %u, expected %u.\n", type, D3DRTYPE_TEXTURE); + level_count = IDirect3DBaseTexture9_GetLevelCount((IDirect3DBaseTexture9 *)texture); + todo_wine ok(level_count == 3, "Texture has %u mip levels, 3 expected.\n", level_count); + hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &desc); + ok(hr == D3D_OK, "IDirect3DTexture9_GetLevelDesc returned %#x, expected %#x.\n", hr, D3D_OK); + ok(desc.Width == 4, "Width is %u, expected 4.\n", desc.Width); + ok(desc.Height == 4, "Height is %u, expected 4.\n", desc.Height); + + hr = IDirect3DTexture9_LockRect(texture, 0, &lock_rect, NULL, D3DLOCK_READONLY); + ok(hr == D3D_OK, "IDirect3DTexture9_LockRect returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + for (i = 0; i < 16; ++i) + ok(((BYTE *)lock_rect.pBits)[i] == dds_volume_map[128 + i], + "Byte at index %u is 0x%02x, expected 0x%02x.\n", + i, ((BYTE *)lock_rect.pBits)[i], dds_volume_map[128 + i]); + IDirect3DTexture9_UnlockRect(texture, 0); + } + /* The lower texture levels are apparently generated by filtering the level 0 surface + * I.e. following levels from the file are ignored. */ + IDirect3DTexture9_Release(texture); + } } static void test_D3DXCreateTextureFromFileInMemoryEx(IDirect3DDevice9 *device) { HRESULT hr; IDirect3DTexture9 *texture; + unsigned int miplevels; + IDirect3DSurface9 *surface; + D3DSURFACE_DESC desc; hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_16bit, sizeof(dds_16bit), D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &texture); @@ -1487,6 +1532,22 @@ ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr, D3D_OK); if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture); + hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_24bit, sizeof(dds_24bit), D3DX_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, D3DUSAGE_DYNAMIC, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_SKIP_DDS_MIP_LEVELS(1, D3DX_FILTER_POINT), 0, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + miplevels = IDirect3DTexture9_GetLevelCount(texture); + ok(miplevels == 1, "Got miplevels %u, expected %u\n", miplevels, 1); + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Width == 1 && desc.Height == 1, + "Surface dimensions are %ux%u, expected 1x1.\n", desc.Width, desc.Height); + IDirect3DSurface9_Release(surface); + IDirect3DTexture9_Release(texture); + } + if (!is_autogenmipmap_supported(device, D3DRTYPE_TEXTURE)) { skip("No D3DUSAGE_AUTOGENMIPMAP support for textures\n"); @@ -1576,7 +1637,10 @@ ok(hr == D3DERR_INVALIDCALL, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL); hr = D3DXCreateVolumeTextureFromFileInMemory(device, dds_volume_map, sizeof(dds_volume_map), &volume_texture); - ok(hr == D3D_OK, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); + if (has_2d_dxt3) + ok(hr == D3D_OK, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); + else + todo_wine ok(hr == D3D_OK, "D3DXCreateVolumeTextureFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); if (SUCCEEDED(hr)) { levelcount = IDirect3DVolumeTexture9_GetLevelCount(volume_texture); @@ -1821,7 +1885,9 @@ return; } - /* Check whether DXT5 textures are supported */ + /* Check whether DXTn textures are supported. */ + has_2d_dxt3 = SUCCEEDED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3)); hr = IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT5); has_2d_dxt5 = SUCCEEDED(hr); diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/tests/volume.c wine1.7-1.7.16/dlls/d3dx9_36/tests/volume.c --- wine1.7-1.7.13/dlls/d3dx9_36/tests/volume.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/tests/volume.c 2014-04-04 19:13:44.000000000 +0000 @@ -73,7 +73,7 @@ &volume_texture, NULL); if (FAILED(hr)) { - skip("Failed to create volume texture\n"); + skip("Failed to create volume texture.\n"); return; } @@ -84,6 +84,11 @@ hr = D3DXLoadVolumeFromMemory(volume, NULL, &dst_box, pixels, D3DFMT_A8R8G8B8, 16, 16, NULL, &src_box, D3DX_DEFAULT, 0); ok(hr == D3D_OK, "D3DXLoadVolumeFromMemory returned %#x, expected %#x\n", hr, D3D_OK); + if (FAILED(hr)) + { + win_skip("D3DXLoadVolumeFromMemory failed with error %#x, skipping some tests.\n", hr); + return; + } IDirect3DVolume9_LockBox(volume, &locked_box, &dst_box, D3DLOCK_READONLY); for (i = 0; i < 16; i++) check_pixel_4bpp(&locked_box, i % 4, 0, i / 4, pixels[i]); diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/texture.c wine1.7-1.7.16/dlls/d3dx9_36/texture.c --- wine1.7-1.7.13/dlls/d3dx9_36/texture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/texture.c 2014-04-04 19:13:44.000000000 +0000 @@ -529,12 +529,15 @@ BOOL file_format = FALSE, file_miplevels = FALSE; BOOL dynamic_texture; D3DXIMAGE_INFO imginfo; - UINT loaded_miplevels; + UINT loaded_miplevels, skip_levels; D3DCAPS9 caps; HRESULT hr; - TRACE("(%p, %p, %u, %u, %u, %u, %x, %x, %x, %u, %u, %x, %p, %p, %p)\n", device, srcdata, srcdatasize, width, - height, miplevels, usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture); + TRACE("device %p, srcdata %p, srcdatasize %u, width %u, height %u, miplevels %u," + " usage %#x, format %#x, pool %#x, filter %#x, mipfilter %#x, colorkey %#x," + " srcinfo %p, palette %p, texture %p.\n", + device, srcdata, srcdatasize, width, height, miplevels, usage, format, pool, + filter, mipfilter, colorkey, srcinfo, palette, texture); /* check for invalid parameters */ if (!device || !texture || !srcdata || !srcdatasize) @@ -588,6 +591,21 @@ miplevels = imginfo.MipLevels; } + skip_levels = mipfilter != D3DX_DEFAULT ? mipfilter >> D3DX_SKIP_DDS_MIP_LEVELS_SHIFT : 0; + if (skip_levels && imginfo.MipLevels > skip_levels) + { + TRACE("Skipping the first %u (of %u) levels of a DDS mipmapped texture.\n", + skip_levels, imginfo.MipLevels); + TRACE("Texture level 0 dimensions are %ux%u.\n", imginfo.Width, imginfo.Height); + width >>= skip_levels; + height >>= skip_levels; + miplevels -= skip_levels; + } + else + { + skip_levels = 0; + } + /* fix texture creation parameters */ hr = D3DXCheckTextureRequirements(device, &width, &height, &miplevels, usage, &format, pool); if (FAILED(hr)) @@ -602,6 +620,12 @@ FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet\n"); miplevels = imginfo.MipLevels; } + if (imginfo.ResourceType == D3DRTYPE_VOLUMETEXTURE + && D3DFMT_DXT1 <= imginfo.Format && imginfo.Format <= D3DFMT_DXT5 && miplevels > 1) + { + FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet.\n"); + miplevels = 1; + } if (((file_width) && (width != imginfo.Width)) || ((file_height) && (height != imginfo.Height)) || @@ -640,10 +664,12 @@ IDirect3DTexture9_GetSurfaceLevel(*texptr, 0, &surface); hr = D3DXLoadSurfaceFromFileInMemory(surface, palette, NULL, srcdata, srcdatasize, NULL, filter, colorkey, NULL); IDirect3DSurface9_Release(surface); + loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels); } else { - hr = load_texture_from_dds(*texptr, srcdata, palette, filter, colorkey, &imginfo); + hr = load_texture_from_dds(*texptr, srcdata, palette, filter, colorkey, &imginfo, skip_levels, + &loaded_miplevels); } if (FAILED(hr)) @@ -654,7 +680,6 @@ return hr; } - loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels); hr = D3DXFilterTexture((IDirect3DBaseTexture9*) *texptr, palette, loaded_miplevels - 1, mipfilter); if (FAILED(hr)) { diff -Nru wine1.7-1.7.13/dlls/d3dx9_36/util.c wine1.7-1.7.16/dlls/d3dx9_36/util.c --- wine1.7-1.7.13/dlls/d3dx9_36/util.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dx9_36/util.c 2014-04-04 19:13:44.000000000 +0000 @@ -349,8 +349,6 @@ void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype) { - TRACE("Changing from type %s to type %s\n", debug_d3dxparameter_type(intype), debug_d3dxparameter_type(outtype)); - if (outtype == intype) { *(DWORD *)outdata = *(DWORD *)indata; diff -Nru wine1.7-1.7.13/dlls/d3dxof/parsing.c wine1.7-1.7.16/dlls/d3dxof/parsing.c --- wine1.7-1.7.13/dlls/d3dxof/parsing.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/d3dxof/parsing.c 2014-04-04 19:13:44.000000000 +0000 @@ -19,6 +19,7 @@ */ #include "config.h" +#include "wine/port.h" #include "wine/debug.h" #define COBJMACROS @@ -90,7 +91,7 @@ (char)(fourcc >> 16), (char)(fourcc >> 24)); } -static const char* get_primitive_string(WORD token) +static const char* get_primitive_string(DWORD token) { switch(token) { diff -Nru wine1.7-1.7.13/dlls/dbghelp/dwarf.c wine1.7-1.7.16/dlls/dbghelp/dwarf.c --- wine1.7-1.7.13/dlls/dbghelp/dwarf.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dbghelp/dwarf.c 2014-04-04 19:13:44.000000000 +0000 @@ -1440,6 +1440,9 @@ switch (child->abbrev->tag) { + case DW_TAG_array_type: + dwarf2_parse_array_type(ctx, di); + break; case DW_TAG_member: /* FIXME: should I follow the sibling stuff ?? */ dwarf2_parse_udt_member(ctx, child, (struct symt_udt*)di->symt); @@ -1710,7 +1713,10 @@ static void dwarf2_parse_subprogram_block(dwarf2_subprogram_t* subpgm, struct symt_block* parent_block, - dwarf2_debug_info_t* di); + dwarf2_debug_info_t* di); + +static struct symt* dwarf2_parse_subroutine_type(dwarf2_parse_context_t* ctx, + dwarf2_debug_info_t* di); static void dwarf2_parse_inlined_subroutine(dwarf2_subprogram_t* subpgm, struct symt_block* parent_block, @@ -1801,6 +1807,12 @@ case DW_TAG_variable: dwarf2_parse_variable(subpgm, block, child); break; + case DW_TAG_pointer_type: + dwarf2_parse_pointer_type(subpgm->ctx, di); + break; + case DW_TAG_subroutine_type: + dwarf2_parse_subroutine_type(subpgm->ctx, di); + break; case DW_TAG_lexical_block: dwarf2_parse_subprogram_block(subpgm, block, child); break; @@ -1930,6 +1942,9 @@ case DW_TAG_inlined_subroutine: dwarf2_parse_inlined_subroutine(&subpgm, NULL, child); break; + case DW_TAG_pointer_type: + dwarf2_parse_pointer_type(subpgm.ctx, di); + break; case DW_TAG_subprogram: /* FIXME: likely a declaration (to be checked) * skip it for now diff -Nru wine1.7-1.7.13/dlls/ddraw/ddraw.c wine1.7-1.7.16/dlls/ddraw/ddraw.c --- wine1.7-1.7.13/dlls/ddraw/ddraw.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/ddraw.c 2014-04-04 19:13:44.000000000 +0000 @@ -4871,9 +4871,9 @@ ddraw->ref7 = 1; flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING; - if (!(ddraw->wined3d = wined3d_create(7, flags))) + if (!(ddraw->wined3d = wined3d_create(flags))) { - if (!(ddraw->wined3d = wined3d_create(7, flags | WINED3D_NO3D))) + if (!(ddraw->wined3d = wined3d_create(flags | WINED3D_NO3D))) { WARN("Failed to create a wined3d object.\n"); return E_FAIL; diff -Nru wine1.7-1.7.13/dlls/ddraw/ddraw_private.h wine1.7-1.7.16/dlls/ddraw/ddraw_private.h --- wine1.7-1.7.13/dlls/ddraw/ddraw_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/ddraw_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -150,6 +150,7 @@ struct ddraw *ddraw; struct wined3d_surface *wined3d_surface; struct wined3d_texture *wined3d_texture; + struct wined3d_private_store private_store; struct d3d_device *device1; /* This implementation handles attaching surfaces to other surfaces */ @@ -543,8 +544,6 @@ DWORD fvf; DWORD size; BOOL dynamic; - - BOOL read_since_last_map; }; HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, diff -Nru wine1.7-1.7.13/dlls/ddraw/device.c wine1.7-1.7.16/dlls/ddraw/device.c --- wine1.7-1.7.13/dlls/ddraw/device.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/device.c 2014-04-04 19:13:44.000000000 +0000 @@ -4268,9 +4268,6 @@ wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType); hr = wined3d_device_draw_primitive(device->wined3d_device, StartVertex, NumVertices); - if (SUCCEEDED(hr)) - vb->read_since_last_map = TRUE; - wined3d_mutex_unlock(); return hr; @@ -4396,9 +4393,6 @@ wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, ib_pos / sizeof(WORD), IndexCount); - if (SUCCEEDED(hr)) - vb->read_since_last_map = TRUE; - wined3d_mutex_unlock(); return hr; diff -Nru wine1.7-1.7.13/dlls/ddraw/main.c wine1.7-1.7.16/dlls/ddraw/main.c --- wine1.7-1.7.13/dlls/ddraw/main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -408,9 +408,9 @@ FIXME("flags 0x%08x not handled\n", flags & ~DDENUM_ATTACHEDSECONDARYDEVICES); TRACE("Enumerating ddraw interfaces\n"); - if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS))) + if (!(wined3d = wined3d_create(WINED3D_LEGACY_DEPTH_BIAS))) { - if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D))) + if (!(wined3d = wined3d_create(WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D))) { WARN("Failed to create a wined3d object.\n"); return E_FAIL; diff -Nru wine1.7-1.7.13/dlls/ddraw/surface.c wine1.7-1.7.16/dlls/ddraw/surface.c --- wine1.7-1.7.13/dlls/ddraw/surface.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/surface.c 2014-04-04 19:13:44.000000000 +0000 @@ -2246,25 +2246,18 @@ * *****************************************************************************/ static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface, - REFGUID tag, void *Data, DWORD Size, DWORD Flags) + REFGUID tag, void *data, DWORD size, DWORD flags) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); - struct wined3d_resource *resource; HRESULT hr; TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n", - iface, debugstr_guid(tag), Data, Size, Flags); + iface, debugstr_guid(tag), data, size, flags); wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_set_private_data(resource, tag, Data, Size, Flags); + hr = wined3d_private_store_set_private_data(&surface->private_store, tag, data, size, flags); wined3d_mutex_unlock(); - - switch(hr) - { - case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS; - default: return hr; - } + return hr_ddraw_from_wined3d(hr); } static HRESULT WINAPI ddraw_surface4_SetPrivateData(IDirectDrawSurface4 *iface, @@ -2294,23 +2287,45 @@ * For more details, see IWineD3DSurface::GetPrivateData * *****************************************************************************/ -static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *Data, DWORD *Size) +static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD *size) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); - struct wined3d_resource *resource; + const struct wined3d_private_data *stored_data; HRESULT hr; TRACE("iface %p, tag %s, data %p, data_size %p.\n", - iface, debugstr_guid(tag), Data, Size); - - if(!Data) - return DDERR_INVALIDPARAMS; + iface, debugstr_guid(tag), data, size); wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_get_private_data(resource, tag, Data, Size); - wined3d_mutex_unlock(); + stored_data = wined3d_private_store_get_private_data(&surface->private_store, tag); + if (!stored_data) + { + hr = DDERR_NOTFOUND; + goto done; + } + if (!size) + { + hr = DDERR_INVALIDPARAMS; + goto done; + } + if (*size < stored_data->size) + { + *size = stored_data->size; + hr = DDERR_MOREDATA; + goto done; + } + if (!data) + { + hr = DDERR_INVALIDPARAMS; + goto done; + } + *size = stored_data->size; + memcpy(data, stored_data->content.data, stored_data->size); + hr = DD_OK; + +done: + wined3d_mutex_unlock(); return hr; } @@ -2340,17 +2355,22 @@ static HRESULT WINAPI ddraw_surface7_FreePrivateData(IDirectDrawSurface7 *iface, REFGUID tag) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); - struct wined3d_resource *resource; - HRESULT hr; + struct wined3d_private_data *entry; TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag)); wined3d_mutex_lock(); - resource = wined3d_surface_get_resource(surface->wined3d_surface); - hr = wined3d_resource_free_private_data(resource, tag); + entry = wined3d_private_store_get_private_data(&surface->private_store, tag); + if (!entry) + { + wined3d_mutex_unlock(); + return DDERR_NOTFOUND; + } + + wined3d_private_store_free_private_data(&surface->private_store, entry); wined3d_mutex_unlock(); - return hr; + return DD_OK; } static HRESULT WINAPI ddraw_surface4_FreePrivateData(IDirectDrawSurface4 *iface, REFGUID tag) @@ -5469,6 +5489,8 @@ if (surface == surface->ddraw->primary) surface->ddraw->primary = NULL; + wined3d_private_store_cleanup(&surface->private_store); + HeapFree(GetProcessHeap(), 0, surface); } @@ -5531,11 +5553,6 @@ /* Ensure DDSD_CAPS is always set. */ desc->dwFlags |= DDSD_CAPS; - /* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE - * field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */ - if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface) - desc->dwFlags &= ~DDSD_LPSURFACE; - if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { DWORD flippable = desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_COMPLEX); @@ -5813,6 +5830,34 @@ } } + /* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE + * field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */ + if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface) + desc->dwFlags &= ~DDSD_LPSURFACE; + if (desc->dwFlags & DDSD_LPSURFACE) + { + if (wined3d_desc.pool != WINED3D_POOL_SYSTEM_MEM) + { + WARN("User memory surfaces should be in the system memory pool.\n"); + HeapFree(GetProcessHeap(), 0, texture); + return DDERR_INVALIDCAPS; + } + + if (version < 4) + { + WARN("User memory surfaces not supported before version 4.\n"); + HeapFree(GetProcessHeap(), 0, texture); + return DDERR_INVALIDPARAMS; + } + + if (!(desc->dwFlags & DDSD_PITCH)) + { + WARN("User memory surfaces should explicitly specify the pitch.\n"); + HeapFree(GetProcessHeap(), 0, texture); + return DDERR_INVALIDPARAMS; + } + } + if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY)) wined3d_desc.usage |= WINED3DUSAGE_OVERLAY; @@ -6043,34 +6088,36 @@ else surface->surface_desc.u1.dwLinearSize = max(4, desc->dwWidth) * max(4, desc->dwHeight); } - else + else if (!(desc->dwFlags & DDSD_LPSURFACE)) { - surface->surface_desc.dwFlags |= DDSD_PITCH; - surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(wined3d_surface); + desc->dwFlags |= DDSD_PITCH; + desc->u1.lPitch = wined3d_surface_get_pitch(wined3d_surface); } if (desc->dwFlags & DDSD_LPSURFACE) { - UINT pitch = 0; - - if (desc->dwFlags & DDSD_PITCH) + if (desc->u1.lPitch < wined3d_surface_get_pitch(wined3d_surface) || desc->u1.lPitch & 3) { - pitch = desc->u1.lPitch; - surface->surface_desc.u1.lPitch = pitch; + WARN("Invalid pitch %u specified.\n", desc->u1.lPitch); + return DDERR_INVALIDPARAMS; } if (FAILED(hr = wined3d_surface_update_desc(wined3d_surface, wined3d_desc.width, wined3d_desc.height, wined3d_desc.format, WINED3D_MULTISAMPLE_NONE, 0, - desc->lpSurface, pitch))) + desc->lpSurface, desc->u1.lPitch))) { ERR("Failed to set surface memory, hr %#x.\n", hr); return hr; } + + desc->dwFlags &= ~DDSD_LPSURFACE; } wined3d_surface_incref(wined3d_surface); surface->wined3d_surface = wined3d_surface; *parent_ops = &ddraw_surface_wined3d_parent_ops; + wined3d_private_store_init(&surface->private_store); + return DD_OK; } diff -Nru wine1.7-1.7.13/dlls/ddraw/tests/ddraw1.c wine1.7-1.7.16/dlls/ddraw/tests/ddraw1.c --- wine1.7-1.7.13/dlls/ddraw/tests/ddraw1.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/tests/ddraw1.c 2014-04-04 19:13:44.000000000 +0000 @@ -96,6 +96,13 @@ CloseHandle(p->thread); } +static HRESULT set_display_mode(IDirectDraw *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw_SetDisplayMode(ddraw, width, height, 32))) + return DD_OK; + return IDirectDraw_SetDisplayMode(ddraw, width, height, 24); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -201,22 +208,28 @@ ok(SUCCEEDED(hr), "Failed to set execute data, hr %#x.\n", hr); } -static HRESULT CALLBACK enum_z_fmt(GUID *guid, char *description, char *name, - D3DDEVICEDESC *hal_desc, D3DDEVICEDESC *hel_desc, void *ctx) +static DWORD get_device_z_depth(IDirect3DDevice *device) { - DWORD *z_depth = ctx; + DDSCAPS caps = {DDSCAPS_ZBUFFER}; + IDirectDrawSurface *ds, *rt; + DDSURFACEDESC desc; + HRESULT hr; - if (!IsEqualGUID(&IID_IDirect3DHALDevice, guid)) - return D3DENUMRET_OK; + if (FAILED(IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt))) + return 0; - if (hal_desc->dwDeviceZBufferBitDepth & DDBD_32) - *z_depth = 32; - else if (hal_desc->dwDeviceZBufferBitDepth & DDBD_24) - *z_depth = 24; - else if (hal_desc->dwDeviceZBufferBitDepth & DDBD_16) - *z_depth = 16; + hr = IDirectDrawSurface_GetAttachedSurface(rt, &caps, &ds); + IDirectDrawSurface_Release(rt); + if (FAILED(hr)) + return 0; - return DDENUMRET_OK; + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + return 0; + + return U2(desc).dwZBufferBitDepth; } static IDirectDraw *create_ddraw(void) @@ -231,11 +244,11 @@ static IDirect3DDevice *create_device(IDirectDraw *ddraw, HWND window, DWORD coop_level) { + static const DWORD z_depths[] = {32, 24, 16}; IDirectDrawSurface *surface, *ds; IDirect3DDevice *device = NULL; DDSURFACEDESC surface_desc; - DWORD z_depth = 0; - IDirect3D *d3d; + unsigned int i; HRESULT hr; hr = IDirectDraw_SetCooperativeLevel(ddraw, window, coop_level); @@ -264,51 +277,34 @@ IDirectDrawClipper_Release(clipper); } - hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D, (void **)&d3d); - if (FAILED(hr)) + /* We used to use EnumDevices() for this, but it seems + * D3DDEVICEDESC.dwDeviceZBufferBitDepth only has a very casual + * relationship with reality. */ + for (i = 0; i < sizeof(z_depths) / sizeof(*z_depths); ++i) { - IDirectDrawSurface_Release(surface); - return NULL; - } + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + U2(surface_desc).dwZBufferBitDepth = z_depths[i]; + surface_desc.dwWidth = 640; + surface_desc.dwHeight = 480; + if (FAILED(hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &ds, NULL))) + continue; - hr = IDirect3D_EnumDevices(d3d, enum_z_fmt, &z_depth); - ok(SUCCEEDED(hr), "Failed to enumerate z-formats, hr %#x.\n", hr); - IDirect3D_Release(d3d); - if (FAILED(hr) || !z_depth) - { - IDirectDrawSurface_Release(surface); - return NULL; - } + hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + continue; - memset(&surface_desc, 0, sizeof(surface_desc)); - surface_desc.dwSize = sizeof(surface_desc); - surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; - surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; - U2(surface_desc).dwZBufferBitDepth = z_depth; - surface_desc.dwWidth = 640; - surface_desc.dwHeight = 480; - hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &ds, NULL); - ok(SUCCEEDED(hr), "Failed to create depth buffer, hr %#x.\n", hr); - if (FAILED(hr)) - { - IDirectDrawSurface_Release(surface); - return NULL; - } + if (SUCCEEDED(hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device))) + break; - hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); - ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface_Release(ds); - if (FAILED(hr)) - { - IDirectDrawSurface_Release(surface); - return NULL; + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); } - hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device); IDirectDrawSurface_Release(surface); - if (FAILED(hr)) - return NULL; - return device; } @@ -447,12 +443,8 @@ focus_window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(focus_window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); @@ -575,12 +567,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 10, 10, 640, 480, 0, 0, 0, 0); ShowWindow(window, SW_SHOW); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); ret = GetClientRect(window, &client_rect); ok(ret, "Failed to get client rect.\n"); @@ -743,12 +731,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -804,7 +788,6 @@ static void test_surface_interface_mismatch(void) { IDirectDraw *ddraw = NULL; - IDirect3D *d3d = NULL; IDirectDrawSurface *surface = NULL, *ds; IDirectDrawSurface3 *surface3 = NULL; IDirect3DDevice *device = NULL; @@ -820,15 +803,19 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(ddraw = create_ddraw())) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { - skip("Failed to create a ddraw object, skipping test.\n"); - goto cleanup; + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw_Release(ddraw); + DestroyWindow(window); + return; } - - hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + z_depth = get_device_z_depth(device); + ok(!!z_depth, "Failed to get device z depth.\n"); + IDirect3DDevice_Release(device); + device = NULL; memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -847,19 +834,6 @@ goto cleanup; } - if (FAILED(hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D, (void **)&d3d))) - { - skip("D3D interface is not available, skipping test.\n"); - goto cleanup; - } - - hr = IDirect3D_EnumDevices(d3d, enum_z_fmt, &z_depth); - if (FAILED(hr) || !z_depth) - { - skip("No depth buffer formats available, skipping test.\n"); - goto cleanup; - } - memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; @@ -903,7 +877,6 @@ if (surface3) IDirectDrawSurface3_Release(surface3); if (surface) IDirectDrawSurface_Release(surface); if (device) IDirect3DDevice_Release(device); - if (d3d) IDirect3D_Release(d3d); if (ddraw) IDirectDraw_Release(ddraw); DestroyWindow(window); } @@ -914,11 +887,8 @@ IDirectDraw *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); create_window_thread(&p); hr = IDirectDraw_SetCooperativeLevel(ddraw, p.window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -948,13 +918,10 @@ IDirect3DDevice *device; HWND window; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } 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"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1080,12 +1047,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1205,12 +1168,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1372,13 +1331,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1532,14 +1486,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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"); if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1763,12 +1713,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); /* Try to create a D3D device to see if the ddraw implementation supports * D3D. 64-bit ddraw in particular doesn't seem to support D3D, and * doesn't support e.g. the IDirect3DTexture interfaces. */ @@ -1852,12 +1798,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1894,11 +1836,8 @@ }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2011,12 +1950,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); @@ -2062,12 +1997,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2143,11 +2074,8 @@ 0, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2190,8 +2118,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2315,16 +2243,15 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr) || broken(hr == DDERR_NOEXCLUSIVEMODE) /* NT4 testbot */, - "SetDisplayMode failed, hr %#x.\n", hr); - if (hr == DDERR_NOEXCLUSIVEMODE) + hr = set_display_mode(ddraw, 640, 480); + if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); IDirectDrawSurface_Release(primary); IDirectDraw_Release(ddraw); goto done; } + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2447,8 +2374,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2533,8 +2460,8 @@ /* Unlike ddraw2-7, changing from EXCLUSIVE to NORMAL does not restore the resolution */ hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2578,30 +2505,25 @@ HRESULT hr; ULONG ref; - if (!(ddraw1 = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + ddraw1 = create_ddraw(); + ok(!!ddraw1, "Failed to create a ddraw object.\n"); orig_w = GetSystemMetrics(SM_CXSCREEN); orig_h = GetSystemMetrics(SM_CYSCREEN); /* With just a single ddraw object, the display mode is restored on * release. */ - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr) || broken(hr == DDERR_NOEXCLUSIVEMODE) /* NT4 testbot */, - "SetDisplayMode failed, hr %#x.\n", hr); - if (hr == DDERR_NOEXCLUSIVEMODE) + hr = set_display_mode(ddraw1, 800, 600); + if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping test.\n"); IDirectDraw_Release(ddraw1); DestroyWindow(window); return; } + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2617,16 +2539,16 @@ /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2648,16 +2570,16 @@ /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2680,8 +2602,8 @@ /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2704,16 +2626,16 @@ /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2738,8 +2660,8 @@ /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2749,7 +2671,7 @@ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw_Release(ddraw1); @@ -2775,11 +2697,8 @@ IDirect3D *d3d; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw_Initialize(ddraw, NULL); ok(hr == DDERR_ALREADYINITIALIZED, "Initialize returned hr %#x.\n", hr); @@ -2821,11 +2740,8 @@ DDSURFACEDESC ddsd; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -2847,13 +2763,8 @@ 0, 0, 640, 480, 0, 0, 0, 0); window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window2); - DestroyWindow(window1); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -2881,12 +2792,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -2967,11 +2874,8 @@ DDSURFACEDESC ddsd; IDirectDrawSurface *surface; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = activateapp_test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -3125,12 +3029,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -3198,9 +3098,9 @@ { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; + IDirect3DDevice *device; IDirectDraw *ddraw; DWORD z_depth = 0; - IDirect3D *d3d; unsigned int i; ULONG refcount; HWND window; @@ -3364,30 +3264,20 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); - - if (FAILED(hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D, (void **)&d3d))) - { - skip("D3D interface is not available, skipping test.\n"); - goto done; - } - - hr = IDirect3D_EnumDevices(d3d, enum_z_fmt, &z_depth); - if (FAILED(hr) || !z_depth) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { - skip("No depth buffer formats available, skipping test.\n"); - IDirect3D_Release(d3d); - goto done; + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw_Release(ddraw); + DestroyWindow(window); + return; } + z_depth = get_device_z_depth(device); + ok(!!z_depth, "Failed to get device z depth.\n"); + IDirect3DDevice_Release(device); memset(palette_entries, 0, sizeof(palette_entries)); hr = IDirectDraw_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL); @@ -3454,9 +3344,6 @@ } IDirectDrawPalette_Release(palette); - IDirect3D_Release(d3d); - -done: refcount = IDirectDraw_Release(ddraw); ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount); DestroyWindow(window); @@ -3576,14 +3463,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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"); for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) { @@ -3621,8 +3504,8 @@ static void test_surface_lock(void) { IDirectDraw *ddraw; - IDirect3D *d3d = NULL; IDirectDrawSurface *surface; + IDirect3DDevice *device; HRESULT hr; HWND window; unsigned int i; @@ -3666,33 +3549,24 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); - - if (FAILED(hr = IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D, (void **)&d3d))) - { - skip("D3D interface is not available, skipping test.\n"); - goto done; - } - - hr = IDirect3D_EnumDevices(d3d, enum_z_fmt, &z_depth); - if (FAILED(hr) || !z_depth) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { - skip("No depth buffer formats available, skipping test.\n"); - goto done; + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw_Release(ddraw); + DestroyWindow(window); + return; } + z_depth = get_device_z_depth(device); + ok(!!z_depth, "Failed to get device z depth.\n"); + IDirect3DDevice_Release(device); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; if (!(tests[i].caps & DDSCAPS_PRIMARYSURFACE)) @@ -3711,7 +3585,7 @@ hr = IDirectDraw_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, type %s, hr %#x.\n", tests[i].name, hr); - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); hr = IDirectDrawSurface_Lock(surface, NULL, &ddsd, DDLOCK_WAIT, NULL); ok(SUCCEEDED(hr), "Failed to lock surface, type %s, hr %#x.\n", tests[i].name, hr); @@ -3724,10 +3598,6 @@ IDirectDrawSurface_Release(surface); } - -done: - if (d3d) - IDirect3D_Release(d3d); refcount = IDirectDraw_Release(ddraw); ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount); DestroyWindow(window); @@ -3757,12 +3627,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + 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); @@ -3842,16 +3708,12 @@ DDBLTFX fx; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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_SetDisplayMode(ddraw, 640, 480, 32); + hr = set_display_mode(ddraw, 640, 480); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -4024,14 +3886,10 @@ IDirectDrawSurface *surface; ULONG ref; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4069,18 +3927,13 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 8); - if (hr == E_NOTIMPL) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (FAILED(hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 8))) { - win_skip("changing display mode is not supported (8bpp)\n"); + win_skip("Failed to set 8 bpp display mode, skipping test.\n"); IDirectDraw_Release(ddraw); DestroyWindow(window); return; @@ -4181,14 +4034,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4406,8 +4255,265 @@ DestroyWindow(window); } +static void test_pixel_format(void) +{ + HWND window, window2 = NULL; + HDC hdc, hdc2 = NULL; + HMODULE gl = NULL; + int format, test_format; + PIXELFORMATDESCRIPTOR pfd; + IDirectDraw *ddraw = NULL; + IDirectDrawClipper *clipper = NULL; + DDSURFACEDESC ddsd; + IDirectDrawSurface *primary = NULL; + DDBLTFX fx; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + if (!window) + { + skip("Failed to create window\n"); + return; + } + + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + + hdc = GetDC(window); + if (!hdc) + { + skip("Failed to get DC\n"); + goto cleanup; + } + + if (window2) + hdc2 = GetDC(window2); + + gl = LoadLibraryA("opengl32.dll"); + ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n"); + + format = GetPixelFormat(hdc); + ok(format == 0, "new window has pixel format %d\n", format); + + ZeroMemory(&pfd, sizeof(pfd)); + pfd.nSize = sizeof(pfd); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; + format = ChoosePixelFormat(hdc, &pfd); + if (format <= 0) + { + skip("no pixel format available\n"); + goto cleanup; + } + + if (!SetPixelFormat(hdc, format, &pfd) || GetPixelFormat(hdc) != format) + { + skip("failed to set pixel format\n"); + goto cleanup; + } + + if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format) + { + skip("failed to set pixel format on second window\n"); + if (hdc2) + { + ReleaseDC(window2, hdc2); + hdc2 = NULL; + } + } + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + if (FAILED(hr)) + { + skip("Failed to set cooperative level, hr %#x.\n", hr); + goto cleanup; + } + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + hr = IDirectDraw_CreateClipper(ddraw, 0, &clipper, NULL); + ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2); + ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + hr = IDirectDraw_CreateSurface(ddraw, &ddsd, &primary, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + if (clipper) + { + hr = IDirectDrawSurface_SetClipper(primary, clipper); + ok(SUCCEEDED(hr), "Failed to set clipper, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&fx, 0, sizeof(fx)); + fx.dwSize = sizeof(fx); + hr = IDirectDrawSurface_Blt(primary, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(SUCCEEDED(hr), "Failed to clear source surface, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + +cleanup: + if (primary) IDirectDrawSurface_Release(primary); + if (clipper) IDirectDrawClipper_Release(clipper); + if (ddraw) IDirectDraw_Release(ddraw); + if (gl) FreeLibrary(gl); + if (hdc) ReleaseDC(window, hdc); + if (hdc2) ReleaseDC(window2, hdc2); + if (window) DestroyWindow(window); + if (window2) DestroyWindow(window2); +} + +static void test_create_surface_pitch(void) +{ + IDirectDrawSurface *surface; + DDSURFACEDESC surface_desc; + IDirectDraw *ddraw; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; + void *mem; + + static const struct + { + DWORD placement; + DWORD flags_in; + DWORD pitch_in; + HRESULT hr; + DWORD flags_out; + DWORD pitch_out; + } + test_data[] = + { + {DDSCAPS_VIDEOMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x100, DDERR_INVALIDCAPS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE, 0, DDERR_INVALIDPARAMS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x100, DDERR_INVALIDPARAMS, + 0, 0 }, + }; + DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE; + + 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); + + mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((64 * 4) + 4) * 64); + + for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | test_data[i].flags_in; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | test_data[i].placement; + surface_desc.dwWidth = 64; + surface_desc.dwHeight = 64; + U1(surface_desc).lPitch = test_data[i].pitch_in; + surface_desc.lpSurface = mem; + surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat); + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32; + U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000; + U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00; + U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW), + "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr); + if (FAILED(hr)) + continue; + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out, + "Test %u: Got unexpected flags %#x, expected %#x.\n", + i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out); + ok(U1(surface_desc).lPitch == test_data[i].pitch_out, + "Test %u: Got unexpected pitch %u, expected %u.\n", + i, U1(surface_desc).lPitch, test_data[i].pitch_out); + + IDirectDrawSurface_Release(surface); + } + + HeapFree(GetProcessHeap(), 0, mem); + refcount = IDirectDraw_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw1) { + IDirectDraw *ddraw; + + if (!(ddraw = create_ddraw())) + { + skip("Failed to create a ddraw object, skipping tests.\n"); + return; + } + IDirectDraw_Release(ddraw); + test_coop_level_create_device_window(); test_clipper_blt(); test_coop_level_d3d_state(); @@ -4439,4 +4545,6 @@ test_sysmem_overlay(); test_primary_palette(); test_surface_attachment(); + test_pixel_format(); + test_create_surface_pitch(); } diff -Nru wine1.7-1.7.13/dlls/ddraw/tests/ddraw2.c wine1.7-1.7.16/dlls/ddraw/tests/ddraw2.c --- wine1.7-1.7.13/dlls/ddraw/tests/ddraw2.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/tests/ddraw2.c 2014-04-04 19:13:44.000000000 +0000 @@ -110,6 +110,13 @@ return ret; } +static HRESULT set_display_mode(IDirectDraw2 *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw2_SetDisplayMode(ddraw, width, height, 32, 0, 0))) + return DD_OK; + return IDirectDraw2_SetDisplayMode(ddraw, width, height, 24, 0, 0); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -133,22 +140,28 @@ return color; } -static HRESULT CALLBACK enum_z_fmt(GUID *guid, char *description, char *name, - D3DDEVICEDESC *hal_desc, D3DDEVICEDESC *hel_desc, void *ctx) +static DWORD get_device_z_depth(IDirect3DDevice2 *device) { - DWORD *z_depth = ctx; + DDSCAPS caps = {DDSCAPS_ZBUFFER}; + IDirectDrawSurface *ds, *rt; + DDSURFACEDESC desc; + HRESULT hr; - if (!IsEqualGUID(&IID_IDirect3DHALDevice, guid)) - return D3DENUMRET_OK; + if (FAILED(IDirect3DDevice2_GetRenderTarget(device, &rt))) + return 0; - if (hal_desc->dwDeviceZBufferBitDepth & DDBD_32) - *z_depth = 32; - else if (hal_desc->dwDeviceZBufferBitDepth & DDBD_24) - *z_depth = 24; - else if (hal_desc->dwDeviceZBufferBitDepth & DDBD_16) - *z_depth = 16; + hr = IDirectDrawSurface_GetAttachedSurface(rt, &caps, &ds); + IDirectDrawSurface_Release(rt); + if (FAILED(hr)) + return 0; - return DDENUMRET_OK; + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + return 0; + + return U2(desc).dwZBufferBitDepth; } static IDirectDraw2 *create_ddraw(void) @@ -170,11 +183,12 @@ static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, DWORD coop_level) { + static const DWORD z_depths[] = {32, 24, 16}; IDirectDrawSurface *surface, *ds; IDirect3DDevice2 *device = NULL; DDSURFACEDESC surface_desc; - DWORD z_depth = 0; IDirect3D2 *d3d; + unsigned int i; HRESULT hr; hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, coop_level); @@ -210,47 +224,35 @@ return NULL; } - hr = IDirect3D2_EnumDevices(d3d, enum_z_fmt, &z_depth); - ok(SUCCEEDED(hr), "Failed to enumerate z-formats, hr %#x.\n", hr); - if (FAILED(hr) || !z_depth) + /* We used to use EnumDevices() for this, but it seems + * D3DDEVICEDESC.dwDeviceZBufferBitDepth only has a very casual + * relationship with reality. */ + for (i = 0; i < sizeof(z_depths) / sizeof(*z_depths); ++i) { - IDirect3D2_Release(d3d); - IDirectDrawSurface_Release(surface); - return NULL; - } + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + U2(surface_desc).dwZBufferBitDepth = z_depths[i]; + surface_desc.dwWidth = 640; + surface_desc.dwHeight = 480; + if (FAILED(hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &ds, NULL))) + continue; - memset(&surface_desc, 0, sizeof(surface_desc)); - surface_desc.dwSize = sizeof(surface_desc); - surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; - surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; - U2(surface_desc).dwZBufferBitDepth = z_depth; - surface_desc.dwWidth = 640; - surface_desc.dwHeight = 480; - hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &ds, NULL); - ok(SUCCEEDED(hr), "Failed to create depth buffer, hr %#x.\n", hr); - if (FAILED(hr)) - { - IDirect3D2_Release(d3d); - IDirectDrawSurface_Release(surface); - return NULL; - } + hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + continue; - hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); - ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface_Release(ds); - if (FAILED(hr)) - { - IDirect3D2_Release(d3d); - IDirectDrawSurface_Release(surface); - return NULL; + if (SUCCEEDED(hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device))) + break; + + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); } - hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device); IDirect3D2_Release(d3d); IDirectDrawSurface_Release(surface); - if (FAILED(hr)) - return NULL; - return device; } @@ -389,12 +391,8 @@ focus_window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(focus_window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); @@ -517,12 +515,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 10, 10, 640, 480, 0, 0, 0, 0); ShowWindow(window, SW_SHOW); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); ret = GetClientRect(window, &client_rect); ok(ret, "Failed to get client rect.\n"); @@ -686,12 +680,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -777,15 +767,19 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(ddraw = create_ddraw())) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { - skip("Failed to create a ddraw object, skipping test.\n"); - goto cleanup; + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw2_Release(ddraw); + DestroyWindow(window); + return; } - - hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + z_depth = get_device_z_depth(device); + ok(!!z_depth, "Failed to get device z depth.\n"); + IDirect3DDevice2_Release(device); + device = NULL; memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -810,13 +804,6 @@ goto cleanup; } - hr = IDirect3D2_EnumDevices(d3d, enum_z_fmt, &z_depth); - if (FAILED(hr) || !z_depth) - { - skip("No depth buffer formats available, skipping test.\n"); - goto cleanup; - } - memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; @@ -871,11 +858,8 @@ IDirectDraw2 *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); create_window_thread(&p); hr = IDirectDraw2_SetCooperativeLevel(ddraw, p.window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -918,12 +902,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1072,11 +1052,8 @@ HRESULT hr; DDCOLORKEY ckey; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -1181,13 +1158,10 @@ IDirect3DDevice2 *device; HWND window; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } 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"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1374,12 +1348,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1479,12 +1449,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1621,13 +1587,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1729,14 +1690,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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"); if (!(device = create_device(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -1960,12 +1917,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); /* Try to create a D3D device to see if the ddraw implementation supports * D3D. 64-bit ddraw in particular doesn't seem to support D3D, and * doesn't support e.g. the IDirect3DTexture interfaces. */ @@ -2048,12 +2001,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -2090,11 +2039,8 @@ }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2207,12 +2153,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); @@ -2258,12 +2200,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2350,11 +2288,9 @@ 0, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -2401,8 +2337,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2526,16 +2462,15 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr) || broken(hr == DDERR_NOEXCLUSIVEMODE) /* NT4 testbot */, - "SetDisplayMode failed, hr %#x.\n", hr); - if (hr == DDERR_NOEXCLUSIVEMODE) + hr = set_display_mode(ddraw, 640, 480); + if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); IDirectDrawSurface_Release(primary); IDirectDraw2_Release(ddraw); goto done; } + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2658,8 +2593,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2744,8 +2679,8 @@ /* Changing the coop level from EXCLUSIVE to NORMAL restores the screen resolution */ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2783,8 +2718,8 @@ /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2810,8 +2745,8 @@ /* If the window is changed at the same time, messages are sent to the new window. */ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2878,30 +2813,25 @@ HRESULT hr; ULONG ref; - if (!(ddraw1 = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + ddraw1 = create_ddraw(); + ok(!!ddraw1, "Failed to create a ddraw object.\n"); orig_w = GetSystemMetrics(SM_CXSCREEN); orig_h = GetSystemMetrics(SM_CYSCREEN); /* With just a single ddraw object, the display mode is restored on * release. */ - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr) || broken(hr == DDERR_NOEXCLUSIVEMODE) /* NT4 testbot */, - "SetDisplayMode failed, hr %#x.\n", hr); - if (hr == DDERR_NOEXCLUSIVEMODE) + hr = set_display_mode(ddraw1, 800, 600); + if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping test.\n"); IDirectDraw2_Release(ddraw1); DestroyWindow(window); return; } + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2917,16 +2847,16 @@ /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2948,16 +2878,16 @@ /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2980,8 +2910,8 @@ /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3004,16 +2934,16 @@ /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3038,8 +2968,8 @@ /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3049,7 +2979,7 @@ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw2_Release(ddraw1); @@ -3074,11 +3004,8 @@ IDirectDraw2 *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_Initialize(ddraw, NULL); ok(hr == DDERR_ALREADYINITIALIZED, "Initialize returned hr %#x.\n", hr); @@ -3102,11 +3029,8 @@ DDSURFACEDESC ddsd; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -3128,13 +3052,8 @@ 0, 0, 640, 480, 0, 0, 0, 0); window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window2); - DestroyWindow(window1); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -3162,12 +3081,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -3227,8 +3142,8 @@ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -3255,8 +3170,8 @@ window = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw2 = create_ddraw())) - goto done; + ddraw2 = create_ddraw(); + ok(!!ddraw2, "Failed to create a ddraw object.\n"); /* Newly created ddraw objects restore the mode on ddraw2+::SetCooperativeLevel(NORMAL) */ restored = test_mode_restored(ddraw2, window); ok(restored, "Display mode not restored in new ddraw object\n"); @@ -3279,8 +3194,8 @@ IDirectDraw_Release(ddraw); IDirectDraw2_Release(ddraw2); - if (!(ddraw2 = create_ddraw())) - goto done; + ddraw2 = create_ddraw(); + ok(!!ddraw2, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_QueryInterface(ddraw2, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3293,8 +3208,8 @@ IDirectDraw2_Release(ddraw2); /* A failing call does not restore the ddraw2+ behavior */ - if (!(ddraw2 = create_ddraw())) - goto done; + ddraw2 = create_ddraw(); + ok(!!ddraw2, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_QueryInterface(ddraw2, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3309,8 +3224,8 @@ IDirectDraw2_Release(ddraw2); /* Neither does a sequence of successful calls with the new interface */ - if (!(ddraw2 = create_ddraw())) - goto done; + ddraw2 = create_ddraw(); + ok(!!ddraw2, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_QueryInterface(ddraw2, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3327,8 +3242,8 @@ IDirectDraw2_Release(ddraw2); /* ddraw1::CreateSurface does not triger the ddraw1 behavior */ - if (!(ddraw2 = create_ddraw())) - goto done; + ddraw2 = create_ddraw(); + ok(!!ddraw2, "Failed to create a ddraw object.\n"); hr = IDirectDraw2_QueryInterface(ddraw2, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3348,8 +3263,6 @@ IDirectDraw_Release(ddraw); IDirectDraw2_Release(ddraw2); - -done: DestroyWindow(window); } @@ -3434,12 +3347,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -3551,11 +3460,8 @@ DDSURFACEDESC ddsd; IDirectDrawSurface *surface; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = activateapp_test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -3709,12 +3615,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -3782,6 +3684,7 @@ { PALETTEENTRY palette_entries[256]; IDirectDrawPalette *palette; + IDirect3DDevice2 *device; IDirectDraw2 *ddraw; DWORD z_depth = 0; IDirect3D2 *d3d; @@ -3990,16 +3893,20 @@ }, }; - if (!(ddraw = create_ddraw())) + 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"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { - skip("Failed to create a ddraw object, skipping test.\n"); + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw2_Release(ddraw); + DestroyWindow(window); return; } - - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, - 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + z_depth = get_device_z_depth(device); + ok(!!z_depth, "Failed to get device z depth.\n"); + IDirect3DDevice2_Release(device); if (FAILED(hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirect3D2, (void **)&d3d))) { @@ -4007,14 +3914,6 @@ goto done; } - hr = IDirect3D2_EnumDevices(d3d, enum_z_fmt, &z_depth); - if (FAILED(hr) || !z_depth) - { - skip("No depth buffer formats available, skipping test.\n"); - IDirect3D2_Release(d3d); - goto done; - } - memset(palette_entries, 0, sizeof(palette_entries)); hr = IDirectDraw2_CreatePalette(ddraw, DDPCAPS_ALLOW256 | DDPCAPS_8BIT, palette_entries, &palette, NULL); ok(SUCCEEDED(hr), "Failed to create palette, hr %#x.\n", hr); @@ -4258,14 +4157,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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"); for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) { @@ -4303,8 +4198,8 @@ static void test_surface_lock(void) { IDirectDraw2 *ddraw; - IDirect3D2 *d3d = NULL; IDirectDrawSurface *surface; + IDirect3DDevice2 *device; HRESULT hr; HWND window; unsigned int i; @@ -4348,33 +4243,24 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); - ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); - - if (FAILED(hr = IDirectDraw2_QueryInterface(ddraw, &IID_IDirect3D2, (void **)&d3d))) - { - skip("D3D interface is not available, skipping test.\n"); - goto done; - } - - hr = IDirect3D2_EnumDevices(d3d, enum_z_fmt, &z_depth); - if (FAILED(hr) || !z_depth) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) { - skip("No depth buffer formats available, skipping test.\n"); - goto done; + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw2_Release(ddraw); + DestroyWindow(window); + return; } + z_depth = get_device_z_depth(device); + ok(!!z_depth, "Failed to get device z depth.\n"); + IDirect3DDevice2_Release(device); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; if (!(tests[i].caps & DDSCAPS_PRIMARYSURFACE)) @@ -4393,7 +4279,7 @@ hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, type %s, hr %#x.\n", tests[i].name, hr); - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); hr = IDirectDrawSurface_Lock(surface, NULL, &ddsd, DDLOCK_WAIT, NULL); ok(SUCCEEDED(hr), "Failed to lock surface, type %s, hr %#x.\n", tests[i].name, hr); @@ -4406,9 +4292,6 @@ IDirectDrawSurface_Release(surface); } -done: - if (d3d) - IDirect3D2_Release(d3d); refcount = IDirectDraw2_Release(ddraw); ok(refcount == 0, "The ddraw object was not properly freed, refcount %u.\n", refcount); DestroyWindow(window); @@ -4438,12 +4321,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + 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); @@ -4523,16 +4402,12 @@ DDBLTFX fx; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -4726,15 +4601,10 @@ {DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY, FALSE, "systemmemory primary"}, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4748,7 +4618,7 @@ U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000; U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00; U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -4793,7 +4663,8 @@ hr = IDirectDrawSurface3_GetSurfaceDesc(surface3, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); + ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN), + "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); /* Setting the caps is an error. This also means the original description cannot be reapplied. */ hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0); @@ -4808,7 +4679,7 @@ ddsd.lpSurface = data; hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0); ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr); - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0); ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr); ddsd.ddsCaps.dwCaps = 0; @@ -4817,7 +4688,8 @@ hr = IDirectDrawSurface3_GetSurfaceDesc(surface3, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); + ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN), + "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); /* Setting the height is allowed, but it cannot be set to 0, and only if LPSURFACE is set too. */ reset_ddsd(&ddsd); @@ -5023,14 +4895,10 @@ HDC dc; unsigned int x, y; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5045,7 +4913,7 @@ U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000; U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00; U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5122,14 +4990,10 @@ IDirectDrawSurface *surface; ULONG ref; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5166,18 +5030,13 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 8, 0, 0); - if (hr == E_NOTIMPL) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (FAILED(hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 8, 0, 0))) { - win_skip("changing display mode is not supported (8bpp)\n"); + win_skip("Failed to set 8 bpp display mode, skipping test.\n"); IDirectDraw2_Release(ddraw); DestroyWindow(window); return; @@ -5278,14 +5137,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5503,8 +5358,265 @@ DestroyWindow(window); } +static void test_pixel_format(void) +{ + HWND window, window2 = NULL; + HDC hdc, hdc2 = NULL; + HMODULE gl = NULL; + int format, test_format; + PIXELFORMATDESCRIPTOR pfd; + IDirectDraw2 *ddraw = NULL; + IDirectDrawClipper *clipper = NULL; + DDSURFACEDESC ddsd; + IDirectDrawSurface *primary = NULL; + DDBLTFX fx; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + if (!window) + { + skip("Failed to create window\n"); + return; + } + + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + + hdc = GetDC(window); + if (!hdc) + { + skip("Failed to get DC\n"); + goto cleanup; + } + + if (window2) + hdc2 = GetDC(window2); + + gl = LoadLibraryA("opengl32.dll"); + ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n"); + + format = GetPixelFormat(hdc); + ok(format == 0, "new window has pixel format %d\n", format); + + ZeroMemory(&pfd, sizeof(pfd)); + pfd.nSize = sizeof(pfd); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; + format = ChoosePixelFormat(hdc, &pfd); + if (format <= 0) + { + skip("no pixel format available\n"); + goto cleanup; + } + + if (!SetPixelFormat(hdc, format, &pfd) || GetPixelFormat(hdc) != format) + { + skip("failed to set pixel format\n"); + goto cleanup; + } + + if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format) + { + skip("failed to set pixel format on second window\n"); + if (hdc2) + { + ReleaseDC(window2, hdc2); + hdc2 = NULL; + } + } + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + if (FAILED(hr)) + { + skip("Failed to set cooperative level, hr %#x.\n", hr); + goto cleanup; + } + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + hr = IDirectDraw2_CreateClipper(ddraw, 0, &clipper, NULL); + ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2); + ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &primary, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + if (clipper) + { + hr = IDirectDrawSurface2_SetClipper(primary, clipper); + ok(SUCCEEDED(hr), "Failed to set clipper, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&fx, 0, sizeof(fx)); + fx.dwSize = sizeof(fx); + hr = IDirectDrawSurface2_Blt(primary, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(SUCCEEDED(hr), "Failed to clear source surface, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + +cleanup: + if (primary) IDirectDrawSurface2_Release(primary); + if (clipper) IDirectDrawClipper_Release(clipper); + if (ddraw) IDirectDraw2_Release(ddraw); + if (gl) FreeLibrary(gl); + if (hdc) ReleaseDC(window, hdc); + if (hdc2) ReleaseDC(window2, hdc2); + if (window) DestroyWindow(window); + if (window2) DestroyWindow(window2); +} + +static void test_create_surface_pitch(void) +{ + IDirectDrawSurface *surface; + DDSURFACEDESC surface_desc; + IDirectDraw2 *ddraw; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; + void *mem; + + static const struct + { + DWORD placement; + DWORD flags_in; + DWORD pitch_in; + HRESULT hr; + DWORD flags_out; + DWORD pitch_out; + } + test_data[] = + { + {DDSCAPS_VIDEOMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x100, DDERR_INVALIDCAPS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE, 0, DDERR_INVALIDPARAMS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x100, DDERR_INVALIDPARAMS, + 0, 0 }, + }; + DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE; + + 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); + + mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((64 * 4) + 4) * 64); + + for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | test_data[i].flags_in; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | test_data[i].placement; + surface_desc.dwWidth = 64; + surface_desc.dwHeight = 64; + U1(surface_desc).lPitch = test_data[i].pitch_in; + surface_desc.lpSurface = mem; + surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat); + surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB; + U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32; + U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000; + U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00; + U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff; + hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW), + "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr); + if (FAILED(hr)) + continue; + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out, + "Test %u: Got unexpected flags %#x, expected %#x.\n", + i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out); + ok(U1(surface_desc).lPitch == test_data[i].pitch_out, + "Test %u: Got unexpected pitch %u, expected %u.\n", + i, U1(surface_desc).lPitch, test_data[i].pitch_out); + + IDirectDrawSurface_Release(surface); + } + + HeapFree(GetProcessHeap(), 0, mem); + refcount = IDirectDraw2_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw2) { + IDirectDraw2 *ddraw; + + if (!(ddraw = create_ddraw())) + { + skip("Failed to create a ddraw object, skipping tests.\n"); + return; + } + IDirectDraw2_Release(ddraw); + test_coop_level_create_device_window(); test_clipper_blt(); test_coop_level_d3d_state(); @@ -5542,4 +5654,6 @@ test_sysmem_overlay(); test_primary_palette(); test_surface_attachment(); + test_pixel_format(); + test_create_surface_pitch(); } diff -Nru wine1.7-1.7.13/dlls/ddraw/tests/ddraw4.c wine1.7-1.7.16/dlls/ddraw/tests/ddraw4.c --- wine1.7-1.7.13/dlls/ddraw/tests/ddraw4.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/tests/ddraw4.c 2014-04-04 19:13:44.000000000 +0000 @@ -150,6 +150,13 @@ return ret; } +static HRESULT set_display_mode(IDirectDraw4 *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw4_SetDisplayMode(ddraw, width, height, 32, 0, 0))) + return DD_OK; + return IDirectDraw4_SetDisplayMode(ddraw, width, height, 24, 0, 0); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface4 *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -576,12 +583,8 @@ focus_window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(focus_window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); @@ -704,12 +707,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 10, 10, 640, 480, 0, 0, 0, 0); ShowWindow(window, SW_SHOW); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); ret = GetClientRect(window, &client_rect); ok(ret, "Failed to get client rect.\n"); @@ -948,13 +947,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - goto cleanup; - } - + 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); @@ -1035,11 +1029,8 @@ IDirectDraw4 *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); create_window_thread(&p); hr = IDirectDraw4_SetCooperativeLevel(ddraw, p.window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -1235,11 +1226,8 @@ HRESULT hr; DDCOLORKEY ckey; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -2101,12 +2089,8 @@ return; } IDirect3DDevice_Release(device); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + 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); @@ -2213,11 +2197,8 @@ }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2330,12 +2311,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); @@ -2381,12 +2358,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2473,11 +2446,8 @@ 0, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2525,8 +2495,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2650,8 +2620,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2774,8 +2744,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2860,8 +2830,8 @@ /* Changing the coop level from EXCLUSIVE to NORMAL restores the screen resolution */ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2899,8 +2869,8 @@ /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2926,8 +2896,8 @@ /* If the window is changed at the same time, messages are sent to the new window. */ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2993,22 +2963,18 @@ HRESULT hr; ULONG ref; - if (!(ddraw1 = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + ddraw1 = create_ddraw(); + ok(!!ddraw1, "Failed to create a ddraw object.\n"); orig_w = GetSystemMetrics(SM_CXSCREEN); orig_h = GetSystemMetrics(SM_CYSCREEN); /* With just a single ddraw object, the display mode is restored on * release. */ - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3024,16 +2990,16 @@ /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3055,16 +3021,16 @@ /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3087,8 +3053,8 @@ /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3111,16 +3077,16 @@ /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3145,8 +3111,8 @@ /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3156,7 +3122,7 @@ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw4_Release(ddraw1); @@ -3181,11 +3147,8 @@ IDirectDraw4 *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_Initialize(ddraw, NULL); ok(hr == DDERR_ALREADYINITIALIZED, "Initialize returned hr %#x.\n", hr); @@ -3209,11 +3172,8 @@ DDSURFACEDESC2 ddsd; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -3314,13 +3274,8 @@ 0, 0, 640, 480, 0, 0, 0, 0); window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window2); - DestroyWindow(window1); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -3458,8 +3413,8 @@ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -3486,8 +3441,8 @@ window = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw4 = create_ddraw())) - goto done; + ddraw4 = create_ddraw(); + ok(!!ddraw4, "Failed to create a ddraw object.\n"); /* Newly created ddraw objects restore the mode on ddraw2+::SetCooperativeLevel(NORMAL) */ restored = test_mode_restored(ddraw4, window); ok(restored, "Display mode not restored in new ddraw object\n"); @@ -3510,8 +3465,8 @@ IDirectDraw_Release(ddraw); IDirectDraw4_Release(ddraw4); - if (!(ddraw4 = create_ddraw())) - goto done; + ddraw4 = create_ddraw(); + ok(!!ddraw4, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_QueryInterface(ddraw4, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3524,8 +3479,8 @@ IDirectDraw4_Release(ddraw4); /* A failing call does not restore the ddraw2+ behavior */ - if (!(ddraw4 = create_ddraw())) - goto done; + ddraw4 = create_ddraw(); + ok(!!ddraw4, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_QueryInterface(ddraw4, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3540,8 +3495,8 @@ IDirectDraw4_Release(ddraw4); /* Neither does a sequence of successful calls with the new interface */ - if (!(ddraw4 = create_ddraw())) - goto done; + ddraw4 = create_ddraw(); + ok(!!ddraw4, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_QueryInterface(ddraw4, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3558,8 +3513,8 @@ IDirectDraw4_Release(ddraw4); /* ddraw1::CreateSurface does not triger the ddraw1 behavior */ - if (!(ddraw4 = create_ddraw())) - goto done; + ddraw4 = create_ddraw(); + ok(!!ddraw4, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_QueryInterface(ddraw4, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3579,8 +3534,6 @@ IDirectDraw_Release(ddraw); IDirectDraw4_Release(ddraw4); - -done: DestroyWindow(window); } @@ -3831,11 +3784,8 @@ DDSURFACEDESC2 ddsd; IDirectDrawSurface4 *surface; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = activateapp_test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -3985,12 +3935,8 @@ DDSCAPS_SYSTEMMEMORY, 0}, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -4097,6 +4043,8 @@ DWORD supported_fmts = 0, supported_overlay_fmts = 0; DWORD num_fourcc_codes = 0, *fourcc_codes; DDSURFACEDESC2 ddsd; + DDCAPS hal_caps; + static const struct { DWORD fourcc; @@ -4186,12 +4134,19 @@ } HeapFree(GetProcessHeap(), 0, fourcc_codes); + memset(&hal_caps, 0, sizeof(hal_caps)); + hal_caps.dwSize = sizeof(hal_caps); + hr = IDirectDraw4_GetCaps(ddraw, &hal_caps, NULL); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + for (i = 0; i < sizeof(formats) / sizeof(*formats); i++) { for (j = 0; j < sizeof(types) / sizeof(*types); j++) { BOOL support; - if (formats[i].overlay != types[j].overlay) + + if (formats[i].overlay != types[j].overlay + || (types[j].overlay && !(hal_caps.dwCaps & DDCAPS_OVERLAY))) continue; if (formats[i].overlay) @@ -4574,14 +4529,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4822,14 +4773,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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"); for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) { @@ -4945,14 +4892,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4972,7 +4915,7 @@ for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; if (!(tests[i].caps & DDSCAPS_PRIMARYSURFACE)) @@ -4992,7 +4935,7 @@ hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, type %s, hr %#x.\n", tests[i].name, hr); - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); hr = IDirectDrawSurface4_Lock(surface, NULL, &ddsd, DDLOCK_WAIT, NULL); ok(SUCCEEDED(hr), "Failed to lock surface, type %s, hr %#x.\n", tests[i].name, hr); @@ -5126,16 +5069,12 @@ DDBLTFX fx; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -5330,15 +5269,10 @@ {DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY, 0, FALSE, "systemmemory primary"}, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5352,7 +5286,7 @@ U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000; U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00; U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5393,7 +5327,8 @@ hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); + ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN), + "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0); /* Setting the caps is an error. This also means the original description cannot be reapplied. */ @@ -5409,7 +5344,7 @@ ddsd.lpSurface = data; hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0); ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr); - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0); ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr); ddsd.ddsCaps.dwCaps = 0; @@ -5419,7 +5354,8 @@ hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); + ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN), + "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0); /* Setting the height is allowed, but it cannot be set to 0, and only if LPSURFACE is set too. */ @@ -5623,14 +5559,10 @@ HDC dc; unsigned int x, y; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5645,7 +5577,7 @@ U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000; U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00; U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5718,14 +5650,10 @@ IDirectDrawSurface4 *surface; ULONG ref; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5762,18 +5690,13 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 8, 0, 0); - if (hr == E_NOTIMPL) + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (FAILED(hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 8, 0, 0))) { - win_skip("changing display mode is not supported (8bpp)\n"); + win_skip("Failed to set 8 bpp display mode, skipping test.\n"); IDirectDraw4_Release(ddraw); DestroyWindow(window); return; @@ -5875,14 +5798,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -6128,22 +6047,35 @@ static void test_private_data(void) { IDirectDraw4 *ddraw; - IDirectDrawSurface4 *surface; + IDirectDrawSurface4 *surface, *surface2; DDSURFACEDESC2 surface_desc; ULONG refcount, refcount2, refcount3; IUnknown *ptr; DWORD size = sizeof(ptr); HRESULT hr; HWND window; - - if (!(ddraw = create_ddraw())) + DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, 0}; + DWORD data[] = {1, 2, 3, 4}; + DDCAPS hal_caps; + static const GUID ddraw_private_data_test_guid = + { + 0xfdb37466, + 0x428f, + 0x4edf, + {0xa3,0x7f,0x9b,0x1d,0xf4,0x88,0xc5,0xfc} + }; + static const GUID ddraw_private_data_test_guid2 = { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + 0x2e5afac2, + 0x87b5, + 0x4c10, + {0x9b,0x4b,0x89,0xd7,0xd1,0x12,0xe7,0x2b} + }; 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); @@ -6156,47 +6088,90 @@ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); /* DDSPD_IUNKNOWNPOINTER needs sizeof(IUnknown *) bytes of data. */ - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, 0, DDSPD_IUNKNOWNPOINTER); ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, 5, DDSPD_IUNKNOWNPOINTER); ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw) * 2, DDSPD_IUNKNOWNPOINTER); ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + /* Note that with a size != 0 and size != sizeof(IUnknown *) and + * DDSPD_IUNKNOWNPOINTER set SetPrivateData in ddraw4 and ddraw7 + * erases the old content and returns an error. This behavior has + * been fixed in d3d8 and d3d9. Unless an application is found + * that depends on this we don't care about this behavior. */ + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, + sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); + ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, + 0, DDSPD_IUNKNOWNPOINTER); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + size = sizeof(ptr); + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid, &ptr, &size); + ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr); + hr = IDirectDrawSurface4_FreePrivateData(surface, &ddraw_private_data_test_guid); + ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); + refcount = get_refcount((IUnknown *)ddraw); - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount + 1, "Got unexpected refcount %u.\n", refcount2); - hr = IDirectDrawSurface4_FreePrivateData(surface, &IID_IDirect3D); + hr = IDirectDrawSurface4_FreePrivateData(surface, &ddraw_private_data_test_guid); ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount, "Got unexpected refcount %u.\n", refcount2); - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, surface, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, surface, sizeof(surface), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount, "Got unexpected refcount %u.\n", refcount2); - hr = IDirectDrawSurface4_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); - hr = IDirectDrawSurface4_GetPrivateData(surface, &IID_IDirect3D, &ptr, &size); + size = 2 * sizeof(ptr); + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid, &ptr, &size); ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr); + ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size); refcount2 = get_refcount(ptr); /* Object is NOT addref'ed by the getter. */ ok(ptr == (IUnknown *)ddraw, "Returned interface pointer is %p, expected %p.\n", ptr, ddraw); ok(refcount2 == refcount + 1, "Got unexpected refcount %u.\n", refcount2); + ptr = (IUnknown *)0xdeadbeef; + size = 1; + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid, NULL, &size); + ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size); + size = 2 * sizeof(ptr); + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid, NULL, &size); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(size == 2 * sizeof(ptr), "Got unexpected size %u.\n", size); + size = 1; + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid, &ptr, &size); + ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size); + ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid2, NULL, NULL); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + size = 0xdeadbabe; + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid2, &ptr, &size); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); + ok(size == 0xdeadbabe, "Got unexpected size %u.\n", size); + hr = IDirectDrawSurface4_GetPrivateData(surface, &ddraw_private_data_test_guid, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + refcount3 = IDirectDrawSurface4_Release(surface); ok(!refcount3, "Got unexpected refcount %u.\n", refcount3); @@ -6205,6 +6180,286 @@ refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount - 1, "Got unexpected refcount %u.\n", refcount2); + memset(&hal_caps, 0, sizeof(hal_caps)); + hal_caps.dwSize = sizeof(hal_caps); + hr = IDirectDraw7_GetCaps(ddraw, &hal_caps, NULL); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) == (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) + { + reset_ddsd(&surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_MIPMAPCOUNT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; + surface_desc.dwHeight = 4; + surface_desc.dwWidth = 4; + U2(surface_desc).dwMipMapCount = 2; + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + hr = IDirectDrawSurface4_GetAttachedSurface(surface, &caps, &surface2); + ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr); + + hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, data, sizeof(data), 0); + ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); + hr = IDirectDrawSurface4_GetPrivateData(surface2, &ddraw_private_data_test_guid, NULL, NULL); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + + IDirectDrawSurface4_Release(surface2); + IDirectDrawSurface4_Release(surface); + } + else + skip("Mipmapped textures not supported, skipping mipmap private data test.\n"); + + refcount = IDirectDraw4_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + +static void test_pixel_format(void) +{ + HWND window, window2 = NULL; + HDC hdc, hdc2 = NULL; + HMODULE gl = NULL; + int format, test_format; + PIXELFORMATDESCRIPTOR pfd; + IDirectDraw4 *ddraw = NULL; + IDirectDrawClipper *clipper = NULL; + DDSURFACEDESC2 ddsd; + IDirectDrawSurface4 *primary = NULL; + DDBLTFX fx; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + if (!window) + { + skip("Failed to create window\n"); + return; + } + + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + + hdc = GetDC(window); + if (!hdc) + { + skip("Failed to get DC\n"); + goto cleanup; + } + + if (window2) + hdc2 = GetDC(window2); + + gl = LoadLibraryA("opengl32.dll"); + ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n"); + + format = GetPixelFormat(hdc); + ok(format == 0, "new window has pixel format %d\n", format); + + ZeroMemory(&pfd, sizeof(pfd)); + pfd.nSize = sizeof(pfd); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; + format = ChoosePixelFormat(hdc, &pfd); + if (format <= 0) + { + skip("no pixel format available\n"); + goto cleanup; + } + + if (!SetPixelFormat(hdc, format, &pfd) || GetPixelFormat(hdc) != format) + { + skip("failed to set pixel format\n"); + goto cleanup; + } + + if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format) + { + skip("failed to set pixel format on second window\n"); + if (hdc2) + { + ReleaseDC(window2, hdc2); + hdc2 = NULL; + } + } + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + if (FAILED(hr)) + { + skip("Failed to set cooperative level, hr %#x.\n", hr); + goto cleanup; + } + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + hr = IDirectDraw4_CreateClipper(ddraw, 0, &clipper, NULL); + ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2); + ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &primary, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + if (clipper) + { + hr = IDirectDrawSurface4_SetClipper(primary, clipper); + ok(SUCCEEDED(hr), "Failed to set clipper, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&fx, 0, sizeof(fx)); + fx.dwSize = sizeof(fx); + hr = IDirectDrawSurface4_Blt(primary, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(SUCCEEDED(hr), "Failed to clear source surface, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + +cleanup: + if (primary) IDirectDrawSurface4_Release(primary); + if (clipper) IDirectDrawClipper_Release(clipper); + if (ddraw) IDirectDraw4_Release(ddraw); + if (gl) FreeLibrary(gl); + if (hdc) ReleaseDC(window, hdc); + if (hdc2) ReleaseDC(window2, hdc2); + if (window) DestroyWindow(window); + if (window2) DestroyWindow(window2); +} + +static void test_create_surface_pitch(void) +{ + IDirectDrawSurface4 *surface; + DDSURFACEDESC2 surface_desc; + IDirectDraw4 *ddraw; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; + void *mem; + + static const struct + { + DWORD placement; + DWORD flags_in; + DWORD pitch_in; + HRESULT hr; + DWORD flags_out; + DWORD pitch_out; + } + test_data[] = + { + {DDSCAPS_VIDEOMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x100, DDERR_INVALIDCAPS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE, 0, DDERR_INVALIDPARAMS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x104}, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x102, DDERR_INVALIDPARAMS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x0fc, DDERR_INVALIDPARAMS, + 0, 0 }, + }; + DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE; + + 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); + + mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((64 * 4) + 4) * 64); + + for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | test_data[i].flags_in; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | test_data[i].placement; + surface_desc.dwWidth = 64; + surface_desc.dwHeight = 64; + U1(surface_desc).lPitch = test_data[i].pitch_in; + surface_desc.lpSurface = mem; + U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat); + U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB; + U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32; + U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000; + U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00; + U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff; + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW), + "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr); + if (FAILED(hr)) + continue; + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface4_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out, + "Test %u: Got unexpected flags %#x, expected %#x.\n", + i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out); + ok(U1(surface_desc).lPitch == test_data[i].pitch_out, + "Test %u: Got unexpected pitch %u, expected %u.\n", + i, U1(surface_desc).lPitch, test_data[i].pitch_out); + + IDirectDrawSurface4_Release(surface); + } + + HeapFree(GetProcessHeap(), 0, mem); refcount = IDirectDraw4_Release(ddraw); ok(!refcount, "Got unexpected refcount %u.\n", refcount); DestroyWindow(window); @@ -6212,6 +6467,15 @@ START_TEST(ddraw4) { + IDirectDraw4 *ddraw; + + if (!(ddraw = create_ddraw())) + { + skip("Failed to create a ddraw object, skipping tests.\n"); + return; + } + IDirectDraw4_Release(ddraw); + test_process_vertices(); test_coop_level_create_device_window(); test_clipper_blt(); @@ -6255,4 +6519,6 @@ test_primary_palette(); test_surface_attachment(); test_private_data(); + test_pixel_format(); + test_create_surface_pitch(); } diff -Nru wine1.7-1.7.13/dlls/ddraw/tests/ddraw7.c wine1.7-1.7.16/dlls/ddraw/tests/ddraw7.c --- wine1.7-1.7.13/dlls/ddraw/tests/ddraw7.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/tests/ddraw7.c 2014-04-04 19:13:44.000000000 +0000 @@ -165,6 +165,13 @@ return ret; } +static HRESULT set_display_mode(IDirectDraw7 *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw7_SetDisplayMode(ddraw, width, height, 32, 0, 0))) + return DD_OK; + return IDirectDraw7_SetDisplayMode(ddraw, width, height, 24, 0, 0); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface7 *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -550,12 +557,8 @@ focus_window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(focus_window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); @@ -678,12 +681,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 10, 10, 640, 480, 0, 0, 0, 0); ShowWindow(window, SW_SHOW); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); ret = GetClientRect(window, &client_rect); ok(ret, "Failed to get client rect.\n"); @@ -915,13 +914,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - goto cleanup; - } - + 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); @@ -998,11 +992,8 @@ IDirectDraw7 *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); create_window_thread(&p); hr = IDirectDraw7_SetCooperativeLevel(ddraw, p.window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -1827,12 +1818,8 @@ return; } IDirect3DDevice_Release(device); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + 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); @@ -1939,11 +1926,8 @@ }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2056,12 +2040,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); @@ -2107,13 +2087,8 @@ window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window); - return; - } - + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2199,11 +2174,8 @@ 0, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2251,8 +2223,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2376,8 +2348,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2500,8 +2472,8 @@ screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2586,8 +2558,8 @@ /* Changing the coop level from EXCLUSIVE to NORMAL restores the screen resolution */ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2625,8 +2597,8 @@ /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2652,8 +2624,8 @@ /* If the window is changed at the same time, messages are sent to the new window. */ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2719,22 +2691,18 @@ HRESULT hr; ULONG ref; - if (!(ddraw1 = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); + ddraw1 = create_ddraw(); + ok(!!ddraw1, "Failed to create a ddraw object.\n"); orig_w = GetSystemMetrics(SM_CXSCREEN); orig_h = GetSystemMetrics(SM_CYSCREEN); /* With just a single ddraw object, the display mode is restored on * release. */ - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2750,16 +2718,16 @@ /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2781,16 +2749,16 @@ /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2813,8 +2781,8 @@ /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2837,16 +2805,16 @@ /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2871,8 +2839,8 @@ /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2882,7 +2850,7 @@ ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw7_Release(ddraw1); @@ -2907,11 +2875,8 @@ IDirectDraw7 *ddraw; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_Initialize(ddraw, NULL); ok(hr == DDERR_ALREADYINITIALIZED, "Initialize returned hr %#x.\n", hr); @@ -2935,11 +2900,8 @@ DDSURFACEDESC2 ddsd; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -3040,13 +3002,8 @@ 0, 0, 640, 480, 0, 0, 0, 0); window2 = CreateWindowA("static", "ddraw_test2", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - DestroyWindow(window2); - DestroyWindow(window1); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -3181,8 +3138,8 @@ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -3209,8 +3166,8 @@ window = CreateWindowA("static", "ddraw_test1", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - if (!(ddraw7 = create_ddraw())) - goto done; + ddraw7 = create_ddraw(); + ok(!!ddraw7, "Failed to create a ddraw object.\n"); /* Newly created ddraw objects restore the mode on ddraw2+::SetCooperativeLevel(NORMAL) */ restored = test_mode_restored(ddraw7, window); ok(restored, "Display mode not restored in new ddraw object\n"); @@ -3233,8 +3190,8 @@ IDirectDraw_Release(ddraw); IDirectDraw7_Release(ddraw7); - if (!(ddraw7 = create_ddraw())) - goto done; + ddraw7 = create_ddraw(); + ok(!!ddraw7, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_QueryInterface(ddraw7, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3247,8 +3204,8 @@ IDirectDraw7_Release(ddraw7); /* A failing call does not restore the ddraw2+ behavior */ - if (!(ddraw7 = create_ddraw())) - goto done; + ddraw7 = create_ddraw(); + ok(!!ddraw7, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_QueryInterface(ddraw7, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3263,8 +3220,8 @@ IDirectDraw7_Release(ddraw7); /* Neither does a sequence of successful calls with the new interface */ - if (!(ddraw7 = create_ddraw())) - goto done; + ddraw7 = create_ddraw(); + ok(!!ddraw7, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_QueryInterface(ddraw7, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3281,8 +3238,8 @@ IDirectDraw7_Release(ddraw7); /* ddraw1::CreateSurface does not triger the ddraw1 behavior */ - if (!(ddraw7 = create_ddraw())) - goto done; + ddraw7 = create_ddraw(); + ok(!!ddraw7, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_QueryInterface(ddraw7, &IID_IDirectDraw, (void **)&ddraw); ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); @@ -3302,8 +3259,6 @@ IDirectDraw_Release(ddraw); IDirectDraw7_Release(ddraw7); - -done: DestroyWindow(window); } @@ -3636,11 +3591,8 @@ DDSURFACEDESC2 ddsd; IDirectDrawSurface7 *surface; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = activateapp_test_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -3790,12 +3742,8 @@ DDSCAPS_SYSTEMMEMORY, 0}, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -3902,6 +3850,8 @@ DWORD supported_fmts = 0, supported_overlay_fmts = 0; DWORD num_fourcc_codes = 0, *fourcc_codes; DDSURFACEDESC2 ddsd; + DDCAPS hal_caps; + static const struct { DWORD fourcc; @@ -3991,12 +3941,19 @@ } HeapFree(GetProcessHeap(), 0, fourcc_codes); + memset(&hal_caps, 0, sizeof(hal_caps)); + hal_caps.dwSize = sizeof(hal_caps); + hr = IDirectDraw7_GetCaps(ddraw, &hal_caps, NULL); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + for (i = 0; i < sizeof(formats) / sizeof(*formats); i++) { for (j = 0; j < sizeof(types) / sizeof(*types); j++) { BOOL support; - if (formats[i].overlay != types[j].overlay) + + if (formats[i].overlay != types[j].overlay + || (types[j].overlay && !(hal_caps.dwCaps & DDCAPS_OVERLAY))) continue; if (formats[i].overlay) @@ -4381,14 +4338,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4634,14 +4587,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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"); for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) { @@ -4797,14 +4746,10 @@ }, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -4827,7 +4772,7 @@ goto done; } - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; ddsd.dwWidth = 64; @@ -4850,7 +4795,7 @@ if (!cubemap_supported && tests[i].caps2 & DDSCAPS2_CUBEMAP) continue; - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; if (!(tests[i].caps & DDSCAPS_PRIMARYSURFACE)) @@ -4870,7 +4815,7 @@ hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, type %s, hr %#x.\n", tests[i].name, hr); - memset(&ddsd, 0, sizeof(ddsd)), + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); hr = IDirectDrawSurface7_Lock(surface, NULL, &ddsd, DDLOCK_WAIT, NULL); ok(SUCCEEDED(hr), "Failed to lock surface, type %s, hr %#x.\n", tests[i].name, hr); @@ -5004,16 +4949,12 @@ DDBLTFX fx; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); @@ -5208,15 +5149,10 @@ {DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY, 0, FALSE, "systemmemory primary"}, }; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5230,7 +5166,7 @@ U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000; U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00; U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5272,7 +5208,8 @@ hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); + ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN), + "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0); /* Setting the caps is an error. This also means the original description cannot be reapplied. */ @@ -5288,7 +5225,7 @@ ddsd.lpSurface = data; hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0); ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr); - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0); ok(hr == DDERR_INVALIDCAPS, "Setting DDSD_CAPS returned %#x.\n", hr); ddsd.ddsCaps.dwCaps = 0; @@ -5298,7 +5235,8 @@ hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.ddsCaps.dwCaps == DDSCAPS_SYSTEMMEMORY, "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); + ok(ddsd.ddsCaps.dwCaps == (DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN), + "Got unexpected caps %#x.\n", ddsd.ddsCaps.dwCaps); ok(ddsd.ddsCaps.dwCaps2 == 0, "Got unexpected caps2 %#x.\n", 0); /* Setting the height is allowed, but it cannot be set to 0, and only if LPSURFACE is set too. */ @@ -5502,15 +5440,10 @@ HDC dc; unsigned int x, y; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5524,7 +5457,7 @@ U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000; U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00; U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff; - ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY; + ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OFFSCREENPLAIN; hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5597,15 +5530,10 @@ IDirectDrawSurface7 *surface; ULONG ref; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5641,14 +5569,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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_SetDisplayMode(ddraw, 640, 480, 8, 0, 0); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -5747,14 +5671,10 @@ HWND window; HRESULT hr; - if (!(ddraw = create_ddraw())) - { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } - 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); @@ -5982,22 +5902,35 @@ static void test_private_data(void) { IDirectDraw7 *ddraw; - IDirectDrawSurface7 *surface; + IDirectDrawSurface7 *surface, *surface2; DDSURFACEDESC2 surface_desc; ULONG refcount, refcount2, refcount3; IUnknown *ptr; DWORD size = sizeof(ptr); HRESULT hr; HWND window; - - if (!(ddraw = create_ddraw())) + DDSCAPS2 caps = {DDSCAPS_COMPLEX, 0, 0, 0}; + DWORD data[] = {1, 2, 3, 4}; + DDCAPS hal_caps; + static const GUID ddraw_private_data_test_guid = + { + 0xfdb37466, + 0x428f, + 0x4edf, + {0xa3,0x7f,0x9b,0x1d,0xf4,0x88,0xc5,0xfc} + }; + static const GUID ddraw_private_data_test_guid2 = { - skip("Failed to create a ddraw object, skipping test.\n"); - return; - } + 0x2e5afac2, + 0x87b5, + 0x4c10, + {0x9b,0x4b,0x89,0xd7,0xd1,0x12,0xe7,0x2b} + }; 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); @@ -6010,47 +5943,90 @@ ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); /* DDSPD_IUNKNOWNPOINTER needs sizeof(IUnknown *) bytes of data. */ - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, 0, DDSPD_IUNKNOWNPOINTER); ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, 5, DDSPD_IUNKNOWNPOINTER); ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw) * 2, DDSPD_IUNKNOWNPOINTER); ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + /* Note that with a size != 0 and size != sizeof(IUnknown *) and + * DDSPD_IUNKNOWNPOINTER set SetPrivateData in ddraw4 and ddraw7 + * erases the old content and returns an error. This behavior has + * been fixed in d3d8 and d3d9. Unless an application is found + * that depends on this we don't care about this behavior. */ + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, + sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); + ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, + 0, DDSPD_IUNKNOWNPOINTER); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + size = sizeof(ptr); + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid, &ptr, &size); + ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr); + hr = IDirectDrawSurface7_FreePrivateData(surface, &ddraw_private_data_test_guid); + ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); + refcount = get_refcount((IUnknown *)ddraw); - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount + 1, "Got unexpected refcount %u.\n", refcount2); - hr = IDirectDrawSurface7_FreePrivateData(surface, &IID_IDirect3D); + hr = IDirectDrawSurface7_FreePrivateData(surface, &ddraw_private_data_test_guid); ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr); refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount, "Got unexpected refcount %u.\n", refcount2); - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, surface, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, surface, sizeof(surface), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount, "Got unexpected refcount %u.\n", refcount2); - hr = IDirectDrawSurface7_SetPrivateData(surface, &IID_IDirect3D, ddraw, + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw, sizeof(ddraw), DDSPD_IUNKNOWNPOINTER); ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); - hr = IDirectDrawSurface7_GetPrivateData(surface, &IID_IDirect3D, &ptr, &size); + size = 2 * sizeof(ptr); + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid, &ptr, &size); ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr); + ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size); refcount2 = get_refcount(ptr); /* Object is NOT addref'ed by the getter. */ ok(ptr == (IUnknown *)ddraw, "Returned interface pointer is %p, expected %p.\n", ptr, ddraw); ok(refcount2 == refcount + 1, "Got unexpected refcount %u.\n", refcount2); + ptr = (IUnknown *)0xdeadbeef; + size = 1; + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid, NULL, &size); + ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size); + size = 2 * sizeof(ptr); + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid, NULL, &size); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + ok(size == 2 * sizeof(ptr), "Got unexpected size %u.\n", size); + size = 1; + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid, &ptr, &size); + ok(hr == DDERR_MOREDATA, "Got unexpected hr %#x.\n", hr); + ok(size == sizeof(ddraw), "Got unexpected size %u.\n", size); + ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid2, NULL, NULL); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + size = 0xdeadbabe; + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid2, &ptr, &size); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + ok(ptr == (IUnknown *)0xdeadbeef, "Got unexpected pointer %p.\n", ptr); + ok(size == 0xdeadbabe, "Got unexpected size %u.\n", size); + hr = IDirectDrawSurface7_GetPrivateData(surface, &ddraw_private_data_test_guid, NULL, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr); + refcount3 = IDirectDrawSurface7_Release(surface); ok(!refcount3, "Got unexpected refcount %u.\n", refcount3); @@ -6059,6 +6035,286 @@ refcount2 = get_refcount((IUnknown *)ddraw); ok(refcount2 == refcount - 1, "Got unexpected refcount %u.\n", refcount2); + memset(&hal_caps, 0, sizeof(hal_caps)); + hal_caps.dwSize = sizeof(hal_caps); + hr = IDirectDraw7_GetCaps(ddraw, &hal_caps, NULL); + ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr); + if ((hal_caps.ddsCaps.dwCaps & (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) == (DDSCAPS_TEXTURE | DDSCAPS_MIPMAP)) + { + reset_ddsd(&surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_MIPMAPCOUNT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY | DDSCAPS_COMPLEX | DDSCAPS_MIPMAP; + surface_desc.dwHeight = 4; + surface_desc.dwWidth = 4; + U2(surface_desc).dwMipMapCount = 2; + hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + hr = IDirectDrawSurface7_GetAttachedSurface(surface, &caps, &surface2); + ok(SUCCEEDED(hr), "Failed to get attached surface, hr %#x.\n", hr); + + hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, data, sizeof(data), 0); + ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr); + hr = IDirectDrawSurface7_GetPrivateData(surface2, &ddraw_private_data_test_guid, NULL, NULL); + ok(hr == DDERR_NOTFOUND, "Got unexpected hr %#x.\n", hr); + + IDirectDrawSurface7_Release(surface2); + IDirectDrawSurface7_Release(surface); + } + else + skip("Mipmapped textures not supported, skipping mipmap private data test.\n"); + + refcount = IDirectDraw7_Release(ddraw); + ok(!refcount, "Got unexpected refcount %u.\n", refcount); + DestroyWindow(window); +} + +static void test_pixel_format(void) +{ + HWND window, window2 = NULL; + HDC hdc, hdc2 = NULL; + HMODULE gl = NULL; + int format, test_format; + PIXELFORMATDESCRIPTOR pfd; + IDirectDraw7 *ddraw = NULL; + IDirectDrawClipper *clipper = NULL; + DDSURFACEDESC2 ddsd; + IDirectDrawSurface7 *primary = NULL; + DDBLTFX fx; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + if (!window) + { + skip("Failed to create window\n"); + return; + } + + window2 = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 100, 100, 160, 160, NULL, NULL, NULL, NULL); + + hdc = GetDC(window); + if (!hdc) + { + skip("Failed to get DC\n"); + goto cleanup; + } + + if (window2) + hdc2 = GetDC(window2); + + gl = LoadLibraryA("opengl32.dll"); + ok(!!gl, "failed to load opengl32.dll; SetPixelFormat()/GetPixelFormat() may not work right\n"); + + format = GetPixelFormat(hdc); + ok(format == 0, "new window has pixel format %d\n", format); + + ZeroMemory(&pfd, sizeof(pfd)); + pfd.nSize = sizeof(pfd); + pfd.nVersion = 1; + pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL; + pfd.iPixelType = PFD_TYPE_RGBA; + pfd.iLayerType = PFD_MAIN_PLANE; + format = ChoosePixelFormat(hdc, &pfd); + if (format <= 0) + { + skip("no pixel format available\n"); + goto cleanup; + } + + if (!SetPixelFormat(hdc, format, &pfd) || GetPixelFormat(hdc) != format) + { + skip("failed to set pixel format\n"); + goto cleanup; + } + + if (!hdc2 || !SetPixelFormat(hdc2, format, &pfd) || GetPixelFormat(hdc2) != format) + { + skip("failed to set pixel format on second window\n"); + if (hdc2) + { + ReleaseDC(window2, hdc2); + hdc2 = NULL; + } + } + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + if (FAILED(hr)) + { + skip("Failed to set cooperative level, hr %#x.\n", hr); + goto cleanup; + } + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + hr = IDirectDraw7_CreateClipper(ddraw, 0, &clipper, NULL); + ok(SUCCEEDED(hr), "Failed to create clipper, hr %#x.\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window2); + ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &primary, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + if (clipper) + { + hr = IDirectDrawSurface7_SetClipper(primary, clipper); + ok(SUCCEEDED(hr), "Failed to set clipper, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + + memset(&fx, 0, sizeof(fx)); + fx.dwSize = sizeof(fx); + hr = IDirectDrawSurface7_Blt(primary, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); + ok(SUCCEEDED(hr), "Failed to clear source surface, hr %#x.\n", hr); + + test_format = GetPixelFormat(hdc); + ok(test_format == format, "window has pixel format %d, expected %d\n", test_format, format); + + if (hdc2) + { + test_format = GetPixelFormat(hdc2); + ok(test_format == format, "second window has pixel format %d, expected %d\n", test_format, format); + } + +cleanup: + if (primary) IDirectDrawSurface7_Release(primary); + if (clipper) IDirectDrawClipper_Release(clipper); + if (ddraw) IDirectDraw7_Release(ddraw); + if (gl) FreeLibrary(gl); + if (hdc) ReleaseDC(window, hdc); + if (hdc2) ReleaseDC(window2, hdc2); + if (window) DestroyWindow(window); + if (window2) DestroyWindow(window2); +} + +static void test_create_surface_pitch(void) +{ + IDirectDrawSurface7 *surface; + DDSURFACEDESC2 surface_desc; + IDirectDraw7 *ddraw; + unsigned int i; + ULONG refcount; + HWND window; + HRESULT hr; + void *mem; + + static const struct + { + DWORD placement; + DWORD flags_in; + DWORD pitch_in; + HRESULT hr; + DWORD flags_out; + DWORD pitch_out; + } + test_data[] = + { + {DDSCAPS_VIDEOMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_VIDEOMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x100, DDERR_INVALIDCAPS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, 0, 0, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_PITCH, 0x0fc, DD_OK, + DDSD_PITCH, 0x100}, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE, 0, DDERR_INVALIDPARAMS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x104, DD_OK, + DDSD_PITCH, 0x104}, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x102, DDERR_INVALIDPARAMS, + 0, 0 }, + {DDSCAPS_SYSTEMMEMORY, DDSD_LPSURFACE | DDSD_PITCH, 0x0fc, DDERR_INVALIDPARAMS, + 0, 0 }, + }; + DWORD flags_mask = DDSD_PITCH | DDSD_LPSURFACE; + + 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); + + mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((64 * 4) + 4) * 64); + + for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | test_data[i].flags_in; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | test_data[i].placement; + surface_desc.dwWidth = 64; + surface_desc.dwHeight = 64; + U1(surface_desc).lPitch = test_data[i].pitch_in; + surface_desc.lpSurface = mem; + U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat); + U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB; + U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32; + U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000; + U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00; + U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff; + hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(hr == test_data[i].hr || (test_data[i].placement == DDSCAPS_VIDEOMEMORY && hr == DDERR_NODIRECTDRAWHW), + "Test %u: Got unexpected hr %#x, expected %#x.\n", i, hr, test_data[i].hr); + if (FAILED(hr)) + continue; + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface7_GetSurfaceDesc(surface, &surface_desc); + ok(SUCCEEDED(hr), "Test %u: Failed to get surface desc, hr %#x.\n", i, hr); + ok((surface_desc.dwFlags & flags_mask) == test_data[i].flags_out, + "Test %u: Got unexpected flags %#x, expected %#x.\n", + i, surface_desc.dwFlags & flags_mask, test_data[i].flags_out); + ok(U1(surface_desc).lPitch == test_data[i].pitch_out, + "Test %u: Got unexpected pitch %u, expected %u.\n", + i, U1(surface_desc).lPitch, test_data[i].pitch_out); + + IDirectDrawSurface7_Release(surface); + } + + HeapFree(GetProcessHeap(), 0, mem); refcount = IDirectDraw7_Release(ddraw); ok(!refcount, "Got unexpected refcount %u.\n", refcount); DestroyWindow(window); @@ -6067,6 +6323,7 @@ START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); + IDirectDraw7 *ddraw; if (!(pDirectDrawCreateEx = (void *)GetProcAddress(module, "DirectDrawCreateEx"))) { @@ -6074,6 +6331,13 @@ return; } + if (!(ddraw = create_ddraw())) + { + skip("Failed to create a ddraw object, skipping tests.\n"); + return; + } + IDirectDraw7_Release(ddraw); + test_process_vertices(); test_coop_level_create_device_window(); test_clipper_blt(); @@ -6117,4 +6381,6 @@ test_primary_palette(); test_surface_attachment(); test_private_data(); + test_pixel_format(); + test_create_surface_pitch(); } diff -Nru wine1.7-1.7.13/dlls/ddraw/vertexbuffer.c wine1.7-1.7.16/dlls/ddraw/vertexbuffer.c --- wine1.7-1.7.13/dlls/ddraw/vertexbuffer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ddraw/vertexbuffer.c 2014-04-04 19:13:44.000000000 +0000 @@ -245,7 +245,7 @@ wined3d_flags |= WINED3D_MAP_READONLY; if (flags & DDLOCK_NOOVERWRITE) wined3d_flags |= WINED3D_MAP_NOOVERWRITE; - if (flags & DDLOCK_DISCARDCONTENTS && buffer->read_since_last_map) + if (flags & DDLOCK_DISCARDCONTENTS) { wined3d_flags |= WINED3D_MAP_DISCARD; @@ -279,9 +279,6 @@ hr = wined3d_buffer_map(buffer->wineD3DVertexBuffer, 0, 0, (BYTE **)data, wined3d_flags); - if (SUCCEEDED(hr)) - buffer->read_since_last_map = FALSE; - wined3d_mutex_unlock(); return hr; diff -Nru wine1.7-1.7.13/dlls/dinput8/tests/device.c wine1.7-1.7.16/dlls/dinput8/tests/device.c --- wine1.7-1.7.13/dlls/dinput8/tests/device.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dinput8/tests/device.c 2014-04-04 19:13:44.000000000 +0000 @@ -60,6 +60,21 @@ { 4, DIMOUSE_YAXIS, 0, { "Y Axis" } } }; +static void flush_events(void) +{ + int diff = 200; + int min_timeout = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects(0, NULL, FALSE, min_timeout, QS_ALLINPUT) == WAIT_TIMEOUT) + break; + diff = time - GetTickCount(); + min_timeout = 50; + } +} + static void test_device_input(IDirectInputDevice8A *lpdid, DWORD event_type, DWORD event, DWORD expected) { HRESULT hr; @@ -76,12 +91,14 @@ if (event_type == INPUT_MOUSE) mouse_event( event, 0, 0, 0, 0); + flush_events(); IDirectInputDevice8_Poll(lpdid); hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0); if (data_size != 1) { win_skip("We're not able to inject input into Windows dinput8 with events\n"); + IDirectInputDevice_Unacquire(lpdid); return; } @@ -100,6 +117,7 @@ mouse_event(MOUSEEVENTF_LEFTUP, 1, 1, 0, 0); } + flush_events(); IDirectInputDevice8_Poll(lpdid); data_size = 1; @@ -108,6 +126,8 @@ data_size = 1; hr = IDirectInputDevice8_GetDeviceData(lpdid, sizeof(obj_data), &obj_data, &data_size, 0); ok(hr == DI_OK && data_size == 1, "GetDeviceData() failed: %08x cnt:%d\n", hr, data_size); + + IDirectInputDevice_Unacquire(lpdid); } static void test_build_action_map(IDirectInputDevice8A *lpdid, DIACTIONFORMATA *lpdiaf, @@ -256,6 +276,7 @@ IDirectInput8A *pDI = NULL; DIACTIONFORMATA af; struct enum_data data = {pDI, &af, NULL, NULL, NULL, 0}; + HWND hwnd; hr = CoCreateInstance(&CLSID_DirectInput8, 0, CLSCTX_INPROC_SERVER, &IID_IDirectInput8A, (LPVOID*)&pDI); if (hr == DIERR_OLDDIRECTINPUTVERSION || @@ -296,6 +317,11 @@ hr = IDirectInput8_EnumDevicesBySemantics(pDI, NULL, &af, enumeration_callback, &data, DIEDBSFL_ATTACHEDONLY); ok (SUCCEEDED(hr), "EnumDevicesBySemantics failed: hr=%08x\n", hr); + hwnd = CreateWindowExA(WS_EX_TOPMOST, "static", "dinput", + WS_POPUP | WS_VISIBLE, 0, 0, 100, 100, NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "failed to create window\n"); + SetCursorPos(50, 50); + if (data.keyboard != NULL) { /* Test keyboard BuildActionMap */ @@ -326,6 +352,8 @@ test_device_input(data.mouse, INPUT_MOUSE, MOUSEEVENTF_LEFTDOWN, 3); } + + DestroyWindow(hwnd); } static void test_save_settings(void) diff -Nru wine1.7-1.7.13/dlls/dmcompos/chordmap.c wine1.7-1.7.16/dlls/dmcompos/chordmap.c --- wine1.7-1.7.13/dlls/dmcompos/chordmap.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmcompos/chordmap.c 2014-04-04 19:13:44.000000000 +0000 @@ -22,116 +22,95 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); WINE_DECLARE_DEBUG_CHANNEL(dmfile); -static ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_AddRef (LPUNKNOWN iface); -static ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef (LPDIRECTMUSICCHORDMAP iface); -static ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface); -static ULONG WINAPI IDirectMusicChordMapImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface); - /***************************************************************************** * IDirectMusicChordMapImpl implementation */ -/* IDirectMusicChordMapImpl IUnknown part: */ -static HRESULT WINAPI IDirectMusicChordMapImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface); - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown)) { - *ppobj = &This->UnknownVtbl; - IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicChordMap)) { - *ppobj = &This->ChordMapVtbl; - IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef ((LPDIRECTMUSICCHORDMAP)&This->ChordMapVtbl); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { - *ppobj = &This->ObjectVtbl; - IDirectMusicChordMapImpl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT)&This->ObjectVtbl); - return S_OK; - } else if (IsEqualIID (riid, &IID_IPersistStream)) { - *ppobj = &This->PersistStreamVtbl; - IDirectMusicChordMapImpl_IPersistStream_AddRef ((LPPERSISTSTREAM)&This->PersistStreamVtbl); - return S_OK; - } - - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; + +/* IDirectMusicChordMapImpl IDirectMusicChordMap part: */ +static inline IDirectMusicChordMapImpl *impl_from_IDirectMusicChordMap(IDirectMusicChordMap *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicChordMapImpl, IDirectMusicChordMap_iface); } -static ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_AddRef (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface); - ULONG ref = InterlockedIncrement(&This->ref); +static HRESULT WINAPI IDirectMusicChordMapImpl_QueryInterface(IDirectMusicChordMap *iface, + REFIID riid, void **ret_iface) +{ + IDirectMusicChordMapImpl *This = impl_from_IDirectMusicChordMap(iface); - TRACE("(%p): AddRef from %d\n", This, ref - 1); - - DMCOMPOS_LockModule(); - - return ref; -} + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ret_iface); -static ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_Release (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface); - ULONG ref = InterlockedDecrement(&This->ref); + *ret_iface = NULL; - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } - - DMCOMPOS_UnlockModule(); - - return ref; + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicChordMap)) + *ret_iface = iface; + else if (IsEqualIID(riid, &IID_IDirectMusicObject)) + *ret_iface = &This->ObjectVtbl; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->PersistStreamVtbl; + else { + WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ret_iface); + return S_OK; } -static const IUnknownVtbl DirectMusicChordMap_Unknown_Vtbl = { - IDirectMusicChordMapImpl_IUnknown_QueryInterface, - IDirectMusicChordMapImpl_IUnknown_AddRef, - IDirectMusicChordMapImpl_IUnknown_Release -}; +static ULONG WINAPI IDirectMusicChordMapImpl_AddRef(IDirectMusicChordMap *iface) +{ + IDirectMusicChordMapImpl *This = impl_from_IDirectMusicChordMap(iface); + LONG ref = InterlockedIncrement(&This->ref); -/* IDirectMusicChordMapImpl IDirectMusicChordMap part: */ -static HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_QueryInterface (LPDIRECTMUSICCHORDMAP iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); -} + TRACE("(%p) ref=%d\n", This, ref); -static ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef (LPDIRECTMUSICCHORDMAP iface) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return ref; } -static ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_Release (LPDIRECTMUSICCHORDMAP iface) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); +static ULONG WINAPI IDirectMusicChordMapImpl_Release(IDirectMusicChordMap *iface) +{ + IDirectMusicChordMapImpl *This = impl_from_IDirectMusicChordMap(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) { + HeapFree(GetProcessHeap(), 0, This->pDesc); + HeapFree(GetProcessHeap(), 0, This); + DMCOMPOS_UnlockModule(); + } + + return ref; } -static HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicChordMap_GetScale (LPDIRECTMUSICCHORDMAP iface, DWORD* pdwScale) { - ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ChordMapVtbl, iface); - FIXME("(%p, %p): stub\n", This, pdwScale); - return S_OK; +static HRESULT WINAPI IDirectMusicChordMapImpl_GetScale(IDirectMusicChordMap *iface, + DWORD *pdwScale) +{ + IDirectMusicChordMapImpl *This = impl_from_IDirectMusicChordMap(iface); + FIXME("(%p, %p): stub\n", This, pdwScale); + return S_OK; } -static const IDirectMusicChordMapVtbl DirectMusicChordMap_ChordMap_Vtbl = { - IDirectMusicChordMapImpl_IDirectMusicChordMap_QueryInterface, - IDirectMusicChordMapImpl_IDirectMusicChordMap_AddRef, - IDirectMusicChordMapImpl_IDirectMusicChordMap_Release, - IDirectMusicChordMapImpl_IDirectMusicChordMap_GetScale +static const IDirectMusicChordMapVtbl dmchordmap_vtbl = { + IDirectMusicChordMapImpl_QueryInterface, + IDirectMusicChordMapImpl_AddRef, + IDirectMusicChordMapImpl_Release, + IDirectMusicChordMapImpl_GetScale }; /* IDirectMusicChordMapImpl IDirectMusicObject part: */ static HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + return IDirectMusicChordMap_QueryInterface(&This->IDirectMusicChordMap_iface, riid, ppobj); } static ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicChordMap_AddRef(&This->IDirectMusicChordMap_iface); } static ULONG WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, ObjectVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicChordMap_Release(&This->IDirectMusicChordMap_iface); } static HRESULT WINAPI IDirectMusicChordMapImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) { @@ -336,17 +315,17 @@ /* IDirectMusicChordMapImpl IPersistStream part: */ static HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); + return IDirectMusicChordMap_QueryInterface(&This->IDirectMusicChordMap_iface, riid, ppobj); } static ULONG WINAPI IDirectMusicChordMapImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicChordMap_AddRef(&This->IDirectMusicChordMap_iface); } static ULONG WINAPI IDirectMusicChordMapImpl_IPersistStream_Release (LPPERSISTSTREAM iface) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, PersistStreamVtbl, iface); - return IDirectMusicChordMapImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); + return IDirectMusicChordMap_Release(&This->IDirectMusicChordMap_iface); } static HRESULT WINAPI IDirectMusicChordMapImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { @@ -527,21 +506,25 @@ HRESULT WINAPI create_dmchordmap(REFIID lpcGUID, void **ppobj) { IDirectMusicChordMapImpl* obj; - + HRESULT hr; + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapImpl)); if (NULL == obj) { *ppobj = NULL; return E_OUTOFMEMORY; } - obj->UnknownVtbl = &DirectMusicChordMap_Unknown_Vtbl; - obj->ChordMapVtbl = &DirectMusicChordMap_ChordMap_Vtbl; + obj->IDirectMusicChordMap_iface.lpVtbl = &dmchordmap_vtbl; obj->ObjectVtbl = &DirectMusicChordMap_Object_Vtbl; obj->PersistStreamVtbl = &DirectMusicChordMap_PersistStream_Vtbl; obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); DM_STRUCT_INIT(obj->pDesc); obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; obj->pDesc->guidClass = CLSID_DirectMusicChordMap; - obj->ref = 0; /* will be inited by QueryInterface */ + obj->ref = 1; + + DMCOMPOS_LockModule(); + hr = IDirectMusicChordMap_QueryInterface(&obj->IDirectMusicChordMap_iface, lpcGUID, ppobj); + IDirectMusicChordMap_Release(&obj->IDirectMusicChordMap_iface); - return IDirectMusicChordMapImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj); + return hr; } diff -Nru wine1.7-1.7.13/dlls/dmcompos/dmcompos_private.h wine1.7-1.7.16/dlls/dmcompos/dmcompos_private.h --- wine1.7-1.7.13/dlls/dmcompos/dmcompos_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmcompos/dmcompos_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -61,9 +61,7 @@ * IDirectMusicChordMapImpl implementation structure */ struct IDirectMusicChordMapImpl { - /* IUnknown fields */ - const IUnknownVtbl *UnknownVtbl; - const IDirectMusicChordMapVtbl *ChordMapVtbl; + IDirectMusicChordMap IDirectMusicChordMap_iface; const IDirectMusicObjectVtbl *ObjectVtbl; const IPersistStreamVtbl *PersistStreamVtbl; LONG ref; diff -Nru wine1.7-1.7.13/dlls/dmime/audiopath.c wine1.7-1.7.16/dlls/dmime/audiopath.c --- wine1.7-1.7.13/dlls/dmime/audiopath.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmime/audiopath.c 2014-04-04 19:13:44.000000000 +0000 @@ -108,21 +108,22 @@ FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), dwIndex, debugstr_dmguid(iidInterface), ppObject); switch (dwStage) { - case DMUS_PATH_BUFFER: - { - if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) { - IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject); - TRACE("returning %p\n",*ppObject); - return S_OK; - } else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) { - IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject); - TRACE("returning %p\n",*ppObject); - return S_OK; - } else { - FIXME("Bad iid\n"); - } - } - break; + case DMUS_PATH_BUFFER: + if (This->pDSBuffer) + { + if (IsEqualIID (iidInterface, &IID_IDirectSoundBuffer8)) { + IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSoundBuffer8, ppObject); + TRACE("returning %p\n",*ppObject); + return S_OK; + } else if (IsEqualIID (iidInterface, &IID_IDirectSound3DBuffer)) { + IDirectSoundBuffer8_QueryInterface (This->pDSBuffer, &IID_IDirectSound3DBuffer, ppObject); + TRACE("returning %p\n",*ppObject); + return S_OK; + } else { + FIXME("Bad iid\n"); + } + } + break; case DMUS_PATH_PRIMARY_BUFFER: { if (IsEqualIID (iidInterface, &IID_IDirectSound3DListener)) { diff -Nru wine1.7-1.7.13/dlls/dmime/dmime_private.h wine1.7-1.7.16/dlls/dmime/dmime_private.h --- wine1.7-1.7.13/dlls/dmime/dmime_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmime/dmime_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -47,7 +47,6 @@ * Interfaces */ typedef struct IDirectMusicSegment8Impl IDirectMusicSegment8Impl; -typedef struct IDirectMusicSegmentState8Impl IDirectMusicSegmentState8Impl; typedef struct IDirectMusicGraphImpl IDirectMusicGraphImpl; typedef struct IDirectMusicAudioPathImpl IDirectMusicAudioPathImpl; @@ -139,34 +138,6 @@ }; /***************************************************************************** - * IDirectMusicSegmentState8Impl implementation structure - */ -struct IDirectMusicSegmentState8Impl { - /* IUnknown fields */ - const IDirectMusicSegmentState8Vtbl *lpVtbl; - LONG ref; - - /* IDirectMusicSegmentState8Impl fields */ -}; - -/***************************************************************************** - * IDirectMusicGraphImpl implementation structure - */ -struct IDirectMusicGraphImpl { - /* IUnknown fields */ - const IUnknownVtbl *UnknownVtbl; - const IDirectMusicGraphVtbl *GraphVtbl; - const IDirectMusicObjectVtbl *ObjectVtbl; - const IPersistStreamVtbl *PersistStreamVtbl; - LONG ref; - - /* IDirectMusicGraphImpl fields */ - LPDMUS_OBJECTDESC pDesc; - WORD num_tools; - struct list Tools; -}; - -/***************************************************************************** * IDirectMusicAudioPathImpl implementation structure */ struct IDirectMusicAudioPathImpl { diff -Nru wine1.7-1.7.13/dlls/dmime/graph.c wine1.7-1.7.16/dlls/dmime/graph.c --- wine1.7-1.7.13/dlls/dmime/graph.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmime/graph.c 2014-04-04 19:13:44.000000000 +0000 @@ -22,242 +22,251 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime); WINE_DECLARE_DEBUG_CHANNEL(dmfile); -/***************************************************************************** - * IDirectMusicGraphImpl implementation - */ -/* IDirectMusicGraphImpl IUnknown part: */ -static HRESULT WINAPI IDirectMusicGraphImpl_IUnknown_QueryInterface (LPUNKNOWN iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ppobj); - - if (IsEqualIID (riid, &IID_IUnknown)) { - *ppobj = &This->UnknownVtbl; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicGraph)) { - *ppobj = &This->GraphVtbl; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { - *ppobj = &This->ObjectVtbl; - IUnknown_AddRef (iface); - return S_OK; - } else if (IsEqualIID (riid, &IID_IPersistStream)) { - *ppobj = &This->PersistStreamVtbl; - IUnknown_AddRef (iface); - return S_OK; - } - - WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ppobj); - return E_NOINTERFACE; +struct IDirectMusicGraphImpl { + IDirectMusicGraph IDirectMusicGraph_iface; + IDirectMusicObject IDirectMusicObject_iface; + IPersistStream IPersistStream_iface; + LONG ref; + + /* IDirectMusicGraphImpl fields */ + LPDMUS_OBJECTDESC pDesc; + WORD num_tools; + struct list Tools; +}; + +static inline IDirectMusicGraphImpl *impl_from_IDirectMusicGraph(IDirectMusicGraph *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicGraphImpl, IDirectMusicGraph_iface); } -static ULONG WINAPI IDirectMusicGraphImpl_IUnknown_AddRef (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - ULONG ref = InterlockedIncrement(&This->ref); +static inline IDirectMusicGraphImpl *impl_from_IDirectMusicObject(IDirectMusicObject *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicGraphImpl, IDirectMusicObject_iface); +} - TRACE("(%p): AddRef from %d\n", This, ref - 1); +static inline IDirectMusicGraphImpl *impl_from_IPersistStream(IPersistStream *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicGraphImpl, IPersistStream_iface); +} - DMIME_LockModule(); +static HRESULT WINAPI DirectMusicGraph_QueryInterface(IDirectMusicGraph *iface, REFIID riid, void **ret_iface) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); - return ref; -} + TRACE("(%p, %s, %p)\n", This, debugstr_guid(riid), ret_iface); -static ULONG WINAPI IDirectMusicGraphImpl_IUnknown_Release (LPUNKNOWN iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } + *ret_iface = NULL; - DMIME_UnlockModule(); - - return ref; + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IDirectMusicGraph)) + { + *ret_iface = &This->IDirectMusicGraph_iface; + } + else if (IsEqualIID(riid, &IID_IDirectMusicObject)) + *ret_iface = &This->IDirectMusicObject_iface; + else if (IsEqualIID(riid, &IID_IPersistStream)) + *ret_iface = &This->IPersistStream_iface; + + if (*ret_iface) + { + IDirectMusicGraph_AddRef(iface); + return S_OK; + } + + WARN("(%p, %s, %p): not found\n", This, debugstr_guid(riid), ret_iface); + return E_NOINTERFACE; } -static const IUnknownVtbl DirectMusicGraph_Unknown_Vtbl = { - IDirectMusicGraphImpl_IUnknown_QueryInterface, - IDirectMusicGraphImpl_IUnknown_AddRef, - IDirectMusicGraphImpl_IUnknown_Release -}; +static ULONG WINAPI DirectMusicGraph_AddRef(IDirectMusicGraph *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); + ULONG ref = InterlockedIncrement(&This->ref); -/* IDirectMusicGraphImpl IDirectMusicGraph part: */ -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_QueryInterface (LPDIRECTMUSICGRAPH iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); - return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); -} + TRACE("(%p): %d\n", This, ref); -static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_AddRef (LPDIRECTMUSICGRAPH iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); - return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); + DMIME_LockModule(); + return ref; } -static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_Release (LPDIRECTMUSICGRAPH iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); - return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); -} +static ULONG WINAPI DirectMusicGraph_Release(IDirectMusicGraph *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); + ULONG ref = InterlockedDecrement(&This->ref); -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_StampPMsg (LPDIRECTMUSICGRAPH iface, DMUS_PMSG* pPMSG) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); - FIXME("(%p, %p): stub\n", This, pPMSG); - return S_OK; + TRACE("(%p): %d\n", This, ref); + + if (ref == 0) + HeapFree(GetProcessHeap(), 0, This); + + DMIME_UnlockModule(); + return ref; } -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_InsertTool (LPDIRECTMUSICGRAPH iface, IDirectMusicTool* pTool, DWORD* pdwPChannels, DWORD cPChannels, LONG lIndex) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); +static HRESULT WINAPI DirectMusicGraph_StampPMsg(IDirectMusicGraph *iface, DMUS_PMSG *msg) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); + FIXME("(%p, %p): stub\n", This, msg); + return S_OK; +} - struct list* pEntry = NULL; - struct list* pPrevEntry = NULL; - LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL; - LPDMUS_PRIVATE_GRAPH_TOOL pNewTool = NULL; +static HRESULT WINAPI DirectMusicGraph_InsertTool(IDirectMusicGraph *iface, IDirectMusicTool* pTool, DWORD* pdwPChannels, DWORD cPChannels, LONG lIndex) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); + struct list* pEntry = NULL; + struct list* pPrevEntry = NULL; + LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL; + LPDMUS_PRIVATE_GRAPH_TOOL pNewTool = NULL; + FIXME("(%p, %p, %p, %d, %i): use of pdwPChannels\n", This, pTool, pdwPChannels, cPChannels, lIndex); - FIXME("(%p, %p, %p, %d, %i): use of pdwPChannels\n", This, pTool, pdwPChannels, cPChannels, lIndex); - - if (NULL == pTool) { - return E_POINTER; - } - - if (0 > lIndex) { - lIndex = This->num_tools + lIndex; - } - - pPrevEntry = &This->Tools; - LIST_FOR_EACH (pEntry, &This->Tools) { - pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry); - if (pIt->dwIndex == lIndex) { - return DMUS_E_ALREADY_EXISTS; - } - if (pIt->dwIndex > lIndex) { - break ; + if (!pTool) + return E_POINTER; + + if (lIndex < 0) + lIndex = This->num_tools + lIndex; + + pPrevEntry = &This->Tools; + LIST_FOR_EACH(pEntry, &This->Tools) + { + pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry); + if (pIt->dwIndex == lIndex) + return DMUS_E_ALREADY_EXISTS; + + if (pIt->dwIndex > lIndex) + break ; + pPrevEntry = pEntry; } - pPrevEntry = pEntry; - } - ++This->num_tools; - pNewTool = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_GRAPH_TOOL)); - pNewTool->pTool = pTool; - pNewTool->dwIndex = lIndex; - IDirectMusicTool8_AddRef(pTool); - IDirectMusicTool8_Init(pTool, iface); - list_add_tail (pPrevEntry->next, &pNewTool->entry); + ++This->num_tools; + pNewTool = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_GRAPH_TOOL)); + pNewTool->pTool = pTool; + pNewTool->dwIndex = lIndex; + IDirectMusicTool8_AddRef(pTool); + IDirectMusicTool8_Init(pTool, iface); + list_add_tail (pPrevEntry->next, &pNewTool->entry); #if 0 DWORD dwNum = 0; IDirectMusicTool8_GetMediaTypes(pTool, &dwNum); #endif - return DS_OK; + return DS_OK; } -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_GetTool (LPDIRECTMUSICGRAPH iface, DWORD dwIndex, IDirectMusicTool** ppTool) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); - struct list* pEntry = NULL; - LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL; +static HRESULT WINAPI DirectMusicGraph_GetTool(IDirectMusicGraph *iface, DWORD dwIndex, IDirectMusicTool** ppTool) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); + struct list* pEntry = NULL; + LPDMUS_PRIVATE_GRAPH_TOOL pIt = NULL; - FIXME("(%p, %d, %p): stub\n", This, dwIndex, ppTool); + FIXME("(%p, %d, %p): stub\n", This, dwIndex, ppTool); - LIST_FOR_EACH (pEntry, &This->Tools) { - pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry); - if (pIt->dwIndex == dwIndex) { - *ppTool = pIt->pTool; - if (NULL != *ppTool) { - IDirectMusicTool8_AddRef((LPDIRECTMUSICTOOL8) *ppTool); - } - return S_OK; - } - if (pIt->dwIndex > dwIndex) { - break ; + LIST_FOR_EACH (pEntry, &This->Tools) + { + pIt = LIST_ENTRY(pEntry, DMUS_PRIVATE_GRAPH_TOOL, entry); + if (pIt->dwIndex == dwIndex) + { + *ppTool = pIt->pTool; + if (*ppTool) + IDirectMusicTool_AddRef(*ppTool); + return S_OK; + } + if (pIt->dwIndex > dwIndex) + break ; } - } - return DMUS_E_NOT_FOUND; + return DMUS_E_NOT_FOUND; } -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicGraph_RemoveTool (LPDIRECTMUSICGRAPH iface, IDirectMusicTool* pTool) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, GraphVtbl, iface); - FIXME("(%p, %p): stub\n", This, pTool); - return S_OK; +static HRESULT WINAPI DirectMusicGraph_RemoveTool(IDirectMusicGraph *iface, IDirectMusicTool* pTool) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicGraph(iface); + FIXME("(%p, %p): stub\n", This, pTool); + return S_OK; } -static const IDirectMusicGraphVtbl DirectMusicGraph_Graph_Vtbl = { - IDirectMusicGraphImpl_IDirectMusicGraph_QueryInterface, - IDirectMusicGraphImpl_IDirectMusicGraph_AddRef, - IDirectMusicGraphImpl_IDirectMusicGraph_Release, - IDirectMusicGraphImpl_IDirectMusicGraph_StampPMsg, - IDirectMusicGraphImpl_IDirectMusicGraph_InsertTool, - IDirectMusicGraphImpl_IDirectMusicGraph_GetTool, - IDirectMusicGraphImpl_IDirectMusicGraph_RemoveTool +static const IDirectMusicGraphVtbl DirectMusicGraphVtbl = +{ + DirectMusicGraph_QueryInterface, + DirectMusicGraph_AddRef, + DirectMusicGraph_Release, + DirectMusicGraph_StampPMsg, + DirectMusicGraph_InsertTool, + DirectMusicGraph_GetTool, + DirectMusicGraph_RemoveTool }; - -/* IDirectMusicGraphImpl IDirectMusicObject part: */ -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_QueryInterface (LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface); - return IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); +static HRESULT WINAPI DirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid, void **ret_iface) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface); + return IDirectMusicGraph_QueryInterface(&This->IDirectMusicGraph_iface, riid, ret_iface); } -static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicObject_AddRef (LPDIRECTMUSICOBJECT iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface); - return IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); +static ULONG WINAPI DirectMusicObject_AddRef(IDirectMusicObject *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface); + return IDirectMusicGraph_AddRef(&This->IDirectMusicGraph_iface); } -static ULONG WINAPI IDirectMusicGraphImpl_IDirectMusicObject_Release (LPDIRECTMUSICOBJECT iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface); - return IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); +static ULONG WINAPI DirectMusicObject_Release(IDirectMusicObject *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface); + return IDirectMusicGraph_Release(&This->IDirectMusicGraph_iface); } -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_GetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface); - TRACE("(%p, %p)\n", This, pDesc); - /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */ - memcpy (pDesc, This->pDesc, This->pDesc->dwSize); - return S_OK; +static HRESULT WINAPI DirectMusicObject_GetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *desc) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface); + TRACE("(%p, %p)\n", This, desc); + /* I think we shouldn't return pointer here since then values can be changed; it'd be a mess */ + memcpy(desc, This->pDesc, This->pDesc->dwSize); + return S_OK; } -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor (LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface); - TRACE("(%p, %p): setting descriptor:\n%s\n", This, pDesc, debugstr_DMUS_OBJECTDESC (pDesc)); - - /* According to MSDN, we should copy only given values, not whole struct */ - if (pDesc->dwValidData & DMUS_OBJ_OBJECT) - This->pDesc->guidObject = pDesc->guidObject; - if (pDesc->dwValidData & DMUS_OBJ_CLASS) - This->pDesc->guidClass = pDesc->guidClass; - if (pDesc->dwValidData & DMUS_OBJ_NAME) - lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); - if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) - lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); - if (pDesc->dwValidData & DMUS_OBJ_FILENAME) - lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); - if (pDesc->dwValidData & DMUS_OBJ_VERSION) - This->pDesc->vVersion = pDesc->vVersion; - if (pDesc->dwValidData & DMUS_OBJ_DATE) - This->pDesc->ftDate = pDesc->ftDate; - if (pDesc->dwValidData & DMUS_OBJ_MEMORY) { - This->pDesc->llMemLength = pDesc->llMemLength; - memcpy (This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength); - } - if (pDesc->dwValidData & DMUS_OBJ_STREAM) { - /* according to MSDN, we copy the stream */ - IStream_Clone (pDesc->pStream, &This->pDesc->pStream); - } - - /* add new flags */ - This->pDesc->dwValidData |= pDesc->dwValidData; +static HRESULT WINAPI DirectMusicObject_SetDescriptor(IDirectMusicObject *iface, DMUS_OBJECTDESC *pDesc) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface); - return S_OK; + TRACE("(%p, %p): %s\n", This, pDesc, debugstr_DMUS_OBJECTDESC(pDesc)); + + /* According to MSDN, we should copy only given values, not whole struct */ + if (pDesc->dwValidData & DMUS_OBJ_OBJECT) + This->pDesc->guidObject = pDesc->guidObject; + if (pDesc->dwValidData & DMUS_OBJ_CLASS) + This->pDesc->guidClass = pDesc->guidClass; + if (pDesc->dwValidData & DMUS_OBJ_NAME) + lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); + if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) + lstrcpynW (This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY); + if (pDesc->dwValidData & DMUS_OBJ_FILENAME) + lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); + if (pDesc->dwValidData & DMUS_OBJ_VERSION) + This->pDesc->vVersion = pDesc->vVersion; + if (pDesc->dwValidData & DMUS_OBJ_DATE) + This->pDesc->ftDate = pDesc->ftDate; + if (pDesc->dwValidData & DMUS_OBJ_MEMORY) + { + This->pDesc->llMemLength = pDesc->llMemLength; + memcpy(This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength); + } + + /* according to MSDN, we copy the stream */ + if (pDesc->dwValidData & DMUS_OBJ_STREAM) + IStream_Clone(pDesc->pStream, &This->pDesc->pStream); + + /* add new flags */ + This->pDesc->dwValidData |= pDesc->dwValidData; + return S_OK; } -static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_ParseDescriptor (LPDIRECTMUSICOBJECT iface, LPSTREAM pStream, LPDMUS_OBJECTDESC pDesc) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, ObjectVtbl, iface); - DMUS_PRIVATE_CHUNK Chunk; - DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; - LARGE_INTEGER liMove; /* used when skipping chunks */ +static HRESULT WINAPI DirectMusicObject_ParseDescriptor(IDirectMusicObject *iface, IStream *pStream, DMUS_OBJECTDESC *pDesc) +{ + IDirectMusicGraphImpl *This = impl_from_IDirectMusicObject(iface); + DMUS_PRIVATE_CHUNK Chunk; + DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; + LARGE_INTEGER liMove; /* used when skipping chunks */ - TRACE("(%p, %p, %p)\n", This, pStream, pDesc); + TRACE("(%p, %p, %p)\n", This, pStream, pDesc); /* FIXME: should this be determined from stream? */ pDesc->dwValidData |= DMUS_OBJ_CLASS; @@ -399,41 +408,51 @@ return S_OK; } -static const IDirectMusicObjectVtbl DirectMusicGraph_Object_Vtbl = { - IDirectMusicGraphImpl_IDirectMusicObject_QueryInterface, - IDirectMusicGraphImpl_IDirectMusicObject_AddRef, - IDirectMusicGraphImpl_IDirectMusicObject_Release, - IDirectMusicGraphImpl_IDirectMusicObject_GetDescriptor, - IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor, - IDirectMusicGraphImpl_IDirectMusicObject_ParseDescriptor +static const IDirectMusicObjectVtbl DirectMusicObjectVtbl = +{ + DirectMusicObject_QueryInterface, + DirectMusicObject_AddRef, + DirectMusicObject_Release, + DirectMusicObject_GetDescriptor, + DirectMusicObject_SetDescriptor, + DirectMusicObject_ParseDescriptor }; -/* IDirectMusicGraphImpl IPersistStream part: */ -static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface); - return IDirectMusicGraphImpl_IUnknown_QueryInterface ((LPUNKNOWN)&This->UnknownVtbl, riid, ppobj); +static HRESULT WINAPI PersistStream_QueryInterface(IPersistStream *iface, REFIID riid, void **ret_iface) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + return IDirectMusicGraph_QueryInterface(&This->IDirectMusicGraph_iface, riid, ret_iface); } -static ULONG WINAPI IDirectMusicGraphImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface); - return IDirectMusicGraphImpl_IUnknown_AddRef ((LPUNKNOWN)&This->UnknownVtbl); +static ULONG WINAPI PersistStream_AddRef(IPersistStream *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + return IDirectMusicGraph_AddRef(&This->IDirectMusicGraph_iface); } -static ULONG WINAPI IDirectMusicGraphImpl_IPersistStream_Release (LPPERSISTSTREAM iface) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface); - return IDirectMusicGraphImpl_IUnknown_Release ((LPUNKNOWN)&This->UnknownVtbl); +static ULONG WINAPI PersistStream_Release(IPersistStream *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + return IDirectMusicGraph_Release(&This->IDirectMusicGraph_iface); } -static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) { - return E_NOTIMPL; +static HRESULT WINAPI PersistStream_GetClassID(IPersistStream *iface, CLSID *clsid) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + FIXME("(%p) %p: stub\n", This, clsid); + return E_NOTIMPL; } -static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_IsDirty (LPPERSISTSTREAM iface) { - return E_NOTIMPL; +static HRESULT WINAPI PersistStream_IsDirty(IPersistStream *iface) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + FIXME("(%p): stub\n", This); + return E_NOTIMPL; } -static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { - ICOM_THIS_MULTI(IDirectMusicGraphImpl, PersistStreamVtbl, iface); +static HRESULT WINAPI PersistStream_Load(IPersistStream *iface, IStream* pStm) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); FOURCC chunkID; DWORD chunkSize, StreamSize, StreamCount, ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -578,45 +597,56 @@ return S_OK; } -static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { - return E_NOTIMPL; +static HRESULT WINAPI PersistStream_Save(IPersistStream *iface, IStream *stream, BOOL clear_dirty) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + FIXME("(%p) %p %d\n", This, stream, clear_dirty); + return E_NOTIMPL; } -static HRESULT WINAPI IDirectMusicGraphImpl_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { - return E_NOTIMPL; +static HRESULT WINAPI PersistStream_GetSizeMax(IPersistStream *iface, ULARGE_INTEGER *size) +{ + IDirectMusicGraphImpl *This = impl_from_IPersistStream(iface); + FIXME("(%p) %p\n", This, size); + return E_NOTIMPL; } -static const IPersistStreamVtbl DirectMusicGraph_PersistStream_Vtbl = { - IDirectMusicGraphImpl_IPersistStream_QueryInterface, - IDirectMusicGraphImpl_IPersistStream_AddRef, - IDirectMusicGraphImpl_IPersistStream_Release, - IDirectMusicGraphImpl_IPersistStream_GetClassID, - IDirectMusicGraphImpl_IPersistStream_IsDirty, - IDirectMusicGraphImpl_IPersistStream_Load, - IDirectMusicGraphImpl_IPersistStream_Save, - IDirectMusicGraphImpl_IPersistStream_GetSizeMax +static const IPersistStreamVtbl PersistStreamVtbl = +{ + PersistStream_QueryInterface, + PersistStream_AddRef, + PersistStream_Release, + PersistStream_GetClassID, + PersistStream_IsDirty, + PersistStream_Load, + PersistStream_Save, + PersistStream_GetSizeMax }; /* for ClassFactory */ -HRESULT WINAPI create_dmgraph(REFIID lpcGUID, void **ppobj) +HRESULT WINAPI create_dmgraph(REFIID riid, void **ret_iface) { - IDirectMusicGraphImpl* obj; + IDirectMusicGraphImpl* obj; + HRESULT hr; + + *ret_iface = NULL; - obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl)); - if (NULL == obj) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - obj->UnknownVtbl = &DirectMusicGraph_Unknown_Vtbl; - obj->GraphVtbl = &DirectMusicGraph_Graph_Vtbl; - obj->ObjectVtbl = &DirectMusicGraph_Object_Vtbl; - obj->PersistStreamVtbl = &DirectMusicGraph_PersistStream_Vtbl; - obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); - DM_STRUCT_INIT(obj->pDesc); - obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; - obj->pDesc->guidClass = CLSID_DirectMusicGraph; - obj->ref = 0; /* will be inited by QueryInterface */ - list_init (&obj->Tools); + obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl)); + if (!obj) + return E_OUTOFMEMORY; + + obj->IDirectMusicGraph_iface.lpVtbl = &DirectMusicGraphVtbl; + obj->IDirectMusicObject_iface.lpVtbl = &DirectMusicObjectVtbl; + obj->IPersistStream_iface.lpVtbl = &PersistStreamVtbl; + obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); + DM_STRUCT_INIT(obj->pDesc); + obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; + obj->pDesc->guidClass = CLSID_DirectMusicGraph; + obj->ref = 1; + list_init(&obj->Tools); + + hr = IDirectMusicGraph_QueryInterface(&obj->IDirectMusicGraph_iface, riid, ret_iface); + IDirectMusicGraph_Release(&obj->IDirectMusicGraph_iface); - return IDirectMusicGraphImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj); + return hr; } diff -Nru wine1.7-1.7.13/dlls/dmime/segmentstate.c wine1.7-1.7.16/dlls/dmime/segmentstate.c --- wine1.7-1.7.13/dlls/dmime/segmentstate.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmime/segmentstate.c 2014-04-04 19:13:44.000000000 +0000 @@ -21,119 +21,140 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmime); -/* IDirectMusicSegmentState8Impl IUnknown part: */ -static HRESULT WINAPI IDirectMusicSegmentState8Impl_QueryInterface (LPDIRECTMUSICSEGMENTSTATE8 iface, REFIID riid, LPVOID *ppobj) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); +typedef struct IDirectMusicSegmentState8Impl { + IDirectMusicSegmentState8 IDirectMusicSegmentState8_iface; + LONG ref; +} IDirectMusicSegmentState8Impl; - if (!riid || !ppobj) - return E_POINTER; - - if (IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IDirectMusicSegmentState) || - IsEqualIID(riid, &IID_IDirectMusicSegmentState8)) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); - return E_NOINTERFACE; +static inline IDirectMusicSegmentState8Impl *impl_from_IDirectMusicSegmentState8(IDirectMusicSegmentState8 *iface) +{ + return CONTAINING_RECORD(iface, IDirectMusicSegmentState8Impl, IDirectMusicSegmentState8_iface); } -static ULONG WINAPI IDirectMusicSegmentState8Impl_AddRef (LPDIRECTMUSICSEGMENTSTATE8 iface) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - ULONG ref = InterlockedIncrement(&This->ref); +static HRESULT WINAPI DirectMusicSegmentState8_QueryInterface(IDirectMusicSegmentState8 *iface, REFIID riid, void **ppobj) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); - TRACE("(%p): AddRef from %d\n", This, ref - 1); + TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); - DMIME_LockModule(); + *ppobj = NULL; - return ref; + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IDirectMusicSegmentState) || + IsEqualIID(riid, &IID_IDirectMusicSegmentState8)) + { + IDirectMusicSegmentState8_AddRef(iface); + *ppobj = &This->IDirectMusicSegmentState8_iface; + return S_OK; + } + + WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj); + return E_NOINTERFACE; } -static ULONG WINAPI IDirectMusicSegmentState8Impl_Release (LPDIRECTMUSICSEGMENTSTATE8 iface) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p): ReleaseRef to %d\n", This, ref); - - if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); - } +static ULONG WINAPI DirectMusicSegmentState8_AddRef(IDirectMusicSegmentState8 *iface) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): %d\n", This, ref); - DMIME_UnlockModule(); + DMIME_LockModule(); - return ref; + return ref; } -/* IDirectMusicSegmentState8Impl IDirectMusicSegmentState part: */ -static HRESULT WINAPI IDirectMusicSegmentState8Impl_GetRepeats (LPDIRECTMUSICSEGMENTSTATE8 iface, DWORD* pdwRepeats) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %p): stub\n", This, pdwRepeats); - return S_OK; -} +static ULONG WINAPI DirectMusicSegmentState8_Release(IDirectMusicSegmentState8 *iface) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + ULONG ref = InterlockedDecrement(&This->ref); -static HRESULT WINAPI IDirectMusicSegmentState8Impl_GetSegment (LPDIRECTMUSICSEGMENTSTATE8 iface, IDirectMusicSegment** ppSegment) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %p): stub\n", This, ppSegment); - return S_OK; -} + TRACE("(%p): %d\n", This, ref); + + if (ref == 0) + HeapFree(GetProcessHeap(), 0, This); -static HRESULT WINAPI IDirectMusicSegmentState8Impl_GetStartTime (LPDIRECTMUSICSEGMENTSTATE8 iface, MUSIC_TIME* pmtStart) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %p): stub\n", This, pmtStart); - return S_OK; + DMIME_UnlockModule(); + + return ref; } -static HRESULT WINAPI IDirectMusicSegmentState8Impl_GetSeek (LPDIRECTMUSICSEGMENTSTATE8 iface, MUSIC_TIME* pmtSeek) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %p): stub\n", This, pmtSeek); - return S_OK; +static HRESULT WINAPI DirectMusicSegmentState8_GetRepeats(IDirectMusicSegmentState8 *iface, DWORD* pdwRepeats) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %p): stub\n", This, pdwRepeats); + return S_OK; } -static HRESULT WINAPI IDirectMusicSegmentState8Impl_GetStartPoint (LPDIRECTMUSICSEGMENTSTATE8 iface, MUSIC_TIME* pmtStart) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %p): stub\n", This, pmtStart); - return S_OK; +static HRESULT WINAPI DirectMusicSegmentState8_GetSegment(IDirectMusicSegmentState8 *iface, IDirectMusicSegment** ppSegment) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %p): stub\n", This, ppSegment); + return S_OK; } -/* IDirectMusicSegmentState8Impl IDirectMusicSegmentState8 part: */ -static HRESULT WINAPI IDirectMusicSegmentState8Impl_SetTrackConfig (LPDIRECTMUSICSEGMENTSTATE8 iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %s, %d, %d, %d, %d): stub\n", This, debugstr_dmguid(rguidTrackClassID), dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff); - return S_OK; +static HRESULT WINAPI DirectMusicSegmentState8_GetStartTime(IDirectMusicSegmentState8 *iface, MUSIC_TIME* pmtStart) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %p): stub\n", This, pmtStart); + return S_OK; } -static HRESULT WINAPI IDirectMusicSegmentState8Impl_GetObjectInPath (LPDIRECTMUSICSEGMENTSTATE8 iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void** ppObject) { - IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), dwIndex, debugstr_dmguid(iidInterface), ppObject); - return S_OK; +static HRESULT WINAPI DirectMusicSegmentState8_GetSeek(IDirectMusicSegmentState8 *iface, MUSIC_TIME* pmtSeek) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %p): stub\n", This, pmtSeek); + return S_OK; } -static const IDirectMusicSegmentState8Vtbl DirectMusicSegmentState8_Vtbl = { - IDirectMusicSegmentState8Impl_QueryInterface, - IDirectMusicSegmentState8Impl_AddRef, - IDirectMusicSegmentState8Impl_Release, - IDirectMusicSegmentState8Impl_GetRepeats, - IDirectMusicSegmentState8Impl_GetSegment, - IDirectMusicSegmentState8Impl_GetStartTime, - IDirectMusicSegmentState8Impl_GetSeek, - IDirectMusicSegmentState8Impl_GetStartPoint, - IDirectMusicSegmentState8Impl_SetTrackConfig, - IDirectMusicSegmentState8Impl_GetObjectInPath +static HRESULT WINAPI DirectMusicSegmentState8_GetStartPoint(IDirectMusicSegmentState8 *iface, MUSIC_TIME* pmtStart) +{ + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %p): stub\n", This, pmtStart); + return S_OK; +} + +static HRESULT WINAPI DirectMusicSegmentState8_SetTrackConfig(IDirectMusicSegmentState8 *iface, REFGUID rguidTrackClassID, DWORD dwGroupBits, DWORD dwIndex, DWORD dwFlagsOn, DWORD dwFlagsOff) { + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %s, %d, %d, %d, %d): stub\n", This, debugstr_dmguid(rguidTrackClassID), dwGroupBits, dwIndex, dwFlagsOn, dwFlagsOff); + return S_OK; +} + +static HRESULT WINAPI DirectMusicSegmentState8_GetObjectInPath(IDirectMusicSegmentState8 *iface, DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID guidObject, DWORD dwIndex, REFGUID iidInterface, void** ppObject) { + IDirectMusicSegmentState8Impl *This = impl_from_IDirectMusicSegmentState8(iface); + FIXME("(%p, %d, %d, %d, %s, %d, %s, %p): stub\n", This, dwPChannel, dwStage, dwBuffer, debugstr_dmguid(guidObject), dwIndex, debugstr_dmguid(iidInterface), ppObject); + return S_OK; +} + +static const IDirectMusicSegmentState8Vtbl DirectMusicSegmentState8Vtbl = { + DirectMusicSegmentState8_QueryInterface, + DirectMusicSegmentState8_AddRef, + DirectMusicSegmentState8_Release, + DirectMusicSegmentState8_GetRepeats, + DirectMusicSegmentState8_GetSegment, + DirectMusicSegmentState8_GetStartTime, + DirectMusicSegmentState8_GetSeek, + DirectMusicSegmentState8_GetStartPoint, + DirectMusicSegmentState8_SetTrackConfig, + DirectMusicSegmentState8_GetObjectInPath }; /* for ClassFactory */ -HRESULT WINAPI create_dmsegmentstate(REFIID lpcGUID, void **ppobj) +HRESULT WINAPI create_dmsegmentstate(REFIID riid, void **ret_iface) { - IDirectMusicSegmentState8Impl* obj; - - obj = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegmentState8Impl)); - if (NULL == obj) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - obj->lpVtbl = &DirectMusicSegmentState8_Vtbl; - obj->ref = 0; /* will be inited by QueryInterface */ - - return IDirectMusicSegmentState8Impl_QueryInterface ((LPDIRECTMUSICSEGMENTSTATE8)obj, lpcGUID, ppobj); + IDirectMusicSegmentState8Impl* obj; + HRESULT hr; + + *ret_iface = NULL; + + obj = HeapAlloc (GetProcessHeap(), 0, sizeof(IDirectMusicSegmentState8Impl)); + if (!obj) + return E_OUTOFMEMORY; + + obj->IDirectMusicSegmentState8_iface.lpVtbl = &DirectMusicSegmentState8Vtbl; + obj->ref = 1; + + hr = IDirectMusicSegmentState8_QueryInterface(&obj->IDirectMusicSegmentState8_iface, riid, ret_iface); + IDirectMusicSegmentState8_Release(&obj->IDirectMusicSegmentState8_iface); + return hr; } diff -Nru wine1.7-1.7.13/dlls/dmloader/container.c wine1.7-1.7.16/dlls/dmloader/container.c --- wine1.7-1.7.13/dlls/dmloader/container.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmloader/container.c 2014-04-04 19:13:44.000000000 +0000 @@ -36,8 +36,8 @@ */ /* IUnknown/IDirectMusicContainer part: */ -static HRESULT DMUSIC_DestroyDirectMusicContainerImpl (LPDIRECTMUSICCONTAINER iface) { - ICOM_THIS_MULTI(IDirectMusicContainerImpl, ContainerVtbl, iface); +static HRESULT destroy_dmcontainer(IDirectMusicContainerImpl *This) +{ LPDIRECTMUSICLOADER pLoader; LPDIRECTMUSICGETLOADER pGetLoader; struct list *pEntry; @@ -68,7 +68,6 @@ IStream_Release (This->pStream); /* FIXME: release allocated entries */ - unlock_module(); return S_OK; } @@ -108,8 +107,10 @@ DWORD dwRef = InterlockedDecrement (&This->dwRef); TRACE("(%p): ReleaseRef to %d\n", This, dwRef); if (dwRef == 0) { - DMUSIC_DestroyDirectMusicContainerImpl (iface); + if (This->pStream) + destroy_dmcontainer(This); HeapFree(GetProcessHeap(), 0, This); + unlock_module(); } return dwRef; @@ -909,7 +910,8 @@ }; /* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { +HRESULT WINAPI create_dmcontainer(REFIID lpcGUID, void **ppobj) +{ IDirectMusicContainerImpl* obj; obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerImpl)); diff -Nru wine1.7-1.7.13/dlls/dmloader/dmloader_main.c wine1.7-1.7.16/dlls/dmloader/dmloader_main.c --- wine1.7-1.7.13/dlls/dmloader/dmloader_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmloader/dmloader_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -27,7 +27,7 @@ typedef struct { IClassFactory IClassFactory_iface; - HRESULT WINAPI (*fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter); + HRESULT WINAPI (*fnCreateInstance)(REFIID riid, void **ppv); } IClassFactoryImpl; /****************************************************************** @@ -73,13 +73,18 @@ } static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, - REFIID riid, void **ppv) + REFIID riid, void **ret_iface) { IClassFactoryImpl *This = impl_from_IClassFactory(iface); - TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv); + TRACE ("(%s, %p)\n", debugstr_dmguid(riid), ret_iface); - return This->fnCreateInstance(riid, ppv, pUnkOuter); + if (pUnkOuter) { + *ret_iface = NULL; + return CLASS_E_NOAGGREGATION; + } + + return This->fnCreateInstance(riid, ret_iface); } static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) @@ -102,9 +107,8 @@ ClassFactory_LockServer }; -static IClassFactoryImpl dm_loader_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicLoaderImpl}; -static IClassFactoryImpl dm_container_CF = {{&classfactory_vtbl}, - DMUSIC_CreateDirectMusicContainerImpl}; +static IClassFactoryImpl dm_loader_CF = {{&classfactory_vtbl}, create_dmloader}; +static IClassFactoryImpl dm_container_CF = {{&classfactory_vtbl}, create_dmcontainer}; /****************************************************************** * DllMain diff -Nru wine1.7-1.7.13/dlls/dmloader/dmloader_private.h wine1.7-1.7.16/dlls/dmloader/dmloader_private.h --- wine1.7-1.7.13/dlls/dmloader/dmloader_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmloader/dmloader_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -65,8 +65,8 @@ /***************************************************************************** * Creation helpers */ -extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN; -extern HRESULT WINAPI DMUSIC_CreateDirectMusicContainerImpl (LPCGUID lpcGUID, LPVOID *ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN; +extern HRESULT WINAPI create_dmloader(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN; +extern HRESULT WINAPI create_dmcontainer(REFIID riid, void **ret_iface) DECLSPEC_HIDDEN; extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderFileStream (LPVOID *ppobj) DECLSPEC_HIDDEN; extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderResourceStream (LPVOID *ppobj) DECLSPEC_HIDDEN; extern HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderGenericStream (LPVOID *ppobj) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/dmloader/loader.c wine1.7-1.7.16/dlls/dmloader/loader.c --- wine1.7-1.7.13/dlls/dmloader/loader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmloader/loader.c 2014-04-04 19:13:44.000000000 +0000 @@ -888,14 +888,14 @@ } /* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl(const GUID *lpcGUID, void **ppobj, IUnknown *pUnkOuter) +HRESULT WINAPI create_dmloader(REFIID lpcGUID, void **ppobj) { IDirectMusicLoaderImpl *obj; DMUS_OBJECTDESC Desc; LPWINE_LOADER_ENTRY pDefaultDLSEntry; struct list *pEntry; - TRACE("(%s, %p, %p)\n", debugstr_dmguid(lpcGUID), ppobj, pUnkOuter); + TRACE("(%s, %p)\n", debugstr_dmguid(lpcGUID), ppobj); obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLoaderImpl)); if (NULL == obj) { *ppobj = NULL; diff -Nru wine1.7-1.7.13/dlls/dmloader/tests/loader.c wine1.7-1.7.16/dlls/dmloader/tests/loader.c --- wine1.7-1.7.13/dlls/dmloader/tests/loader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dmloader/tests/loader.c 2014-04-04 19:13:44.000000000 +0000 @@ -27,17 +27,26 @@ "fmt \x10\x00\x00\x00\x01\x00\x20\x00\xAC\x44\x00\x00\x10\xB1\x02\x00\x04\x00\x10\x00" /* format segment: PCM, 2 chan, 44100 Hz, 16 bits */ "data\x00\x01\x00\x00"; /* 256 byte data segment (silence) */ +static BOOL missing_dmloader(void) +{ + IDirectMusicLoader8 *dml; + HRESULT hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicLoader8, (void**)&dml); + + if (hr == S_OK && dml) + { + IDirectMusicLoader8_Release(dml); + return FALSE; + } + return TRUE; +} + static void test_release_object(void) { HRESULT hr; IDirectMusicLoader8* loader = NULL; hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, &IID_IDirectMusicLoader8, (void**)&loader); - if ( FAILED(hr) ) - { - skip("CoCreateInstance failed.\n"); - return; - } hr = IDirectMusicLoader_ReleaseObject(loader, NULL); ok(hr == E_POINTER, "Expected E_POINTER, received %#x\n", hr); @@ -125,10 +134,103 @@ IDirectMusicLoader8_Release(loader); } +static void test_COM(void) +{ + IDirectMusicLoader8 *dml8 = (IDirectMusicLoader8*)0xdeadbeef; + IUnknown *unk; + ULONG refcount; + HRESULT hr; + + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_DirectMusicLoader, (IUnknown*)&dml8, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&dml8); + ok(hr == CLASS_E_NOAGGREGATION, + "DirectMusicLoader create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr); + ok(!dml8, "dml8 = %p\n", dml8); + + /* Invalid RIID */ + hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicObject, (void**)&dml8); + ok(hr == E_NOINTERFACE, "DirectMusicLoader create failed: %08x, expected E_NOINTERFACE\n", hr); + + /* Same refcount for all DirectMusicLoader interfaces */ + hr = CoCreateInstance(&CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicLoader8, (void**)&dml8); + ok(hr == S_OK, "DirectMusicLoader create failed: %08x, expected S_OK\n", hr); + refcount = IDirectMusicLoader8_AddRef(dml8); + ok(refcount == 2, "refcount == %u, expected 2\n", refcount); + + hr = IDirectMusicLoader8_QueryInterface(dml8, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); + refcount = IUnknown_AddRef(unk); + ok(refcount == 4, "refcount == %u, expected 4\n", refcount); + refcount = IUnknown_Release(unk); + + while (IDirectMusicLoader8_Release(dml8)); +} + +static void test_COM_container(void) +{ + IDirectMusicContainer *dmc = (IDirectMusicContainer*)0xdeadbeef; + IDirectMusicObject *dmo; + IPersistStream *ps; + IUnknown *unk; + ULONG refcount; + HRESULT hr; + + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_DirectMusicContainer, (IUnknown*)&dmc, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&dmc); + ok(hr == CLASS_E_NOAGGREGATION, + "DirectMusicContainer create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr); + ok(!dmc, "dmc = %p\n", dmc); + + /* Invalid RIID */ + hr = CoCreateInstance(&CLSID_DirectMusicContainer, NULL, CLSCTX_INPROC_SERVER, + &IID_IClassFactory, (void**)&dmc); + ok(hr == E_NOINTERFACE, "DirectMusicContainer create failed: %08x, expected E_NOINTERFACE\n", hr); + + /* Same refcount for all DirectMusicContainer interfaces */ + hr = CoCreateInstance(&CLSID_DirectMusicContainer, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicContainer, (void**)&dmc); + ok(hr == S_OK, "DirectMusicContainer create failed: %08x, expected S_OK\n", hr); + refcount = IDirectMusicContainer_AddRef(dmc); + ok(refcount == 2, "refcount == %u, expected 2\n", refcount); + + hr = IDirectMusicContainer_QueryInterface(dmc, &IID_IDirectMusicObject, (void**)&dmo); + ok(hr == S_OK, "QueryInterface for IID_IDirectMusicObject failed: %08x\n", hr); + refcount = IDirectMusicObject_AddRef(dmo); + ok(refcount == 4, "refcount == %u, expected 4\n", refcount); + refcount = IDirectMusicObject_Release(dmo); + + hr = IDirectMusicContainer_QueryInterface(dmc, &IID_IPersistStream, (void**)&ps); + ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); + refcount = IPersistStream_AddRef(ps); + ok(refcount == 5, "refcount == %u, expected 5\n", refcount); + refcount = IPersistStream_Release(ps); + + hr = IDirectMusicContainer_QueryInterface(dmc, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); + refcount = IUnknown_AddRef(unk); + ok(refcount == 6, "refcount == %u, expected 6\n", refcount); + refcount = IUnknown_Release(unk); + + while (IDirectMusicContainer_Release(dmc)); +} + START_TEST(loader) { CoInitialize(NULL); + + if (missing_dmloader()) + { + skip("dmloader not available\n"); + CoUninitialize(); + return; + } test_release_object(); test_simple_playing(); + test_COM(); + test_COM_container(); CoUninitialize(); } diff -Nru wine1.7-1.7.13/dlls/dplayx/dplay.c wine1.7-1.7.16/dlls/dplayx/dplay.c --- wine1.7-1.7.13/dlls/dplayx/dplay.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dplayx/dplay.c 2014-04-04 19:13:44.000000000 +0000 @@ -1660,7 +1660,7 @@ } #if 1 - if( This->dp2->bHostInterface == FALSE ) + if( !This->dp2->bHostInterface ) { /* Let the name server know about the creation of this player */ /* FIXME: Is this only to be done for the creation of a server player or diff -Nru wine1.7-1.7.13/dlls/dplayx/dplayx_global.c wine1.7-1.7.16/dlls/dplayx/dplayx_global.c --- wine1.7-1.7.13/dlls/dplayx/dplayx_global.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dplayx/dplayx_global.c 2014-04-04 19:13:44.000000000 +0000 @@ -83,9 +83,10 @@ typedef struct { - DWORD used; - DWORD data[dwBlockSize-sizeof(DWORD)]; + BOOL used; + BYTE data[dwBlockSize - sizeof(BOOL)]; } DPLAYX_MEM_SLICE; +C_ASSERT(sizeof(DPLAYX_MEM_SLICE) == dwBlockSize); static DPLAYX_MEM_SLICE* lpMemArea; @@ -100,10 +101,10 @@ return; } - lpAddrStart = (char*)addr - sizeof(DWORD); /* Find block header */ + lpAddrStart = CONTAINING_RECORD(addr, DPLAYX_MEM_SLICE, data); /* Find block header */ dwBlockUsed = ((BYTE*)lpAddrStart - (BYTE*)lpMemArea)/dwBlockSize; - lpMemArea[ dwBlockUsed ].used = 0; + lpMemArea[ dwBlockUsed ].used = FALSE; } static LPVOID DPLAYX_PrivHeapAlloc( DWORD flags, DWORD size ) @@ -111,20 +112,20 @@ LPVOID lpvArea = NULL; UINT uBlockUsed; - if( size > (dwBlockSize - sizeof(DWORD)) ) + if( size > (dwBlockSize - sizeof(BOOL)) ) { FIXME( "Size exceeded. Request of 0x%08x\n", size ); - size = dwBlockSize - sizeof(DWORD); + size = dwBlockSize - sizeof(BOOL); } /* Find blank area */ uBlockUsed = 0; - while( ( lpMemArea[ uBlockUsed ].used != 0 ) && ( uBlockUsed <= dwMaxBlock ) ) { uBlockUsed++; } + while( lpMemArea[ uBlockUsed ].used && uBlockUsed <= dwMaxBlock ) { uBlockUsed++; } if( uBlockUsed <= dwMaxBlock ) { /* Set the area used */ - lpMemArea[ uBlockUsed ].used = 1; + lpMemArea[ uBlockUsed ].used = TRUE; lpvArea = lpMemArea[ uBlockUsed ].data; } else diff -Nru wine1.7-1.7.13/dlls/dpnet/peer.c wine1.7-1.7.16/dlls/dpnet/peer.c --- wine1.7-1.7.13/dlls/dpnet/peer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dpnet/peer.c 2014-04-04 19:13:44.000000000 +0000 @@ -130,6 +130,9 @@ TRACE("(%p)->(%p,%p,%p,%p,%p,%x): stub\n", iface, pguidServiceProvider, pguidApplication, pSPInfoBuffer, pcbEnumData, pcReturned, dwFlags); + if(!pcReturned || !pcbEnumData) + return E_POINTER; + if(!pguidServiceProvider) { req_size = sizeof(DPN_SERVICE_PROVIDER_INFO) + sizeof(dp_providerW); diff -Nru wine1.7-1.7.13/dlls/dpnet/tests/peer.c wine1.7-1.7.16/dlls/dpnet/tests/peer.c --- wine1.7-1.7.13/dlls/dpnet/tests/peer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dpnet/tests/peer.c 2014-04-04 19:13:44.000000000 +0000 @@ -59,6 +59,12 @@ size = 0; items = 0; + hr = IDirectPlay8Peer_EnumServiceProviders(peer, NULL, NULL, NULL, &size, NULL, 0); + ok(hr == E_POINTER, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr); + + hr = IDirectPlay8Peer_EnumServiceProviders(peer, NULL, NULL, NULL, NULL, &items, 0); + ok(hr == E_POINTER, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr); + hr = IDirectPlay8Peer_EnumServiceProviders(peer, NULL, NULL, NULL, &size, &items, 0); ok(hr == DPNERR_BUFFERTOOSMALL, "IDirectPlay8Peer_EnumServiceProviders failed with %x\n", hr); ok(size != 0, "size is unexpectedly 0\n"); diff -Nru wine1.7-1.7.13/dlls/dswave/dswave.c wine1.7-1.7.16/dlls/dswave/dswave.c --- wine1.7-1.7.13/dlls/dswave/dswave.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dswave/dswave.c 2014-04-04 19:13:44.000000000 +0000 @@ -723,7 +723,8 @@ /* for ClassFactory */ -HRESULT WINAPI DMUSIC_CreateDirectMusicWaveImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { +HRESULT WINAPI create_dswave(REFIID lpcGUID, void **ppobj) +{ IDirectMusicWaveImpl* obj; obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicWaveImpl)); diff -Nru wine1.7-1.7.13/dlls/dswave/dswave_main.c wine1.7-1.7.16/dlls/dswave/dswave_main.c --- wine1.7-1.7.13/dlls/dswave/dswave_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dswave/dswave_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -71,12 +71,17 @@ return 1; /* non-heap based object */ } -static HRESULT WINAPI WaveCF_CreateInstance(IClassFactory * iface, IUnknown *pOuter, REFIID riid, - void **ppobj) +static HRESULT WINAPI WaveCF_CreateInstance(IClassFactory * iface, IUnknown *outer_unk, REFIID riid, + void **ret_iface) { - TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); + TRACE ("(%p, %s, %p)\n", outer_unk, debugstr_dmguid(riid), ret_iface); - return DMUSIC_CreateDirectMusicWaveImpl (riid, ppobj, pOuter); + if (outer_unk) { + *ret_iface = NULL; + return CLASS_E_NOAGGREGATION; + } + + return create_dswave(riid, ret_iface); } static HRESULT WINAPI WaveCF_LockServer(IClassFactory * iface, BOOL dolock) diff -Nru wine1.7-1.7.13/dlls/dswave/dswave_private.h wine1.7-1.7.16/dlls/dswave/dswave_private.h --- wine1.7-1.7.13/dlls/dswave/dswave_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dswave/dswave_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -48,7 +48,7 @@ /***************************************************************************** * ClassFactory */ -extern HRESULT WINAPI DMUSIC_CreateDirectMusicWaveImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) DECLSPEC_HIDDEN; +extern HRESULT WINAPI create_dswave(REFIID lpcGUID, void **ret_iface) DECLSPEC_HIDDEN; /***************************************************************************** diff -Nru wine1.7-1.7.13/dlls/dswave/tests/dswave.c wine1.7-1.7.16/dlls/dswave/tests/dswave.c --- wine1.7-1.7.13/dlls/dswave/tests/dswave.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/dswave/tests/dswave.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,102 @@ +/* + * Copyright 2014 Michael Stefaniuc + * + * 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 +#include +#include +#include +#include + +static BOOL missing_dswave(void) +{ + IDirectMusicObject *dmo; + HRESULT hr = CoCreateInstance(&CLSID_DirectSoundWave, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicObject, (void**)&dmo); + + if (hr == S_OK && dmo) + { + IDirectMusicObject_Release(dmo); + return FALSE; + } + return TRUE; +} + +static void test_COM(void) +{ + IDirectMusicObject *dmo = (IDirectMusicObject*)0xdeadbeef; + IPersistStream *ps; + IUnknown *unk; + ULONG refcount; + HRESULT hr; + + /* COM aggregation */ + hr = CoCreateInstance(&CLSID_DirectSoundWave, (IUnknown*)&dmo, CLSCTX_INPROC_SERVER, + &IID_IUnknown, (void**)&dmo); + ok(hr == CLASS_E_NOAGGREGATION, + "DirectSoundWave create failed: %08x, expected CLASS_E_NOAGGREGATION\n", hr); + ok(!dmo, "dmo = %p\n", dmo); + + /* Invalid RIID */ + hr = CoCreateInstance(&CLSID_DirectSoundWave, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicSegment8, (void**)&dmo); + todo_wine ok(hr == E_NOINTERFACE, "DirectSoundWave create failed: %08x, expected E_NOINTERFACE\n", hr); + + /* Same refcount for all DirectSoundWave interfaces */ + hr = CoCreateInstance(&CLSID_DirectSoundWave, NULL, CLSCTX_INPROC_SERVER, + &IID_IDirectMusicObject, (void**)&dmo); + ok(hr == S_OK, "DirectSoundWave create failed: %08x, expected S_OK\n", hr); + refcount = IDirectMusicObject_AddRef(dmo); + ok(refcount == 2, "refcount == %u, expected 2\n", refcount); + + hr = IDirectMusicObject_QueryInterface(dmo, &IID_IPersistStream, (void**)&ps); + ok(hr == S_OK, "QueryInterface for IID_IPersistStream failed: %08x\n", hr); + refcount = IPersistStream_AddRef(ps); + ok(refcount == 4, "refcount == %u, expected 4\n", refcount); + refcount = IPersistStream_Release(ps); + + hr = IDirectMusicObject_QueryInterface(dmo, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "QueryInterface for IID_IUnknown failed: %08x\n", hr); + refcount = IUnknown_AddRef(unk); + ok(refcount == 5, "refcount == %u, expected 5\n", refcount); + refcount = IUnknown_Release(unk); + + /* Interfaces that native does not support */ + hr = IDirectMusicObject_QueryInterface(dmo, &IID_IDirectMusicSegment, (void**)&unk); + todo_wine ok(hr == E_NOINTERFACE, "QueryInterface for IID_IDirectMusicSegment failed: %08x\n", hr); + hr = IDirectMusicObject_QueryInterface(dmo, &IID_IDirectMusicSegment8, (void**)&unk); + todo_wine ok(hr == E_NOINTERFACE, "QueryInterface for IID_IDirectMusicSegment8 failed: %08x\n", hr); + + while (IDirectMusicObject_Release(dmo)); +} + +START_TEST(dswave) +{ + CoInitialize(NULL); + + if (missing_dswave()) + { + skip("dswave not available\n"); + CoUninitialize(); + return; + } + test_COM(); + + CoUninitialize(); +} diff -Nru wine1.7-1.7.13/dlls/dswave/tests/Makefile.in wine1.7-1.7.16/dlls/dswave/tests/Makefile.in --- wine1.7-1.7.13/dlls/dswave/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/dswave/tests/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,5 @@ +TESTDLL = dswave.dll +IMPORTS = ole32 + +C_SRCS = \ + dswave.c diff -Nru wine1.7-1.7.13/dlls/dxdiagn/provider.c wine1.7-1.7.16/dlls/dxdiagn/provider.c --- wine1.7-1.7.13/dlls/dxdiagn/provider.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dxdiagn/provider.c 2014-04-04 19:13:44.000000000 +0000 @@ -915,10 +915,15 @@ static const WCHAR id_fmtW[] = {'0','x','%','0','4','x',0}; static const WCHAR subsysid_fmtW[] = {'0','x','%','0','8','x',0}; static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0}; + static const WCHAR b3DAccelerationExists[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','x','i','s','t','s',0}; + static const WCHAR b3DAccelerationEnabled[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0}; + static const WCHAR bDDAccelerationEnabled[] = {'b','D','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0}; D3DADAPTER_IDENTIFIER9 adapter_info; D3DDISPLAYMODE adapter_mode; + D3DCAPS9 device_caps; DWORD available_mem = 0; + BOOL hardware_accel; snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), adapterid_fmtW, index); display_adapter = allocate_information_node(buffer); @@ -1043,6 +1048,21 @@ hr = add_bstr_property(display_adapter, szDisplayMemoryEnglish, buffer); if (FAILED(hr)) goto cleanup; + + hr = IDirect3D9_GetDeviceCaps(pDirect3D9, index, D3DDEVTYPE_HAL, &device_caps); + hardware_accel = SUCCEEDED(hr); + + hr = add_bool_property(display_adapter, b3DAccelerationEnabled, hardware_accel); + if (FAILED(hr)) + goto cleanup; + + hr = add_bool_property(display_adapter, b3DAccelerationExists, hardware_accel); + if (FAILED(hr)) + goto cleanup; + + hr = add_bool_property(display_adapter, bDDAccelerationEnabled, hardware_accel); + if (FAILED(hr)) + goto cleanup; } hr = S_OK; diff -Nru wine1.7-1.7.13/dlls/dxdiagn/tests/container.c wine1.7-1.7.16/dlls/dxdiagn/tests/container.c --- wine1.7-1.7.13/dlls/dxdiagn/tests/container.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dxdiagn/tests/container.c 2014-04-04 19:13:44.000000000 +0000 @@ -938,6 +938,9 @@ static const WCHAR szRevisionId[] = {'s','z','R','e','v','i','s','i','o','n','I','d',0}; static const WCHAR dwRefreshRate[] = {'d','w','R','e','f','r','e','s','h','R','a','t','e',0}; static const WCHAR szManufacturer[] = {'s','z','M','a','n','u','f','a','c','t','u','r','e','r',0}; + static const WCHAR b3DAccelerationExists[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','x','i','s','t','s',0}; + static const WCHAR b3DAccelerationEnabled[] = {'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0}; + static const WCHAR bDDAccelerationEnabled[] = {'b','D','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0}; static const struct property_test property_tests[] = { @@ -959,6 +962,9 @@ {szRevisionId, VT_BSTR}, {dwRefreshRate, VT_UI4}, {szManufacturer, VT_BSTR}, + {b3DAccelerationExists, VT_BOOL}, + {b3DAccelerationEnabled, VT_BOOL}, + {bDDAccelerationEnabled, VT_BOOL}, }; IDxDiagContainer *display_cont = NULL; diff -Nru wine1.7-1.7.13/dlls/dxgi/factory.c wine1.7-1.7.16/dlls/dxgi/factory.c --- wine1.7-1.7.13/dlls/dxgi/factory.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/dxgi/factory.c 2014-04-04 19:13:44.000000000 +0000 @@ -329,7 +329,7 @@ factory->refcount = 1; EnterCriticalSection(&dxgi_cs); - factory->wined3d = wined3d_create(10, 0); + factory->wined3d = wined3d_create(0); if (!factory->wined3d) { LeaveCriticalSection(&dxgi_cs); diff -Nru wine1.7-1.7.13/dlls/dxva2/dxva2.spec wine1.7-1.7.16/dlls/dxva2/dxva2.spec --- wine1.7-1.7.13/dlls/dxva2/dxva2.spec 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/dxva2/dxva2.spec 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,37 @@ +@ stdcall CapabilitiesRequestAndCapabilitiesReply(ptr ptr long) +@ stdcall DXVA2CreateDirect3DDeviceManager9(ptr ptr) +@ stdcall DXVA2CreateVideoService(ptr ptr ptr) +@ stdcall DegaussMonitor(ptr) +@ stdcall DestroyPhysicalMonitor(ptr) +@ stdcall DestroyPhysicalMonitors(long ptr) +@ stdcall GetCapabilitiesStringLength(ptr ptr) +@ stdcall GetMonitorBrightness(ptr ptr ptr ptr) +@ stdcall GetMonitorCapabilities(ptr ptr ptr) +@ stdcall GetMonitorColorTemperature(ptr ptr) +@ stdcall GetMonitorContrast(ptr ptr ptr ptr) +@ stdcall GetMonitorDisplayAreaPosition(ptr long ptr ptr ptr) +@ stdcall GetMonitorDisplayAreaSize(ptr long ptr ptr ptr) +@ stdcall GetMonitorRedGreenOrBlueDrive(ptr long ptr ptr ptr) +@ stdcall GetMonitorRedGreenOrBlueGain(ptr long ptr ptr ptr) +@ stdcall GetMonitorTechnologyType(ptr ptr) +@ stdcall GetNumberOfPhysicalMonitorsFromHMONITOR(ptr ptr) +@ stdcall GetNumberOfPhysicalMonitorsFromIDirect3DDevice9(ptr ptr) +@ stdcall GetPhysicalMonitorsFromHMONITOR(ptr long ptr) +@ stdcall GetPhysicalMonitorsFromIDirect3DDevice9(ptr long ptr) +@ stdcall GetTimingReport(ptr ptr) +@ stdcall GetVCPFeatureAndVCPFeatureReply(ptr long ptr ptr ptr) +@ stdcall OPMGetVideoOutputsFromHMONITOR(ptr long ptr ptr) +@ stdcall OPMGetVideoOutputsFromIDirect3DDevice9Object(ptr long ptr ptr) +@ stdcall RestoreMonitorFactoryColorDefaults(ptr) +@ stdcall RestoreMonitorFactoryDefaults(ptr) +@ stdcall SaveCurrentMonitorSettings(ptr) +@ stdcall SaveCurrentSettings(ptr) +@ stdcall SetMonitorBrightness(ptr long) +@ stdcall SetMonitorColorTemperature(ptr long) +@ stdcall SetMonitorContrast(ptr long) +@ stdcall SetMonitorDisplayAreaPosition(ptr long long) +@ stdcall SetMonitorDisplayAreaSize(ptr long long) +@ stdcall SetMonitorRedGreenOrBlueDrive(ptr long long) +@ stdcall SetMonitorRedGreenOrBlueGain(ptr long long) +@ stdcall SetVCPFeature(ptr long long) +@ stub UABGetCertificate diff -Nru wine1.7-1.7.13/dlls/dxva2/main.c wine1.7-1.7.16/dlls/dxva2/main.c --- wine1.7-1.7.13/dlls/dxva2/main.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/dxva2/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,336 @@ +/* + * Copyright 2014 Michael Müller for Pipelight + * + * 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 +#include "windef.h" +#include "winbase.h" +#include "d3d9.h" +#include "dxva2api.h" +#include "physicalmonitorenumerationapi.h" +#include "lowlevelmonitorconfigurationapi.h" +#include "highlevelmonitorconfigurationapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dxva2); + +BOOL WINAPI CapabilitiesRequestAndCapabilitiesReply( HMONITOR monitor, LPSTR buffer, DWORD length ) +{ + FIXME("(%p, %p, %d): stub\n", monitor, buffer, length); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +HRESULT WINAPI DXVA2CreateDirect3DDeviceManager9( UINT *resetToken, IDirect3DDeviceManager9 **dxvManager ) +{ + FIXME("(%p, %p): stub\n", resetToken, dxvManager); + + return E_NOTIMPL; +} + +HRESULT WINAPI DXVA2CreateVideoService( IDirect3DDevice9 *device, REFIID riid, void **ppv ) +{ + FIXME("(%p, %s, %p): stub\n", device, debugstr_guid(riid), ppv); + + return E_NOTIMPL; +} + +BOOL WINAPI DegaussMonitor( HMONITOR monitor ) +{ + FIXME("(%p): stub\n", monitor); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI DestroyPhysicalMonitor( HMONITOR monitor ) +{ + FIXME("(%p): stub\n", monitor); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI DestroyPhysicalMonitors( DWORD arraySize, LPPHYSICAL_MONITOR array ) +{ + FIXME("(0x%x, %p): stub\n", arraySize, array); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetCapabilitiesStringLength( HMONITOR monitor, LPDWORD length ) +{ + FIXME("(%p, %p): stub\n", monitor, length); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorBrightness( HMONITOR monitor, LPDWORD minimum, LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, %p, %p, %p): stub\n", monitor, minimum, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorCapabilities( HMONITOR monitor, LPDWORD capabilities, LPDWORD temperatures ) +{ + FIXME("(%p, %p, %p): stub\n", monitor, capabilities, temperatures); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +BOOL WINAPI GetMonitorColorTemperature( HMONITOR monitor, LPMC_COLOR_TEMPERATURE temperature ) +{ + FIXME("(%p, %p): stub\n", monitor, temperature); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorContrast( HMONITOR monitor, LPDWORD minimum, LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, %p, %p, %p): stub\n", monitor, minimum, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorDisplayAreaPosition( HMONITOR monitor, MC_POSITION_TYPE type, LPDWORD minimum, + LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorDisplayAreaSize( HMONITOR monitor, MC_SIZE_TYPE type, LPDWORD minimum, + LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorRedGreenOrBlueDrive( HMONITOR monitor, MC_DRIVE_TYPE type, LPDWORD minimum, + LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorRedGreenOrBlueGain( HMONITOR monitor, MC_GAIN_TYPE type, LPDWORD minimum, + LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, 0x%x, %p, %p, %p): stub\n", monitor, type, minimum, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetMonitorTechnologyType( HMONITOR monitor, LPMC_DISPLAY_TECHNOLOGY_TYPE type ) +{ + FIXME("(%p, %p): stub\n", monitor, type); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetNumberOfPhysicalMonitorsFromHMONITOR( HMONITOR monitor, LPDWORD number ) +{ + FIXME("(%p, %p): stub\n", monitor, number); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +HRESULT WINAPI GetNumberOfPhysicalMonitorsFromIDirect3DDevice9( IDirect3DDevice9 *device, LPDWORD number ) +{ + FIXME("(%p, %p): stub\n", device, number); + + return E_NOTIMPL; +} + +BOOL WINAPI GetPhysicalMonitorsFromHMONITOR( HMONITOR monitor, DWORD arraySize, LPPHYSICAL_MONITOR array ) +{ + FIXME("(%p, 0x%x, %p): stub\n", monitor, arraySize, array); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +HRESULT WINAPI GetPhysicalMonitorsFromIDirect3DDevice9( IDirect3DDevice9 *device, DWORD arraySize, LPPHYSICAL_MONITOR array ) +{ + FIXME("(%p, 0x%x, %p): stub\n", device, arraySize, array); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetTimingReport( HMONITOR monitor, LPMC_TIMING_REPORT timingReport ) +{ + FIXME("(%p, %p): stub\n", monitor, timingReport); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI GetVCPFeatureAndVCPFeatureReply( HMONITOR monitor, BYTE vcpCode, LPMC_VCP_CODE_TYPE pvct, + LPDWORD current, LPDWORD maximum ) +{ + FIXME("(%p, 0x%02x, %p, %p, %p): stub\n", monitor, vcpCode, pvct, current, maximum); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +HRESULT WINAPI OPMGetVideoOutputsFromHMONITOR( HMONITOR monitor, /* OPM_VIDEO_OUTPUT_SEMANTICS */ int vos, + ULONG *numVideoOutputs, /* IOPMVideoOutput */ void ***videoOutputs ) +{ + FIXME("(%p, 0x%x, %p, %p): stub\n", monitor, vos, numVideoOutputs, videoOutputs); + + return E_NOTIMPL; +} + +HRESULT WINAPI OPMGetVideoOutputsFromIDirect3DDevice9Object( IDirect3DDevice9 *device, /* OPM_VIDEO_OUTPUT_SEMANTICS */ int vos, + ULONG *numVideoOutputs, /* IOPMVideoOutput */ void ***videoOutputs ) +{ + FIXME("(%p, 0x%x, %p, %p): stub\n", device, vos, numVideoOutputs, videoOutputs); + + return E_NOTIMPL; +} + +BOOL WINAPI RestoreMonitorFactoryColorDefaults( HMONITOR monitor ) +{ + FIXME("(%p): stub\n", monitor); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI RestoreMonitorFactoryDefaults( HMONITOR monitor ) +{ + FIXME("(%p): stub\n", monitor); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SaveCurrentMonitorSettings( HMONITOR monitor ) +{ + FIXME("(%p): stub\n", monitor); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SaveCurrentSettings( HMONITOR monitor ) +{ + FIXME("(%p): stub\n", monitor); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorBrightness( HMONITOR monitor, DWORD brightness ) +{ + FIXME("(%p, 0x%x): stub\n", monitor, brightness); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorColorTemperature( HMONITOR monitor, MC_COLOR_TEMPERATURE temperature ) +{ + FIXME("(%p, 0x%x): stub\n", monitor, temperature); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorContrast( HMONITOR monitor, DWORD contrast ) +{ + FIXME("(%p, 0x%x): stub\n", monitor, contrast); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorDisplayAreaPosition( HMONITOR monitor, MC_POSITION_TYPE type, DWORD position ) +{ + FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, position); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorDisplayAreaSize( HMONITOR monitor, MC_SIZE_TYPE type, DWORD size ) +{ + FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, size); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorRedGreenOrBlueDrive( HMONITOR monitor, MC_DRIVE_TYPE type, DWORD drive ) +{ + FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, drive); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetMonitorRedGreenOrBlueGain( HMONITOR monitor, MC_GAIN_TYPE type, DWORD gain ) +{ + FIXME("(%p, 0x%x, 0x%x): stub\n", monitor, type, gain); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI SetVCPFeature( HMONITOR monitor, BYTE vcpCode, DWORD value ) +{ + FIXME("(%p, 0x%02x, 0x%x): stub\n", monitor, vcpCode, value); + + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + } + + return TRUE; +} diff -Nru wine1.7-1.7.13/dlls/dxva2/Makefile.in wine1.7-1.7.16/dlls/dxva2/Makefile.in --- wine1.7-1.7.13/dlls/dxva2/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/dxva2/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,4 @@ +MODULE = dxva2.dll + +C_SRCS = \ + main.c diff -Nru wine1.7-1.7.13/dlls/faultrep/tests/faultrep.c wine1.7-1.7.16/dlls/faultrep/tests/faultrep.c --- wine1.7-1.7.13/dlls/faultrep/tests/faultrep.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/faultrep/tests/faultrep.c 2014-04-04 19:13:44.000000000 +0000 @@ -36,15 +36,50 @@ static BOOL is_process_limited(void) { + static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL) = NULL; static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE) = NULL; + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; HANDLE token; if (!pOpenProcessToken) { HMODULE hadvapi32 = GetModuleHandleA("advapi32.dll"); pOpenProcessToken = (void*)GetProcAddress(hadvapi32, "OpenProcessToken"); - if (!pOpenProcessToken) + pCheckTokenMembership = (void*)GetProcAddress(hadvapi32, "CheckTokenMembership"); + if (!pCheckTokenMembership || !pOpenProcessToken) + { + /* Win9x (power to the masses) or NT4 (no way to know) */ + trace("missing pOpenProcessToken or CheckTokenMembership\n"); return FALSE; + } + } + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + if (!AllocateAndInitializeSid(&NtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_POWER_USERS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is a power user\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators and power users can be powerful */ + return TRUE; + } } if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) diff -Nru wine1.7-1.7.13/dlls/fltlib/Makefile.in wine1.7-1.7.16/dlls/fltlib/Makefile.in --- wine1.7-1.7.13/dlls/fltlib/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/fltlib/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -2,3 +2,5 @@ C_SRCS = \ fltlib.c + +RC_SRCS = rsrc.rc diff -Nru wine1.7-1.7.13/dlls/fltlib/rsrc.rc wine1.7-1.7.16/dlls/fltlib/rsrc.rc --- wine1.7-1.7.13/dlls/fltlib/rsrc.rc 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fltlib/rsrc.rc 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,27 @@ +/* + * Copyright 2014 Stefan Leichter + * + * 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 "Wine Filter Library" +#define WINE_FILENAME_STR "fltlib.dll" + +#define WINE_FILEVERSION 5,1,2600,5512 +#define WINE_FILEVERSION_STR "5.1.2600.5512" +#define WINE_PRODUCTVERSION 5,1,2600,5512 +#define WINE_PRODUCTVERSION_STR "5.1.2600.5512" + +#include "wine/wine_common_ver.rc" diff -Nru wine1.7-1.7.13/dlls/fntcache/fntcache.spec wine1.7-1.7.16/dlls/fntcache/fntcache.spec --- wine1.7-1.7.13/dlls/fntcache/fntcache.spec 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fntcache/fntcache.spec 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,3 @@ +@ stub DllRegisterServer +@ stub DllUnregisterServer +@ stdcall -private ServiceMain(long ptr) diff -Nru wine1.7-1.7.13/dlls/fntcache/main.c wine1.7-1.7.16/dlls/fntcache/main.c --- wine1.7-1.7.13/dlls/fntcache/main.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fntcache/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,112 @@ +/* + * Font Cache service + * + * Copyright 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 + * 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 WIN32_LEAN_AND_MEAN +#include +#include "winsvc.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fontcache); + +static HINSTANCE hInst; +static SERVICE_STATUS_HANDLE service_handle; +static HANDLE stop_event; + +/*********************************************************************** + * DllMain (fntcache.@) + */ +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + hInst = hinstDLL; + break; + } + + return TRUE; +} + +static DWORD WINAPI service_handler( DWORD ctrl, DWORD event_type, void *event_data, void *context ) +{ + SERVICE_STATUS status; + + status.dwServiceType = SERVICE_WIN32; + status.dwControlsAccepted = SERVICE_ACCEPT_STOP; + status.dwWin32ExitCode = 0; + status.dwServiceSpecificExitCode = 0; + status.dwCheckPoint = 0; + status.dwWaitHint = 0; + + switch(ctrl) + { + case SERVICE_CONTROL_STOP: + case SERVICE_CONTROL_SHUTDOWN: + WINE_TRACE( "shutting down\n" ); + status.dwCurrentState = SERVICE_STOP_PENDING; + status.dwControlsAccepted = 0; + SetServiceStatus( service_handle, &status ); + SetEvent( stop_event ); + return NO_ERROR; + default: + WINE_FIXME( "got service ctrl %x\n", ctrl ); + status.dwCurrentState = SERVICE_RUNNING; + SetServiceStatus( service_handle, &status ); + return NO_ERROR; + } +} + +/*********************************************************************** + * ServiceMain (fntcache.@) + */ +VOID WINAPI ServiceMain(DWORD argc, LPWSTR *argv) +{ + static const WCHAR fontcacheW[] = {'F','o','n','t','C','a','c','h','e',0}; + SERVICE_STATUS status; + + WINE_TRACE( "starting service\n" ); + + stop_event = CreateEventW( NULL, TRUE, FALSE, NULL ); + + service_handle = RegisterServiceCtrlHandlerExW( fontcacheW, service_handler, NULL ); + if (!service_handle) + return; + + status.dwServiceType = SERVICE_WIN32; + status.dwCurrentState = SERVICE_RUNNING; + status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + status.dwWin32ExitCode = 0; + status.dwServiceSpecificExitCode = 0; + status.dwCheckPoint = 0; + status.dwWaitHint = 10000; + SetServiceStatus( service_handle, &status ); + + WaitForSingleObject( stop_event, INFINITE ); + + status.dwCurrentState = SERVICE_STOPPED; + status.dwControlsAccepted = 0; + SetServiceStatus( service_handle, &status ); + WINE_TRACE( "service stopped\n" ); +} diff -Nru wine1.7-1.7.13/dlls/fntcache/Makefile.in wine1.7-1.7.16/dlls/fntcache/Makefile.in --- wine1.7-1.7.13/dlls/fntcache/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fntcache/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,5 @@ +MODULE = fntcache.dll +IMPORTS = advapi32 + +C_SRCS = \ + main.c diff -Nru wine1.7-1.7.13/dlls/fontsub/fontsub.spec wine1.7-1.7.16/dlls/fontsub/fontsub.spec --- wine1.7-1.7.13/dlls/fontsub/fontsub.spec 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fontsub/fontsub.spec 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,2 @@ +@ stub CreateFontPackage +@ stub MergeFontPackage diff -Nru wine1.7-1.7.13/dlls/fontsub/main.c wine1.7-1.7.16/dlls/fontsub/main.c --- wine1.7-1.7.13/dlls/fontsub/main.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fontsub/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright 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 + * 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 +#include "windef.h" +#include "winbase.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fontsub); + +BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("%p,%x,%p\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + } + + return TRUE; +} diff -Nru wine1.7-1.7.13/dlls/fontsub/Makefile.in wine1.7-1.7.16/dlls/fontsub/Makefile.in --- wine1.7-1.7.13/dlls/fontsub/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/fontsub/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,4 @@ +MODULE = fontsub.dll + +C_SRCS = \ + main.c diff -Nru wine1.7-1.7.13/dlls/gameux/tests/gamestatistics.c wine1.7-1.7.16/dlls/gameux/tests/gamestatistics.c --- wine1.7-1.7.13/dlls/gameux/tests/gamestatistics.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gameux/tests/gamestatistics.c 2014-04-04 19:13:44.000000000 +0000 @@ -130,15 +130,13 @@ 'l','o','r','e','r','\\','G','a','m','e','S','t','a','t','i','s', 't','i','c','s','\\',0}; static const WCHAR sDotGamestats[] = {'.','g','a','m','e','s','t','a','t','s',0}; - static const DWORD dwGuidLength = 49; - HRESULT hr; - WCHAR sGuid[dwGuidLength], sPath[MAX_PATH] = {0}; + WCHAR sGuid[49], sPath[MAX_PATH]; hr = pSHGetFolderPathW(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, sPath); if(SUCCEEDED(hr)) - hr = (StringFromGUID2(guidApplicationId, sGuid, dwGuidLength)!=0 ? S_OK : E_FAIL); + hr = (StringFromGUID2(guidApplicationId, sGuid, sizeof(sGuid) / sizeof(sGuid[0])) != 0 ? S_OK : E_FAIL); if(SUCCEEDED(hr)) { diff -Nru wine1.7-1.7.13/dlls/gdi32/bidi.c wine1.7-1.7.16/dlls/gdi32/bidi.c --- wine1.7-1.7.13/dlls/gdi32/bidi.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdi32/bidi.c 2014-04-04 19:13:44.000000000 +0000 @@ -596,10 +596,25 @@ if (lpGlyphs && doGlyphs) { - BYTE runOrder[maxItems]; - int visOrder[maxItems]; + BYTE *runOrder; + int *visOrder; SCRIPT_ITEM *curItem; + runOrder = HeapAlloc(GetProcessHeap(), 0, maxItems * sizeof(*runOrder)); + visOrder = HeapAlloc(GetProcessHeap(), 0, maxItems * sizeof(*visOrder)); + if (!runOrder || !visOrder) + { + WARN("Out of memory\n"); + HeapFree(GetProcessHeap(), 0, runOrder); + HeapFree(GetProcessHeap(), 0, visOrder); + HeapFree(GetProcessHeap(), 0, chartype); + HeapFree(GetProcessHeap(), 0, levels); + HeapFree(GetProcessHeap(), 0, pItems); + HeapFree(GetProcessHeap(), 0, psva); + HeapFree(GetProcessHeap(), 0, pwLogClust); + return FALSE; + } + for (j = 0; j < nItems; j++) runOrder[j] = pItems[j].a.s.uBidiLevel; @@ -621,6 +636,8 @@ if (!run_glyphs) { WARN("Out of memory\n"); + HeapFree(GetProcessHeap(), 0, runOrder); + HeapFree(GetProcessHeap(), 0, visOrder); HeapFree(GetProcessHeap(), 0, chartype); HeapFree(GetProcessHeap(), 0, levels); HeapFree(GetProcessHeap(), 0, pItems); @@ -655,6 +672,8 @@ glyph_i += cOutGlyphs; } } + HeapFree(GetProcessHeap(), 0, runOrder); + HeapFree(GetProcessHeap(), 0, visOrder); } done += i; diff -Nru wine1.7-1.7.13/dlls/gdi32/freetype.c wine1.7-1.7.16/dlls/gdi32/freetype.c --- wine1.7-1.7.13/dlls/gdi32/freetype.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdi32/freetype.c 2014-04-04 19:13:44.000000000 +0000 @@ -5527,12 +5527,20 @@ return i; } +static inline BOOL is_complex_script_ansi_cp(UINT ansi_cp) +{ + return (ansi_cp == 874 /* Thai */ + || ansi_cp == 1255 /* Hebrew */ + || ansi_cp == 1256 /* Arabic */ + ); +} /*************************************************** * create_enum_charset_list * * This function creates charset enumeration list because in DEFAULT_CHARSET * case, the ANSI codepage's charset takes precedence over other charsets. + * Above rule doesn't apply if the ANSI codepage uses complex script (e.g. Thai). * This function works as a filter other than DEFAULT_CHARSET case. */ static DWORD create_enum_charset_list(DWORD charset, struct enum_charset_list *list) @@ -5553,7 +5561,8 @@ /* Set the current codepage's charset as the first element. */ acp = GetACP(); - if (TranslateCharsetInfo((DWORD*)(INT_PTR)acp, &csi, TCI_SRCCODEPAGE) && + if (!is_complex_script_ansi_cp(acp) && + TranslateCharsetInfo((DWORD*)(INT_PTR)acp, &csi, TCI_SRCCODEPAGE) && csi.fs.fsCsb[0] != 0) { list->element[n].mask = csi.fs.fsCsb[0]; list->element[n].charset = csi.ciCharset; diff -Nru wine1.7-1.7.13/dlls/gdi32/tests/clipping.c wine1.7-1.7.16/dlls/gdi32/tests/clipping.c --- wine1.7-1.7.13/dlls/gdi32/tests/clipping.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdi32/tests/clipping.c 2014-04-04 19:13:44.000000000 +0000 @@ -438,7 +438,7 @@ HDC hdc; HRGN hrgn, hrgn_empty; HWND hwnd; - RECT rc; + RECT rc, virtual_rect; int ret, screen_width, screen_height; /* Windows versions earlier than Win2k do not support the virtual screen metrics, @@ -447,6 +447,8 @@ if(!screen_width) screen_width = GetSystemMetrics(SM_CXSCREEN); screen_height = GetSystemMetrics(SM_CYVIRTUALSCREEN); if(!screen_height) screen_height = GetSystemMetrics(SM_CYSCREEN); + SetRect(&virtual_rect, GetSystemMetrics(SM_XVIRTUALSCREEN), GetSystemMetrics(SM_YVIRTUALSCREEN), + GetSystemMetrics(SM_XVIRTUALSCREEN) + screen_width, GetSystemMetrics(SM_YVIRTUALSCREEN) + screen_height); trace("screen resolution %d x %d\n", screen_width, screen_height); @@ -474,9 +476,9 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); - ok(rc.left == 0 && rc.top == 0 && rc.right == screen_width && rc.bottom == screen_height, - "expected 0,0-%d,%d, got %d,%d-%d,%d\n", screen_width, screen_height, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rc, &virtual_rect), "expected %d,%d-%d,%d, got %d,%d-%d,%d\n", + virtual_rect.left, virtual_rect.top, virtual_rect.right, virtual_rect.bottom, + rc.left, rc.top, rc.right, rc.bottom); SetRect( &rc, 10, 10, 20, 20 ); ret = RectVisible( hdc, &rc ); @@ -494,9 +496,9 @@ ret = GetRgnBox(hrgn, &rc); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); - ok(rc.left == 0 && rc.top == 0 && rc.right == screen_width && rc.bottom == screen_height, - "expected 0,0-%d,%d, got %d,%d-%d,%d\n", screen_width, screen_height, - rc.left, rc.top, rc.right, rc.bottom); + ok(EqualRect(&rc, &virtual_rect), "expected %d,%d-%d,%d, got %d,%d-%d,%d\n", + virtual_rect.left, virtual_rect.top, virtual_rect.right, virtual_rect.bottom, + rc.left, rc.top, rc.right, rc.bottom); ret = ExtSelectClipRgn(hdc, 0, RGN_COPY); ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1), diff -Nru wine1.7-1.7.13/dlls/gdi32/tests/dc.c wine1.7-1.7.16/dlls/gdi32/tests/dc.c --- wine1.7-1.7.13/dlls/gdi32/tests/dc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdi32/tests/dc.c 2014-04-04 19:13:44.000000000 +0000 @@ -457,12 +457,46 @@ type = GetClipBox( ref_dc, &rect ); if (type != COMPLEXREGION && type != ERROR) /* region can be complex on multi-monitor setups */ { + RECT ref_rect; + ok( type == SIMPLEREGION, "GetClipBox returned %d on %s\n", type, descr ); - ok( rect.left == 0 && rect.top == 0 && - rect.right == GetDeviceCaps( ref_dc, DESKTOPHORZRES ) && - rect.bottom == GetDeviceCaps( ref_dc, DESKTOPVERTRES ), - "GetClipBox returned %d,%d,%d,%d on %s\n", - rect.left, rect.top, rect.right, rect.bottom, descr ); + if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY) + { + if (GetSystemMetrics( SM_CXSCREEN ) != GetSystemMetrics( SM_CXVIRTUALSCREEN )) + todo_wine ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetSystemMetrics( SM_CXSCREEN ), + "Got DESKTOPHORZRES %d on %s, expected %d\n", + GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetSystemMetrics( SM_CXSCREEN ) ); + else + ok( GetDeviceCaps( ref_dc, DESKTOPHORZRES ) == GetSystemMetrics( SM_CXSCREEN ), + "Got DESKTOPHORZRES %d on %s, expected %d\n", + GetDeviceCaps( ref_dc, DESKTOPHORZRES ), descr, GetSystemMetrics( SM_CXSCREEN ) ); + + if (GetSystemMetrics( SM_CYSCREEN ) != GetSystemMetrics( SM_CYVIRTUALSCREEN )) + todo_wine ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetSystemMetrics( SM_CYSCREEN ), + "Got DESKTOPVERTRES %d on %s, expected %d\n", + GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetSystemMetrics( SM_CYSCREEN ) ); + else + ok( GetDeviceCaps( ref_dc, DESKTOPVERTRES ) == GetSystemMetrics( SM_CYSCREEN ), + "Got DESKTOPVERTRES %d on %s, expected %d\n", + GetDeviceCaps( ref_dc, DESKTOPVERTRES ), descr, GetSystemMetrics( SM_CYSCREEN ) ); + + SetRect( &ref_rect, GetSystemMetrics( SM_XVIRTUALSCREEN ), GetSystemMetrics( SM_YVIRTUALSCREEN ), + GetSystemMetrics( SM_XVIRTUALSCREEN ) + GetSystemMetrics( SM_CXVIRTUALSCREEN ), + GetSystemMetrics( SM_YVIRTUALSCREEN ) + GetSystemMetrics( SM_CYVIRTUALSCREEN ) ); + } + else + { + SetRect( &ref_rect, 0, 0, GetDeviceCaps( ref_dc, DESKTOPHORZRES ), + GetDeviceCaps( ref_dc, DESKTOPVERTRES ) ); + } + + if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY && GetObjectType( hdc ) != OBJ_ENHMETADC && + (GetSystemMetrics( SM_XVIRTUALSCREEN ) || GetSystemMetrics( SM_YVIRTUALSCREEN ))) + todo_wine ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %d,%d,%d,%d on %s\n", + rect.left, rect.top, rect.right, rect.bottom, descr ); + else + ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %d,%d,%d,%d on %s\n", + rect.left, rect.top, rect.right, rect.bottom, descr ); } SetBoundsRect( ref_dc, NULL, DCB_RESET | DCB_ACCUMULATE ); diff -Nru wine1.7-1.7.13/dlls/gdi32/tests/font.c wine1.7-1.7.16/dlls/gdi32/tests/font.c --- wine1.7-1.7.13/dlls/gdi32/tests/font.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdi32/tests/font.c 2014-04-04 19:13:44.000000000 +0000 @@ -1190,8 +1190,6 @@ {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE}}, {HANGEUL_CHARSET, 0x8141, 0xac02, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE}}, - {JOHAB_CHARSET, 0x8446, 0x3135, - {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE}}, {GB2312_CHARSET, 0x8141, 0x4e04, {TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE}}, {CHINESEBIG5_CHARSET, 0xa142, 0x3001, @@ -2957,7 +2955,7 @@ if (TranslateCharsetInfo(ULongToPtr(target->lfCharSet), &csi, TCI_SRCCHARSET)) { fs = ntm->ntmFontSig.fsCsb[0] & valid_bits; - if ((fs & csi.fs.fsCsb[0]) && (fs & ~csi.fs.fsCsb[0])) { + if ((fs & csi.fs.fsCsb[0]) && (fs & ~csi.fs.fsCsb[0]) && (fs & FS_LATIN1)) { *target = *lf; return FALSE; } @@ -2998,13 +2996,13 @@ { struct enum_font_data efd; LOGFONTA target, enum_font; - DWORD ret; + UINT acp; HDC hdc; CHARSETINFO csi; - ret = GetACP(); - if (!TranslateCharsetInfo(ULongToPtr(ret), &csi, TCI_SRCCODEPAGE)) { - skip("TranslateCharsetInfo failed for code page %d.\n", ret); + acp = GetACP(); + if (!TranslateCharsetInfo(ULongToPtr(acp), &csi, TCI_SRCCODEPAGE)) { + skip("TranslateCharsetInfo failed for code page %u.\n", acp); return; } @@ -3018,6 +3016,10 @@ skip("suitable font isn't found for charset %d.\n", enum_font.lfCharSet); return; } + if (acp == 874 || acp == 1255 || acp == 1256) { + /* these codepage use complex script, expecting ANSI_CHARSET here. */ + target.lfCharSet = ANSI_CHARSET; + } efd.total = 0; memset(&enum_font, 0, sizeof(enum_font)); @@ -4127,7 +4129,6 @@ {ANSI_CHARSET, 0x30, 0x30}, {SHIFTJIS_CHARSET, 0x82a0, 0x3042}, {HANGEUL_CHARSET, 0x8141, 0xac02}, - {JOHAB_CHARSET, 0x8446, 0x3135}, {GB2312_CHARSET, 0x8141, 0x4e04}, {CHINESEBIG5_CHARSET, 0xa142, 0x3001} }; diff -Nru wine1.7-1.7.13/dlls/gdiplus/brush.c wine1.7-1.7.16/dlls/gdiplus/brush.c --- wine1.7-1.7.13/dlls/gdiplus/brush.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdiplus/brush.c 2014-04-04 19:13:44.000000000 +0000 @@ -745,8 +745,6 @@ /****************************************************************************** * GdipCreateTextureIA [GDIPLUS.@] - * - * FIXME: imageattr ignored */ GpStatus WINGDIPAPI GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageattr, REAL x, REAL y, REAL width, @@ -844,6 +842,7 @@ imageattr->wrap = wrapmode; stat = GdipCreateTextureIA(image, imageattr, x, y, width, height, texture); + GdipDisposeImageAttributes(imageattr); } return stat; diff -Nru wine1.7-1.7.13/dlls/gdiplus/graphics.c wine1.7-1.7.16/dlls/gdiplus/graphics.c --- wine1.7-1.7.13/dlls/gdiplus/graphics.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdiplus/graphics.c 2014-04-04 19:13:44.000000000 +0000 @@ -1243,7 +1243,7 @@ INT min_y, max_y, min_x, max_x; INT x, y; ARGB outer_color; - static int transform_fixme_once; + static BOOL transform_fixme_once; if (fill->focus.X != 0.0 || fill->focus.Y != 0.0) { @@ -1280,7 +1280,7 @@ if (!is_identity) { FIXME("path gradient transform not implemented\n"); - transform_fixme_once = 1; + transform_fixme_once = TRUE; } } @@ -1314,7 +1314,7 @@ for (i=0; ipathdata.Count; i++) { int start_center_line=0, end_center_line=0; - int seen_start=0, seen_end=0, seen_center=0; + BOOL seen_start = FALSE, seen_end = FALSE, seen_center = FALSE; REAL center_distance; ARGB start_color, end_color; REAL dy, dx; @@ -1374,17 +1374,17 @@ if (!seen_start && yf >= start_point.Y) { - seen_start = 1; + seen_start = TRUE; start_center_line ^= 1; } if (!seen_end && yf >= end_point.Y) { - seen_end = 1; + seen_end = TRUE; end_center_line ^= 1; } if (!seen_center && yf >= center_point.Y) { - seen_center = 1; + seen_center = TRUE; start_center_line ^= 1; end_center_line ^= 1; } @@ -2781,9 +2781,33 @@ debugstr_pointf(&points[2])); memcpy(ptf, points, 3 * sizeof(GpPointF)); + + /* Ensure source width/height is positive */ + if (srcwidth < 0) + { + GpPointF tmp = ptf[1]; + srcx = srcx + srcwidth; + srcwidth = -srcwidth; + ptf[2].X = ptf[2].X + ptf[1].X - ptf[0].X; + ptf[2].Y = ptf[2].Y + ptf[1].Y - ptf[0].Y; + ptf[1] = ptf[0]; + ptf[0] = tmp; + } + + if (srcheight < 0) + { + GpPointF tmp = ptf[2]; + srcy = srcy + srcheight; + srcheight = -srcheight; + ptf[1].X = ptf[1].X + ptf[2].X - ptf[0].X; + ptf[1].Y = ptf[1].Y + ptf[2].Y - ptf[0].Y; + ptf[2] = ptf[0]; + ptf[0] = tmp; + } + ptf[3].X = ptf[2].X + ptf[1].X - ptf[0].X; ptf[3].Y = ptf[2].Y + ptf[1].Y - ptf[0].Y; - if (!srcwidth || !srcheight || ptf[3].X == ptf[0].X || ptf[3].Y == ptf[0].Y) + if (!srcwidth || !srcheight || (ptf[3].X == ptf[0].X && ptf[3].Y == ptf[0].Y)) return Ok; transform_and_round_points(graphics, pti, ptf, 4); @@ -2815,7 +2839,7 @@ else if (image->type == ImageTypeBitmap) { GpBitmap* bitmap = (GpBitmap*)image; - int use_software=0; + BOOL use_software = FALSE; TRACE("graphics: %.2fx%.2f dpi, fmt %#x, scale %f, image: %.2fx%.2f dpi, fmt %#x, color %08x\n", graphics->xres, graphics->yres, @@ -2829,11 +2853,12 @@ ptf[1].X - ptf[0].X != srcwidth || ptf[2].Y - ptf[0].Y != srcheight || srcx < 0 || srcy < 0 || srcx + srcwidth > bitmap->width || srcy + srcheight > bitmap->height) - use_software = 1; + use_software = TRUE; if (use_software) { RECT dst_area; + GpRectF graphics_bounds; GpRect src_area; int i, x, y, src_stride, dst_stride; GpMatrix dst_to_src; @@ -2859,8 +2884,18 @@ if (dst_area.bottom < pti[i].y) dst_area.bottom = pti[i].y; } + stat = get_graphics_bounds(graphics, &graphics_bounds); + if (stat != Ok) return stat; + + if (graphics_bounds.X > dst_area.left) dst_area.left = floorf(graphics_bounds.X); + if (graphics_bounds.Y > dst_area.top) dst_area.top = floorf(graphics_bounds.Y); + if (graphics_bounds.X + graphics_bounds.Width < dst_area.right) dst_area.right = ceilf(graphics_bounds.X + graphics_bounds.Width); + if (graphics_bounds.Y + graphics_bounds.Height < dst_area.bottom) dst_area.bottom = ceilf(graphics_bounds.Y + graphics_bounds.Height); + TRACE("dst_area: %s\n", wine_dbgstr_rect(&dst_area)); + if (IsRectEmpty(&dst_area)) return Ok; + m11 = (ptf[1].X - ptf[0].X) / srcwidth; m21 = (ptf[2].X - ptf[0].X) / srcheight; mdx = ptf[0].X - m11 * srcx - m21 * srcy; @@ -2906,8 +2941,7 @@ if (stat != Ok) { - if (src_data != dst_data) - GdipFree(src_data); + GdipFree(src_data); GdipFree(dst_data); return stat; } @@ -2956,7 +2990,7 @@ else { HDC hdc; - int temp_hdc=0, temp_bitmap=0; + BOOL temp_hdc = FALSE, temp_bitmap = FALSE; HBITMAP hbitmap, old_hbm=NULL; if (!(bitmap->format == PixelFormat16bppRGB555 || @@ -2970,8 +3004,8 @@ /* we can't draw a bitmap of this format directly */ hdc = CreateCompatibleDC(0); - temp_hdc = 1; - temp_bitmap = 1; + temp_hdc = TRUE; + temp_bitmap = TRUE; bih.biSize = sizeof(BITMAPINFOHEADER); bih.biWidth = bitmap->width; @@ -3005,7 +3039,7 @@ else { GdipCreateHBITMAPFromBitmap(bitmap, &hbitmap, 0); - temp_bitmap = 1; + temp_bitmap = TRUE; } hdc = bitmap->hdc; @@ -4357,7 +4391,7 @@ INT *hotkeyprefix_offsets=NULL; INT hotkeyprefix_count=0; INT hotkeyprefix_pos=0, hotkeyprefix_end_pos=0; - int seen_prefix=0; + BOOL seen_prefix = FALSE; if(length == -1) length = lstrlenW(string); @@ -4404,11 +4438,11 @@ hotkeyprefix_offsets[hotkeyprefix_count++] = j; else if (!seen_prefix && hkprefix != HotkeyPrefixNone && string[i] == '&') { - seen_prefix = 1; + seen_prefix = TRUE; continue; } - seen_prefix = 0; + seen_prefix = FALSE; stringdup[j] = string[i]; j++; diff -Nru wine1.7-1.7.13/dlls/gdiplus/image.c wine1.7-1.7.16/dlls/gdiplus/image.c --- wine1.7-1.7.13/dlls/gdiplus/image.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdiplus/image.c 2014-04-04 19:13:44.000000000 +0000 @@ -1252,6 +1252,28 @@ srcBitmap->stride, srcBitmap->bits + srcBitmap->stride * area.Y + PIXELFORMATBPP(srcBitmap->format) * area.X / 8, srcBitmap->format, srcBitmap->image.palette); + + if (stat == Ok && srcBitmap->image.palette) + { + ColorPalette *src_palette, *dst_palette; + + src_palette = srcBitmap->image.palette; + + dst_palette = GdipAlloc(sizeof(UINT) * 2 + sizeof(ARGB) * src_palette->Count); + + if (dst_palette) + { + dst_palette->Flags = src_palette->Flags; + dst_palette->Count = src_palette->Count; + memcpy(dst_palette->Entries, src_palette->Entries, sizeof(ARGB) * src_palette->Count); + + GdipFree((*dstBitmap)->image.palette); + (*dstBitmap)->image.palette = dst_palette; + } + else + stat = OutOfMemory; + } + if (stat != Ok) GdipDisposeImage((GpImage*)*dstBitmap); } @@ -4714,7 +4736,7 @@ GpBitmap *new_bitmap; GpBitmap *bitmap; int bpp, bytesperpixel; - int rotate_90, flip_x, flip_y; + BOOL rotate_90, flip_x, flip_y; int src_x_offset, src_y_offset; LPBYTE src_origin; UINT x, y, width, height; diff -Nru wine1.7-1.7.13/dlls/gdiplus/metafile.c wine1.7-1.7.16/dlls/gdiplus/metafile.c --- wine1.7-1.7.13/dlls/gdiplus/metafile.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdiplus/metafile.c 2014-04-04 19:13:44.000000000 +0000 @@ -363,7 +363,7 @@ { EmfPlusFillRects *record; GpStatus stat; - BOOL integer_rects=1; + BOOL integer_rects = TRUE; int i; DWORD brushid; int flags = 0; @@ -383,7 +383,7 @@ { if (!is_integer_rect(&rects[i])) { - integer_rects = 0; + integer_rects = FALSE; break; } } diff -Nru wine1.7-1.7.13/dlls/gdiplus/pathiterator.c wine1.7-1.7.16/dlls/gdiplus/pathiterator.c --- wine1.7-1.7.13/dlls/gdiplus/pathiterator.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdiplus/pathiterator.c 2014-04-04 19:13:44.000000000 +0000 @@ -217,7 +217,7 @@ if(iterator->subpath_pos == count){ *startIndex = *endIndex = *resultCount = 0; - *isClosed = 1; + *isClosed = TRUE; return Ok; } diff -Nru wine1.7-1.7.13/dlls/gdiplus/tests/image.c wine1.7-1.7.16/dlls/gdiplus/tests/image.c --- wine1.7-1.7.13/dlls/gdiplus/tests/image.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/gdiplus/tests/image.c 2014-04-04 19:13:44.000000000 +0000 @@ -3213,8 +3213,10 @@ ok(td[i].id == prop_item->id, "%u: expected id %#x, got %#x\n", i, td[i].id, prop_item->id); prop_size -= sizeof(*prop_item); ok(prop_item->length == prop_size, "%u: expected length %u, got %u\n", i, prop_size, prop_item->length); - ok(td[i].length == prop_item->length, "%u: expected length %u, got %u\n", i, td[i].length, prop_item->length); - ok(td[i].length == prop_size, "%u: expected length %u, got %u\n", i, td[i].length, prop_size); + ok(td[i].length == prop_item->length || broken(td[i].id == 0xf00f && td[i].length == prop_item->length+1) /* XP */, + "%u: expected length %u, got %u\n", i, td[i].length, prop_item->length); + ok(td[i].length == prop_size || broken(td[i].id == 0xf00f && td[i].length == prop_size+1) /* XP */, + "%u: expected length %u, got %u\n", i, td[i].length, prop_size); if (td[i].length == prop_item->length) { int match = memcmp(td[i].value, prop_item->value, td[i].length) == 0; diff -Nru wine1.7-1.7.13/dlls/hhctrl.ocx/hhctrl.c wine1.7-1.7.16/dlls/hhctrl.ocx/hhctrl.c --- wine1.7-1.7.13/dlls/hhctrl.ocx/hhctrl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/hhctrl.ocx/hhctrl.c 2014-04-04 19:13:44.000000000 +0000 @@ -203,7 +203,20 @@ case HH_DISPLAY_TOPIC: case HH_DISPLAY_TOC: if (data) - index = (const WCHAR *)data; + { + static const WCHAR delimW[] = {':',':',0}; + const WCHAR *i = (const WCHAR *)data; + + index = strstrW(i, delimW); + if(index) + { + if(memcmp(info->pCHMInfo->szFile, i, index-i)) + FIXME("Opening a CHM file in the context of another is not supported.\n"); + index += strlenW(delimW); + } + else + index = i; + } break; } diff -Nru wine1.7-1.7.13/dlls/hhctrl.ocx/stream.c wine1.7-1.7.16/dlls/hhctrl.ocx/stream.c --- wine1.7-1.7.13/dlls/hhctrl.ocx/stream.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/hhctrl.ocx/stream.c 2014-04-04 19:13:44.000000000 +0000 @@ -110,12 +110,52 @@ return TRUE; } +static BOOL find_node_end(stream_t *stream, strbuf_t *buf) +{ + int tag_count = 0, b = buf->len; + char *p; + + while(1) + { + if(!stream_chr(stream, buf, '>')) + return FALSE; + if(buf->len == 0) + break; + p = &buf->buf[b]; + while((p = memchr(p+1, '"', buf->len-(p-buf->buf))) != NULL) + tag_count++; + b = buf->len; + if(tag_count % 2 != 0) + { + if(!stream_chr(stream, buf, '"')) + return FALSE; + tag_count++; + } + else + break; + } + return TRUE; +} + BOOL next_node(stream_t *stream, strbuf_t *buf) { + strbuf_t tmpbuf; + + /* search through the end of the current node */ + strbuf_init(&tmpbuf); + if(!find_node_end(stream, &tmpbuf)) + { + strbuf_free(&tmpbuf); + return FALSE; + } + strbuf_free(&tmpbuf); + + /* find the beginning of the next node */ if(!stream_chr(stream, NULL, '<')) return FALSE; - if(!stream_chr(stream, buf, '>')) + /* read out the data of the next node */ + if(!find_node_end(stream, buf)) return FALSE; strbuf_append(buf, ">", 2); diff -Nru wine1.7-1.7.13/dlls/hlink/hlink_main.c wine1.7-1.7.16/dlls/hlink/hlink_main.c --- wine1.7-1.7.13/dlls/hlink/hlink_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/hlink/hlink_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -380,6 +380,8 @@ HRESULT WINAPI HlinkParseDisplayName(LPBC pibc, LPCWSTR pwzDisplayName, BOOL fNoForceAbs, ULONG *pcchEaten, IMoniker **ppimk) { + static const WCHAR file_colonW[] = {'f','i','l','e',':'}; + ULONG eaten = 0; HRESULT hres; TRACE("(%p %s %x %p %p)\n", pibc, debugstr_w(pwzDisplayName), fNoForceAbs, pcchEaten, ppimk); @@ -387,17 +389,27 @@ if(fNoForceAbs) FIXME("Unsupported fNoForceAbs\n"); - hres = MkParseDisplayNameEx(pibc, pwzDisplayName, pcchEaten, ppimk); - if(SUCCEEDED(hres)) - return hres; - - hres = MkParseDisplayName(pibc, pwzDisplayName, pcchEaten, ppimk); - if(SUCCEEDED(hres)) - return hres; + if(!strncmpiW(pwzDisplayName, file_colonW, sizeof(file_colonW)/sizeof(WCHAR))) { + pwzDisplayName += sizeof(file_colonW)/sizeof(WCHAR); + eaten += sizeof(file_colonW)/sizeof(WCHAR); + + while(*pwzDisplayName == '/') { + pwzDisplayName++; + eaten++; + } + }else { + hres = MkParseDisplayNameEx(pibc, pwzDisplayName, pcchEaten, ppimk); + if(SUCCEEDED(hres)) + return hres; + + hres = MkParseDisplayName(pibc, pwzDisplayName, pcchEaten, ppimk); + if(SUCCEEDED(hres)) + return hres; + } hres = CreateFileMoniker(pwzDisplayName, ppimk); if(SUCCEEDED(hres)) - *pcchEaten = strlenW(pwzDisplayName); + *pcchEaten = eaten + strlenW(pwzDisplayName); return hres; } diff -Nru wine1.7-1.7.13/dlls/hlink/tests/hlink.c wine1.7-1.7.16/dlls/hlink/tests/hlink.c --- wine1.7-1.7.13/dlls/hlink/tests/hlink.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/hlink/tests/hlink.c 2014-04-04 19:13:44.000000000 +0000 @@ -626,6 +626,8 @@ static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':', '2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8', '-','0','8','0','0','2','B','3','0','3','0','9','D',':',0}; + static const WCHAR file_urlW[] = + {'f','i','l','e',':','/','/','/','c',':','\\','f','i','l','e','.','t','x','t',0}; CreateBindCtx(0, &bctx); @@ -657,7 +659,7 @@ IMoniker_Release(mon); hres = HlinkParseDisplayName(bctx, invalid_urlW, FALSE, &eaten, &mon); - ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres); + ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres); ok(eaten == sizeof(invalid_urlW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten); ok(mon != NULL, "mon == NULL\n"); @@ -667,6 +669,22 @@ CoTaskMemFree(name); hres = IMoniker_IsSystemMoniker(mon, &issys); + ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres); + ok(issys == MKSYS_FILEMONIKER, "issys=%x\n", issys); + + IMoniker_Release(mon); + + hres = HlinkParseDisplayName(bctx, file_urlW, FALSE, &eaten, &mon); + ok(hres == S_OK, "HlinkParseDisplayName failed: %08x\n", hres); + ok(eaten == sizeof(file_urlW)/sizeof(WCHAR)-1, "eaten=%d\n", eaten); + ok(mon != NULL, "mon == NULL\n"); + + hres = IMoniker_GetDisplayName(mon, bctx, 0, &name); + ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres); + ok(!lstrcmpW(name, file_urlW+8), "wrong display name %s\n", wine_dbgstr_w(name)); + CoTaskMemFree(name); + + hres = IMoniker_IsSystemMoniker(mon, &issys); ok(hres == S_OK, "IsSystemMoniker failed: %08x\n", hres); ok(issys == MKSYS_FILEMONIKER, "issys=%x\n", issys); diff -Nru wine1.7-1.7.13/dlls/ieframe/ieframe.h wine1.7-1.7.16/dlls/ieframe/ieframe.h --- wine1.7-1.7.13/dlls/ieframe/ieframe.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ieframe/ieframe.h 2014-04-04 19:13:44.000000000 +0000 @@ -58,7 +58,7 @@ IHlinkFrame IHlinkFrame_iface; ITargetFrame2 ITargetFrame2_iface; ITargetFramePriv2 ITargetFramePriv2_iface; - IWebBrowserPriv2IE8 IWebBrowserPriv2IE8_iface; + IWebBrowserPriv2IE9 IWebBrowserPriv2IE9_iface; IUnknown *outer; DocHost *doc_host; diff -Nru wine1.7-1.7.13/dlls/ieframe/navigate.c wine1.7-1.7.16/dlls/ieframe/navigate.c --- wine1.7-1.7.13/dlls/ieframe/navigate.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ieframe/navigate.c 2014-04-04 19:13:44.000000000 +0000 @@ -1451,107 +1451,43 @@ TargetFramePriv2_AggregatedNavigation2 }; -static inline HlinkFrame *impl_from_IWebBrowserPriv2IE8(IWebBrowserPriv2IE8 *iface) +static inline HlinkFrame *impl_from_IWebBrowserPriv2IE9(IWebBrowserPriv2IE9 *iface) { - return CONTAINING_RECORD(iface, HlinkFrame, IWebBrowserPriv2IE8_iface); + return CONTAINING_RECORD(iface, HlinkFrame, IWebBrowserPriv2IE9_iface); } -static HRESULT WINAPI WebBrowserPriv2IE8_QueryInterface(IWebBrowserPriv2IE8 *iface, REFIID riid, void **ppv) +static HRESULT WINAPI WebBrowserPriv2IE9_QueryInterface(IWebBrowserPriv2IE9 *iface, REFIID riid, void **ppv) { - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); + HlinkFrame *This = impl_from_IWebBrowserPriv2IE9(iface); return IUnknown_QueryInterface(This->outer, riid, ppv); } -static ULONG WINAPI WebBrowserPriv2IE8_AddRef(IWebBrowserPriv2IE8 *iface) +static ULONG WINAPI WebBrowserPriv2IE9_AddRef(IWebBrowserPriv2IE9 *iface) { - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); + HlinkFrame *This = impl_from_IWebBrowserPriv2IE9(iface); return IUnknown_AddRef(This->outer); } -static ULONG WINAPI WebBrowserPriv2IE8_Release(IWebBrowserPriv2IE8 *iface) +static ULONG WINAPI WebBrowserPriv2IE9_Release(IWebBrowserPriv2IE9 *iface) { - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); + HlinkFrame *This = impl_from_IWebBrowserPriv2IE9(iface); return IUnknown_Release(This->outer); } -static HRESULT WINAPI WebBrowserPriv2IE8_NavigateWithBindCtx2(IWebBrowserPriv2IE8 *iface, IUri *uri, VARIANT *flags, - VARIANT *target_frame, VARIANT *post_data, VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment) +static HRESULT WINAPI WebBrowserPriv2IE9_NavigateWithBindCtx2(IWebBrowserPriv2IE9 *iface, IUri *uri, VARIANT *flags, + VARIANT *target_frame, VARIANT *post_data, VARIANT *headers, IBindCtx *bind_ctx, LPOLESTR url_fragment, DWORD unused) { - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); + HlinkFrame *This = impl_from_IWebBrowserPriv2IE9(iface); FIXME("(%p)->(%p %s %s %s %s %p %s)\n", This, uri, debugstr_variant(flags), debugstr_variant(target_frame), debugstr_variant(post_data), debugstr_variant(headers), bind_ctx, debugstr_w(url_fragment)); return E_NOTIMPL; } -static HRESULT WINAPI WebBrowserPriv2IE8_SetBrowserFrameOptions(IWebBrowserPriv2IE8 *iface, DWORD opt1, DWORD opt2) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->(%x %x)\n", This, opt1, opt2); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_DetachConnectionPoints(IWebBrowserPriv2IE8 *iface) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_GetProcessId(IWebBrowserPriv2IE8 *iface, DWORD *pid) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->(%p)\n", This, pid); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_CompatAttachEditEvents(IWebBrowserPriv2IE8 *iface) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_HandleOpenOptions(IWebBrowserPriv2IE8 *iface, IUnknown *obj, BSTR bstr, int options) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->(%p %s %x)\n", This, obj, debugstr_w(bstr), options); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_SetSearchTerm(IWebBrowserPriv2IE8 *iface, BSTR term) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(term)); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_GetSearchTerm(IWebBrowserPriv2IE8 *iface, BSTR *term) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->(%p)\n", This, term); - return E_NOTIMPL; -} - -static HRESULT WINAPI WebBrowserPriv2IE8_GetCurrentDocument(IWebBrowserPriv2IE8 *iface, IDispatch **doc) -{ - HlinkFrame *This = impl_from_IWebBrowserPriv2IE8(iface); - FIXME("(%p)->(%p)\n", This, doc); - return E_NOTIMPL; -} - -static const IWebBrowserPriv2IE8Vtbl WebBrowserPriv2IE8Vtbl = { - WebBrowserPriv2IE8_QueryInterface, - WebBrowserPriv2IE8_AddRef, - WebBrowserPriv2IE8_Release, - WebBrowserPriv2IE8_NavigateWithBindCtx2, - WebBrowserPriv2IE8_SetBrowserFrameOptions, - WebBrowserPriv2IE8_DetachConnectionPoints, - WebBrowserPriv2IE8_GetProcessId, - WebBrowserPriv2IE8_CompatAttachEditEvents, - WebBrowserPriv2IE8_HandleOpenOptions, - WebBrowserPriv2IE8_SetSearchTerm, - WebBrowserPriv2IE8_GetSearchTerm, - WebBrowserPriv2IE8_GetCurrentDocument +static const IWebBrowserPriv2IE9Vtbl WebBrowserPriv2IE9Vtbl = { + WebBrowserPriv2IE9_QueryInterface, + WebBrowserPriv2IE9_AddRef, + WebBrowserPriv2IE9_Release, + WebBrowserPriv2IE9_NavigateWithBindCtx2 }; BOOL HlinkFrame_QI(HlinkFrame *This, REFIID riid, void **ppv) @@ -1568,9 +1504,9 @@ }else if(IsEqualGUID(&IID_ITargetFramePriv2, riid)) { TRACE("(%p)->(IID_ITargetFramePriv2 %p)\n", This, ppv); *ppv = &This->ITargetFramePriv2_iface; - }else if(IsEqualGUID(&IID_IWebBrowserPriv2IE8, riid)) { - TRACE("(%p)->(IID_IWebBrowserPriv2IE8 %p)\n", This, ppv); - *ppv = &This->IWebBrowserPriv2IE8_iface; + }else if(IsEqualGUID(&IID_IWebBrowserPriv2IE9, riid)) { + TRACE("(%p)->(IID_IWebBrowserPriv2IE9 %p)\n", This, ppv); + *ppv = &This->IWebBrowserPriv2IE9_iface; }else { return FALSE; } @@ -1584,7 +1520,7 @@ This->IHlinkFrame_iface.lpVtbl = &HlinkFrameVtbl; This->ITargetFrame2_iface.lpVtbl = &TargetFrame2Vtbl; This->ITargetFramePriv2_iface.lpVtbl = &TargetFramePriv2Vtbl; - This->IWebBrowserPriv2IE8_iface.lpVtbl = &WebBrowserPriv2IE8Vtbl; + This->IWebBrowserPriv2IE9_iface.lpVtbl = &WebBrowserPriv2IE9Vtbl; This->outer = outer; This->doc_host = doc_host; diff -Nru wine1.7-1.7.13/dlls/ieframe/tests/webbrowser.c wine1.7-1.7.16/dlls/ieframe/tests/webbrowser.c --- wine1.7-1.7.13/dlls/ieframe/tests/webbrowser.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ieframe/tests/webbrowser.c 2014-04-04 19:13:44.000000000 +0000 @@ -419,10 +419,12 @@ CHECK_EXPECT(Exec_IDM_STOP); return OLECMDERR_E_NOTSUPPORTED; case OLECMDID_UPDATETRAVELENTRY_DATARECOVERY: + case OLECMDID_PAGEAVAILABLE: /* TODO (IE11) */ + return E_NOTIMPL; case 6058: /* TODO */ return E_NOTIMPL; default: - ok(0, "unexpected nsCmdID %d\n", nCmdID); + ok(0, "unexpected nCmdID %d\n", nCmdID); } }else if(IsEqualGUID(&CGID_Explorer, pguidCmdGroup)) { switch(nCmdID) { @@ -437,6 +439,7 @@ case 101: /* TODO (IE8) */ case 109: /* TODO (IE9) */ case 113: /* TODO (IE10) */ + case 119: /* IE11 */ return E_FAIL; default: ok(0, "unexpected nCmdID %d\n", nCmdID); @@ -444,11 +447,14 @@ }else if(IsEqualGUID(&CGID_ShellDocView, pguidCmdGroup)) { switch(nCmdID) { case 105: /* TODO */ + case 133: /* IE11 */ case 134: /* TODO (IE10) */ + case 135: /* IE11 */ case 136: /* TODO (IE10) */ case 138: /* TODO */ case 140: /* TODO (Win7) */ case 144: /* TODO */ + case 178: /* IE11 */ return E_FAIL; default: ok(0, "unexpected nCmdID %d\n", nCmdID); @@ -3424,6 +3430,10 @@ trace("GoForward...\n"); test_go_forward(webbrowser, "http://test.winehq.org/tests/winehq_snapshot/"); test_download(DWL_FROM_GOFORWARD|DWL_HTTP); + }else { + trace("Navigate2 repeated with the same URL...\n"); + test_Navigate2(webbrowser, "about:blank"); + test_download(DWL_EXPECT_BEFORE_NAVIGATE); } test_EnumVerbs(webbrowser); diff -Nru wine1.7-1.7.13/dlls/imm32/imm.c wine1.7-1.7.16/dlls/imm32/imm.c --- wine1.7-1.7.13/dlls/imm32/imm.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/imm32/imm.c 2014-04-04 19:13:44.000000000 +0000 @@ -696,6 +696,9 @@ /* Initialize the IME Private */ new_context->IMC.hPrivate = ImmCreateIMCC(new_context->immKbd->imeInfo.dwPrivateDataSize); + new_context->IMC.fdwConversion = new_context->immKbd->imeInfo.fdwConversionCaps; + new_context->IMC.fdwSentence = new_context->immKbd->imeInfo.fdwSentenceCaps; + if (!new_context->immKbd->pImeSelect(new_context, TRUE)) { TRACE("Selection of IME failed\n"); diff -Nru wine1.7-1.7.13/dlls/jscript/jsutils.c wine1.7-1.7.16/dlls/jscript/jsutils.c --- wine1.7-1.7.13/dlls/jscript/jsutils.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/jscript/jsutils.c 2014-04-04 19:13:44.000000000 +0000 @@ -327,6 +327,9 @@ *r = jsval_disp(disp); return S_OK; } + }else { + *r = jsval_disp(NULL); + return S_OK; } /* fall through */ default: diff -Nru wine1.7-1.7.13/dlls/jscript/tests/run.c wine1.7-1.7.16/dlls/jscript/tests/run.c --- wine1.7-1.7.13/dlls/jscript/tests/run.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/jscript/tests/run.c 2014-04-04 19:13:44.000000000 +0000 @@ -1156,7 +1156,7 @@ return S_OK; case DISPID_GLOBAL_TESTARGTYPES: { - VARIANT args[3]; + VARIANT args[4]; DISPPARAMS dp = {args, NULL, sizeof(args)/sizeof(*args), 0}; HRESULT hres; @@ -1190,6 +1190,8 @@ V_INT(args+1) = 22; V_VT(args+2) = VT_UNKNOWN; V_UNKNOWN(args+2) = (IUnknown*)&testObj; + V_VT(args+3) = VT_UNKNOWN; + V_UNKNOWN(args+3) = NULL; hres = IDispatch_Invoke(V_DISPATCH(pdp->rgvarg), DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dp, NULL, NULL, NULL); ok(hres == S_OK, "Invoke failed: %08x\n", hres); @@ -2140,10 +2142,12 @@ CHECK_CALLED(global_propargput_i); SET_EXPECT(global_testargtypes_i); - parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp, function(d,i,s) {" + parse_script_a("testArgTypes(dispUnk, intProp(), intProp, getShort(), shortProp, function(nullunk,d,i,s) {" " ok(getVT(i) === 'VT_I4', 'getVT(i) = ' + getVT(i));" " ok(getVT(s) === 'VT_I4', 'getVT(s) = ' + getVT(s));" " ok(getVT(d) === 'VT_DISPATCH', 'getVT(d) = ' + getVT(d));" + " ok(getVT(nullunk) === 'VT_DISPATCH', 'getVT(nullunk) = ' + getVT(nullunk));" + " ok(nullunk === null, 'nullunk !== null');" "});"); CHECK_CALLED(global_testargtypes_i); diff -Nru wine1.7-1.7.13/dlls/kernel32/fiber.c wine1.7-1.7.16/dlls/kernel32/fiber.c --- wine1.7-1.7.13/dlls/kernel32/fiber.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/fiber.c 2014-04-04 19:13:44.000000000 +0000 @@ -230,7 +230,7 @@ } else { - index = RtlFindClearBitsAndSet( peb->FlsBitmap, 1, 0 ); + index = RtlFindClearBitsAndSet( peb->FlsBitmap, 1, 1 ); if (index != ~0U) { if (!NtCurrentTeb()->FlsSlots && @@ -279,7 +279,7 @@ */ PVOID WINAPI FlsGetValue( DWORD index ) { - if (index >= 8 * sizeof(NtCurrentTeb()->Peb->FlsBitmapBits) || !NtCurrentTeb()->FlsSlots) + if (!index || index >= 8 * sizeof(NtCurrentTeb()->Peb->FlsBitmapBits) || !NtCurrentTeb()->FlsSlots) { SetLastError( ERROR_INVALID_PARAMETER ); return NULL; @@ -293,7 +293,7 @@ */ BOOL WINAPI FlsSetValue( DWORD index, PVOID data ) { - if (index >= 8 * sizeof(NtCurrentTeb()->Peb->FlsBitmapBits)) + if (!index || index >= 8 * sizeof(NtCurrentTeb()->Peb->FlsBitmapBits)) { SetLastError( ERROR_INVALID_PARAMETER ); return FALSE; diff -Nru wine1.7-1.7.13/dlls/kernel32/kernel32.spec wine1.7-1.7.16/dlls/kernel32/kernel32.spec --- wine1.7-1.7.13/dlls/kernel32/kernel32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/kernel32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -442,6 +442,7 @@ @ stdcall GetCPInfoExW(long long ptr) @ stdcall GetCalendarInfoA(long long long ptr long ptr) @ stdcall GetCalendarInfoW(long long long ptr long ptr) +@ stdcall GetCalendarInfoEx(wstr long ptr long ptr long ptr) # @ stub GetComPlusPackageInstallStatus @ stdcall GetCommConfig(long ptr long) @ stdcall GetCommMask(long ptr) @@ -939,6 +940,7 @@ @ stub QueryOldestEventLogRecord @ stdcall QueryPerformanceCounter(ptr) @ stdcall QueryPerformanceFrequency(ptr) +@ stdcall QueryUnbiasedInterruptTime(ptr) @ stub QueryWin31IniFilesMappedToRegistry @ stdcall QueueUserAPC(ptr long long) @ stdcall QueueUserWorkItem(ptr ptr long) @@ -1190,6 +1192,7 @@ @ stub SetVolumeMountPointA @ stub SetVolumeMountPointW @ stdcall SetWaitableTimer(long ptr long ptr ptr long) +@ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long) @ stdcall SetupComm(long long long) @ stub ShowConsoleCursor @ stdcall SignalObjectAndWait(long long long long) @@ -1274,6 +1277,7 @@ @ stdcall WerRegisterMemoryBlock(ptr long) @ stdcall WerRegisterRuntimeExceptionModule(wstr ptr) @ stdcall WerSetFlags(long) +@ stdcall WerUnregisterMemoryBlock(ptr) @ stdcall WideCharToMultiByte(long long wstr long ptr long ptr ptr) @ stdcall WinExec(str long) @ stdcall Wow64EnableWow64FsRedirection(long) diff -Nru wine1.7-1.7.13/dlls/kernel32/locale.c wine1.7-1.7.16/dlls/kernel32/locale.c --- wine1.7-1.7.13/dlls/kernel32/locale.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/locale.c 2014-04-04 19:13:44.000000000 +0000 @@ -160,6 +160,107 @@ static LCID lcid_LC_MEASUREMENT; static LCID lcid_LC_TELEPHONE; +static const WCHAR iCalendarTypeW[] = {'i','C','a','l','e','n','d','a','r','T','y','p','e',0}; +static const WCHAR iCountryW[] = {'i','C','o','u','n','t','r','y',0}; +static const WCHAR iCurrDigitsW[] = {'i','C','u','r','r','D','i','g','i','t','s',0}; +static const WCHAR iCurrencyW[] = {'i','C','u','r','r','e','n','c','y',0}; +static const WCHAR iDateW[] = {'i','D','a','t','e',0}; +static const WCHAR iDigitsW[] = {'i','D','i','g','i','t','s',0}; +static const WCHAR iFirstDayOfWeekW[] = {'i','F','i','r','s','t','D','a','y','O','f','W','e','e','k',0}; +static const WCHAR iFirstWeekOfYearW[] = {'i','F','i','r','s','t','W','e','e','k','O','f','Y','e','a','r',0}; +static const WCHAR iLDateW[] = {'i','L','D','a','t','e',0}; +static const WCHAR iLZeroW[] = {'i','L','Z','e','r','o',0}; +static const WCHAR iMeasureW[] = {'i','M','e','a','s','u','r','e',0}; +static const WCHAR iNegCurrW[] = {'i','N','e','g','C','u','r','r',0}; +static const WCHAR iNegNumberW[] = {'i','N','e','g','N','u','m','b','e','r',0}; +static const WCHAR iPaperSizeW[] = {'i','P','a','p','e','r','S','i','z','e',0}; +static const WCHAR iTLZeroW[] = {'i','T','L','Z','e','r','o',0}; +static const WCHAR iTimePrefixW[] = {'i','T','i','m','e','P','r','e','f','i','x',0}; +static const WCHAR iTimeW[] = {'i','T','i','m','e',0}; +static const WCHAR s1159W[] = {'s','1','1','5','9',0}; +static const WCHAR s2359W[] = {'s','2','3','5','9',0}; +static const WCHAR sCountryW[] = {'s','C','o','u','n','t','r','y',0}; +static const WCHAR sCurrencyW[] = {'s','C','u','r','r','e','n','c','y',0}; +static const WCHAR sDateW[] = {'s','D','a','t','e',0}; +static const WCHAR sDecimalW[] = {'s','D','e','c','i','m','a','l',0}; +static const WCHAR sGroupingW[] = {'s','G','r','o','u','p','i','n','g',0}; +static const WCHAR sLanguageW[] = {'s','L','a','n','g','u','a','g','e',0}; +static const WCHAR sListW[] = {'s','L','i','s','t',0}; +static const WCHAR sLongDateW[] = {'s','L','o','n','g','D','a','t','e',0}; +static const WCHAR sMonDecimalSepW[] = {'s','M','o','n','D','e','c','i','m','a','l','S','e','p',0}; +static const WCHAR sMonGroupingW[] = {'s','M','o','n','G','r','o','u','p','i','n','g',0}; +static const WCHAR sMonThousandSepW[] = {'s','M','o','n','T','h','o','u','s','a','n','d','S','e','p',0}; +static const WCHAR sNativeDigitsW[] = {'s','N','a','t','i','v','e','D','i','g','i','t','s',0}; +static const WCHAR sNegativeSignW[] = {'s','N','e','g','a','t','i','v','e','S','i','g','n',0}; +static const WCHAR sPositiveSignW[] = {'s','P','o','s','i','t','i','v','e','S','i','g','n',0}; +static const WCHAR sShortDateW[] = {'s','S','h','o','r','t','D','a','t','e',0}; +static const WCHAR sThousandW[] = {'s','T','h','o','u','s','a','n','d',0}; +static const WCHAR sTimeFormatW[] = {'s','T','i','m','e','F','o','r','m','a','t',0}; +static const WCHAR sTimeW[] = {'s','T','i','m','e',0}; +static const WCHAR sYearMonthW[] = {'s','Y','e','a','r','M','o','n','t','h',0}; +static const WCHAR NumShapeW[] = {'N','u','m','s','h','a','p','e',0}; + +static struct registry_value +{ + DWORD lctype; + const WCHAR *name; + WCHAR *cached_value; +} registry_values[] = +{ + { LOCALE_ICALENDARTYPE, iCalendarTypeW }, + { LOCALE_ICURRDIGITS, iCurrDigitsW }, + { LOCALE_ICURRENCY, iCurrencyW }, + { LOCALE_IDIGITS, iDigitsW }, + { LOCALE_IFIRSTDAYOFWEEK, iFirstDayOfWeekW }, + { LOCALE_IFIRSTWEEKOFYEAR, iFirstWeekOfYearW }, + { LOCALE_ILZERO, iLZeroW }, + { LOCALE_IMEASURE, iMeasureW }, + { LOCALE_INEGCURR, iNegCurrW }, + { LOCALE_INEGNUMBER, iNegNumberW }, + { LOCALE_IPAPERSIZE, iPaperSizeW }, + { LOCALE_ITIME, iTimeW }, + { LOCALE_S1159, s1159W }, + { LOCALE_S2359, s2359W }, + { LOCALE_SCURRENCY, sCurrencyW }, + { LOCALE_SDATE, sDateW }, + { LOCALE_SDECIMAL, sDecimalW }, + { LOCALE_SGROUPING, sGroupingW }, + { LOCALE_SLIST, sListW }, + { LOCALE_SLONGDATE, sLongDateW }, + { LOCALE_SMONDECIMALSEP, sMonDecimalSepW }, + { LOCALE_SMONGROUPING, sMonGroupingW }, + { LOCALE_SMONTHOUSANDSEP, sMonThousandSepW }, + { LOCALE_SNEGATIVESIGN, sNegativeSignW }, + { LOCALE_SPOSITIVESIGN, sPositiveSignW }, + { LOCALE_SSHORTDATE, sShortDateW }, + { LOCALE_STHOUSAND, sThousandW }, + { LOCALE_STIME, sTimeW }, + { LOCALE_STIMEFORMAT, sTimeFormatW }, + { LOCALE_SYEARMONTH, sYearMonthW }, + /* The following are not listed under MSDN as supported, + * but seem to be used and also stored in the registry. + */ + { LOCALE_ICOUNTRY, iCountryW }, + { LOCALE_IDATE, iDateW }, + { LOCALE_ILDATE, iLDateW }, + { LOCALE_ITLZERO, iTLZeroW }, + { LOCALE_SCOUNTRY, sCountryW }, + { LOCALE_SABBREVLANGNAME, sLanguageW }, + /* The following are used in XP and later */ + { LOCALE_IDIGITSUBSTITUTION, NumShapeW }, + { LOCALE_SNATIVEDIGITS, sNativeDigitsW }, + { LOCALE_ITIMEMARKPOSN, iTimePrefixW } +}; + +static CRITICAL_SECTION cache_section; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &cache_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": cache_section") } +}; +static CRITICAL_SECTION cache_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + /* Copy Ascii string to Unicode without using codepages */ static inline void strcpynAtoW( WCHAR *dst, const char *src, size_t n ) { @@ -1023,103 +1124,16 @@ /****************************************************************************** - * get_locale_value_name + * get_locale_registry_value * - * Gets the registry value name for a given lctype. + * Gets the registry value name and cache for a given lctype. */ -static const WCHAR *get_locale_value_name( DWORD lctype ) +static struct registry_value *get_locale_registry_value( DWORD lctype ) { - static const WCHAR iCalendarTypeW[] = {'i','C','a','l','e','n','d','a','r','T','y','p','e',0}; - static const WCHAR iCountryW[] = {'i','C','o','u','n','t','r','y',0}; - static const WCHAR iCurrDigitsW[] = {'i','C','u','r','r','D','i','g','i','t','s',0}; - static const WCHAR iCurrencyW[] = {'i','C','u','r','r','e','n','c','y',0}; - static const WCHAR iDateW[] = {'i','D','a','t','e',0}; - static const WCHAR iDigitsW[] = {'i','D','i','g','i','t','s',0}; - static const WCHAR iFirstDayOfWeekW[] = {'i','F','i','r','s','t','D','a','y','O','f','W','e','e','k',0}; - static const WCHAR iFirstWeekOfYearW[] = {'i','F','i','r','s','t','W','e','e','k','O','f','Y','e','a','r',0}; - static const WCHAR iLDateW[] = {'i','L','D','a','t','e',0}; - static const WCHAR iLZeroW[] = {'i','L','Z','e','r','o',0}; - static const WCHAR iMeasureW[] = {'i','M','e','a','s','u','r','e',0}; - static const WCHAR iNegCurrW[] = {'i','N','e','g','C','u','r','r',0}; - static const WCHAR iNegNumberW[] = {'i','N','e','g','N','u','m','b','e','r',0}; - static const WCHAR iPaperSizeW[] = {'i','P','a','p','e','r','S','i','z','e',0}; - static const WCHAR iTLZeroW[] = {'i','T','L','Z','e','r','o',0}; - static const WCHAR iTimePrefixW[] = {'i','T','i','m','e','P','r','e','f','i','x',0}; - static const WCHAR iTimeW[] = {'i','T','i','m','e',0}; - static const WCHAR s1159W[] = {'s','1','1','5','9',0}; - static const WCHAR s2359W[] = {'s','2','3','5','9',0}; - static const WCHAR sCountryW[] = {'s','C','o','u','n','t','r','y',0}; - static const WCHAR sCurrencyW[] = {'s','C','u','r','r','e','n','c','y',0}; - static const WCHAR sDateW[] = {'s','D','a','t','e',0}; - static const WCHAR sDecimalW[] = {'s','D','e','c','i','m','a','l',0}; - static const WCHAR sGroupingW[] = {'s','G','r','o','u','p','i','n','g',0}; - static const WCHAR sLanguageW[] = {'s','L','a','n','g','u','a','g','e',0}; - static const WCHAR sListW[] = {'s','L','i','s','t',0}; - static const WCHAR sLongDateW[] = {'s','L','o','n','g','D','a','t','e',0}; - static const WCHAR sMonDecimalSepW[] = {'s','M','o','n','D','e','c','i','m','a','l','S','e','p',0}; - static const WCHAR sMonGroupingW[] = {'s','M','o','n','G','r','o','u','p','i','n','g',0}; - static const WCHAR sMonThousandSepW[] = {'s','M','o','n','T','h','o','u','s','a','n','d','S','e','p',0}; - static const WCHAR sNativeDigitsW[] = {'s','N','a','t','i','v','e','D','i','g','i','t','s',0}; - static const WCHAR sNegativeSignW[] = {'s','N','e','g','a','t','i','v','e','S','i','g','n',0}; - static const WCHAR sPositiveSignW[] = {'s','P','o','s','i','t','i','v','e','S','i','g','n',0}; - static const WCHAR sShortDateW[] = {'s','S','h','o','r','t','D','a','t','e',0}; - static const WCHAR sThousandW[] = {'s','T','h','o','u','s','a','n','d',0}; - static const WCHAR sTimeFormatW[] = {'s','T','i','m','e','F','o','r','m','a','t',0}; - static const WCHAR sTimeW[] = {'s','T','i','m','e',0}; - static const WCHAR sYearMonthW[] = {'s','Y','e','a','r','M','o','n','t','h',0}; - static const WCHAR NumShapeW[] = {'N','u','m','s','h','a','p','e',0}; - - switch (lctype) - { - /* These values are used by SetLocaleInfo and GetLocaleInfo, and - * the values are stored in the registry, confirmed under Windows. - */ - case LOCALE_ICALENDARTYPE: return iCalendarTypeW; - case LOCALE_ICURRDIGITS: return iCurrDigitsW; - case LOCALE_ICURRENCY: return iCurrencyW; - case LOCALE_IDIGITS: return iDigitsW; - case LOCALE_IFIRSTDAYOFWEEK: return iFirstDayOfWeekW; - case LOCALE_IFIRSTWEEKOFYEAR: return iFirstWeekOfYearW; - case LOCALE_ILZERO: return iLZeroW; - case LOCALE_IMEASURE: return iMeasureW; - case LOCALE_INEGCURR: return iNegCurrW; - case LOCALE_INEGNUMBER: return iNegNumberW; - case LOCALE_IPAPERSIZE: return iPaperSizeW; - case LOCALE_ITIME: return iTimeW; - case LOCALE_S1159: return s1159W; - case LOCALE_S2359: return s2359W; - case LOCALE_SCURRENCY: return sCurrencyW; - case LOCALE_SDATE: return sDateW; - case LOCALE_SDECIMAL: return sDecimalW; - case LOCALE_SGROUPING: return sGroupingW; - case LOCALE_SLIST: return sListW; - case LOCALE_SLONGDATE: return sLongDateW; - case LOCALE_SMONDECIMALSEP: return sMonDecimalSepW; - case LOCALE_SMONGROUPING: return sMonGroupingW; - case LOCALE_SMONTHOUSANDSEP: return sMonThousandSepW; - case LOCALE_SNEGATIVESIGN: return sNegativeSignW; - case LOCALE_SPOSITIVESIGN: return sPositiveSignW; - case LOCALE_SSHORTDATE: return sShortDateW; - case LOCALE_STHOUSAND: return sThousandW; - case LOCALE_STIME: return sTimeW; - case LOCALE_STIMEFORMAT: return sTimeFormatW; - case LOCALE_SYEARMONTH: return sYearMonthW; - - /* The following are not listed under MSDN as supported, - * but seem to be used and also stored in the registry. - */ - case LOCALE_ICOUNTRY: return iCountryW; - case LOCALE_IDATE: return iDateW; - case LOCALE_ILDATE: return iLDateW; - case LOCALE_ITLZERO: return iTLZeroW; - case LOCALE_SCOUNTRY: return sCountryW; - case LOCALE_SABBREVLANGNAME: return sLanguageW; - - /* The following are used in XP and later */ - case LOCALE_IDIGITSUBSTITUTION: return NumShapeW; - case LOCALE_SNATIVEDIGITS: return sNativeDigitsW; - case LOCALE_ITIMEMARKPOSN: return iTimePrefixW; - } + int i; + for (i=0; i < sizeof(registry_values)/sizeof(registry_values[0]); i++) + if (registry_values[i].lctype == lctype) + return ®istry_values[i]; return NULL; } @@ -1130,7 +1144,7 @@ * Retrieve user-modified locale info from the registry. * Return length, 0 on error, -1 if not found. */ -static INT get_registry_locale_info( LPCWSTR value, LPWSTR buffer, INT len ) +static INT get_registry_locale_info( struct registry_value *registry_value, LPWSTR buffer, INT len ) { DWORD size; INT ret; @@ -1140,54 +1154,92 @@ KEY_VALUE_PARTIAL_INFORMATION *info; static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); - if (!(hkey = create_registry_key())) return -1; - - RtlInitUnicodeString( &nameW, value ); - size = info_size + len * sizeof(WCHAR); + RtlEnterCriticalSection( &cache_section ); - if (!(info = HeapAlloc( GetProcessHeap(), 0, size ))) + if (!registry_value->cached_value) { + if (!(hkey = create_registry_key())) + { + RtlLeaveCriticalSection( &cache_section ); + return -1; + } + + RtlInitUnicodeString( &nameW, registry_value->name ); + size = info_size + len * sizeof(WCHAR); + + if (!(info = HeapAlloc( GetProcessHeap(), 0, size ))) + { + NtClose( hkey ); + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlLeaveCriticalSection( &cache_section ); + return 0; + } + + status = NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, info, size, &size ); + NtClose( hkey ); - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); - return 0; - } - status = NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, info, size, &size ); + if (!status) + { + INT length = (size - info_size) / sizeof(WCHAR); + LPWSTR cached_value; - if (!status) - { - ret = (size - info_size) / sizeof(WCHAR); - /* append terminating null if needed */ - if (!ret || ((WCHAR *)info->Data)[ret-1]) + if (!length || ((WCHAR *)&info->Data)[length-1]) + length++; + + cached_value = HeapAlloc( GetProcessHeap(), 0, length * sizeof(WCHAR) ); + + if (!cached_value) + { + HeapFree( GetProcessHeap(), 0, info ); + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + RtlLeaveCriticalSection( &cache_section ); + return 0; + } + + memcpy( cached_value, info->Data, (length-1) * sizeof(WCHAR) ); + cached_value[length-1] = 0; + HeapFree( GetProcessHeap(), 0, info ); + registry_value->cached_value = cached_value; + } + else { - if (ret < len || !buffer) ret++; + if (status == STATUS_BUFFER_OVERFLOW && !buffer) + { + ret = (size - info_size) / sizeof(WCHAR) + 1; + } + else if (status == STATUS_OBJECT_NAME_NOT_FOUND) + { + ret = -1; + } else { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); + SetLastError( RtlNtStatusToDosError(status) ); ret = 0; } + HeapFree( GetProcessHeap(), 0, info ); + RtlLeaveCriticalSection( &cache_section ); + return ret; } - if (ret && buffer) - { - memcpy( buffer, info->Data, (ret-1) * sizeof(WCHAR) ); - buffer[ret-1] = 0; - } - } - else if (status == STATUS_BUFFER_OVERFLOW && !buffer) - { - ret = (size - info_size) / sizeof(WCHAR) + 1; - } - else if (status == STATUS_OBJECT_NAME_NOT_FOUND) - { - ret = -1; } - else + + ret = lstrlenW( registry_value->cached_value ) + 1; + + if (buffer) { - SetLastError( RtlNtStatusToDosError(status) ); - ret = 0; + if (ret > len) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = 0; + } + else + { + lstrcpyW( buffer, registry_value->cached_value ); + } } - NtClose( hkey ); - HeapFree( GetProcessHeap(), 0, info ); + + RtlLeaveCriticalSection( &cache_section ); + return ret; } @@ -1314,7 +1366,7 @@ if (!(lcflags & LOCALE_NOUSEROVERRIDE) && lcid == convert_default_lcid( LOCALE_USER_DEFAULT, lctype )) { - const WCHAR *value = get_locale_value_name(lctype); + struct registry_value *value = get_locale_registry_value(lctype); if (value) { @@ -1507,14 +1559,14 @@ */ BOOL WINAPI SetLocaleInfoW( LCID lcid, LCTYPE lctype, LPCWSTR data ) { - const WCHAR *value; + struct registry_value *value; static const WCHAR intlW[] = {'i','n','t','l',0 }; UNICODE_STRING valueW; NTSTATUS status; HANDLE hkey; lctype &= 0xffff; - value = get_locale_value_name( lctype ); + value = get_locale_registry_value( lctype ); if (!data || !value) { @@ -1528,17 +1580,22 @@ return FALSE; } - TRACE("setting %x (%s) to %s\n", lctype, debugstr_w(value), debugstr_w(data) ); + TRACE("setting %x (%s) to %s\n", lctype, debugstr_w(value->name), debugstr_w(data) ); /* FIXME: should check that data to set is sane */ /* FIXME: profile functions should map to registry */ - WriteProfileStringW( intlW, value, data ); + WriteProfileStringW( intlW, value->name, data ); if (!(hkey = create_registry_key())) return FALSE; - RtlInitUnicodeString( &valueW, value ); + RtlInitUnicodeString( &valueW, value->name ); status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, data, (strlenW(data)+1)*sizeof(WCHAR) ); + RtlEnterCriticalSection( &cache_section ); + HeapFree( GetProcessHeap(), 0, value->cached_value ); + value->cached_value = NULL; + RtlLeaveCriticalSection( &cache_section ); + if (lctype == LOCALE_SSHORTDATE || lctype == LOCALE_SLONGDATE) { /* Set I-value from S value */ @@ -1568,12 +1625,17 @@ else lctype = LOCALE_ILDATE; - value = get_locale_value_name( lctype ); + value = get_locale_registry_value( lctype ); - WriteProfileStringW( intlW, value, szBuff ); + WriteProfileStringW( intlW, value->name, szBuff ); - RtlInitUnicodeString( &valueW, value ); + RtlInitUnicodeString( &valueW, value->name ); status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, szBuff, sizeof(szBuff) ); + + RtlEnterCriticalSection( &cache_section ); + HeapFree( GetProcessHeap(), 0, value->cached_value ); + value->cached_value = NULL; + RtlLeaveCriticalSection( &cache_section ); } NtClose( hkey ); diff -Nru wine1.7-1.7.13/dlls/kernel32/process.c wine1.7-1.7.16/dlls/kernel32/process.c --- wine1.7-1.7.13/dlls/kernel32/process.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/process.c 2014-04-04 19:13:44.000000000 +0000 @@ -2768,7 +2768,7 @@ PEB * const peb = NtCurrentTeb()->Peb; RtlAcquirePebLock(); - index = RtlFindClearBitsAndSet( peb->TlsBitmap, 1, 0 ); + index = RtlFindClearBitsAndSet( peb->TlsBitmap, 1, 1 ); if (index != ~0U) NtCurrentTeb()->TlsSlots[index] = 0; /* clear the value */ else { @@ -3911,9 +3911,9 @@ */ BOOL WINAPI GetNumaHighestNodeNumber(PULONG highestnode) { - FIXME("(%p): stub\n", highestnode); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + *highestnode = 0; + FIXME("(%p): semi-stub\n", highestnode); + return TRUE; } /********************************************************************** diff -Nru wine1.7-1.7.13/dlls/kernel32/sync.c wine1.7-1.7.16/dlls/kernel32/sync.c --- wine1.7-1.7.13/dlls/kernel32/sync.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/sync.c 2014-04-04 19:13:44.000000000 +0000 @@ -1177,6 +1177,20 @@ return TRUE; } +/*********************************************************************** + * SetWaitableTimerEx (KERNEL32.@) + */ +BOOL WINAPI SetWaitableTimerEx( HANDLE handle, const LARGE_INTEGER *when, LONG period, + PTIMERAPCROUTINE callback, LPVOID arg, REASON_CONTEXT *context, ULONG tolerabledelay ) +{ + static int once; + if (!once++) + { + FIXME("(%p, %p, %d, %p, %p, %p, %d) semi-stub\n", + handle, when, period, callback, arg, context, tolerabledelay); + } + return SetWaitableTimer(handle, when, period, callback, arg, FALSE); +} /*********************************************************************** * CancelWaitableTimer (KERNEL32.@) diff -Nru wine1.7-1.7.13/dlls/kernel32/tests/actctx.c wine1.7-1.7.16/dlls/kernel32/tests/actctx.c --- wine1.7-1.7.13/dlls/kernel32/tests/actctx.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/tests/actctx.c 2014-04-04 19:13:44.000000000 +0000 @@ -186,7 +186,7 @@ " wndClass3" " wndClass4" " " +" flags=\"HiddeN,CoNTROL,rESTRICTED\" />" " " " " "" diff -Nru wine1.7-1.7.13/dlls/kernel32/tests/alloc.c wine1.7-1.7.16/dlls/kernel32/tests/alloc.c --- wine1.7-1.7.13/dlls/kernel32/tests/alloc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/tests/alloc.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,403 +0,0 @@ -/* - * Unit test suite for memory allocation functions. - * - * Copyright 2002 Geoffrey Hausheer - * - * 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 - -#include "wine/test.h" -#include "windef.h" -#include "winbase.h" -#include "winerror.h" - - - /* The following functions don't have tests, because either I don't know how - to test them, or they are WinNT only, or require multiple threads. - Since the last two issues shouldn't really stop the tests from being - written, assume for now that it is all due to the first case - HeapCompact - HeapLock - HeapQueryInformation - HeapSetInformation - HeapUnlock - HeapValidate - HeapWalk -*/ -/* In addition, these features aren't being tested - HEAP_NO_SERIALIZE - HEAP_GENERATE_EXCEPTIONS - STATUS_ACCESS_VIOLATION (error code from HeapAlloc) -*/ - -static void test_Heap(void) -{ - SYSTEM_INFO sysInfo; - ULONG memchunk; - HANDLE heap; - LPVOID mem1,mem1a,mem3; - UCHAR *mem2,*mem2a; - UINT i; - BOOL error; - DWORD dwSize; - -/* Retrieve the page size for this system */ - sysInfo.dwPageSize=0; - GetSystemInfo(&sysInfo); - ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size\n"); - -/* Create a Heap with a minimum and maximum size */ -/* Note that Windows and Wine seem to behave a bit differently with respect - to memory allocation. In Windows, you can't access all the memory - specified in the heap (due to overhead), so choosing a reasonable maximum - size for the heap was done mostly by trial-and-error on Win2k. It may need - more tweaking for otherWindows variants. -*/ - memchunk=10*sysInfo.dwPageSize; - heap=HeapCreate(0,2*memchunk,5*memchunk); - -/* Check that HeapCreate allocated the right amount of ram */ - mem1=HeapAlloc(heap,0,5*memchunk+1); - ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n"); - HeapFree(heap,0,mem1); - -/* Check that a normal alloc works */ - mem1=HeapAlloc(heap,0,memchunk); - ok(mem1!=NULL,"HeapAlloc failed\n"); - if(mem1) { - ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block\n"); - } - -/* Check that a 'zeroing' alloc works */ - mem2=HeapAlloc(heap,HEAP_ZERO_MEMORY,memchunk); - ok(mem2!=NULL,"HeapAlloc failed\n"); - if(mem2) { - ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block\n"); - error=FALSE; - for(i=0;i=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed\n"); - error=FALSE; - for(i=0;i<5*sysInfo.dwPageSize;i++) { - if(mem2a[memchunk+i]!=0) { - error=TRUE; - } - } - ok(!error,"HeapReAlloc should have zeroed out its allocated memory\n"); - } - -/* Check that HeapRealloc honours HEAP_REALLOC_IN_PLACE_ONLY */ - error=FALSE; - mem1a=HeapReAlloc(heap,HEAP_REALLOC_IN_PLACE_ONLY,mem1,memchunk+sysInfo.dwPageSize); - if(mem1a!=NULL) { - if(mem1a!=mem1) { - error=TRUE; - } - } - ok(mem1a==NULL || !error,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY\n"); - -/* Check that HeapFree works correctly */ - if(mem1a) { - ok(HeapFree(heap,0,mem1a),"HeapFree failed\n"); - } else { - ok(HeapFree(heap,0,mem1),"HeapFree failed\n"); - } - if(mem2a) { - ok(HeapFree(heap,0,mem2a),"HeapFree failed\n"); - } else { - ok(HeapFree(heap,0,mem2),"HeapFree failed\n"); - } - - /* 0-length buffer */ - mem1 = HeapAlloc(heap, 0, 0); - ok(mem1 != NULL, "Reserved memory\n"); - - dwSize = HeapSize(heap, 0, mem1); - /* should work with 0-length buffer */ - ok(dwSize < 0xFFFFFFFF, "The size of the 0-length buffer\n"); - ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer\n"); - -/* Check that HeapDestry works */ - ok(HeapDestroy(heap),"HeapDestroy failed\n"); -} - -/* The following functions don't have tests, because either I don't know how - to test them, or they are WinNT only, or require multiple threads. - Since the last two issues shouldn't really stop the tests from being - written, assume for now that it is all due to the first case - GlobalFlags - GlobalMemoryStatus - GlobalMemoryStatusEx -*/ -/* In addition, these features aren't being tested - GMEM_DISCARDABLE - GMEM_NOCOMPACT -*/ -static void test_Global(void) -{ - ULONG memchunk; - HGLOBAL mem1,mem2,mem2a,mem2b; - UCHAR *mem2ptr; - UINT i; - BOOL error; - memchunk=100000; - - SetLastError(NO_ERROR); -/* Check that a normal alloc works */ - mem1=GlobalAlloc(0,memchunk); - ok(mem1!=NULL,"GlobalAlloc failed\n"); - if(mem1) { - ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block\n"); - } - -/* Check that a 'zeroing' alloc works */ - mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk); - ok(mem2!=NULL,"GlobalAlloc failed: error=%d\n",GetLastError()); - if(mem2) { - ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block\n"); - mem2ptr=GlobalLock(mem2); - ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated\n"); - if(mem2ptr) { - error=FALSE; - for(i=0;i=2*memchunk,"GlobalReAlloc failed\n"); - mem2ptr=GlobalLock(mem2a); - ok(mem2ptr!=NULL,"GlobalLock Failed\n"); - if(mem2ptr) { - error=FALSE; - for(i=0;i=memchunk, "LocalAlloc should return a big enough memory block\n"); - } - -/* Check that a 'zeroing' and lock alloc works */ - mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk); - ok(mem2!=NULL,"LocalAlloc failed: error=%d\n",GetLastError()); - if(mem2) { - ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block\n"); - mem2ptr=LocalLock(mem2); - ok(mem2ptr!=NULL,"LocalLock: error=%d\n",GetLastError()); - if(mem2ptr) { - error=FALSE; - for(i=0;i=2*memchunk,"LocalReAlloc failed\n"); - mem2ptr=LocalLock(mem2a); - ok(mem2ptr!=NULL,"LocalLock Failed\n"); - if(mem2ptr) { - error=FALSE; - for(i=0;i0,"GetSystemInfo should return a valid page size\n"); - -/* Choose a reasonable allocation size */ - memchunk=10*sysInfo.dwPageSize; - -/* Check that a normal alloc works */ - mem1=VirtualAlloc(NULL,memchunk,MEM_COMMIT,PAGE_READWRITE); - ok(mem1!=NULL,"VirtualAlloc failed\n"); - if(mem1) { -/* check that memory is initialized to 0 */ - error=FALSE; - for(i=0;i0,"GetSystemInfo should return a valid page size\n"); + + /* Create a Heap with a minimum and maximum size */ + /* Note that Windows and Wine seem to behave a bit differently with respect + to memory allocation. In Windows, you can't access all the memory + specified in the heap (due to overhead), so choosing a reasonable maximum + size for the heap was done mostly by trial-and-error on Win2k. It may need + more tweaking for otherWindows variants. + */ + memchunk=10*sysInfo.dwPageSize; + heap=HeapCreate(0,2*memchunk,5*memchunk); + ok( !((ULONG_PTR)heap & 0xffff), "heap %p not 64K aligned\n", heap ); + + /* Check that HeapCreate allocated the right amount of ram */ + mem1=HeapAlloc(heap,0,5*memchunk+1); + ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n"); + HeapFree(heap,0,mem1); + + /* Check that a normal alloc works */ + mem1=HeapAlloc(heap,0,memchunk); + ok(mem1!=NULL,"HeapAlloc failed\n"); + if(mem1) { + ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block\n"); + } + + /* Check that a 'zeroing' alloc works */ + mem2=HeapAlloc(heap,HEAP_ZERO_MEMORY,memchunk); + ok(mem2!=NULL,"HeapAlloc failed\n"); + if(mem2) { + ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block\n"); + error=FALSE; + for(i=0;i=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed\n"); + error=FALSE; + for(i=0;i<5*sysInfo.dwPageSize;i++) { + if(mem2a[memchunk+i]!=0) { + error=TRUE; + } + } + ok(!error,"HeapReAlloc should have zeroed out its allocated memory\n"); + } + + /* Check that HeapRealloc honours HEAP_REALLOC_IN_PLACE_ONLY */ + error=FALSE; + mem1a=HeapReAlloc(heap,HEAP_REALLOC_IN_PLACE_ONLY,mem1,memchunk+sysInfo.dwPageSize); + if(mem1a!=NULL) { + if(mem1a!=mem1) { + error=TRUE; + } + } + ok(mem1a==NULL || !error,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY\n"); + + /* Check that HeapFree works correctly */ + if(mem1a) { + ok(HeapFree(heap,0,mem1a),"HeapFree failed\n"); + } else { + ok(HeapFree(heap,0,mem1),"HeapFree failed\n"); + } + if(mem2a) { + ok(HeapFree(heap,0,mem2a),"HeapFree failed\n"); + } else { + ok(HeapFree(heap,0,mem2),"HeapFree failed\n"); + } + + /* 0-length buffer */ + mem1 = HeapAlloc(heap, 0, 0); + ok(mem1 != NULL, "Reserved memory\n"); + + dwSize = HeapSize(heap, 0, mem1); + /* should work with 0-length buffer */ + ok(dwSize < 0xFFFFFFFF, "The size of the 0-length buffer\n"); + ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer\n"); + + /* Check that HeapDestroy works */ + ok(HeapDestroy(heap),"HeapDestroy failed\n"); +} + + +static void test_GlobalAlloc(void) +{ + ULONG memchunk; + HGLOBAL mem1,mem2,mem2a,mem2b; + UCHAR *mem2ptr; + UINT i; + BOOL error; + memchunk=100000; + + SetLastError(NO_ERROR); + /* Check that a normal alloc works */ + mem1=GlobalAlloc(0,memchunk); + ok(mem1!=NULL,"GlobalAlloc failed\n"); + if(mem1) { + ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block\n"); + } + + /* Check that a 'zeroing' alloc works */ + mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk); + ok(mem2!=NULL,"GlobalAlloc failed: error=%d\n",GetLastError()); + if(mem2) { + ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block\n"); + mem2ptr=GlobalLock(mem2); + ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated\n"); + if(mem2ptr) { + error=FALSE; + for(i=0;i=2*memchunk,"GlobalReAlloc failed\n"); + mem2ptr=GlobalLock(mem2a); + ok(mem2ptr!=NULL,"GlobalLock Failed\n"); + if(mem2ptr) { + error=FALSE; + for(i=0;i=memchunk, "LocalAlloc should return a big enough memory block\n"); + } + + /* Check that a 'zeroing' and lock alloc works */ + mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk); + ok(mem2!=NULL,"LocalAlloc failed: error=%d\n",GetLastError()); + if(mem2) { + ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block\n"); + mem2ptr=LocalLock(mem2); + ok(mem2ptr!=NULL,"LocalLock: error=%d\n",GetLastError()); + if(mem2ptr) { + error=FALSE; + for(i=0;i=2*memchunk,"LocalReAlloc failed\n"); + mem2ptr=LocalLock(mem2a); + ok(mem2ptr!=NULL,"LocalLock Failed\n"); + if(mem2ptr) { + error=FALSE; + for(i=0;i= 0x24F5 && ch <= 0x24FD) || ch == 0x24FF || ch == 0x19da || - (ch >= 0x1369 && ch <= 0x1371), - "MAP_FOLDDIGITS: ch %d 0x%04x Expected unchanged got %d\n", ch, ch, dst[0]); + (ch >= 0xa8e0 && ch <= 0xa8e9), /* combining Devanagari on Win8 */ + "MAP_FOLDDIGITS: ch 0x%04x Expected unchanged got %04x\n", ch, dst[0]); + ok(!isdigitW(ch) || strchrW(outOfSequenceDigits, ch) || + broken( ch >= 0xbf0 && ch <= 0xbf2 ), /* win2k */ + "char %04x should not be a digit\n", ch ); } if (digitRanges[j] == 0xffff) @@ -2519,7 +2553,7 @@ (digitRanges[j] == 0x3020 && dst[0] == ch) || /* Hangzhou not present in all Windows versions */ (digitRanges[j] == 0x0F29 && dst[0] == ch) || /* Tibetan not present in all Windows versions */ strchrW(noDigitAvailable, c), - "MAP_FOLDDIGITS: ch %d Expected %d got %d\n", + "MAP_FOLDDIGITS: ch %04x Expected %04x got %04x\n", ch, '0' + digitRanges[j] - ch, dst[0]); } prev_ch = ch; diff -Nru wine1.7-1.7.13/dlls/kernel32/tests/Makefile.in wine1.7-1.7.16/dlls/kernel32/tests/Makefile.in --- wine1.7-1.7.13/dlls/kernel32/tests/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/tests/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -3,7 +3,6 @@ C_SRCS = \ actctx.c \ - alloc.c \ atom.c \ change.c \ codepage.c \ diff -Nru wine1.7-1.7.13/dlls/kernel32/tests/profile.c wine1.7-1.7.16/dlls/kernel32/tests/profile.c --- wine1.7-1.7.13/dlls/kernel32/tests/profile.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/tests/profile.c 2014-04-04 19:13:44.000000000 +0000 @@ -1019,18 +1019,22 @@ broken(GetLastError() == ERROR_PATH_NOT_FOUND), /* Win9x and WinME */ "Expected ERROR_ACCESS_DENIED, got %d\n", GetLastError()); - /* The resulting file will be X:\\%WINDIR%\\win1.tmp */ + /* Relative paths are relative to X:\\%WINDIR% */ GetWindowsDirectoryA(temp, MAX_PATH); GetTempFileNameA(temp, "win", 1, path); - DeleteFileA(path); + if (GetFileAttributesA(path) == INVALID_FILE_ATTRIBUTES) + skip("Not allowed to create a file in the Windows directory\n"); + else + { + DeleteFileA(path); - /* relative path in lpFileName */ - data = "[App]\r\n" - "key=string\r\n"; - ret = WritePrivateProfileStringA("App", "key", "string", "win1.tmp"); - ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - ok(check_file_data(path, data), "File doesn't match\n"); - DeleteFileA(path); + data = "[App]\r\n" + "key=string\r\n"; + ret = WritePrivateProfileStringA("App", "key", "string", "win1.tmp"); + ok(ret == TRUE, "Expected TRUE, got %d, le=%u\n", ret, GetLastError()); + ok(check_file_data(path, data), "File doesn't match\n"); + DeleteFileA(path); + } GetTempPathA(MAX_PATH, temp); GetTempFileNameA(temp, "wine", 0, path); diff -Nru wine1.7-1.7.13/dlls/kernel32/tests/thread.c wine1.7-1.7.16/dlls/kernel32/tests/thread.c --- wine1.7-1.7.13/dlls/kernel32/tests/thread.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/tests/thread.c 2014-04-04 19:13:44.000000000 +0000 @@ -1638,6 +1638,43 @@ todo_wine ok (pool != NULL, "CreateThreadpool failed\n"); } +static void test_reserved_tls(void) +{ + void *val; + DWORD tls; + BOOL ret; + + /* This seems to be a WinXP SP2+ feature. */ + if(!pIsWow64Process) { + win_skip("Skipping reserved TLS slot on too old Windows.\n"); + return; + } + + val = TlsGetValue(0); + ok(!val, "TlsGetValue(0) = %p\n", val); + + /* Also make sure that there is a TLS allocated. */ + tls = TlsAlloc(); + ok(tls && tls != TLS_OUT_OF_INDEXES, "tls = %x\n", tls); + TlsSetValue(tls, (void*)1); + + val = TlsGetValue(0); + ok(!val, "TlsGetValue(0) = %p\n", val); + + TlsFree(tls); + + /* The following is too ugly to be run by default */ + if(0) { + /* Set TLS index 0 value and see that this works and doesn't cause problems + * for remaining tests. */ + ret = TlsSetValue(0, (void*)1); + ok(ret, "TlsSetValue(0, 1) failed: %u\n", GetLastError()); + + val = TlsGetValue(0); + ok(val == (void*)1, "TlsGetValue(0) = %p\n", val); + } +} + static void init_funcs(void) { HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); @@ -1711,6 +1748,7 @@ return; } + test_reserved_tls(); test_CreateRemoteThread(); test_CreateThread_basic(); test_CreateThread_suspended(); diff -Nru wine1.7-1.7.13/dlls/kernel32/tests/version.c wine1.7-1.7.16/dlls/kernel32/tests/version.c --- wine1.7-1.7.13/dlls/kernel32/tests/version.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/tests/version.c 2014-04-04 19:13:44.000000000 +0000 @@ -21,8 +21,6 @@ /* Needed for PRODUCT_* defines and GetProductInfo() */ #define _WIN32_WINNT 0x0600 -#include - #include "wine/test.h" #include "winbase.h" diff -Nru wine1.7-1.7.13/dlls/kernel32/time.c wine1.7-1.7.16/dlls/kernel32/time.c --- wine1.7-1.7.13/dlls/kernel32/time.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/time.c 2014-04-04 19:13:44.000000000 +0000 @@ -798,6 +798,18 @@ } /********************************************************************* + * GetCalendarInfoEx (KERNEL32.@) + */ +int WINAPI GetCalendarInfoEx(LPCWSTR locale, CALID calendar, LPCWSTR lpReserved, CALTYPE caltype, + LPWSTR data, int len, DWORD *value) +{ + LCID lcid = LocaleNameToLCID(locale, 0); + FIXME("(%s, %d, %p, 0x%08x, %p, %d, %p): semi-stub\n", debugstr_w(locale), calendar, lpReserved, caltype, + data, len, value); + return GetCalendarInfoW(lcid, calendar, caltype, data, len, value); +} + +/********************************************************************* * SetCalendarInfoA (KERNEL32.@) * */ @@ -1091,3 +1103,14 @@ SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return TIME_ZONE_ID_INVALID; } + +/*********************************************************************** + * QueryUnbiasedInterruptTime (KERNEL32.@) + */ +BOOL WINAPI QueryUnbiasedInterruptTime(ULONGLONG *time) +{ + TRACE("(%p)\n", time); + if (!time) return FALSE; + RtlQueryUnbiasedInterruptTime(time); + return TRUE; +} diff -Nru wine1.7-1.7.13/dlls/kernel32/wer.c wine1.7-1.7.16/dlls/kernel32/wer.c --- wine1.7-1.7.13/dlls/kernel32/wer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/kernel32/wer.c 2014-04-04 19:13:44.000000000 +0000 @@ -64,8 +64,20 @@ return E_NOTIMPL; } +/*********************************************************************** + * WerRegisterMemoryBlock (KERNEL32.@) + */ HRESULT WINAPI WerRegisterMemoryBlock(void *block, DWORD size) { FIXME("(%p %d) stub\n", block, size); return E_NOTIMPL; } + +/*********************************************************************** + * WerUnregisterMemoryBlock (KERNEL32.@) + */ +HRESULT WINAPI WerUnregisterMemoryBlock(void *block) +{ + FIXME("(%p) stub\n", block); + return E_NOTIMPL; +} diff -Nru wine1.7-1.7.13/dlls/krnl386.exe16/int21.c wine1.7-1.7.16/dlls/krnl386.exe16/int21.c --- wine1.7-1.7.13/dlls/krnl386.exe16/int21.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/krnl386.exe16/int21.c 2014-04-04 19:13:44.000000000 +0000 @@ -2737,7 +2737,7 @@ static void INT21_Ioctl_Char( CONTEXT *context ) { int status; - int IsConsoleIOHandle = 0; + BOOL IsConsoleIOHandle = FALSE; IO_STATUS_BLOCK io; FILE_INTERNAL_INFORMATION info; HANDLE handle = DosFileHandleToWin32Handle(BX_reg(context)); @@ -2746,7 +2746,7 @@ if (status) { if( VerifyConsoleIoHandle( handle)) - IsConsoleIOHandle = 1; + IsConsoleIOHandle = TRUE; else { SET_AX( context, RtlNtStatusToDosError(status) ); SET_CFLAG( context ); diff -Nru wine1.7-1.7.13/dlls/krnl386.exe16/int31.c wine1.7-1.7.16/dlls/krnl386.exe16/int31.c --- wine1.7-1.7.13/dlls/krnl386.exe16/int31.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/krnl386.exe16/int31.c 2014-04-04 19:13:44.000000000 +0000 @@ -439,7 +439,7 @@ LPWORD stack16; LPVOID addr = NULL; /* avoid gcc warning */ RMCB *CurrRMCB; - int alloc = 0, already = 0; + BOOL alloc = FALSE, already = FALSE; BYTE *code; TRACE("EAX=%08x EBX=%08x ECX=%08x EDX=%08x\n", @@ -490,7 +490,7 @@ } if (!already) { if (!context->SegSs) { - alloc = 1; /* allocate default stack */ + alloc = TRUE; /* allocate default stack */ stack16 = addr = DOSMEM_AllocBlock( 64, (UINT16 *)&(context->SegSs) ); context->Esp = 64-2; stack16 += 32-1; @@ -514,7 +514,7 @@ *(--stack16) = 0; /* adjust stack */ context->Esp -= 2*sizeof(WORD); - already = 1; + already = TRUE; } if (CurrRMCB) { diff -Nru wine1.7-1.7.13/dlls/krnl386.exe16/soundblaster.c wine1.7-1.7.16/dlls/krnl386.exe16/soundblaster.c --- wine1.7-1.7.13/dlls/krnl386.exe16/soundblaster.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/krnl386.exe16/soundblaster.c 2014-04-04 19:13:44.000000000 +0000 @@ -48,8 +48,8 @@ static BYTE DSP_OutBuffer[10]; /* Store DSP information bytes to host */ static int OutSize; /* Nb of bytes in InBuffer */ static int command; /* Current command */ -static int end_sound_loop = 0; -static int dma_enable = 0; +static BOOL end_sound_loop = FALSE; +static BOOL dma_enable = FALSE; /* The maximum size of a dma transfer can be 65536 */ #define DMATRFSIZE 1024 @@ -112,7 +112,7 @@ SamplesCount -= size; if (!SamplesCount) { DOSVM_QueueEvent(SB_IRQ,SB_IRQ_PRI,NULL,NULL); - dma_enable = 0; + dma_enable = FALSE; } } return 0; @@ -166,7 +166,7 @@ } buf_off = 0; - end_sound_loop = 0; + end_sound_loop = FALSE; SB_Thread = CreateThread(NULL, 0, SB_Poll, NULL, 0, NULL); TRACE("thread\n"); if (!SB_Thread) { @@ -254,7 +254,7 @@ case 0x14: /* SB */ SamplesCount = DSP_InBuffer[1]+(val<<8)+1; TRACE("DMA DAC (8-bit) for %x samples\n",SamplesCount); - dma_enable = 1; + dma_enable = TRUE; break; case 0x20: FIXME("Direct ADC (8-bit) - Not Implemented\n"); @@ -274,7 +274,7 @@ /* case 0xBX/0xCX -> See below */ case 0xD0: /* SB */ TRACE("Halt DMA operation (8-bit)\n"); - dma_enable = 0; + dma_enable = FALSE; break; case 0xD1: /* SB */ FIXME("Enable Speaker - Not Implemented\n"); @@ -331,7 +331,7 @@ FIXME("Generic DAC/ADC stereo mode not supported\n"); SamplesCount = DSP_InBuffer[2]+(val<<8)+1; TRACE("Generic DMA for %x samples\n",SamplesCount); - dma_enable = 1; + dma_enable = TRUE; } else FIXME("DSP command %x not supported\n",val); diff -Nru wine1.7-1.7.13/dlls/mgmtapi/mgmtapi.spec wine1.7-1.7.16/dlls/mgmtapi/mgmtapi.spec --- wine1.7-1.7.13/dlls/mgmtapi/mgmtapi.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mgmtapi/mgmtapi.spec 2014-04-04 19:13:44.000000000 +0000 @@ -4,6 +4,6 @@ @ stub SnmpMgrGetTrapEx @ stub SnmpMgrOidToStr @ stub SnmpMgrOpen -@ stub SnmpMgrrequest +@ stub SnmpMgrRequest @ stub SnmpMgrStrToOid @ stub SnmpMgrTrapListen diff -Nru wine1.7-1.7.13/dlls/mscms/tests/profile.c wine1.7-1.7.16/dlls/mscms/tests/profile.c --- wine1.7-1.7.13/dlls/mscms/tests/profile.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mscms/tests/profile.c 2014-04-04 19:13:44.000000000 +0000 @@ -122,6 +122,8 @@ 'c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; +static BOOL have_color_profile; + static const unsigned char rgbheader[] = { 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02, 0x72, 0x74, 0x6e, 0x6d, 0x20, 0x42, 0x47, 0x52, 0x20, 0x5a, 0x59, 0x58, @@ -669,7 +671,7 @@ ok( !ret, "EnumColorProfilesA() succeeded (%d)\n", GetLastError() ); ret = pEnumColorProfilesA( NULL, &record, buffer, &size, &number ); - if (standardprofile) + if (have_color_profile) ok( ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() ); else todo_wine ok( ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() ); @@ -683,7 +685,7 @@ size = total; ret = pEnumColorProfilesA( NULL, &record, buffer, &size, &number ); - if (standardprofile) + if (have_color_profile) ok( ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() ); else todo_wine ok( ret, "EnumColorProfilesA() failed (%d)\n", GetLastError() ); @@ -723,7 +725,7 @@ ok( !ret, "EnumColorProfilesW() succeeded (%d)\n", GetLastError() ); ret = pEnumColorProfilesW( NULL, &record, buffer, &size, &number ); - if (standardprofileW) + if (have_color_profile) ok( ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() ); else todo_wine ok( ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() ); @@ -736,7 +738,7 @@ size = total; ret = pEnumColorProfilesW( NULL, &record, buffer, &size, &number ); - if (standardprofileW) + if (have_color_profile) ok( ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() ); else todo_wine ok( ret, "EnumColorProfilesW() failed (%d)\n", GetLastError() ); @@ -1317,6 +1319,21 @@ } } +static BOOL have_profile(void) +{ + char glob[MAX_PATH + sizeof("\\*.icm")]; + DWORD size = MAX_PATH; + HANDLE handle; + WIN32_FIND_DATAA data; + + if (!pGetColorDirectoryA( NULL, glob, &size )) return FALSE; + lstrcatA( glob, "\\*.icm" ); + handle = FindFirstFileA( glob, &data ); + if (handle == INVALID_HANDLE_VALUE) return FALSE; + FindClose( handle ); + return TRUE; +} + START_TEST(profile) { UINT len; @@ -1392,6 +1409,8 @@ } } + have_color_profile = have_profile(); + test_GetColorDirectoryA(); test_GetColorDirectoryW(); diff -Nru wine1.7-1.7.13/dlls/mshtml/binding.h wine1.7-1.7.16/dlls/mshtml/binding.h --- wine1.7-1.7.13/dlls/mshtml/binding.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/binding.h 2014-04-04 19:13:44.000000000 +0000 @@ -107,6 +107,7 @@ #define BINDING_FROMHIST 0x0004 #define BINDING_REFRESH 0x0008 #define BINDING_SUBMIT 0x0010 +#define BINDING_NOFRAG 0x0020 HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int) DECLSPEC_HIDDEN; HRESULT create_redirect_nschannel(const WCHAR*,nsChannel*,nsChannel**) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlanchor.c wine1.7-1.7.16/dlls/mshtml/htmlanchor.c --- wine1.7-1.7.13/dlls/mshtml/htmlanchor.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlanchor.c 2014-04-04 19:13:44.000000000 +0000 @@ -70,47 +70,81 @@ return hres; } +HTMLOuterWindow *get_target_window(HTMLOuterWindow *window, nsAString *target_str, BOOL *use_new_window) +{ + HTMLOuterWindow *top_window, *ret_window; + const PRUnichar *target; + HRESULT hres; + + static const WCHAR _parentW[] = {'_','p','a','r','e','n','t',0}; + static const WCHAR _selfW[] = {'_','s','e','l','f',0}; + static const WCHAR _topW[] = {'_','t','o','p',0}; + + *use_new_window = FALSE; + + nsAString_GetData(target_str, &target); + TRACE("%s\n", debugstr_w(target)); + + if(!*target || !strcmpiW(target, _selfW)) { + IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); + return window; + } + + if(!strcmpiW(target, _topW)) { + get_top_window(window, &top_window); + IHTMLWindow2_AddRef(&top_window->base.IHTMLWindow2_iface); + return top_window; + } + + if(!strcmpiW(target, _parentW)) { + if(!window->parent) { + WARN("Window has no parent\n"); + return NULL; + } + + IHTMLWindow2_AddRef(&window->parent->base.IHTMLWindow2_iface); + return window->parent; + } + + get_top_window(window, &top_window); + + hres = get_frame_by_name(top_window, target, TRUE, &ret_window); + if(FAILED(hres) || !ret_window) { + *use_new_window = TRUE; + return NULL; + } + + IHTMLWindow2_AddRef(&ret_window->base.IHTMLWindow2_iface); + return ret_window; +} + static HRESULT navigate_anchor(HTMLAnchorElement *This) { nsAString href_str, target_str; - HTMLOuterWindow *window = NULL; + HTMLOuterWindow *window; + BOOL use_new_window; nsresult nsres; HRESULT hres = E_FAIL; - static const WCHAR _parentW[] = {'p','a','r','e','n','t',0}; - static const WCHAR _selfW[] = {'_','s','e','l','f',0}; - static const WCHAR _topW[] = {'_','t','o','p',0}; nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLAnchorElement_GetTarget(This->nsanchor, &target_str); - if(NS_SUCCEEDED(nsres)) { + if(NS_FAILED(nsres)) + return E_FAIL; + + window = get_target_window(This->element.node.doc->basedoc.window, &target_str, &use_new_window); + if(!window && use_new_window) { const PRUnichar *target; nsAString_GetData(&target_str, &target); - TRACE("target %s\n", debugstr_w(target)); - if(*target && strcmpiW(target, _selfW)) { - if(!strcmpiW(target, _topW)) { - TRACE("target _top\n"); - get_top_window(This->element.node.doc->basedoc.window, &window); - }else if(!strcmpiW(target, _parentW)) { - FIXME("Navigating to target _parent is not implemented\n"); - nsAString_Finish(&target_str); - return S_OK; - }else { - HTMLOuterWindow *top_window; - - get_top_window(This->element.node.doc->basedoc.window, &top_window); - - hres = get_frame_by_name(top_window, target, TRUE, &window); - if(FAILED(hres) || !window) { - hres = navigate_anchor_window(This, target); - nsAString_Finish(&target_str); - return hres; - } - } - } + hres = navigate_anchor_window(This, target); + nsAString_Finish(&target_str); + return hres; } + nsAString_Finish(&target_str); + if(!window) + return S_OK; nsAString_Init(&href_str, NULL); nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str); @@ -119,8 +153,6 @@ nsAString_GetData(&href_str, &href); if(*href) { - if(!window) - window = This->element.node.doc->basedoc.window; hres = navigate_url(window, href, window->uri_nofrag, BINDING_NAVIGATED); }else { TRACE("empty href\n"); @@ -128,6 +160,7 @@ } } nsAString_Finish(&href_str); + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); return hres; } diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlbody.c wine1.7-1.7.16/dlls/mshtml/htmlbody.c --- wine1.7-1.7.13/dlls/mshtml/htmlbody.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlbody.c 2014-04-04 19:13:44.000000000 +0000 @@ -124,7 +124,7 @@ | comp_value(hex+2*dpc, dpc); } -static HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) +HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) { unsigned int i; int rgb = -1; @@ -155,7 +155,7 @@ return S_OK; } -static BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) +BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) { switch(V_VT(v)) { case VT_BSTR: diff -Nru wine1.7-1.7.13/dlls/mshtml/htmldoc3.c wine1.7-1.7.16/dlls/mshtml/htmldoc3.c --- wine1.7-1.7.13/dlls/mshtml/htmldoc3.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmldoc3.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,890 +0,0 @@ -/* - * Copyright 2005 Jacek Caban 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 - */ - -#include "config.h" - -#include -#include -#include - -#define COBJMACROS - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "ole2.h" - -#include "wine/debug.h" - -#include "mshtml_private.h" -#include "htmlevent.h" - -WINE_DEFAULT_DEBUG_CHANNEL(mshtml); - -HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement **ret) -{ - nsIDOMNodeList *nsnode_list; - nsIDOMElement *nselem; - nsIDOMNode *nsnode; - nsAString id_str; - nsresult nsres; - HRESULT hres; - - if(!doc->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } - - nsAString_InitDepend(&id_str, id); - /* get element by id attribute */ - nsres = nsIDOMHTMLDocument_GetElementById(doc->nsdoc, &id_str, &nselem); - if(FAILED(nsres)) { - ERR("GetElementById failed: %08x\n", nsres); - nsAString_Finish(&id_str); - return E_FAIL; - } - - /* get first element by name attribute */ - nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nsdoc, &id_str, &nsnode_list); - nsAString_Finish(&id_str); - if(FAILED(nsres)) { - ERR("getElementsByName failed: %08x\n", nsres); - if(nselem) - nsIDOMElement_Release(nselem); - return E_FAIL; - } - - nsres = nsIDOMNodeList_Item(nsnode_list, 0, &nsnode); - nsIDOMNodeList_Release(nsnode_list); - assert(nsres == NS_OK); - - if(nsnode && nselem) { - UINT16 pos; - - nsres = nsIDOMNode_CompareDocumentPosition(nsnode, (nsIDOMNode*)nselem, &pos); - if(NS_FAILED(nsres)) { - FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres); - nsIDOMNode_Release(nsnode); - nsIDOMElement_Release(nselem); - return E_FAIL; - } - - TRACE("CompareDocumentPosition gave: 0x%x\n", pos); - if(!(pos & (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS))) { - nsIDOMElement_Release(nselem); - nselem = NULL; - } - } - - if(nsnode) { - if(!nselem) { - nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem); - assert(nsres == NS_OK); - } - nsIDOMNode_Release(nsnode); - } - - if(!nselem) { - *ret = NULL; - return S_OK; - } - - hres = get_elem(doc, nselem, ret); - nsIDOMElement_Release(nselem); - return hres; -} - -static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface) -{ - return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface); -} - -static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface, - REFIID riid, void **ppv) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return htmldoc_query_interface(This, riid, ppv); -} - -static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return htmldoc_addref(This); -} - -static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return htmldoc_release(This); -} - -static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); -} - -static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo, - LCID lcid, ITypeInfo **ppTInfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); -} - -static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, - LCID lcid, DISPID *rgDispId) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, - rgDispId); -} - -static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember, - REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, - VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, - pDispParams, pVarResult, pExcepInfo, puArgErr); -} - -static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%x)\n", This, fForce); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text, - IHTMLDOMNode **newTextNode) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - nsIDOMText *nstext; - HTMLDOMNode *node; - nsAString text_str; - nsresult nsres; - HRESULT hres; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode); - - if(!This->doc_node->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } - - nsAString_InitDepend(&text_str, text); - nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext); - nsAString_Finish(&text_str); - if(NS_FAILED(nsres)) { - ERR("CreateTextNode failed: %08x\n", nsres); - return E_FAIL; - } - - hres = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext, &node); - nsIDOMText_Release(nstext); - if(FAILED(hres)) - return hres; - - *newTextNode = &node->IHTMLDOMNode_iface; - return S_OK; -} - -static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - nsIDOMElement *nselem = NULL; - HTMLDOMNode *node; - nsresult nsres; - HRESULT hres; - - TRACE("(%p)->(%p)\n", This, p); - - if(This->window->readystate == READYSTATE_UNINITIALIZED) { - *p = NULL; - return S_OK; - } - - if(!This->doc_node->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } - - nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem); - if(NS_FAILED(nsres)) { - ERR("GetDocumentElement failed: %08x\n", nsres); - return E_FAIL; - } - - if(!nselem) { - *p = NULL; - return S_OK; - } - - hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node); - nsIDOMElement_Release(nselem); - if(FAILED(hres)) - return hres; - - hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p); - node_release(node); - return hres; -} - -static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event, - IDispatch* pDisp, VARIANT_BOOL *pfResult) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - - TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); - - return attach_event(&This->doc_node->node.event_target, This->doc_node->node.nsnode, This, event, pDisp, pfResult); -} - -static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event, - IDispatch *pDisp) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp); - - return detach_event(This->doc_node->node.event_target, This, event, pDisp); -} - -static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - - TRACE("(%p)->()\n", This); - - return set_doc_event(This, EVENTID_CONTEXTMENU, &v); -} - -static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - - TRACE("(%p)->(%p)\n", This, p); - - return get_doc_event(This, EVENTID_CONTEXTMENU, p); -} - -static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface, - IHTMLDocument2 **ppNewDoc) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - nsIDOMDocumentFragment *doc_frag; - HTMLDocumentNode *docnode; - nsresult nsres; - HRESULT hres; - - TRACE("(%p)->(%p)\n", This, ppNewDoc); - - if(!This->doc_node->nsdoc) { - FIXME("NULL nsdoc\n"); - return E_NOTIMPL; - } - - nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag); - if(NS_FAILED(nsres)) { - ERR("CreateDocumentFragment failed: %08x\n", nsres); - return E_FAIL; - } - - hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode); - nsIDOMDocumentFragment_Release(doc_frag); - if(FAILED(hres)) - return hres; - - *ppNewDoc = &docnode->basedoc.IHTMLDocument2_iface; - return S_OK; -} - -static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface, - IHTMLDocument2 **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface, - VARIANT_BOOL v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%x)\n", This, v); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface, - VARIANT_BOOL *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - - TRACE("(%p)->(%p)\n", This, p); - - return IHTMLDOMNode_get_childNodes(&This->doc_node->node.IHTMLDOMNode_iface, p); -} - -static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface, - VARIANT_BOOL v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface, - VARIANT_BOOL *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v, - IHTMLElementCollection **ppelColl) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - nsIDOMNodeList *node_list; - nsAString selector_str; - WCHAR *selector; - nsresult nsres; - - static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0}; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl); - - if(!This->doc_node || !This->doc_node->nsdoc) { - /* We should probably return an empty collection. */ - FIXME("No nsdoc\n"); - return E_NOTIMPL; - } - - selector = heap_alloc(2*SysStringLen(v)*sizeof(WCHAR) + sizeof(formatW)); - if(!selector) - return E_OUTOFMEMORY; - sprintfW(selector, formatW, v, v); - - /* - * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes. - * That's why we use CSS selector instead. We should also use name only when it applies to given element - * types and search should be case insensitive. Those are currently not supported properly. - */ - nsAString_InitDepend(&selector_str, selector); - nsres = nsIDOMNodeSelector_QuerySelectorAll(This->doc_node->nsnode_selector, &selector_str, &node_list); - nsAString_Finish(&selector_str); - heap_free(selector); - if(NS_FAILED(nsres)) { - ERR("QuerySelectorAll failed: %08x\n", nsres); - return E_FAIL; - } - - *ppelColl = create_collection_from_nodelist(This->doc_node, node_list); - nsIDOMNodeList_Release(node_list); - return S_OK; -} - - -static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v, - IHTMLElement **pel) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - HTMLElement *elem; - HRESULT hres; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); - - hres = get_doc_elem_by_id(This->doc_node, v, &elem); - if(FAILED(hres) || !elem) { - *pel = NULL; - return hres; - } - - *pel = &elem->IHTMLElement_iface; - return S_OK; -} - - -static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v, - IHTMLElementCollection **pelColl) -{ - HTMLDocument *This = impl_from_IHTMLDocument3(iface); - nsIDOMNodeList *nslist; - nsAString id_str; - nsresult nsres; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl); - - if(!This->doc_node->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } - - nsAString_InitDepend(&id_str, v); - nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->doc_node->nsdoc, &id_str, &nslist); - nsAString_Finish(&id_str); - if(FAILED(nsres)) { - ERR("GetElementByName failed: %08x\n", nsres); - return E_FAIL; - } - - *pelColl = create_collection_from_nodelist(This->doc_node, nslist); - nsIDOMNodeList_Release(nslist); - - return S_OK; -} - -static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = { - HTMLDocument3_QueryInterface, - HTMLDocument3_AddRef, - HTMLDocument3_Release, - HTMLDocument3_GetTypeInfoCount, - HTMLDocument3_GetTypeInfo, - HTMLDocument3_GetIDsOfNames, - HTMLDocument3_Invoke, - HTMLDocument3_releaseCapture, - HTMLDocument3_recalc, - HTMLDocument3_createTextNode, - HTMLDocument3_get_documentElement, - HTMLDocument3_uniqueID, - HTMLDocument3_attachEvent, - HTMLDocument3_detachEvent, - HTMLDocument3_put_onrowsdelete, - HTMLDocument3_get_onrowsdelete, - HTMLDocument3_put_onrowsinserted, - HTMLDocument3_get_onrowsinserted, - HTMLDocument3_put_oncellchange, - HTMLDocument3_get_oncellchange, - HTMLDocument3_put_ondatasetchanged, - HTMLDocument3_get_ondatasetchanged, - HTMLDocument3_put_ondataavailable, - HTMLDocument3_get_ondataavailable, - HTMLDocument3_put_ondatasetcomplete, - HTMLDocument3_get_ondatasetcomplete, - HTMLDocument3_put_onpropertychange, - HTMLDocument3_get_onpropertychange, - HTMLDocument3_put_dir, - HTMLDocument3_get_dir, - HTMLDocument3_put_oncontextmenu, - HTMLDocument3_get_oncontextmenu, - HTMLDocument3_put_onstop, - HTMLDocument3_get_onstop, - HTMLDocument3_createDocumentFragment, - HTMLDocument3_get_parentDocument, - HTMLDocument3_put_enableDownload, - HTMLDocument3_get_enableDownload, - HTMLDocument3_put_baseUrl, - HTMLDocument3_get_baseUrl, - HTMLDocument3_get_childNodes, - HTMLDocument3_put_inheritStyleSheets, - HTMLDocument3_get_inheritStyleSheets, - HTMLDocument3_put_onbeforeeditfocus, - HTMLDocument3_get_onbeforeeditfocus, - HTMLDocument3_getElementsByName, - HTMLDocument3_getElementById, - HTMLDocument3_getElementsByTagName -}; - -static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface) -{ - return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface); -} - -static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface, - REFIID riid, void **ppv) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return htmldoc_query_interface(This, riid, ppv); -} - -static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return htmldoc_addref(This); -} - -static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return htmldoc_release(This); -} - -static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); -} - -static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo, - LCID lcid, ITypeInfo **ppTInfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); -} - -static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, - LCID lcid, DISPID *rgDispId) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, - rgDispId); -} - -static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember, - REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, - VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, - pDispParams, pVarResult, pExcepInfo, puArgErr); -} - -static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - nsIDOMHTMLElement *nsbody; - nsresult nsres; - - TRACE("(%p)->()\n", This); - - nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody); - if(NS_FAILED(nsres) || !nsbody) { - ERR("GetBody failed: %08x\n", nsres); - return E_FAIL; - } - - nsres = nsIDOMHTMLElement_Focus(nsbody); - nsIDOMHTMLElement_Release(nsbody); - if(NS_FAILED(nsres)) { - ERR("Focus failed: %08x\n", nsres); - return E_FAIL; - } - - return S_OK; -} - -static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%p)\n", This, pfFocus); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl, - BSTR bstrOptions, IHTMLDocument2 **newDoc) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface, - VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - - TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarEventObject), ppEventObj); - - if(pvarEventObject && V_VT(pvarEventObject) != VT_ERROR && V_VT(pvarEventObject) != VT_EMPTY) { - FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject)); - return E_NOTIMPL; - } - - return create_event_obj(ppEventObj); -} - -static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName, - VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - - TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled); - - return dispatch_event(&This->doc_node->node, bstrEventName, pvarEventObject, pfCanceled); -} - -static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v, - IHTMLRenderStyle **ppIHTMLRenderStyle) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument4(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = { - HTMLDocument4_QueryInterface, - HTMLDocument4_AddRef, - HTMLDocument4_Release, - HTMLDocument4_GetTypeInfoCount, - HTMLDocument4_GetTypeInfo, - HTMLDocument4_GetIDsOfNames, - HTMLDocument4_Invoke, - HTMLDocument4_focus, - HTMLDocument4_hasFocus, - HTMLDocument4_put_onselectionchange, - HTMLDocument4_get_onselectionchange, - HTMLDocument4_get_namespace, - HTMLDocument4_createDocumentFromUrl, - HTMLDocument4_put_media, - HTMLDocument4_get_media, - HTMLDocument4_createEventObject, - HTMLDocument4_fireEvent, - HTMLDocument4_createRenderStyle, - HTMLDocument4_put_oncontrolselect, - HTMLDocument4_get_oncontrolselect, - HTMLDocument4_get_URLEncoded -}; - -void HTMLDocument_HTMLDocument3_Init(HTMLDocument *This) -{ - This->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl; - This->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl; -} diff -Nru wine1.7-1.7.13/dlls/mshtml/htmldoc5.c wine1.7-1.7.16/dlls/mshtml/htmldoc5.c --- wine1.7-1.7.13/dlls/mshtml/htmldoc5.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmldoc5.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,443 +0,0 @@ -/* - * Copyright 2007 Jacek Caban 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 - */ - -#include "config.h" - -#include -#include - -#define COBJMACROS - -#include "windef.h" -#include "winbase.h" -#include "winuser.h" -#include "ole2.h" - -#include "wine/debug.h" - -#include "mshtml_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(mshtml); - -static inline HTMLDocument *impl_from_IHTMLDocument5(IHTMLDocument5 *iface) -{ - return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument5_iface); -} - -static HRESULT WINAPI HTMLDocument5_QueryInterface(IHTMLDocument5 *iface, - REFIID riid, void **ppv) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return htmldoc_query_interface(This, riid, ppv); -} - -static ULONG WINAPI HTMLDocument5_AddRef(IHTMLDocument5 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return htmldoc_addref(This); -} - -static ULONG WINAPI HTMLDocument5_Release(IHTMLDocument5 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return htmldoc_release(This); -} - -static HRESULT WINAPI HTMLDocument5_GetTypeInfoCount(IHTMLDocument5 *iface, UINT *pctinfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); -} - -static HRESULT WINAPI HTMLDocument5_GetTypeInfo(IHTMLDocument5 *iface, UINT iTInfo, - LCID lcid, ITypeInfo **ppTInfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); -} - -static HRESULT WINAPI HTMLDocument5_GetIDsOfNames(IHTMLDocument5 *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, - rgDispId); -} - -static HRESULT WINAPI HTMLDocument5_Invoke(IHTMLDocument5 *iface, DISPID dispIdMember, - REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, - VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, - pDispParams, pVarResult, pExcepInfo, puArgErr); -} - -static HRESULT WINAPI HTMLDocument5_put_onmousewheel(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_onmousewheel(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMNode **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -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; -} - -static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName, - IHTMLDOMAttribute **ppattribute) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - HTMLDOMAttribute *attr; - HRESULT hres; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute); - - hres = HTMLDOMAttribute_Create(bstrattrName, NULL, 0, &attr); - if(FAILED(hres)) - return hres; - - *ppattribute = &attr->IHTMLDOMAttribute_iface; - return S_OK; -} - -static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bstrdata, - IHTMLDOMNode **ppRetNode) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - nsIDOMComment *nscomment; - HTMLElement *elem; - nsAString str; - nsresult nsres; - HRESULT hres; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode); - - if(!This->doc_node->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } - - nsAString_InitDepend(&str, bstrdata); - nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment); - nsAString_Finish(&str); - if(NS_FAILED(nsres)) { - ERR("CreateTextNode failed: %08x\n", nsres); - return E_FAIL; - } - - hres = HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment, &elem); - nsIDOMComment_Release(nscomment); - if(FAILED(hres)) - return hres; - - *ppRetNode = &elem->node.IHTMLDOMNode_iface; - return S_OK; -} - -static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_onfocusin(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_put_onfocusout(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_onfocusout(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_put_onactivate(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_onactivate(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_put_ondeactivate(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_ondeactivate(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_put_onbeforeactivate(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_onbeforeactivate(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument5(iface); - nsAString mode_str; - const PRUnichar *mode; - - TRACE("(%p)->(%p)\n", This, p); - - if(!This->doc_node->nsdoc) { - WARN("NULL nsdoc\n"); - return E_UNEXPECTED; - } - - nsAString_Init(&mode_str, NULL); - nsIDOMHTMLDocument_GetCompatMode(This->doc_node->nsdoc, &mode_str); - - nsAString_GetData(&mode_str, &mode); - *p = SysAllocString(mode); - nsAString_Finish(&mode_str); - - return S_OK; -} - -static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = { - HTMLDocument5_QueryInterface, - HTMLDocument5_AddRef, - HTMLDocument5_Release, - HTMLDocument5_GetTypeInfoCount, - HTMLDocument5_GetTypeInfo, - HTMLDocument5_GetIDsOfNames, - HTMLDocument5_Invoke, - HTMLDocument5_put_onmousewheel, - HTMLDocument5_get_onmousewheel, - HTMLDocument5_get_doctype, - HTMLDocument5_get_implementation, - HTMLDocument5_createAttribute, - HTMLDocument5_createComment, - HTMLDocument5_put_onfocusin, - HTMLDocument5_get_onfocusin, - HTMLDocument5_put_onfocusout, - HTMLDocument5_get_onfocusout, - HTMLDocument5_put_onactivate, - HTMLDocument5_get_onactivate, - HTMLDocument5_put_ondeactivate, - HTMLDocument5_get_ondeactivate, - HTMLDocument5_put_onbeforeactivate, - HTMLDocument5_get_onbeforeactivate, - HTMLDocument5_put_onbeforedeactivate, - HTMLDocument5_get_onbeforedeactivate, - HTMLDocument5_get_compatMode -}; - -static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface) -{ - return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface); -} - -static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface, - REFIID riid, void **ppv) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return htmldoc_query_interface(This, riid, ppv); -} - -static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return htmldoc_addref(This); -} - -static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return htmldoc_release(This); -} - -static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); -} - -static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo, - LCID lcid, ITypeInfo **ppTInfo) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); -} - -static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid, - LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, - rgDispId); -} - -static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember, - REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, - VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, - pDispParams, pVarResult, pExcepInfo, puArgErr); -} - -static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface, - IHTMLDocumentCompatibleInfoCollection **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface, - VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface, - VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface, - VARIANT *p) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface, - BSTR bstrId, IHTMLElement2 **p) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p); - return E_NOTIMPL; -} - -static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface) -{ - HTMLDocument *This = impl_from_IHTMLDocument6(iface); - FIXME("(%p)->()\n", This); - return E_NOTIMPL; -} - -static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = { - HTMLDocument6_QueryInterface, - HTMLDocument6_AddRef, - HTMLDocument6_Release, - HTMLDocument6_GetTypeInfoCount, - HTMLDocument6_GetTypeInfo, - HTMLDocument6_GetIDsOfNames, - HTMLDocument6_Invoke, - HTMLDocument6_get_compatible, - HTMLDocument6_get_documentMode, - HTMLDocument6_put_onstorage, - HTMLDocument6_get_onstorage, - HTMLDocument6_put_onstoragecommit, - HTMLDocument6_get_onstoragecommit, - HTMLDocument6_getElementById, - HTMLDocument6_updateSettings -}; - -void HTMLDocument_HTMLDocument5_Init(HTMLDocument *This) -{ - This->IHTMLDocument5_iface.lpVtbl = &HTMLDocument5Vtbl; - This->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl; -} diff -Nru wine1.7-1.7.13/dlls/mshtml/htmldoc.c wine1.7-1.7.16/dlls/mshtml/htmldoc.c --- wine1.7-1.7.13/dlls/mshtml/htmldoc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmldoc.c 2014-04-04 19:13:44.000000000 +0000 @@ -41,6 +41,79 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); +HRESULT get_doc_elem_by_id(HTMLDocumentNode *doc, const WCHAR *id, HTMLElement **ret) +{ + nsIDOMNodeList *nsnode_list; + nsIDOMElement *nselem; + nsIDOMNode *nsnode; + nsAString id_str; + nsresult nsres; + HRESULT hres; + + if(!doc->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; + } + + nsAString_InitDepend(&id_str, id); + /* get element by id attribute */ + nsres = nsIDOMHTMLDocument_GetElementById(doc->nsdoc, &id_str, &nselem); + if(FAILED(nsres)) { + ERR("GetElementById failed: %08x\n", nsres); + nsAString_Finish(&id_str); + return E_FAIL; + } + + /* get first element by name attribute */ + nsres = nsIDOMHTMLDocument_GetElementsByName(doc->nsdoc, &id_str, &nsnode_list); + nsAString_Finish(&id_str); + if(FAILED(nsres)) { + ERR("getElementsByName failed: %08x\n", nsres); + if(nselem) + nsIDOMElement_Release(nselem); + return E_FAIL; + } + + nsres = nsIDOMNodeList_Item(nsnode_list, 0, &nsnode); + nsIDOMNodeList_Release(nsnode_list); + assert(nsres == NS_OK); + + if(nsnode && nselem) { + UINT16 pos; + + nsres = nsIDOMNode_CompareDocumentPosition(nsnode, (nsIDOMNode*)nselem, &pos); + if(NS_FAILED(nsres)) { + FIXME("CompareDocumentPosition failed: 0x%08x\n", nsres); + nsIDOMNode_Release(nsnode); + nsIDOMElement_Release(nselem); + return E_FAIL; + } + + TRACE("CompareDocumentPosition gave: 0x%x\n", pos); + if(!(pos & (DOCUMENT_POSITION_PRECEDING | DOCUMENT_POSITION_CONTAINS))) { + nsIDOMElement_Release(nselem); + nselem = NULL; + } + } + + if(nsnode) { + if(!nselem) { + nsres = nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem); + assert(nsres == NS_OK); + } + nsIDOMNode_Release(nsnode); + } + + if(!nselem) { + *ret = NULL; + return S_OK; + } + + hres = get_elem(doc, nselem, ret); + nsIDOMElement_Release(nselem); + return hres; +} + static inline HTMLDocument *impl_from_IHTMLDocument2(IHTMLDocument2 *iface) { return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument2_iface); @@ -1683,12 +1756,2087 @@ HTMLDocument_createStyleSheet }; +static inline HTMLDocument *impl_from_IHTMLDocument3(IHTMLDocument3 *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument3_iface); +} + +static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface, + REFIID riid, void **ppv) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return htmldoc_query_interface(This, riid, ppv); +} + +static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return htmldoc_addref(This); +} + +static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return htmldoc_release(This); +} + +static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, + rgDispId); +} + +static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%x)\n", This, fForce); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text, + IHTMLDOMNode **newTextNode) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + nsIDOMText *nstext; + HTMLDOMNode *node; + nsAString text_str; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode); + + if(!This->doc_node->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; + } + + nsAString_InitDepend(&text_str, text); + nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext); + nsAString_Finish(&text_str); + if(NS_FAILED(nsres)) { + ERR("CreateTextNode failed: %08x\n", nsres); + return E_FAIL; + } + + hres = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext, &node); + nsIDOMText_Release(nstext); + if(FAILED(hres)) + return hres; + + *newTextNode = &node->IHTMLDOMNode_iface; + return S_OK; +} + +static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + nsIDOMElement *nselem = NULL; + HTMLDOMNode *node; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + if(This->window->readystate == READYSTATE_UNINITIALIZED) { + *p = NULL; + return S_OK; + } + + if(!This->doc_node->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; + } + + nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem); + if(NS_FAILED(nsres)) { + ERR("GetDocumentElement failed: %08x\n", nsres); + return E_FAIL; + } + + if(!nselem) { + *p = NULL; + return S_OK; + } + + hres = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE, &node); + nsIDOMElement_Release(nselem); + if(FAILED(hres)) + return hres; + + hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p); + node_release(node); + return hres; +} + +static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event, + IDispatch* pDisp, VARIANT_BOOL *pfResult) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + + TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); + + return attach_event(&This->doc_node->node.event_target, This, event, pDisp, pfResult); +} + +static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event, + IDispatch *pDisp) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp); + + return detach_event(This->doc_node->node.event_target, This, event, pDisp); +} + +static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + + TRACE("(%p)->()\n", This); + + return set_doc_event(This, EVENTID_CONTEXTMENU, &v); +} + +static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return get_doc_event(This, EVENTID_CONTEXTMENU, p); +} + +static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface, + IHTMLDocument2 **ppNewDoc) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + nsIDOMDocumentFragment *doc_frag; + HTMLDocumentNode *docnode; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, ppNewDoc); + + if(!This->doc_node->nsdoc) { + FIXME("NULL nsdoc\n"); + return E_NOTIMPL; + } + + nsres = nsIDOMHTMLDocument_CreateDocumentFragment(This->doc_node->nsdoc, &doc_frag); + if(NS_FAILED(nsres)) { + ERR("CreateDocumentFragment failed: %08x\n", nsres); + return E_FAIL; + } + + hres = create_document_fragment((nsIDOMNode*)doc_frag, This->doc_node, &docnode); + nsIDOMDocumentFragment_Release(doc_frag); + if(FAILED(hres)) + return hres; + + *ppNewDoc = &docnode->basedoc.IHTMLDocument2_iface; + return S_OK; +} + +static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface, + IHTMLDocument2 **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface, + VARIANT_BOOL v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface, + VARIANT_BOOL *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + + TRACE("(%p)->(%p)\n", This, p); + + return IHTMLDOMNode_get_childNodes(&This->doc_node->node.IHTMLDOMNode_iface, p); +} + +static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface, + VARIANT_BOOL v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface, + VARIANT_BOOL *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v, + IHTMLElementCollection **ppelColl) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + nsIDOMNodeList *node_list; + nsAString selector_str; + WCHAR *selector; + nsresult nsres; + + static const WCHAR formatW[] = {'*','[','i','d','=','%','s',']',',','*','[','n','a','m','e','=','%','s',']',0}; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl); + + if(!This->doc_node || !This->doc_node->nsdoc) { + /* We should probably return an empty collection. */ + FIXME("No nsdoc\n"); + return E_NOTIMPL; + } + + selector = heap_alloc(2*SysStringLen(v)*sizeof(WCHAR) + sizeof(formatW)); + if(!selector) + return E_OUTOFMEMORY; + sprintfW(selector, formatW, v, v); + + /* + * NOTE: IE getElementsByName implementation differs from Gecko. It searches both name and id attributes. + * That's why we use CSS selector instead. We should also use name only when it applies to given element + * types and search should be case insensitive. Those are currently not supported properly. + */ + nsAString_InitDepend(&selector_str, selector); + nsres = nsIDOMNodeSelector_QuerySelectorAll(This->doc_node->nsnode_selector, &selector_str, &node_list); + nsAString_Finish(&selector_str); + heap_free(selector); + if(NS_FAILED(nsres)) { + ERR("QuerySelectorAll failed: %08x\n", nsres); + return E_FAIL; + } + + *ppelColl = create_collection_from_nodelist(This->doc_node, node_list); + nsIDOMNodeList_Release(node_list); + return S_OK; +} + + +static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v, + IHTMLElement **pel) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + HTMLElement *elem; + HRESULT hres; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); + + hres = get_doc_elem_by_id(This->doc_node, v, &elem); + if(FAILED(hres) || !elem) { + *pel = NULL; + return hres; + } + + *pel = &elem->IHTMLElement_iface; + return S_OK; +} + + +static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v, + IHTMLElementCollection **pelColl) +{ + HTMLDocument *This = impl_from_IHTMLDocument3(iface); + nsIDOMNodeList *nslist; + nsAString id_str; + nsresult nsres; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl); + + if(!This->doc_node->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; + } + + nsAString_InitDepend(&id_str, v); + nsres = nsIDOMHTMLDocument_GetElementsByTagName(This->doc_node->nsdoc, &id_str, &nslist); + nsAString_Finish(&id_str); + if(FAILED(nsres)) { + ERR("GetElementByName failed: %08x\n", nsres); + return E_FAIL; + } + + *pelColl = create_collection_from_nodelist(This->doc_node, nslist); + nsIDOMNodeList_Release(nslist); + + return S_OK; +} + +static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = { + HTMLDocument3_QueryInterface, + HTMLDocument3_AddRef, + HTMLDocument3_Release, + HTMLDocument3_GetTypeInfoCount, + HTMLDocument3_GetTypeInfo, + HTMLDocument3_GetIDsOfNames, + HTMLDocument3_Invoke, + HTMLDocument3_releaseCapture, + HTMLDocument3_recalc, + HTMLDocument3_createTextNode, + HTMLDocument3_get_documentElement, + HTMLDocument3_uniqueID, + HTMLDocument3_attachEvent, + HTMLDocument3_detachEvent, + HTMLDocument3_put_onrowsdelete, + HTMLDocument3_get_onrowsdelete, + HTMLDocument3_put_onrowsinserted, + HTMLDocument3_get_onrowsinserted, + HTMLDocument3_put_oncellchange, + HTMLDocument3_get_oncellchange, + HTMLDocument3_put_ondatasetchanged, + HTMLDocument3_get_ondatasetchanged, + HTMLDocument3_put_ondataavailable, + HTMLDocument3_get_ondataavailable, + HTMLDocument3_put_ondatasetcomplete, + HTMLDocument3_get_ondatasetcomplete, + HTMLDocument3_put_onpropertychange, + HTMLDocument3_get_onpropertychange, + HTMLDocument3_put_dir, + HTMLDocument3_get_dir, + HTMLDocument3_put_oncontextmenu, + HTMLDocument3_get_oncontextmenu, + HTMLDocument3_put_onstop, + HTMLDocument3_get_onstop, + HTMLDocument3_createDocumentFragment, + HTMLDocument3_get_parentDocument, + HTMLDocument3_put_enableDownload, + HTMLDocument3_get_enableDownload, + HTMLDocument3_put_baseUrl, + HTMLDocument3_get_baseUrl, + HTMLDocument3_get_childNodes, + HTMLDocument3_put_inheritStyleSheets, + HTMLDocument3_get_inheritStyleSheets, + HTMLDocument3_put_onbeforeeditfocus, + HTMLDocument3_get_onbeforeeditfocus, + HTMLDocument3_getElementsByName, + HTMLDocument3_getElementById, + HTMLDocument3_getElementsByTagName +}; + +static inline HTMLDocument *impl_from_IHTMLDocument4(IHTMLDocument4 *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument4_iface); +} + +static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface, + REFIID riid, void **ppv) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return htmldoc_query_interface(This, riid, ppv); +} + +static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return htmldoc_addref(This); +} + +static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return htmldoc_release(This); +} + +static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, + rgDispId); +} + +static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + nsIDOMHTMLElement *nsbody; + nsresult nsres; + + TRACE("(%p)->()\n", This); + + nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody); + if(NS_FAILED(nsres) || !nsbody) { + ERR("GetBody failed: %08x\n", nsres); + return E_FAIL; + } + + nsres = nsIDOMHTMLElement_Focus(nsbody); + nsIDOMHTMLElement_Release(nsbody); + if(NS_FAILED(nsres)) { + ERR("Focus failed: %08x\n", nsres); + return E_FAIL; + } + + return S_OK; +} + +static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%p)\n", This, pfFocus); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl, + BSTR bstrOptions, IHTMLDocument2 **newDoc) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface, + VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_variant(pvarEventObject), ppEventObj); + + if(pvarEventObject && V_VT(pvarEventObject) != VT_ERROR && V_VT(pvarEventObject) != VT_EMPTY) { + FIXME("unsupported pvarEventObject %s\n", debugstr_variant(pvarEventObject)); + return E_NOTIMPL; + } + + return create_event_obj(ppEventObj); +} + +static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName, + VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + + TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled); + + return dispatch_event(&This->doc_node->node, bstrEventName, pvarEventObject, pfCanceled); +} + +static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v, + IHTMLRenderStyle **ppIHTMLRenderStyle) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument4(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = { + HTMLDocument4_QueryInterface, + HTMLDocument4_AddRef, + HTMLDocument4_Release, + HTMLDocument4_GetTypeInfoCount, + HTMLDocument4_GetTypeInfo, + HTMLDocument4_GetIDsOfNames, + HTMLDocument4_Invoke, + HTMLDocument4_focus, + HTMLDocument4_hasFocus, + HTMLDocument4_put_onselectionchange, + HTMLDocument4_get_onselectionchange, + HTMLDocument4_get_namespace, + HTMLDocument4_createDocumentFromUrl, + HTMLDocument4_put_media, + HTMLDocument4_get_media, + HTMLDocument4_createEventObject, + HTMLDocument4_fireEvent, + HTMLDocument4_createRenderStyle, + HTMLDocument4_put_oncontrolselect, + HTMLDocument4_get_oncontrolselect, + HTMLDocument4_get_URLEncoded +}; + +static inline HTMLDocument *impl_from_IHTMLDocument5(IHTMLDocument5 *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument5_iface); +} + +static HRESULT WINAPI HTMLDocument5_QueryInterface(IHTMLDocument5 *iface, + REFIID riid, void **ppv) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return htmldoc_query_interface(This, riid, ppv); +} + +static ULONG WINAPI HTMLDocument5_AddRef(IHTMLDocument5 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return htmldoc_addref(This); +} + +static ULONG WINAPI HTMLDocument5_Release(IHTMLDocument5 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return htmldoc_release(This); +} + +static HRESULT WINAPI HTMLDocument5_GetTypeInfoCount(IHTMLDocument5 *iface, UINT *pctinfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLDocument5_GetTypeInfo(IHTMLDocument5 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLDocument5_GetIDsOfNames(IHTMLDocument5 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, + rgDispId); +} + +static HRESULT WINAPI HTMLDocument5_Invoke(IHTMLDocument5 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLDocument5_put_onmousewheel(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_onmousewheel(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_doctype(IHTMLDocument5 *iface, IHTMLDOMNode **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +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; +} + +static HRESULT WINAPI HTMLDocument5_createAttribute(IHTMLDocument5 *iface, BSTR bstrattrName, + IHTMLDOMAttribute **ppattribute) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + HTMLDOMAttribute *attr; + HRESULT hres; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrattrName), ppattribute); + + hres = HTMLDOMAttribute_Create(bstrattrName, NULL, 0, &attr); + if(FAILED(hres)) + return hres; + + *ppattribute = &attr->IHTMLDOMAttribute_iface; + return S_OK; +} + +static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bstrdata, + IHTMLDOMNode **ppRetNode) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + nsIDOMComment *nscomment; + HTMLElement *elem; + nsAString str; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(bstrdata), ppRetNode); + + if(!This->doc_node->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; + } + + nsAString_InitDepend(&str, bstrdata); + nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment); + nsAString_Finish(&str); + if(NS_FAILED(nsres)) { + ERR("CreateTextNode failed: %08x\n", nsres); + return E_FAIL; + } + + hres = HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment, &elem); + nsIDOMComment_Release(nscomment); + if(FAILED(hres)) + return hres; + + *ppRetNode = &elem->node.IHTMLDOMNode_iface; + return S_OK; +} + +static HRESULT WINAPI HTMLDocument5_put_onfocusin(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_onfocusin(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_put_onfocusout(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_onfocusout(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_put_onactivate(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_onactivate(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_put_ondeactivate(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_ondeactivate(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_put_onbeforeactivate(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_onbeforeactivate(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_put_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_onbeforedeactivate(IHTMLDocument5 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument5_get_compatMode(IHTMLDocument5 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument5(iface); + nsAString mode_str; + const PRUnichar *mode; + + TRACE("(%p)->(%p)\n", This, p); + + if(!This->doc_node->nsdoc) { + WARN("NULL nsdoc\n"); + return E_UNEXPECTED; + } + + nsAString_Init(&mode_str, NULL); + nsIDOMHTMLDocument_GetCompatMode(This->doc_node->nsdoc, &mode_str); + + nsAString_GetData(&mode_str, &mode); + *p = SysAllocString(mode); + nsAString_Finish(&mode_str); + + return S_OK; +} + +static const IHTMLDocument5Vtbl HTMLDocument5Vtbl = { + HTMLDocument5_QueryInterface, + HTMLDocument5_AddRef, + HTMLDocument5_Release, + HTMLDocument5_GetTypeInfoCount, + HTMLDocument5_GetTypeInfo, + HTMLDocument5_GetIDsOfNames, + HTMLDocument5_Invoke, + HTMLDocument5_put_onmousewheel, + HTMLDocument5_get_onmousewheel, + HTMLDocument5_get_doctype, + HTMLDocument5_get_implementation, + HTMLDocument5_createAttribute, + HTMLDocument5_createComment, + HTMLDocument5_put_onfocusin, + HTMLDocument5_get_onfocusin, + HTMLDocument5_put_onfocusout, + HTMLDocument5_get_onfocusout, + HTMLDocument5_put_onactivate, + HTMLDocument5_get_onactivate, + HTMLDocument5_put_ondeactivate, + HTMLDocument5_get_ondeactivate, + HTMLDocument5_put_onbeforeactivate, + HTMLDocument5_get_onbeforeactivate, + HTMLDocument5_put_onbeforedeactivate, + HTMLDocument5_get_onbeforedeactivate, + HTMLDocument5_get_compatMode +}; + +static inline HTMLDocument *impl_from_IHTMLDocument6(IHTMLDocument6 *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument6_iface); +} + +static HRESULT WINAPI HTMLDocument6_QueryInterface(IHTMLDocument6 *iface, + REFIID riid, void **ppv) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return htmldoc_query_interface(This, riid, ppv); +} + +static ULONG WINAPI HTMLDocument6_AddRef(IHTMLDocument6 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return htmldoc_addref(This); +} + +static ULONG WINAPI HTMLDocument6_Release(IHTMLDocument6 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return htmldoc_release(This); +} + +static HRESULT WINAPI HTMLDocument6_GetTypeInfoCount(IHTMLDocument6 *iface, UINT *pctinfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLDocument6_GetTypeInfo(IHTMLDocument6 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLDocument6_GetIDsOfNames(IHTMLDocument6 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, + rgDispId); +} + +static HRESULT WINAPI HTMLDocument6_Invoke(IHTMLDocument6 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLDocument6_get_compatible(IHTMLDocument6 *iface, + IHTMLDocumentCompatibleInfoCollection **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_get_documentMode(IHTMLDocument6 *iface, + VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_get_onstorage(IHTMLDocument6 *iface, + VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_put_onstorage(IHTMLDocument6 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_get_onstoragecommit(IHTMLDocument6 *iface, + VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_put_onstoragecommit(IHTMLDocument6 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_getElementById(IHTMLDocument6 *iface, + BSTR bstrId, IHTMLElement2 **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrId), p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument6_updateSettings(IHTMLDocument6 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument6(iface); + FIXME("(%p)->()\n", This); + return E_NOTIMPL; +} + +static const IHTMLDocument6Vtbl HTMLDocument6Vtbl = { + HTMLDocument6_QueryInterface, + HTMLDocument6_AddRef, + HTMLDocument6_Release, + HTMLDocument6_GetTypeInfoCount, + HTMLDocument6_GetTypeInfo, + HTMLDocument6_GetIDsOfNames, + HTMLDocument6_Invoke, + HTMLDocument6_get_compatible, + HTMLDocument6_get_documentMode, + HTMLDocument6_put_onstorage, + HTMLDocument6_get_onstorage, + HTMLDocument6_put_onstoragecommit, + HTMLDocument6_get_onstoragecommit, + HTMLDocument6_getElementById, + HTMLDocument6_updateSettings +}; + +static inline HTMLDocument *impl_from_IHTMLDocument7(IHTMLDocument7 *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument7_iface); +} + +static HRESULT WINAPI HTMLDocument7_QueryInterface(IHTMLDocument7 *iface, REFIID riid, void **ppv) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return htmldoc_query_interface(This, riid, ppv); +} + +static ULONG WINAPI HTMLDocument7_AddRef(IHTMLDocument7 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return htmldoc_addref(This); +} + +static ULONG WINAPI HTMLDocument7_Release(IHTMLDocument7 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return htmldoc_release(This); +} + +static HRESULT WINAPI HTMLDocument7_GetTypeInfoCount(IHTMLDocument7 *iface, UINT *pctinfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo); +} + +static HRESULT WINAPI HTMLDocument7_GetTypeInfo(IHTMLDocument7 *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI HTMLDocument7_GetIDsOfNames(IHTMLDocument7 *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid, + rgDispId); +} + +static HRESULT WINAPI HTMLDocument7_Invoke(IHTMLDocument7 *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); +} + +static HRESULT WINAPI HTMLDocument7_get_defaultView(IHTMLDocument7 *iface, IHTMLWindow2 **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_createCDATASection(IHTMLDocument7 *iface, BSTR text, IHTMLDOMNode **newCDATASectionNode) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, newCDATASectionNode); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_getSelection(IHTMLDocument7 *iface, IHTMLSelection **ppIHTMLSelection) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, ppIHTMLSelection); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_getElementsByTagNameNS(IHTMLDocument7 *iface, VARIANT *pvarNS, + BSTR bstrLocalName, IHTMLElementCollection **pelColl) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrLocalName), pelColl); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_createElementNS(IHTMLDocument7 *iface, VARIANT *pvarNS, BSTR bstrTag, IHTMLElement **newElem) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrTag), newElem); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_createAttributeNS(IHTMLDocument7 *iface, VARIANT *pvarNS, + BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_variant(pvarNS), debugstr_w(bstrAttrName), ppAttribute); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onmsthumbnailclick(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_characterSet(IHTMLDocument7 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_createElement(IHTMLDocument7 *iface, BSTR bstrTag, IHTMLElement **newElem) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrTag), newElem); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_createAttribute(IHTMLDocument7 *iface, BSTR bstrAttrName, IHTMLDOMAttribute **ppAttribute) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrAttrName), ppAttribute); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_getElementByClassName(IHTMLDocument7 *iface, BSTR v, IHTMLElementCollection **pel) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), pel); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_createProcessingInstruction(IHTMLDocument7 *iface, BSTR target, + BSTR data, IDOMProcessingInstruction **newProcessingInstruction) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(target), debugstr_w(data), newProcessingInstruction); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_adoptNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource, IHTMLDOMNode3 **ppNodeDest) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p %p)\n", This, pNodeSource, ppNodeDest); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onmssitemodejumplistitemremoved(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_all(IHTMLDocument7 *iface, IHTMLElementCollection **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_inputEncoding(IHTMLDocument7 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_xmlEncoding(IHTMLDocument7 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_xmlStandalone(IHTMLDocument7 *iface, VARIANT_BOOL *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_xmlVersion(IHTMLDocument7 *iface, BSTR v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_xmlVersion(IHTMLDocument7 *iface, BSTR *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_hasAttributes(IHTMLDocument7 *iface, VARIANT_BOOL *pfHasAttributes) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, pfHasAttributes); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onabort(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onabort(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onblur(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onblur(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_oncanplay(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_oncanplay(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_oncanplaythrough(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_oncanplaythrough(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onchange(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onchange(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondrag(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondrag(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondragend(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondragend(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondragenter(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondragenter(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondragleave(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondragleave(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondragover(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondragover(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondrop(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondrop(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ondurationchange(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ondurationchange(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onemptied(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onemptied(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onended(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onended(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onerror(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onerror(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onfocus(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onfocus(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_oninput(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_oninput(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onload(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onload(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onloadeddata(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onloadeddata(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onloadedmetadata(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onloadedmetadata(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onloadstart(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onloadstart(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onpause(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onpause(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onplay(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onplay(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onplaying(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onplaying(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onprogress(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onprogress(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onratechange(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onratechange(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onreset(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onreset(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onscroll(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onscroll(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onseekend(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onseekend(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onseeking(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onseeking(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onselect(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onselect(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onstalled(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onstalled(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onsubmit(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onsubmit(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onsuspend(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onsuspend(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_ontimeupdate(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_ontimeupdate(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onvolumechange(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onvolumechange(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_onwaiting(IHTMLDocument7 *iface, VARIANT v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_onwaiting(IHTMLDocument7 *iface, VARIANT *p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_normalize(IHTMLDocument7 *iface) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_importNode(IHTMLDocument7 *iface, IHTMLDOMNode *pNodeSource, + VARIANT_BOOL fDeep, IHTMLDOMNode3 **ppNodeDest) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p %x %p)\n", This, pNodeSource, fDeep, ppNodeDest); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_parentWindow(IHTMLDocument7 *iface, IHTMLWindow2 **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_put_body(IHTMLDocument7 *iface, IHTMLElement *v) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_body(IHTMLDocument7 *iface, IHTMLElement **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI HTMLDocument7_get_head(IHTMLDocument7 *iface, IHTMLElement **p) +{ + HTMLDocument *This = impl_from_IHTMLDocument7(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static const IHTMLDocument7Vtbl HTMLDocument7Vtbl = { + HTMLDocument7_QueryInterface, + HTMLDocument7_AddRef, + HTMLDocument7_Release, + HTMLDocument7_GetTypeInfoCount, + HTMLDocument7_GetTypeInfo, + HTMLDocument7_GetIDsOfNames, + HTMLDocument7_Invoke, + HTMLDocument7_get_defaultView, + HTMLDocument7_createCDATASection, + HTMLDocument7_getSelection, + HTMLDocument7_getElementsByTagNameNS, + HTMLDocument7_createElementNS, + HTMLDocument7_createAttributeNS, + HTMLDocument7_put_onmsthumbnailclick, + HTMLDocument7_get_onmsthumbnailclick, + HTMLDocument7_get_characterSet, + HTMLDocument7_createElement, + HTMLDocument7_createAttribute, + HTMLDocument7_getElementByClassName, + HTMLDocument7_createProcessingInstruction, + HTMLDocument7_adoptNode, + HTMLDocument7_put_onmssitemodejumplistitemremoved, + HTMLDocument7_get_onmssitemodejumplistitemremoved, + HTMLDocument7_get_all, + HTMLDocument7_get_inputEncoding, + HTMLDocument7_get_xmlEncoding, + HTMLDocument7_put_xmlStandalone, + HTMLDocument7_get_xmlStandalone, + HTMLDocument7_put_xmlVersion, + HTMLDocument7_get_xmlVersion, + HTMLDocument7_hasAttributes, + HTMLDocument7_put_onabort, + HTMLDocument7_get_onabort, + HTMLDocument7_put_onblur, + HTMLDocument7_get_onblur, + HTMLDocument7_put_oncanplay, + HTMLDocument7_get_oncanplay, + HTMLDocument7_put_oncanplaythrough, + HTMLDocument7_get_oncanplaythrough, + HTMLDocument7_put_onchange, + HTMLDocument7_get_onchange, + HTMLDocument7_put_ondrag, + HTMLDocument7_get_ondrag, + HTMLDocument7_put_ondragend, + HTMLDocument7_get_ondragend, + HTMLDocument7_put_ondragenter, + HTMLDocument7_get_ondragenter, + HTMLDocument7_put_ondragleave, + HTMLDocument7_get_ondragleave, + HTMLDocument7_put_ondragover, + HTMLDocument7_get_ondragover, + HTMLDocument7_put_ondrop, + HTMLDocument7_get_ondrop, + HTMLDocument7_put_ondurationchange, + HTMLDocument7_get_ondurationchange, + HTMLDocument7_put_onemptied, + HTMLDocument7_get_onemptied, + HTMLDocument7_put_onended, + HTMLDocument7_get_onended, + HTMLDocument7_put_onerror, + HTMLDocument7_get_onerror, + HTMLDocument7_put_onfocus, + HTMLDocument7_get_onfocus, + HTMLDocument7_put_oninput, + HTMLDocument7_get_oninput, + HTMLDocument7_put_onload, + HTMLDocument7_get_onload, + HTMLDocument7_put_onloadeddata, + HTMLDocument7_get_onloadeddata, + HTMLDocument7_put_onloadedmetadata, + HTMLDocument7_get_onloadedmetadata, + HTMLDocument7_put_onloadstart, + HTMLDocument7_get_onloadstart, + HTMLDocument7_put_onpause, + HTMLDocument7_get_onpause, + HTMLDocument7_put_onplay, + HTMLDocument7_get_onplay, + HTMLDocument7_put_onplaying, + HTMLDocument7_get_onplaying, + HTMLDocument7_put_onprogress, + HTMLDocument7_get_onprogress, + HTMLDocument7_put_onratechange, + HTMLDocument7_get_onratechange, + HTMLDocument7_put_onreset, + HTMLDocument7_get_onreset, + HTMLDocument7_put_onscroll, + HTMLDocument7_get_onscroll, + HTMLDocument7_put_onseekend, + HTMLDocument7_get_onseekend, + HTMLDocument7_put_onseeking, + HTMLDocument7_get_onseeking, + HTMLDocument7_put_onselect, + HTMLDocument7_get_onselect, + HTMLDocument7_put_onstalled, + HTMLDocument7_get_onstalled, + HTMLDocument7_put_onsubmit, + HTMLDocument7_get_onsubmit, + HTMLDocument7_put_onsuspend, + HTMLDocument7_get_onsuspend, + HTMLDocument7_put_ontimeupdate, + HTMLDocument7_get_ontimeupdate, + HTMLDocument7_put_onvolumechange, + HTMLDocument7_get_onvolumechange, + HTMLDocument7_put_onwaiting, + HTMLDocument7_get_onwaiting, + HTMLDocument7_normalize, + HTMLDocument7_importNode, + HTMLDocument7_get_parentWindow, + HTMLDocument7_put_body, + HTMLDocument7_get_body, + HTMLDocument7_get_head +}; + static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp) { HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface); if(This->window) - update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode); + update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp); } static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface) @@ -2015,6 +4163,9 @@ }else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) { TRACE("(%p)->(IID_IHTMLDocument6, %p)\n", This, ppv); *ppv = &This->IHTMLDocument6_iface; + }else if(IsEqualGUID(&IID_IHTMLDocument7, riid)) { + TRACE("(%p)->(IID_IHTMLDocument7, %p)\n", This, ppv); + *ppv = &This->IHTMLDocument7_iface; }else if(IsEqualGUID(&IID_IPersist, riid)) { TRACE("(%p)->(IID_IPersist, %p)\n", This, ppv); *ppv = &This->IPersistFile_iface; @@ -2136,6 +4287,11 @@ static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex) { doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl; + doc->IHTMLDocument3_iface.lpVtbl = &HTMLDocument3Vtbl; + doc->IHTMLDocument4_iface.lpVtbl = &HTMLDocument4Vtbl; + doc->IHTMLDocument5_iface.lpVtbl = &HTMLDocument5Vtbl; + doc->IHTMLDocument6_iface.lpVtbl = &HTMLDocument6Vtbl; + doc->IHTMLDocument7_iface.lpVtbl = &HTMLDocument7Vtbl; doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl; doc->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl; doc->IProvideClassInfo_iface.lpVtbl = &ProvideClassInfoVtbl; @@ -2144,8 +4300,6 @@ doc->dispex = dispex; doc->task_magic = get_task_target_magic(); - HTMLDocument_HTMLDocument3_Init(doc); - HTMLDocument_HTMLDocument5_Init(doc); HTMLDocument_Persist_Init(doc); HTMLDocument_OleCmd_Init(doc); HTMLDocument_OleObj_Init(doc); diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlelem2.c wine1.7-1.7.16/dlls/mshtml/htmlelem2.c --- wine1.7-1.7.13/dlls/mshtml/htmlelem2.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlelem2.c 2014-04-04 19:13:44.000000000 +0000 @@ -864,7 +864,7 @@ TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); - return attach_event(get_node_event_target(&This->node), This->node.nsnode, &This->node.doc->basedoc, event, pDisp, pfResult); + return attach_event(get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp, pfResult); } static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp) diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlevent.c wine1.7-1.7.16/dlls/mshtml/htmlevent.c --- wine1.7-1.7.13/dlls/mshtml/htmlevent.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlevent.c 2014-04-04 19:13:44.000000000 +0000 @@ -42,7 +42,6 @@ } handler_vector_t; struct event_target_t { - DWORD node_handlers_mask; handler_vector_t *event_table[EVENTID_LAST]; }; @@ -159,13 +158,13 @@ #define EVENT_DEFAULTLISTENER 0x0001 #define EVENT_BUBBLE 0x0002 #define EVENT_FORWARDBODY 0x0004 -#define EVENT_NODEHANDLER 0x0008 +#define EVENT_BIND_TO_BODY 0x0008 #define EVENT_CANCELABLE 0x0010 #define EVENT_HASDEFAULTHANDLERS 0x0020 static const event_info_t event_info[] = { {abortW, onabortW, EVENTT_NONE, DISPID_EVMETH_ONABORT, - EVENT_NODEHANDLER}, + EVENT_BIND_TO_BODY}, {beforeunloadW, onbeforeunloadW, EVENTT_NONE, DISPID_EVMETH_ONBEFOREUNLOAD, EVENT_DEFAULTLISTENER|EVENT_FORWARDBODY}, {blurW, onblurW, EVENTT_HTML, DISPID_EVMETH_ONBLUR, @@ -185,7 +184,7 @@ {dragstartW, ondragstartW, EVENTT_MOUSE, DISPID_EVMETH_ONDRAGSTART, EVENT_CANCELABLE}, {errorW, onerrorW, EVENTT_NONE, DISPID_EVMETH_ONERROR, - EVENT_NODEHANDLER}, + EVENT_BIND_TO_BODY}, {focusW, onfocusW, EVENTT_HTML, DISPID_EVMETH_ONFOCUS, EVENT_DEFAULTLISTENER}, {helpW, onhelpW, EVENTT_KEY, DISPID_EVMETH_ONHELP, @@ -197,7 +196,7 @@ {keyupW, onkeyupW, EVENTT_KEY, DISPID_EVMETH_ONKEYUP, EVENT_DEFAULTLISTENER|EVENT_BUBBLE}, {loadW, onloadW, EVENTT_HTML, DISPID_EVMETH_ONLOAD, - EVENT_NODEHANDLER}, + EVENT_BIND_TO_BODY}, {mousedownW, onmousedownW, EVENTT_MOUSE, DISPID_EVMETH_ONMOUSEDOWN, EVENT_DEFAULTLISTENER|EVENT_BUBBLE}, {mousemoveW, onmousemoveW, EVENTT_MOUSE, DISPID_EVMETH_ONMOUSEMOVE, @@ -222,8 +221,6 @@ EVENT_DEFAULTLISTENER|EVENT_BUBBLE|EVENT_CANCELABLE} }; -static const eventid_t node_handled_list[] = { EVENTID_ABORT, EVENTID_ERROR, EVENTID_LOAD }; - eventid_t str_to_eid(LPCWSTR str) { int i; @@ -249,19 +246,6 @@ return EVENTID_LAST; } -static DWORD get_node_handler_mask(eventid_t eid) -{ - DWORD i; - - for(i=0; insdoc) - return S_OK; - - if(event_info[eid].flags & EVENT_NODEHANDLER) { - DWORD mask; + nsIDOMNode *nsnode = NULL; - mask = get_node_handler_mask(eid); - if(event_target->node_handlers_mask & mask) - return S_OK; + TRACE("%s\n", debugstr_w(event_info[eid].name)); - add_nsevent_listener(doc, nsnode, event_info[eid].name); - event_target->node_handlers_mask |= mask; + if(!doc->nsdoc || doc->event_vector[eid] || !(event_info[eid].flags & (EVENT_DEFAULTLISTENER|EVENT_BIND_TO_BODY))) return S_OK; - } - if(!(event_info[eid].flags & EVENT_DEFAULTLISTENER)) - return S_OK; + if(event_info[eid].flags & EVENT_BIND_TO_BODY) { + nsIDOMHTMLElement *nsbody; + nsresult nsres; - if(!doc->event_vector[eid]) { - doc->event_vector[eid] = TRUE; - add_nsevent_listener(doc, NULL, event_info[eid].name); + nsres = nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody); + if(NS_SUCCEEDED(nsres) && nsbody) { + nsnode = (nsIDOMNode*)nsbody; + }else { + ERR("GetBody failed: %08x\n", nsres); + return E_UNEXPECTED; + } } + doc->event_vector[eid] = TRUE; + add_nsevent_listener(doc, nsnode, event_info[eid].name); + + if(nsnode) + nsIDOMNode_Release(nsnode); return S_OK; } @@ -1392,7 +1378,7 @@ return S_OK; } -static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, nsIDOMNode *nsnode, HTMLDocumentNode *doc, +static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, HTMLDocumentNode *doc, eventid_t eid, IDispatch *disp) { event_target_t *event_target; @@ -1413,17 +1399,17 @@ event_target->event_table[eid]->handler_prop = disp; IDispatch_AddRef(disp); - return ensure_nsevent_handler(doc, event_target, nsnode, eid); + return ensure_nsevent_handler(doc, event_target, eid); } -HRESULT set_event_handler(event_target_t **event_target, nsIDOMNode *nsnode, HTMLDocumentNode *doc, eventid_t eid, VARIANT *var) +HRESULT set_event_handler(event_target_t **event_target, HTMLDocumentNode *doc, eventid_t eid, VARIANT *var) { switch(V_VT(var)) { case VT_NULL: return remove_event_handler(event_target, eid); case VT_DISPATCH: - return set_event_handler_disp(event_target, nsnode, doc, eid, V_DISPATCH(var)); + return set_event_handler_disp(event_target, doc, eid, V_DISPATCH(var)); default: FIXME("not handler %s\n", debugstr_variant(var)); @@ -1448,7 +1434,7 @@ return S_OK; } -HRESULT attach_event(event_target_t **event_target_ptr, nsIDOMNode *nsnode, HTMLDocument *doc, BSTR name, +HRESULT attach_event(event_target_t **event_target_ptr, HTMLDocument *doc, BSTR name, IDispatch *disp, VARIANT_BOOL *res) { event_target_t *event_target; @@ -1479,7 +1465,7 @@ event_target->event_table[eid]->handlers[i] = disp; *res = VARIANT_TRUE; - return ensure_nsevent_handler(doc->doc_node, event_target, nsnode, eid); + return ensure_nsevent_handler(doc->doc_node, event_target, eid); } HRESULT detach_event(event_target_t *event_target, HTMLDocument *doc, BSTR name, IDispatch *disp) @@ -1522,10 +1508,10 @@ return; } - set_event_handler_disp(event_target, node ? node->nsnode : NULL, doc, eid, disp); + set_event_handler_disp(event_target, doc, eid, disp); } -void update_cp_events(HTMLInnerWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp, nsIDOMNode *nsnode) +void update_cp_events(HTMLInnerWindow *window, event_target_t **event_target_ptr, cp_static_data_t *cp) { event_target_t *event_target; int i; @@ -1536,7 +1522,7 @@ for(i=0; i < EVENTID_LAST; i++) { if((event_info[i].flags & EVENT_DEFAULTLISTENER) && is_cp_event(cp, event_info[i].dispid)) - ensure_nsevent_handler(window->doc, event_target, nsnode, i); + ensure_nsevent_handler(window->doc, event_target, i); } } @@ -1567,7 +1553,7 @@ if(disp) { hres = get_node(doc, (nsIDOMNode*)nselem, TRUE, &node); if(SUCCEEDED(hres)) { - set_event_handler_disp(get_node_event_target(node), node->nsnode, node->doc, i, disp); + set_event_handler_disp(get_node_event_target(node), node->doc, i, disp); node_release(node); } IDispatch_Release(disp); @@ -1592,7 +1578,7 @@ for(i=0; i < EVENTID_LAST; i++) { if(event_info[i].flags & EVENT_HASDEFAULTHANDLERS) { - hres = ensure_nsevent_handler(doc, NULL, NULL, i); + hres = ensure_nsevent_handler(doc, NULL, i); if(FAILED(hres)) return hres; } diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlevent.h wine1.7-1.7.16/dlls/mshtml/htmlevent.h --- wine1.7-1.7.13/dlls/mshtml/htmlevent.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlevent.h 2014-04-04 19:13:44.000000000 +0000 @@ -51,14 +51,14 @@ eventid_t str_to_eid(LPCWSTR) DECLSPEC_HIDDEN; void check_event_attr(HTMLDocumentNode*,nsIDOMElement*) DECLSPEC_HIDDEN; void release_event_target(event_target_t*) DECLSPEC_HIDDEN; - void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*,IDispatch*) DECLSPEC_HIDDEN; -HRESULT set_event_handler(event_target_t**,nsIDOMNode*,HTMLDocumentNode*,eventid_t,VARIANT*) DECLSPEC_HIDDEN; +void fire_event(HTMLDocumentNode*,eventid_t,BOOL,nsIDOMNode*,nsIDOMEvent*,IDispatch*) DECLSPEC_HIDDEN; +HRESULT set_event_handler(event_target_t**,HTMLDocumentNode*,eventid_t,VARIANT*) DECLSPEC_HIDDEN; HRESULT get_event_handler(event_target_t**,eventid_t,VARIANT*) DECLSPEC_HIDDEN; -HRESULT attach_event(event_target_t**,nsIDOMNode*,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN; +HRESULT attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT detach_event(event_target_t*,HTMLDocument*,BSTR,IDispatch*) DECLSPEC_HIDDEN; HRESULT dispatch_event(HTMLDOMNode*,const WCHAR*,VARIANT*,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT call_fire_event(HTMLDOMNode*,eventid_t) DECLSPEC_HIDDEN; -void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*,nsIDOMNode*) DECLSPEC_HIDDEN; +void update_cp_events(HTMLInnerWindow*,event_target_t**,cp_static_data_t*) DECLSPEC_HIDDEN; HRESULT doc_init_events(HTMLDocumentNode*) DECLSPEC_HIDDEN; void detach_events(HTMLDocumentNode *doc) DECLSPEC_HIDDEN; HRESULT create_event_obj(IHTMLEventObj**) DECLSPEC_HIDDEN; @@ -76,7 +76,7 @@ static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var) { - return set_event_handler(get_node_event_target(node), node->nsnode, node->doc, eid, var); + return set_event_handler(get_node_event_target(node), node->doc, eid, var); } static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var) diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlform.c wine1.7-1.7.16/dlls/mshtml/htmlform.c --- wine1.7-1.7.13/dlls/mshtml/htmlform.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlform.c 2014-04-04 19:13:44.000000000 +0000 @@ -362,9 +362,9 @@ static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); - HTMLOuterWindow *window = NULL; + HTMLOuterWindow *window = NULL, *this_window = NULL; nsIInputStream *post_stream; - nsAString action_uri_str; + nsAString action_uri_str, target_str; IUri *uri; nsresult nsres; HRESULT hres; @@ -374,19 +374,32 @@ if(This->element.node.doc) { HTMLDocumentNode *doc = This->element.node.doc; if(doc->window && doc->window->base.outer_window) - window = doc->window->base.outer_window; + this_window = doc->window->base.outer_window; } - if(!window) { + if(!this_window) { TRACE("No outer window\n"); return S_OK; } + nsAString_Init(&target_str, NULL); + nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str); + if(NS_SUCCEEDED(nsres)) { + BOOL use_new_window; + window = get_target_window(this_window, &target_str, &use_new_window); + if(use_new_window) + FIXME("submit to new window is not supported\n"); + } + nsAString_Finish(&target_str); + if(!window) + return S_OK; + /* * FIXME: We currently don't use our submit implementation for sub-windows because * load_nsuri can't support post data. We should fix it. */ if(!window->doc_obj || window->doc_obj->basedoc.window != window) { nsres = nsIDOMHTMLFormElement_Submit(This->nsform); + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(NS_FAILED(nsres)) { ERR("Submit failed: %08x\n", nsres); return E_FAIL; @@ -414,6 +427,7 @@ IUri_Release(uri); } + IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(post_stream) nsIInputStream_Release(post_stream); return hres; diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlframebase.c wine1.7-1.7.16/dlls/mshtml/htmlframebase.c --- wine1.7-1.7.13/dlls/mshtml/htmlframebase.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlframebase.c 2014-04-04 19:13:44.000000000 +0000 @@ -28,6 +28,7 @@ #include "mshtml_private.h" #include "binding.h" +#include "htmlevent.h" #include "wine/debug.h" @@ -593,15 +594,19 @@ static HRESULT WINAPI HTMLFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v) { HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + return set_node_event(&This->element.node, EVENTID_LOAD, &v); } static HRESULT WINAPI HTMLFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p) { HTMLFrameBase *This = impl_from_IHTMLFrameBase2(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_node_event(&This->element.node, EVENTID_LOAD, p); } static HRESULT WINAPI HTMLFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v) diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlstyle.c wine1.7-1.7.16/dlls/mshtml/htmlstyle.c --- wine1.7-1.7.13/dlls/mshtml/htmlstyle.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlstyle.c 2014-04-04 19:13:44.000000000 +0000 @@ -126,6 +126,8 @@ {'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 attrListStyleType[] = + {'l','i','s','t','-','s','t','y','l','e','-','t','y','p','e',0}; static const WCHAR attrMargin[] = {'m','a','r','g','i','n',0}; static const WCHAR attrMarginBottom[] = @@ -241,6 +243,7 @@ {attrLeft, DISPID_IHTMLSTYLE_LEFT}, {attrLetterSpacing, DISPID_IHTMLSTYLE_LETTERSPACING}, {attrLineHeight, DISPID_IHTMLSTYLE_LINEHEIGHT}, + {attrListStyleType, DISPID_IHTMLSTYLE_LISTSTYLETYPE}, {attrMargin, DISPID_IHTMLSTYLE_MARGIN}, {attrMarginBottom, DISPID_IHTMLSTYLE_MARGINBOTTOM}, {attrMarginLeft, DISPID_IHTMLSTYLE_MARGINLEFT}, @@ -2168,15 +2171,19 @@ static HRESULT WINAPI HTMLStyle_put_listStyleType(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_LISTSTYLETYPE, v, 0); } static HRESULT WINAPI HTMLStyle_get_listStyleType(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_LISTSTYLETYPE, p); } static HRESULT WINAPI HTMLStyle_put_listStylePosition(IHTMLStyle *iface, BSTR v) diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlstyle.h wine1.7-1.7.16/dlls/mshtml/htmlstyle.h --- wine1.7-1.7.13/dlls/mshtml/htmlstyle.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlstyle.h 2014-04-04 19:13:44.000000000 +0000 @@ -78,6 +78,7 @@ STYLEID_LEFT, STYLEID_LETTER_SPACING, STYLEID_LINE_HEIGHT, + STYLEID_LISTSTYLETYPE, STYLEID_MARGIN, STYLEID_MARGIN_BOTTOM, STYLEID_MARGIN_LEFT, diff -Nru wine1.7-1.7.13/dlls/mshtml/htmltable.c wine1.7-1.7.16/dlls/mshtml/htmltable.c --- wine1.7-1.7.13/dlls/mshtml/htmltable.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmltable.c 2014-04-04 19:13:44.000000000 +0000 @@ -302,15 +302,34 @@ static HRESULT WINAPI HTMLTable_put_align(IHTMLTable *iface, BSTR v) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&val, v); + + nsres = nsIDOMHTMLTableElement_SetAlign(This->nstable, &val); + nsAString_Finish(&val); + if (NS_FAILED(nsres)){ + ERR("Set Align(%s) failed!\n", debugstr_w(v)); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLTable_get_align(IHTMLTable *iface, BSTR *p) { HTMLTable *This = impl_from_IHTMLTable(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&val, NULL); + nsres = nsIDOMHTMLTableElement_GetAlign(This->nstable, &val); + + return return_nsstr(nsres, &val, p); } static HRESULT WINAPI HTMLTable_refresh(IHTMLTable *iface) diff -Nru wine1.7-1.7.13/dlls/mshtml/htmltablerow.c wine1.7-1.7.16/dlls/mshtml/htmltablerow.c --- wine1.7-1.7.13/dlls/mshtml/htmltablerow.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmltablerow.c 2014-04-04 19:13:44.000000000 +0000 @@ -102,43 +102,116 @@ static HRESULT WINAPI HTMLTableRow_put_align(IHTMLTableRow *iface, BSTR v) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&val, v); + + nsres = nsIDOMHTMLTableRowElement_SetAlign(This->nsrow, &val); + nsAString_Finish(&val); + if (NS_FAILED(nsres)){ + ERR("Set Align(%s) failed!\n", debugstr_w(v)); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLTableRow_get_align(IHTMLTableRow *iface, BSTR *p) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&val, NULL); + nsres = nsIDOMHTMLTableRowElement_GetAlign(This->nsrow, &val); + + return return_nsstr(nsres, &val, p); } static HRESULT WINAPI HTMLTableRow_put_vAlign(IHTMLTableRow *iface, BSTR v) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%s)\n", This, debugstr_w(v)); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_w(v)); + + nsAString_InitDepend(&val, v); + + nsres = nsIDOMHTMLTableRowElement_SetVAlign(This->nsrow, &val); + nsAString_Finish(&val); + + if (NS_FAILED(nsres)){ + ERR("Set VAlign(%s) failed!\n", debugstr_w(v)); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLTableRow_get_vAlign(IHTMLTableRow *iface, BSTR *p) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&val, NULL); + nsres = nsIDOMHTMLTableRowElement_GetVAlign(This->nsrow, &val); + + return return_nsstr(nsres, &val, p); } static HRESULT WINAPI HTMLTableRow_put_bgColor(IHTMLTableRow *iface, VARIANT v) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%s)\n", This, debugstr_variant(&v)); - return E_NOTIMPL; + nsAString val; + nsresult nsres; + + TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); + + nsAString_InitDepend(&val, V_BSTR(&v)); + variant_to_nscolor(&v, &val); + nsres = nsIDOMHTMLTableRowElement_SetBgColor(This->nsrow, &val); + nsAString_Finish(&val); + + if (NS_FAILED(nsres)){ + ERR("Set BgColor(%s) failed!\n", debugstr_variant(&v)); + return E_FAIL; + } + + return S_OK; } static HRESULT WINAPI HTMLTableRow_get_bgColor(IHTMLTableRow *iface, VARIANT *p) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString strColor; + nsresult nsres; + HRESULT hres; + const PRUnichar *color; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&strColor, NULL); + nsres = nsIDOMHTMLTableRowElement_GetBgColor(This->nsrow, &strColor); + nsAString_Finish(&strColor); + + if(NS_SUCCEEDED(nsres)) { + nsAString_GetData(&strColor, &color); + V_VT(p) = VT_BSTR; + hres = nscolor_to_str(color, &V_BSTR(p)); + }else { + ERR("SetBgColor failed: %08x\n", nsres); + hres = E_FAIL; + } + + return hres; } static HRESULT WINAPI HTMLTableRow_put_borderColor(IHTMLTableRow *iface, VARIANT v) @@ -186,15 +259,29 @@ static HRESULT WINAPI HTMLTableRow_get_rowIndex(IHTMLTableRow *iface, LONG *p) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + nsres = nsIDOMHTMLTableRowElement_GetRowIndex(This->nsrow, p); + if(NS_FAILED(nsres)) { + ERR("Get rowIndex failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } -static HRESULT WINAPI HTMLTableRow_get_selectionRowIndex(IHTMLTableRow *iface, LONG *p) +static HRESULT WINAPI HTMLTableRow_get_sectionRowIndex(IHTMLTableRow *iface, LONG *p) { HTMLTableRow *This = impl_from_IHTMLTableRow(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsresult nsres; + + TRACE("(%p)->(%p)\n", This, p); + nsres = nsIDOMHTMLTableRowElement_GetSectionRowIndex(This->nsrow, p); + if(NS_FAILED(nsres)) { + ERR("Get selectionRowIndex failed: %08x\n", nsres); + return E_FAIL; + } + return S_OK; } static HRESULT WINAPI HTMLTableRow_get_cells(IHTMLTableRow *iface, IHTMLElementCollection **p) @@ -252,7 +339,7 @@ HTMLTableRow_put_borderColorDark, HTMLTableRow_get_borderColorDark, HTMLTableRow_get_rowIndex, - HTMLTableRow_get_selectionRowIndex, + HTMLTableRow_get_sectionRowIndex, HTMLTableRow_get_cells, HTMLTableRow_insertCell, HTMLTableRow_deleteCell diff -Nru wine1.7-1.7.13/dlls/mshtml/htmlwindow.c wine1.7-1.7.16/dlls/mshtml/htmlwindow.c --- wine1.7-1.7.13/dlls/mshtml/htmlwindow.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/htmlwindow.c 2014-04-04 19:13:44.000000000 +0000 @@ -95,7 +95,7 @@ return E_FAIL; } - return set_event_handler(&window->inner_window->doc->body_event_target, NULL, window->inner_window->doc, eid, var); + return set_event_handler(&window->inner_window->doc->body_event_target, window->inner_window->doc, eid, var); } static inline HRESULT get_window_event(HTMLWindow *window, eventid_t eid, VARIANT *var) @@ -1617,7 +1617,7 @@ return E_FAIL; } - return attach_event(&window->doc->body_event_target, NULL, &window->doc->basedoc, event, pDisp, pfResult); + return attach_event(&window->doc->body_event_target, &window->doc->basedoc, event, pDisp, pfResult); } static HRESULT WINAPI HTMLWindow3_detachEvent(IHTMLWindow3 *iface, BSTR event, IDispatch *pDisp) @@ -2184,7 +2184,7 @@ headers = V_BSTR(headers_var); } - hres = super_navigate(window, uri, BINDING_NAVIGATED, headers, post_data, post_data_size); + hres = super_navigate(window, uri, BINDING_NAVIGATED|BINDING_NOFRAG, headers, post_data, post_data_size); IUri_Release(uri); if(post_data) SafeArrayUnaccessData(V_ARRAY(post_data_var)); diff -Nru wine1.7-1.7.13/dlls/mshtml/Makefile.in wine1.7-1.7.16/dlls/mshtml/Makefile.in --- wine1.7-1.7.13/dlls/mshtml/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -14,8 +14,6 @@ htmlcomment.c \ htmlcurstyle.c \ htmldoc.c \ - htmldoc3.c \ - htmldoc5.c \ htmlelem.c \ htmlelem2.c \ htmlelem3.c \ diff -Nru wine1.7-1.7.13/dlls/mshtml/mshtml_private.h wine1.7-1.7.16/dlls/mshtml/mshtml_private.h --- wine1.7-1.7.13/dlls/mshtml/mshtml_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/mshtml_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -488,6 +488,7 @@ IHTMLDocument4 IHTMLDocument4_iface; IHTMLDocument5 IHTMLDocument5_iface; IHTMLDocument6 IHTMLDocument6_iface; + IHTMLDocument7 IHTMLDocument7_iface; IPersistMoniker IPersistMoniker_iface; IPersistFile IPersistFile_iface; IPersistHistory IPersistHistory_iface; @@ -760,8 +761,6 @@ HRESULT create_storage(IHTMLStorage**) DECLSPEC_HIDDEN; -void HTMLDocument_HTMLDocument3_Init(HTMLDocument*) DECLSPEC_HIDDEN; -void HTMLDocument_HTMLDocument5_Init(HTMLDocument*) DECLSPEC_HIDDEN; void HTMLDocument_Persist_Init(HTMLDocument*) DECLSPEC_HIDDEN; void HTMLDocument_OleCmd_Init(HTMLDocument*) DECLSPEC_HIDDEN; void HTMLDocument_OleObj_Init(HTMLDocument*) DECLSPEC_HIDDEN; @@ -863,6 +862,10 @@ HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN; +BOOL variant_to_nscolor(const VARIANT *v, nsAString *nsstr) DECLSPEC_HIDDEN; +HRESULT nscolor_to_str(LPCWSTR color, BSTR *ret) DECLSPEC_HIDDEN; + + struct HTMLAttributeCollection { DispatchEx dispex; IHTMLAttributeCollection IHTMLAttributeCollection_iface; @@ -944,6 +947,7 @@ HRESULT search_window_props(HTMLInnerWindow*,BSTR,DWORD,DISPID*) DECLSPEC_HIDDEN; HRESULT get_frame_by_name(HTMLOuterWindow*,const WCHAR*,BOOL,HTMLOuterWindow**) DECLSPEC_HIDDEN; HRESULT get_doc_elem_by_id(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN; +HTMLOuterWindow *get_target_window(HTMLOuterWindow*,nsAString*,BOOL*) DECLSPEC_HIDDEN; HRESULT wrap_iface(IUnknown*,IUnknown*,IUnknown**) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/mshtml/navigate.c wine1.7-1.7.16/dlls/mshtml/navigate.c --- wine1.7-1.7.13/dlls/mshtml/navigate.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/navigate.c 2014-04-04 19:13:44.000000000 +0000 @@ -1657,7 +1657,7 @@ static void handle_extern_mime_navigation(nsChannelBSC *This) { - IWebBrowserPriv2IE8 *webbrowser_priv; + IWebBrowserPriv2IE9 *webbrowser_priv; IOleCommandTarget *cmdtrg; HTMLDocumentObj *doc_obj; IBindCtx *bind_ctx; @@ -1698,8 +1698,8 @@ hres = IUnknown_QueryInterface(doc_obj->webbrowser, &IID_IWebBrowserPriv2IE8, (void**)&webbrowser_priv); if(SUCCEEDED(hres)) { - hres = IWebBrowserPriv2IE8_NavigateWithBindCtx2(webbrowser_priv, uri, &flags, NULL, NULL, NULL, bind_ctx, NULL); - IWebBrowserPriv2IE8_Release(webbrowser_priv); + hres = IWebBrowserPriv2IE9_NavigateWithBindCtx2(webbrowser_priv, uri, &flags, NULL, NULL, NULL, bind_ctx, NULL, 0); + IWebBrowserPriv2IE9_Release(webbrowser_priv); }else { IWebBrowserPriv *webbrowser_priv_old; VARIANT uriv; @@ -2210,7 +2210,7 @@ } } - if(!(flags & BINDING_REFRESH) && window->uri_nofrag && !post_data_size) { + if(!(flags & BINDING_NOFRAG) && window->uri_nofrag && !post_data_size) { BOOL eq; hres = IUri_IsEqual(uri_nofrag, window->uri_nofrag, &eq); diff -Nru wine1.7-1.7.13/dlls/mshtml/olecmd.c wine1.7-1.7.16/dlls/mshtml/olecmd.c --- wine1.7-1.7.13/dlls/mshtml/olecmd.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/olecmd.c 2014-04-04 19:13:44.000000000 +0000 @@ -407,7 +407,7 @@ IOleCommandTarget_Exec(window->doc_obj->client_cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL); } - load_uri(task->window, task->window->uri, BINDING_REFRESH); + load_uri(task->window, task->window->uri, BINDING_REFRESH|BINDING_NOFRAG); } static void refresh_destr(task_t *_task) diff -Nru wine1.7-1.7.13/dlls/mshtml/script.c wine1.7-1.7.16/dlls/mshtml/script.c --- wine1.7-1.7.13/dlls/mshtml/script.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/script.c 2014-04-04 19:13:44.000000000 +0000 @@ -816,11 +816,13 @@ { const WCHAR text_javascriptW[] = {'t','e','x','t','/','j','a','v','a','s','c','r','i','p','t',0}; + const WCHAR text_jscriptW[] = + {'t','e','x','t','/','j','s','c','r','i','p','t',0}; const WCHAR text_vbscriptW[] = {'t','e','x','t','/','v','b','s','c','r','i','p','t',0}; /* FIXME: Handle more types */ - if(!strcmpiW(type, text_javascriptW)) { + if(!strcmpiW(type, text_javascriptW) || !strcmpiW(type, text_jscriptW)) { *guid = CLSID_JScript; }else if(!strcmpiW(type, text_vbscriptW)) { *guid = CLSID_VBScript; diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/blank.html wine1.7-1.7.16/dlls/mshtml/tests/blank.html --- wine1.7-1.7.13/dlls/mshtml/tests/blank.html 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/blank.html 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1 @@ + diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/dom.c wine1.7-1.7.16/dlls/mshtml/tests/dom.c --- wine1.7-1.7.13/dlls/mshtml/tests/dom.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/dom.c 2014-04-04 19:13:44.000000000 +0000 @@ -5576,6 +5576,9 @@ IHTMLElementCollection *col; IHTMLTableRow *row; HRESULT hres; + BSTR bstr; + LONG lval; + VARIANT vbg, vDefaultbg; static const elem_type_t cell_types[] = {ET_TD,ET_TD}; @@ -5592,6 +5595,74 @@ test_elem_collection((IUnknown*)col, cell_types, sizeof(cell_types)/sizeof(*cell_types)); IHTMLElementCollection_Release(col); + bstr = a2bstr("left"); + hres = IHTMLTableRow_put_align(row, bstr); + ok(hres == S_OK, "set_align failed: %08x\n", hres); + SysFreeString(bstr); + + bstr = NULL; + hres = IHTMLTableRow_get_align(row, &bstr); + ok(hres == S_OK, "get_align failed: %08x\n", hres); + ok(bstr != NULL, "get_align returned NULL\n"); + ok(!strcmp_wa(bstr, "left"), "get_align returned %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + bstr = a2bstr("top"); + hres = IHTMLTableRow_put_vAlign(row, bstr); + ok(hres == S_OK, "set_valign failed: %08x\n", hres); + SysFreeString(bstr); + + bstr = NULL; + hres = IHTMLTableRow_get_vAlign(row, &bstr); + ok(hres == S_OK, "get_valign failed: %08x\n", hres); + ok(bstr != NULL, "get_valign returned NULL\n"); + ok(!strcmp_wa(bstr, "top"), "get_valign returned %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + + lval = 0xdeadbeef; + hres = IHTMLTableRow_get_rowIndex(row, &lval); + ok(hres == S_OK, "get_rowIndex failed: %08x\n", hres); + ok(lval == 1, "get_rowIndex returned %d\n", lval); + + lval = 0xdeadbeef; + hres = IHTMLTableRow_get_sectionRowIndex(row, &lval); + ok(hres == S_OK, "get_sectionRowIndex failed: %08x\n", hres); + ok(lval == 1, "get_sectionRowIndex returned %d\n", lval); + + hres = IHTMLTableRow_get_bgColor(row, &vDefaultbg); + ok(hres == S_OK, "get_bgColor failed: %08x\n", hres); + ok(V_VT(&vDefaultbg) == VT_BSTR, "bstr != NULL\n"); + ok(!V_BSTR(&vDefaultbg), "V_BSTR(bgColor) = %s\n", wine_dbgstr_w(V_BSTR(&vDefaultbg))); + + V_VT(&vbg) = VT_BSTR; + V_BSTR(&vbg) = a2bstr("red"); + hres = IHTMLTableRow_put_bgColor(row, vbg); + ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); + VariantClear(&vbg); + + hres = IHTMLTableRow_get_bgColor(row, &vbg); + ok(hres == S_OK, "get_bgColor failed: %08x\n", hres); + ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n"); + ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg))); + VariantClear(&vbg); + + V_VT(&vbg) = VT_I4; + V_I4(&vbg) = 0xff0000; + hres = IHTMLTableRow_put_bgColor(row, vbg); + ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); + VariantClear(&vbg); + + hres = IHTMLTableRow_get_bgColor(row, &vbg); + ok(hres == S_OK, "get_bgColor failed: %08x\n", hres); + ok(V_VT(&vDefaultbg) == VT_BSTR, "V_VT(&vDefaultbg) != VT_BSTR\n"); + ok(!strcmp_wa(V_BSTR(&vbg), "#ff0000"), "Unexpected bgcolor %s\n", wine_dbgstr_w(V_BSTR(&vbg))); + VariantClear(&vbg); + + /* Restore Originial */ + hres = IHTMLTableRow_put_bgColor(row, vDefaultbg); + ok(hres == S_OK, "put_bgColor failed: %08x\n", hres); + VariantClear(&vDefaultbg); + IHTMLTableRow_Release(row); } @@ -5657,6 +5728,7 @@ IHTMLDOMNode *node; VARIANT v; HRESULT hres; + BSTR bstr; static const elem_type_t row_types[] = {ET_TR,ET_TR}; static const elem_type_t all_types[] = {ET_TBODY,ET_TR,ET_TR,ET_TD,ET_TD}; @@ -5710,6 +5782,18 @@ test_table_cell_spacing(table, "11"); VariantClear(&v); + bstr = a2bstr("left"); + hres = IHTMLTable_put_align(table, bstr); + ok(hres == S_OK, "set_align failed: %08x\n", hres); + SysFreeString(bstr); + + bstr = NULL; + hres = IHTMLTable_get_align(table, &bstr); + ok(hres == S_OK, "get_align failed: %08x\n", hres); + ok(bstr != NULL, "get_align returned NULL\n"); + ok(!strcmp_wa(bstr, "left"), "get_align returned %s\n", wine_dbgstr_w(bstr)); + SysFreeString(bstr); + IHTMLTable_Release(table); } @@ -6014,7 +6098,6 @@ hres = IHTMLStyleSheetsCollection_item(col, &idx, &res); ok(hres == E_INVALIDARG, "item failed: %08x, expected E_INVALIDARG\n", hres); ok(V_VT(&res) == VT_EMPTY, "V_VT(res) = %d\n", V_VT(&res)); - ok(V_DISPATCH(&res) != NULL, "V_DISPATCH(&res) == NULL\n"); VariantClear(&res); IHTMLStyleSheetsCollection_Release(col); diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/events.c wine1.7-1.7.16/dlls/mshtml/tests/events.c --- wine1.7-1.7.13/dlls/mshtml/tests/events.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/events.c 2014-04-04 19:13:44.000000000 +0000 @@ -83,11 +83,13 @@ DEFINE_EXPECT(submit_onclick_attached_check_cancel); DEFINE_EXPECT(submit_onclick_setret); DEFINE_EXPECT(elem2_cp_onclick); +DEFINE_EXPECT(iframe_onload); static HWND container_hwnd = NULL; static IHTMLWindow2 *window; static IOleDocumentView *view; static BOOL xy_todo; +static BOOL is_ie9plus; typedef struct { LONG x; @@ -243,6 +245,18 @@ return elem3; } +#define get_iframe_iface(u) _get_iframe_iface(__LINE__,u) +static IHTMLIFrameElement *_get_iframe_iface(unsigned line, IUnknown *unk) +{ + IHTMLIFrameElement *iframe; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLIFrameElement, (void**)&iframe); + ok_(__FILE__,line)(hres == S_OK, "QueryInterface(IID_IHTMLIFrameElement) failed: %08x\n", hres); + + return iframe; +} + #define doc_get_body(d) _doc_get_body(__LINE__,d) static IHTMLElement *_doc_get_body(unsigned line, IHTMLDocument2 *doc) { @@ -993,6 +1007,17 @@ EVENT_HANDLER_FUNC_OBJ(submit_onclick); +static HRESULT WINAPI iframe_onload(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + CHECK_EXPECT(iframe_onload); + test_event_args(&DIID_DispHTMLIFrame, id, wFlags, pdp, pvarRes, pei, pspCaller); + test_event_src("IFRAME"); + return S_OK; +} + +EVENT_HANDLER_FUNC_OBJ(iframe_onload); + static HRESULT WINAPI submit_onclick_attached(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -2058,6 +2083,8 @@ CHECK_CALLED(submit_onclick_attached_check_cancel); CHECK_CALLED(submit_onclick_attached); + if(1)pump_msgs(NULL); + IHTMLElement_Release(submit); } @@ -2144,16 +2171,19 @@ static void test_iframe_connections(IHTMLDocument2 *doc) { - HRESULT hres; IHTMLIFrameElement *iframe; IHTMLDocument2 *iframes_doc; DWORD cookie; IConnectionPoint *cp; - IHTMLElement *element = find_element_by_id(doc, "ifr"); + IHTMLElement *element; + BSTR str; + HRESULT hres; + + trace("iframe tests...\n"); - hres = IHTMLElement_QueryInterface(element, &IID_IHTMLIFrameElement, (void**)&iframe); + element = find_element_by_id(doc, "ifr"); + iframe = get_iframe_iface((IUnknown*)element); IHTMLElement_Release(element); - ok(hres == S_OK, "QueryInterface(IID_IHTMLIFrameElement) failed: %08x\n", hres); iframes_doc = get_iframe_doc(iframe); IHTMLIFrameElement_Release(iframe); @@ -2165,6 +2195,43 @@ IConnectionPoint_Release(cp); ok(hres == CONNECT_E_NOCONNECTION, "Unadvise returned %08x, expected CONNECT_E_NOCONNECTION\n", hres); + unregister_cp((IUnknown*)iframes_doc, &IID_IDispatch, cookie); + + if(is_ie9plus) { + IHTMLFrameBase2 *frame_base2; + VARIANT v; + + hres = IHTMLIFrameElement_QueryInterface(iframe, &IID_IHTMLFrameBase2, (void**)&frame_base2); + ok(hres == S_OK, "Could not get IHTMLFrameBase2 iface: %08x\n", hres); + + V_VT(&v) = VT_DISPATCH; + V_DISPATCH(&v) = (IDispatch*)&iframe_onload_obj; + hres = IHTMLFrameBase2_put_onload(frame_base2, v); + ok(hres == S_OK, "put_onload failed: %08x\n", hres); + + IHTMLFrameBase2_Release(frame_base2); + + str = a2bstr("about:blank"); + hres = IHTMLDocument2_put_URL(iframes_doc, str); + ok(hres == S_OK, "put_URL failed: %08x\n", hres); + SysFreeString(str); + + SET_EXPECT(iframe_onload); + pump_msgs(&called_iframe_onload); + CHECK_CALLED(iframe_onload); + + str = a2bstr("about:test"); + hres = IHTMLDocument2_put_URL(iframes_doc, str); + ok(hres == S_OK, "put_URL failed: %08x\n", hres); + SysFreeString(str); + + SET_EXPECT(iframe_onload); + pump_msgs(&called_iframe_onload); + CHECK_CALLED(iframe_onload); + }else { + win_skip("Skipping iframe onload tests on IE older than 9.\n"); + } + IHTMLDocument2_Release(iframes_doc); } @@ -2672,24 +2739,12 @@ static IHTMLDocument2 *create_document(void) { IHTMLDocument2 *doc; - IHTMLDocument5 *doc5; HRESULT hres; hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IHTMLDocument2, (void**)&doc); ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres); - if (FAILED(hres)) - return NULL; - - hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5); - if(FAILED(hres)) { - win_skip("Could not get IHTMLDocument5 interface, probably too old IE\n"); - IHTMLDocument2_Release(doc); - return NULL; - } - - IHTMLDocument5_Release(doc5); - return doc; + return SUCCEEDED(hres) ? doc : NULL; } @@ -2790,24 +2845,57 @@ IHTMLDocument2_Release(doc); } +static BOOL check_ie(void) +{ + IHTMLDocument2 *doc; + IHTMLDocument5 *doc5; + IHTMLDocument7 *doc7; + HRESULT hres; + + doc = create_document(); + if(!doc) + return FALSE; + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7); + if(SUCCEEDED(hres)) { + is_ie9plus = TRUE; + IHTMLDocument7_Release(doc7); + } + + trace("is_ie9plus %x\n", is_ie9plus); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5); + if(SUCCEEDED(hres)) + IHTMLDocument5_Release(doc5); + + IHTMLDocument2_Release(doc); + return SUCCEEDED(hres); +} + START_TEST(events) { CoInitialize(NULL); - container_hwnd = create_container_window(); - if(winetest_interactive) - ShowWindow(container_hwnd, SW_SHOW); + if(check_ie()) { + container_hwnd = create_container_window(); + + if(winetest_interactive) + ShowWindow(container_hwnd, SW_SHOW); - run_test(empty_doc_str, test_timeout); - run_test(click_doc_str, test_onclick); - run_test(readystate_doc_str, test_onreadystatechange); - run_test(img_doc_str, test_imgload); - run_test(input_doc_str, test_focus); - run_test(form_doc_str, test_submit); - run_test(iframe_doc_str, test_iframe_connections); + run_test(empty_doc_str, test_timeout); + run_test(click_doc_str, test_onclick); + run_test(readystate_doc_str, test_onreadystatechange); + run_test(img_doc_str, test_imgload); + run_test(input_doc_str, test_focus); + run_test(form_doc_str, test_submit); + run_test(iframe_doc_str, test_iframe_connections); - test_empty_document(); + test_empty_document(); + + DestroyWindow(container_hwnd); + }else { + win_skip("Too old IE\n"); + } - DestroyWindow(container_hwnd); CoUninitialize(); } diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/htmldoc.c wine1.7-1.7.16/dlls/mshtml/tests/htmldoc.c --- wine1.7-1.7.13/dlls/mshtml/tests/htmldoc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/htmldoc.c 2014-04-04 19:13:44.000000000 +0000 @@ -1211,7 +1211,8 @@ return E_NOINTERFACE; } - ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid)); + trace("Binding::QI(%s)\n", wine_dbgstr_guid(riid)); + *ppv = NULL; return E_NOINTERFACE; } @@ -2666,13 +2667,15 @@ return S_OK; } + *ppv = NULL; + if(IsEqualGUID(&IID_IOleCommandTarget, riid)) return E_NOINTERFACE; - else if(IsEqualGUID(&IID_IDocHostShowUI, riid)) + if(IsEqualGUID(&IID_IDocHostShowUI, riid)) return E_NOINTERFACE; /* TODO */ - ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid)); + trace("CustomDocHostUIHandler::QI(%s)\n", wine_dbgstr_guid(riid)); return E_NOINTERFACE; } @@ -2971,11 +2974,15 @@ return E_NOTIMPL; + case 83: + case 102: case 134: /* TODO */ + case 135: case 136: /* TODO */ case 139: /* TODO */ case 143: /* TODO */ case 144: /* TODO */ + case 178: return E_NOTIMPL; default: @@ -3036,7 +3043,7 @@ ok(ind == 0, "Lower bound = %d\n", ind); hres = SafeArrayGetUBound(sa, 1, &ind); ok(hres == S_OK, "SafeArrayGetUBound failed: %x\n", hres); - ok(ind == 7 || broken(ind == 5), "Upper bound = %d\n", ind); + ok(ind == 7 || ind == 8 /* IE11 */ ||broken(ind == 5), "Upper bound = %d\n", ind); ind = 0; SafeArrayGetElement(sa, &ind, &var); @@ -4869,7 +4876,7 @@ static HRESULT WINAPI WebBrowser_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value) { - ok(0, "unexpected call\n"); + trace("get_AddressBar: ignoring\n"); /* Some old IEs call it */ return E_NOTIMPL; } @@ -5242,7 +5249,7 @@ else if(IsEqualGUID(&IID_IDocHostUIHandlerPriv, riid)) return E_NOINTERFACE; /* ? */ else - ok(0, "unexpected riid %s\n", wine_dbgstr_guid(riid)); + trace("QI(%s)\n", wine_dbgstr_guid(riid)); if(*ppv) return S_OK; @@ -5804,8 +5811,12 @@ CLEAR_CALLED(UpdateUI); CLEAR_CALLED(Exec_UPDATECOMMANDS); CLEAR_CALLED(Exec_SETTITLE); - if(flags & DWL_EXPECT_HISTUPDATE) - CHECK_CALLED(Exec_Explorer_38); + if(flags & DWL_EXPECT_HISTUPDATE) { + if(flags & DWL_FROM_HISTORY) + CHECK_CALLED_BROKEN(Exec_Explorer_38); /* Some old IEs don't call it. */ + else + CHECK_CALLED(Exec_Explorer_38); + } todo_wine CHECK_CALLED_BROKEN(UpdateBackForwardState); } if(!is_js && !is_extern) { diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/nav_test.html wine1.7-1.7.16/dlls/mshtml/tests/nav_test.html --- wine1.7-1.7.13/dlls/mshtml/tests/nav_test.html 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/nav_test.html 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,42 @@ + + + + + + + diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/rsrc.rc wine1.7-1.7.16/dlls/mshtml/tests/rsrc.rc --- wine1.7-1.7.13/dlls/mshtml/tests/rsrc.rc 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/rsrc.rc 2014-04-04 19:13:44.000000000 +0000 @@ -31,6 +31,15 @@ /* @makedep: externscr.js */ externscr.js HTML "externscr.js" +/* @makedep: nav_test.html */ +nav_test.html HTML "nav_test.html" + +/* @makedep: blank.html */ +blank.html HTML "blank.html" + +/* @makedep: blank.html */ +blank2.html HTML "blank.html" + /* @makedep: test_tlb.tlb */ 1 TYPELIB test_tlb.tlb diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/script.c wine1.7-1.7.16/dlls/mshtml/tests/script.c --- wine1.7-1.7.13/dlls/mshtml/tests/script.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/script.c 2014-04-04 19:13:44.000000000 +0000 @@ -150,6 +150,7 @@ static const GUID CLSID_TestActiveX = {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}}; +static BOOL is_ie9plus; static IHTMLDocument2 *notif_doc; static IOleDocumentView *view; static IDispatchEx *window_dispex; @@ -1165,23 +1166,12 @@ static IHTMLDocument2 *create_document(void) { IHTMLDocument2 *doc; - IHTMLDocument5 *doc5; HRESULT hres; hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IHTMLDocument2, (void**)&doc); ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres); - if (hres != S_OK) return NULL; - - hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5); - if(FAILED(hres)) { - win_skip("Could not get IHTMLDocument5, probably too old IE\n"); - IHTMLDocument2_Release(doc); - return NULL; - } - - IHTMLDocument5_Release(doc5); - return doc; + return SUCCEEDED(hres) ? doc : NULL; } static void load_string(IHTMLDocument2 *doc, const char *str) @@ -2831,6 +2821,10 @@ run_js_script("exectest.html"); run_js_script("vbtest.html"); run_js_script("events.html"); + if(is_ie9plus) + run_js_script("nav_test.html"); + else + win_skip("Skipping nav_test.html on IE older than 9 (for broken ieframe onload).\n"); } static BOOL init_registry(BOOL init) @@ -2882,21 +2876,52 @@ 300, 300, NULL, NULL, NULL, NULL); } +static BOOL check_ie(void) +{ + IHTMLDocument2 *doc; + IHTMLDocument5 *doc5; + IHTMLDocument7 *doc7; + HRESULT hres; + + doc = create_document(); + if(!doc) + return FALSE; + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument7, (void**)&doc7); + if(SUCCEEDED(hres)) { + is_ie9plus = TRUE; + IHTMLDocument7_Release(doc7); + } + + trace("is_ie9plus %x\n", is_ie9plus); + + hres = IHTMLDocument2_QueryInterface(doc, &IID_IHTMLDocument5, (void**)&doc5); + if(SUCCEEDED(hres)) + IHTMLDocument5_Release(doc5); + + IHTMLDocument2_Release(doc); + return SUCCEEDED(hres); +} + START_TEST(script) { CoInitialize(NULL); container_hwnd = create_container_window(); - if(winetest_interactive || ! is_ie_hardened()) { - if(register_script_engine()) { - test_simple_script(); - init_registry(FALSE); + if(check_ie()) { + if(winetest_interactive || ! is_ie_hardened()) { + if(register_script_engine()) { + test_simple_script(); + init_registry(FALSE); + }else { + skip("Could not register TestScript engine\n"); + } + run_js_tests(); }else { - skip("Could not register TestScript engine\n"); + skip("IE running in Enhanced Security Configuration\n"); } - run_js_tests(); }else { - skip("IE running in Enhanced Security Configuration\n"); + win_skip("Too old IE.\n"); } DestroyWindow(container_hwnd); diff -Nru wine1.7-1.7.13/dlls/mshtml/tests/style.c wine1.7-1.7.16/dlls/mshtml/tests/style.c --- wine1.7-1.7.13/dlls/mshtml/tests/style.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/mshtml/tests/style.c 2014-04-04 19:13:44.000000000 +0000 @@ -2092,6 +2092,22 @@ ok(!strcmp_wa(str, "nowrap"), "whiteSpace = %s\n", wine_dbgstr_w(str)); SysFreeString(str); + /* listStyleType */ + hres = IHTMLStyle_get_listStyleType(style, &str); + ok(hres == S_OK, "get_listStyleType failed: %08x\n", hres); + ok(!str, "listStyleType = %s\n", wine_dbgstr_w(str)); + + str = a2bstr("square"); + hres = IHTMLStyle_put_listStyleType(style, str); + ok(hres == S_OK, "put_listStyleType failed: %08x\n", hres); + SysFreeString(str); + + str = NULL; + 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); + hres = IHTMLStyle_QueryInterface(style, &IID_IHTMLStyle2, (void**)&style2); ok(hres == S_OK, "Could not get IHTMLStyle2 iface: %08x\n", hres); if(SUCCEEDED(hres)) { diff -Nru wine1.7-1.7.13/dlls/msi/action.c wine1.7-1.7.16/dlls/msi/action.c --- wine1.7-1.7.13/dlls/msi/action.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/action.c 2014-04-04 19:13:44.000000000 +0000 @@ -3564,9 +3564,29 @@ if (comp->num_clients <= 0) { if (package->Context == MSIINSTALLCONTEXT_MACHINE) - MSIREG_DeleteUserDataComponentKey( comp->ComponentId, szLocalSid ); + rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, szLocalSid ); else - MSIREG_DeleteUserDataComponentKey( comp->ComponentId, NULL ); + rc = MSIREG_DeleteUserDataComponentKey( comp->ComponentId, NULL ); + + if (rc != ERROR_SUCCESS) WARN( "failed to delete component key %u\n", rc ); + } + else + { + LONG res; + + if (package->Context == MSIINSTALLCONTEXT_MACHINE) + rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, szLocalSid, &hkey, FALSE ); + else + rc = MSIREG_OpenUserDataComponentKey( comp->ComponentId, NULL, &hkey, FALSE ); + + if (rc != ERROR_SUCCESS) + { + WARN( "failed to open component key %u\n", rc ); + continue; + } + res = RegDeleteValueW( hkey, squished_pc ); + RegCloseKey(hkey); + if (res) WARN( "failed to delete component value %d\n", res ); } } @@ -5793,7 +5813,11 @@ ERR("Query failed\n"); goto done; } - key = MSI_RecordGetString(row, 6); + if (!(key = MSI_RecordGetString(row, 6))) + { + msiobj_release(&row->hdr); + goto done; + } file = msi_get_loaded_file(package, key); msiobj_release(&row->hdr); if (!file) diff -Nru wine1.7-1.7.13/dlls/msi/classes.c wine1.7-1.7.16/dlls/msi/classes.c --- wine1.7-1.7.13/dlls/msi/classes.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/classes.c 2014-04-04 19:13:44.000000000 +0000 @@ -296,7 +296,7 @@ cls->Feature = msi_get_loaded_feature(package, buffer); cls->Attributes = MSI_RecordGetInteger(row,13); - + cls->action = INSTALLSTATE_UNKNOWN; return cls; } @@ -425,7 +425,7 @@ buffer = MSI_RecordGetString(row,5); ext->Feature = msi_get_loaded_feature( package, buffer ); - + ext->action = INSTALLSTATE_UNKNOWN; return ext; } @@ -698,59 +698,6 @@ return load_all_mimes( package ); } -static void mark_progid_for_install( MSIPACKAGE* package, MSIPROGID *progid ) -{ - MSIPROGID *child; - - if (!progid) - return; - - if (progid->InstallMe) - return; - - progid->InstallMe = TRUE; - - /* all children if this is a parent also install */ - LIST_FOR_EACH_ENTRY( child, &package->progids, MSIPROGID, entry ) - { - if (child->Parent == progid) - mark_progid_for_install( package, child ); - } -} - -static void mark_progid_for_uninstall( MSIPACKAGE *package, MSIPROGID *progid ) -{ - MSIPROGID *child; - - if (!progid) - return; - - if (!progid->InstallMe) - return; - - progid->InstallMe = FALSE; - - LIST_FOR_EACH_ENTRY( child, &package->progids, MSIPROGID, entry ) - { - if (child->Parent == progid) - mark_progid_for_uninstall( package, child ); - } -} - -static void mark_mime_for_install( MSIMIME *mime ) -{ - if (!mime) - return; - mime->InstallMe = TRUE; -} - -static void mark_mime_for_uninstall( MSIMIME *mime ) -{ - if (!mime) - return; - mime->InstallMe = FALSE; -} - static UINT register_appid(const MSIAPPID *appid, LPCWSTR app ) { static const WCHAR szRemoteServerName[] = @@ -856,8 +803,7 @@ } TRACE("Registering class %s (%p)\n", debugstr_w(cls->clsid), cls); - cls->Installed = TRUE; - mark_progid_for_install( package, cls->ProgID ); + cls->action = INSTALLSTATE_LOCAL; RegCreateKeyW( hkey, cls->clsid, &hkey2 ); @@ -1014,8 +960,7 @@ } TRACE("Unregistering class %s (%p)\n", debugstr_w(cls->clsid), cls); - cls->Installed = FALSE; - mark_progid_for_uninstall( package, cls->ProgID ); + cls->action = INSTALLSTATE_ABSENT; res = RegDeleteTreeW( hkey, cls->clsid ); if (res != ERROR_SUCCESS) @@ -1103,6 +1048,35 @@ return rc; } +static const MSICLASS *get_progid_class( const MSIPROGID *progid ) +{ + while (progid) + { + if (progid->Parent) progid = progid->Parent; + if (progid->Class) return progid->Class; + if (!progid->Parent || progid->Parent == progid) break; + } + return NULL; +} + +static BOOL has_class_installed( const MSIPROGID *progid ) +{ + const MSICLASS *class = get_progid_class( progid ); + if (!class || !class->ProgID) return FALSE; + return (class->action == INSTALLSTATE_LOCAL); +} + +static BOOL has_one_extension_installed( const MSIPACKAGE *package, const MSIPROGID *progid ) +{ + const MSIEXTENSION *extension; + LIST_FOR_EACH_ENTRY( extension, &package->extensions, MSIEXTENSION, entry ) + { + if (extension->ProgID == progid && !list_empty( &extension->verbs ) && + extension->action == INSTALLSTATE_LOCAL) return TRUE; + } + return FALSE; +} + UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package) { MSIPROGID *progid; @@ -1115,17 +1089,11 @@ LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry ) { - /* check if this progid is to be installed */ - if (progid->Class && progid->Class->Installed) - progid->InstallMe = TRUE; - - if (!progid->InstallMe) + if (!has_class_installed( progid ) && !has_one_extension_installed( package, progid )) { - TRACE("progid %s not scheduled to be installed\n", - debugstr_w(progid->ProgID)); + TRACE("progid %s not scheduled to be installed\n", debugstr_w(progid->ProgID)); continue; } - TRACE("Registering progid %s\n", debugstr_w(progid->ProgID)); register_progid( progid ); @@ -1138,6 +1106,36 @@ return ERROR_SUCCESS; } +static BOOL has_class_removed( const MSIPROGID *progid ) +{ + const MSICLASS *class = get_progid_class( progid ); + if (!class || !class->ProgID) return FALSE; + return (class->action == INSTALLSTATE_ABSENT); +} + +static BOOL has_extensions( const MSIPACKAGE *package, const MSIPROGID *progid ) +{ + const MSIEXTENSION *extension; + LIST_FOR_EACH_ENTRY( extension, &package->extensions, MSIEXTENSION, entry ) + { + if (extension->ProgID == progid && !list_empty( &extension->verbs )) return TRUE; + } + return FALSE; +} + +static BOOL has_all_extensions_removed( const MSIPACKAGE *package, const MSIPROGID *progid ) +{ + BOOL ret = FALSE; + const MSIEXTENSION *extension; + LIST_FOR_EACH_ENTRY( extension, &package->extensions, MSIEXTENSION, entry ) + { + if (extension->ProgID == progid && !list_empty( &extension->verbs ) && + extension->action == INSTALLSTATE_ABSENT) ret = TRUE; + else ret = FALSE; + } + return ret; +} + UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package ) { MSIPROGID *progid; @@ -1151,16 +1149,12 @@ LIST_FOR_EACH_ENTRY( progid, &package->progids, MSIPROGID, entry ) { - /* check if this progid is to be removed */ - if (progid->Class && !progid->Class->Installed) - progid->InstallMe = FALSE; - - if (progid->InstallMe) + if (!has_class_removed( progid ) || + (has_extensions( package, progid ) && !has_all_extensions_removed( package, progid ))) { TRACE("progid %s not scheduled to be removed\n", debugstr_w(progid->ProgID)); continue; } - TRACE("Unregistering progid %s\n", debugstr_w(progid->ProgID)); res = RegDeleteTreeW( HKEY_CLASSES_ROOT, progid->ProgID ); @@ -1302,15 +1296,7 @@ } TRACE("Registering extension %s (%p)\n", debugstr_w(ext->Extension), ext); - ext->Installed = TRUE; - - /* this is only registered if the extension has at least 1 verb - * according to MSDN - */ - if (ext->ProgID && !list_empty( &ext->verbs ) ) - mark_progid_for_install( package, ext->ProgID ); - - mark_mime_for_install(ext->Mime); + ext->action = INSTALLSTATE_LOCAL; extension = msi_alloc( (strlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) @@ -1408,12 +1394,7 @@ } TRACE("Unregistering extension %s\n", debugstr_w(ext->Extension)); - ext->Installed = FALSE; - - if (ext->ProgID && !list_empty( &ext->verbs )) - mark_progid_for_uninstall( package, ext->ProgID ); - - mark_mime_for_uninstall( ext->Mime ); + ext->action = INSTALLSTATE_ABSENT; extension = msi_alloc( (strlenW( ext->Extension ) + 2) * sizeof(WCHAR) ); if (extension) @@ -1477,11 +1458,8 @@ * check if the MIME is to be installed. Either as requested by an * extension or Class */ - mt->InstallMe = (mt->InstallMe || - (mt->Class && mt->Class->Installed) || - (mt->Extension && mt->Extension->Installed)); - - if (!mt->InstallMe) + if ((!mt->Class || mt->Class->action != INSTALLSTATE_LOCAL) && + mt->Extension->action != INSTALLSTATE_LOCAL) { TRACE("MIME %s not scheduled to be installed\n", debugstr_w(mt->ContentType)); continue; @@ -1531,11 +1509,8 @@ LONG res; LPWSTR mime_key; - mime->InstallMe = (mime->InstallMe || - (mime->Class && mime->Class->Installed) || - (mime->Extension && mime->Extension->Installed)); - - if (mime->InstallMe) + if ((!mime->Class || mime->Class->action != INSTALLSTATE_ABSENT) && + mime->Extension->action != INSTALLSTATE_ABSENT) { TRACE("MIME %s not scheduled to be removed\n", debugstr_w(mime->ContentType)); continue; diff -Nru wine1.7-1.7.13/dlls/msi/custom.c wine1.7-1.7.16/dlls/msi/custom.c --- wine1.7-1.7.13/dlls/msi/custom.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/custom.c 2014-04-04 19:13:44.000000000 +0000 @@ -1003,7 +1003,7 @@ 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', '`','B','i' ,'n','a','r','y','`',' ','W','H','E','R','E',' ', '`','N','a','m','e','`',' ','=',' ','\'','%','s','\'',0}; - MSIRECORD *row = 0; + MSIRECORD *row = NULL; msi_custom_action_info *info; CHAR *buffer = NULL; WCHAR *bufferw = NULL; @@ -1017,10 +1017,14 @@ return ERROR_FUNCTION_FAILED; r = MSI_RecordReadStream(row, 2, NULL, &sz); - if (r != ERROR_SUCCESS) return r; + if (r != ERROR_SUCCESS) goto done; buffer = msi_alloc( sz + 1 ); - if (!buffer) return ERROR_FUNCTION_FAILED; + if (!buffer) + { + r = ERROR_FUNCTION_FAILED; + goto done; + } r = MSI_RecordReadStream(row, 2, buffer, &sz); if (r != ERROR_SUCCESS) @@ -1040,6 +1044,7 @@ done: msi_free(bufferw); msi_free(buffer); + msiobj_release(&row->hdr); return r; } diff -Nru wine1.7-1.7.13/dlls/msi/format.c wine1.7-1.7.16/dlls/msi/format.c --- wine1.7-1.7.13/dlls/msi/format.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/format.c 2014-04-04 19:13:44.000000000 +0000 @@ -370,7 +370,11 @@ { max_len = len; buf = msi_realloc(buf, (max_len + 1) * sizeof(WCHAR)); - if (!buf) return NULL; + if (!buf) + { + msi_free(rc); + return NULL; + } } if (str) Binary files /tmp/qNPOTbG4JY/wine1.7-1.7.13/dlls/msi/instabsent.bmp and /tmp/GGrtppGXyS/wine1.7-1.7.16/dlls/msi/instabsent.bmp differ Binary files /tmp/qNPOTbG4JY/wine1.7-1.7.13/dlls/msi/instadvert.bmp and /tmp/GGrtppGXyS/wine1.7-1.7.16/dlls/msi/instadvert.bmp differ Binary files /tmp/qNPOTbG4JY/wine1.7-1.7.13/dlls/msi/instlocal.bmp and /tmp/GGrtppGXyS/wine1.7-1.7.16/dlls/msi/instlocal.bmp differ diff -Nru wine1.7-1.7.13/dlls/msi/msipriv.h wine1.7-1.7.16/dlls/msi/msipriv.h --- wine1.7-1.7.13/dlls/msi/msipriv.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/msipriv.h 2014-04-04 19:13:44.000000000 +0000 @@ -614,7 +614,7 @@ MSIFEATURE *Feature; INT Attributes; /* not in the table, set during installation */ - BOOL Installed; + INSTALLSTATE action; } MSICLASS; typedef struct tagMSIMIME MSIMIME; @@ -629,7 +629,7 @@ MSIMIME *Mime; MSIFEATURE *Feature; /* not in the table, set during installation */ - BOOL Installed; + INSTALLSTATE action; struct list verbs; } MSIEXTENSION; @@ -642,7 +642,6 @@ LPWSTR Description; LPWSTR IconPath; /* not in the table, set during installation */ - BOOL InstallMe; MSIPROGID *CurVer; MSIPROGID *VersionInd; }; @@ -664,8 +663,6 @@ LPWSTR suffix; LPWSTR clsid; MSICLASS *Class; - /* not in the table, set during installation */ - BOOL InstallMe; }; enum SCRIPTS diff -Nru wine1.7-1.7.13/dlls/msi/msiserver.idl wine1.7-1.7.16/dlls/msi/msiserver.idl --- wine1.7-1.7.13/dlls/msi/msiserver.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/msiserver.idl 2014-04-04 19:13:44.000000000 +0000 @@ -153,6 +153,14 @@ coclass PSFactoryBuffer { interface IPSFactoryBuffer; } [ + helpstring("Microsoft Windows Installer"), + threading(apartment), + progid("WindowsInstaller.Installer"), + uuid(000c1090-0000-0000-c000-000000000046) +] +coclass MsiInstaller { interface Installer; } + +[ uuid(000c1082-0000-0000-c000-000000000046) ] coclass MsiTransform { } @@ -184,7 +192,6 @@ ] coclass WineMsiRemotePackage { interface WineMsiRemotePackage; } - [ uuid(000C1092-0000-0000-C000-000000000046), version(1.0) ] library WindowsInstaller { @@ -251,14 +258,14 @@ [id(DISPID_INSTALLER_OPENPACKAGE)] Session* OpenPackage( [in] VARIANT PackagePath, - [in, optional, defaultvalue(0)] long Options); + [in, defaultvalue(0)] long Options); [id(DISPID_INSTALLER_OPENPRODUCT)] Session* OpenProduct( [in] BSTR ProductCode); [id(DISPID_INSTALLER_SUMMARYINFORMATION)] SummaryInfo* SummaryInformation( [in] BSTR PackagePath, - [in, optional, defaultvalue(0)] long UpdateCount); + [in, defaultvalue(0)] long UpdateCount); [id(DISPID_INSTALLER_OPENDATABASE)] Database *OpenDatabase( [in] BSTR DatabasePath, @@ -270,7 +277,7 @@ [id(DISPID_INSTALLER_INSTALLPRODUCT)] void InstallProduct( [in] BSTR PackagePath, - [in, optional, defaultvalue("0")] BSTR PropertyValues); + [in, defaultvalue("0")] BSTR PropertyValues); [id(DISPID_INSTALLER_VERSION)] BSTR Version(); [id(DISPID_INSTALLER_LASTERRORRECORD)] @@ -393,7 +400,7 @@ properties: methods: [id(DISPID_VIEW_EXECUTE)] - void Execute([in, optional, defaultvalue(0)] Record *Params); + void Execute([in, defaultvalue(0)] Record *Params); [id(DISPID_VIEW_FETCH)] Record* Fetch(); [id(DISPID_VIEW_MODIFY)] @@ -412,7 +419,7 @@ [id(DISPID_DATABASE_OPENVIEW)] View* OpenView([in] BSTR Sql); [id(DISPID_DATABASE_SUMMARYINFORMATION), propget] - SummaryInfo *SummaryInformation([in, optional, defaultvalue(0)] long UpdateCount); + SummaryInfo *SummaryInformation([in, defaultvalue(0)] long UpdateCount); } typedef enum { @@ -551,12 +558,4 @@ properties: methods: } - - [ - helpstring("Microsoft Windows Installer"), - threading(apartment), - progid("WindowsInstaller.Installer"), - uuid(000c1090-0000-0000-c000-000000000046) - ] - coclass MsiInstaller { interface Installer; } } diff -Nru wine1.7-1.7.13/dlls/msi/msiserver.rgs wine1.7-1.7.16/dlls/msi/msiserver.rgs --- wine1.7-1.7.13/dlls/msi/msiserver.rgs 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/msiserver.rgs 2014-04-04 19:13:44.000000000 +0000 @@ -2,7 +2,12 @@ { NoRemove CLSID { - '{000C101D-0000-0000-C000-000000000046}' { DllVersion = s '3.1.4000' } - '{000C1090-0000-0000-C000-000000000046}' { InProcHandler32 = s 'ole32.dll' } + '{000C101D-0000-0000-C000-000000000046}' { DllVersion = s '4.5.6001' } + '{000C1090-0000-0000-C000-000000000046}' + { + TypeLib = s '{000C1092-0000-0000-C000-000000000046}' + Version = s '1.0' + InProcHandler32 = s 'ole32.dll' + } } } diff -Nru wine1.7-1.7.13/dlls/msi/table.c wine1.7-1.7.16/dlls/msi/table.c --- wine1.7-1.7.13/dlls/msi/table.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/table.c 2014-04-04 19:13:44.000000000 +0000 @@ -1970,7 +1970,10 @@ r = TABLE_CreateView(tv->db, szColumns, &columns); if (r != ERROR_SUCCESS) + { + msiobj_release(&rec->hdr); return r; + } r = msi_table_find_row((MSITABLEVIEW *)columns, rec, &row, NULL); if (r != ERROR_SUCCESS) @@ -2092,7 +2095,10 @@ r = TABLE_CreateView(tv->db, szTables, &tables); if (r != ERROR_SUCCESS) + { + msiobj_release(&rec->hdr); return r; + } r = msi_table_find_row((MSITABLEVIEW *)tables, rec, &row, NULL); if (r != ERROR_SUCCESS) diff -Nru wine1.7-1.7.13/dlls/msi/tests/action.c wine1.7-1.7.16/dlls/msi/tests/action.c --- wine1.7-1.7.13/dlls/msi/tests/action.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/tests/action.c 2014-04-04 19:13:44.000000000 +0000 @@ -21,6 +21,7 @@ #define _WIN32_MSI 300 #include +#include #include #include @@ -45,6 +46,7 @@ static UINT (WINAPI *pMsiQueryFeatureStateExA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE *); +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR *); static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); @@ -78,7 +80,8 @@ "dangler\t{6091DF25-EF96-45F1-B8E9-A9B1420C7A3C}\tTARGETDIR\t4\t\tregdata\n" "component\t\tMSITESTDIR\t0\t1\tfile\n" "service_comp\t{935A0A91-22A3-4F87-BCA8-928FFDFE2353}\tMSITESTDIR\t0\t\tservice_file\n" - "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2"; + "service_comp2\t{3F7B04A4-9521-4649-BDC9-0C8722740A49}\tMSITESTDIR\t0\t\tservice_file2\n" + "service_comp3\t{DBCD1502-20E3-423F-B53E-F37E263CDC7E}\tMSITESTDIR\t0\t\t\n"; static const char directory_dat[] = "Directory\tDirectory_Parent\tDefaultDir\n" @@ -115,7 +118,8 @@ "Two\tTwo\n" "feature\tcomponent\n" "service_feature\tservice_comp\n" - "service_feature\tservice_comp2"; + "service_feature\tservice_comp2\n" + "service_feature\tservice_comp3"; static const char file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" @@ -223,6 +227,14 @@ "TestService\t[SERVNAME]\t[SERVDISP]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService\t\t-a arg\tservice_comp\tdescription\n" "TestService2\tSERVNAME2]\t[SERVDISP2]\t2\t3\t0\t\tservice1[~]+group1[~]service2[~]+group2[~][~]\tTestService2\t\t-a arg\tservice_comp2\tdescription"; +static const char service_install2_dat[] = + "ServiceInstall\tName\tDisplayName\tServiceType\tStartType\tErrorControl\t" + "LoadOrderGroup\tDependencies\tStartName\tPassword\tArguments\tComponent_\tDescription\n" + "s72\ts255\tL255\ti4\ti4\ti4\tS255\tS255\tS255\tS255\tS255\ts72\tL255\n" + "ServiceInstall\tServiceInstall\n" + "TestService\tTestService\tTestService\t2\t3\t0\t\t\tTestService\t\t\tservice_comp\t\n" + "TestService4\tTestService4\tTestService4\t2\t3\t0\t\t\tTestService4\t\t\tservice_comp3\t\n"; + static const char service_control_dat[] = "ServiceControl\tName\tEvent\tArguments\tWait\tComponent_\n" "s72\tl255\ti2\tL255\tI2\ts72\n" @@ -1320,6 +1332,95 @@ "PublishProduct\t\t5200\n" "InstallFinalize\t\t6000\n"; +static const char rpi_file_dat[] = + "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" + "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" + "File\tFile\n" + "progid.txt\tprogid\tprogid.txt\t1000\t\t\t8192\t1\n"; + +static const char rpi_feature_dat[] = + "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n" + "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n" + "Feature\tFeature\n" + "progid\t\t\tprogid feature\t1\t2\tMSITESTDIR\t0\n"; + +static const char rpi_feature_comp_dat[] = + "Feature_\tComponent_\n" + "s38\ts72\n" + "FeatureComponents\tFeature_\tComponent_\n" + "progid\tprogid\n"; + +static const char rpi_component_dat[] = + "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "progid\t{89A98345-F8A1-422E-A48B-0250B5809F2D}\tMSITESTDIR\t0\t\tprogid.txt\n"; + +static const char rpi_appid_dat[] = + "AppId\tRemoteServerName\tLocalService\tServiceParameters\tDllSurrogate\tActivateAtStorage\tRunAsInteractiveUser\n" + "s38\tS255\tS255\tS255\tS255\tI2\tI2\n" + "AppId\tAppId\n" + "{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\t\t\t\t\t\t\n"; + +static const char rpi_class_dat[] = + "CLSID\tContext\tComponent_\tProgId_Default\tDescription\tAppId_\tFileTypeMask\tIcon_\tIconIndex\tDefInprocHandler\tArgument\tFeature_\tAttributes\n" + "s38\ts32\ts72\tS255\tL255\tS38\tS255\tS72\tI2\tS32\tS255\ts38\tI2\n" + "Class\tCLSID\tContext\tComponent_\n" + "{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tLocalServer\tprogid\tWinetest.Class.1\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n" + "{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tLocalServer\tprogid\tWinetest.VerClass\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n" + "{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tLocalServer\tprogid\t\tdescription\t{CFCC3B38-E683-497D-9AB4-CB40AAFE307F}\tmask1;mask2\t\t\t2\t\tprogid\t\n"; + +static const char rpi_extension_dat[] = + "Extension\tComponent_\tProgId_\tMIME_\tFeature_\n" + "s255\ts72\tS255\tS64\ts38\n" + "Extension\tExtension\tComponent_\n" + "winetest\tprogid\tWinetest.Extension\t\tprogid\n"; + +static const char rpi_verb_dat[] = + "Extension_\tVerb\tSequence\tCommand\tArgument\n" + "s255\ts32\tI2\tL255\tL255\n" + "Verb\tExtension_\tVerb\n" + "winetest\tOpen\t1\t&Open\t/argument\n"; + +static const char rpi_progid_dat[] = + "ProgId\tProgId_Parent\tClass_\tDescription\tIcon_\tIconIndex\n" + "s255\tS255\tS38\tL255\tS72\tI2\n" + "ProgId\tProgId\n" + "Winetest.Class.1\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n" + "Winetest.Class\tWinetest.Class.1\t\tdescription\t\t\n" + "Winetest.Class.2\t\t{110913E7-86D1-4BF3-9922-BA103FCDDDFA}\tdescription\t\t\n" + "Winetest.VerClass.1\t\t{904E6BC9-F57F-4412-B460-D40DE2F256E2}\tdescription\t\t\n" + "Winetest.VerClass\tWinetest.VerClass.1\t\tdescription\t\t\n" + "Winetest.NoProgIdClass.1\t\t{57C413FB-CA02-498A-81F6-7E769BDB7C97}\tdescription\t\t\n" + "Winetest.NoProgIdClass\tWinetest.NoProgIdClass.1\t\tdescription\t\t\n" + "Winetest.Orphaned\t\t\tdescription\t\t\n" + "Winetest.Orphaned2\t\t\tdescription\t\t\n" + "Winetest.Extension\t\t\tdescription\t\t\n"; + +static const char rpi_install_exec_seq_dat[] = + "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "InstallExecuteSequence\tAction\n" + "LaunchConditions\t\t100\n" + "CostInitialize\t\t800\n" + "FileCost\t\t900\n" + "CostFinalize\t\t1000\n" + "InstallValidate\t\t1400\n" + "InstallInitialize\t\t1500\n" + "ProcessComponents\t\t1600\n" + "RemoveFiles\t\t1700\n" + "UnregisterClassInfo\t\t3000\n" + "UnregisterExtensionInfo\t\t3200\n" + "UnregisterProgIdInfo\t\t3400\n" + "InstallFiles\t\t3600\n" + "RegisterClassInfo\t\t4000\n" + "RegisterExtensionInfo\t\t4200\n" + "RegisterProgIdInfo\t\t4400\n" + "RegisterProduct\t\t5000\n" + "PublishFeatures\t\t5100\n" + "PublishProduct\t\t5200\n" + "InstallFinalize\t\t6000\n"; + static const char rmi_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" @@ -1681,6 +1782,19 @@ ADD_TABLE(property) }; +static const msi_table sis_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(sds_install_exec_seq), + ADD_TABLE(service_install2), + ADD_TABLE(media), + ADD_TABLE(property) +}; + static const msi_table sr_tables[] = { ADD_TABLE(component), @@ -1871,6 +1985,23 @@ ADD_TABLE(property) }; +static const msi_table rpi_tables[] = +{ + ADD_TABLE(directory), + ADD_TABLE(rpi_component), + ADD_TABLE(rpi_feature), + ADD_TABLE(rpi_feature_comp), + ADD_TABLE(rpi_file), + ADD_TABLE(rpi_appid), + ADD_TABLE(rpi_class), + ADD_TABLE(rpi_extension), + ADD_TABLE(rpi_verb), + ADD_TABLE(rpi_progid), + ADD_TABLE(rpi_install_exec_seq), + ADD_TABLE(media), + ADD_TABLE(property) +}; + static const msi_table rmi_tables[] = { ADD_TABLE(directory), @@ -2108,6 +2239,7 @@ GET_PROC(hmsi, MsiGetComponentPathExA); GET_PROC(hmsi, MsiQueryFeatureStateExA); + GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) @@ -2122,9 +2254,26 @@ static BOOL is_process_limited(void) { + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; HANDLE token; - if (!pOpenProcessToken) return FALSE; + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators have enough privileges for these tests */ + return TRUE; + } if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -5263,6 +5412,78 @@ DeleteFileA(msifile); } +static void test_install_services(void) +{ + UINT r; + SC_HANDLE manager, service; + BOOL ret; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + + create_test_files(); + create_database(msifile, sis_tables, sizeof(sis_tables) / sizeof(msi_table)); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + r = MsiInstallProductA(msifile, NULL); + if (r == ERROR_INSTALL_PACKAGE_REJECTED) + { + skip("Not enough rights to perform tests\n"); + goto error; + } + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); + ok(manager != NULL, "can't open service manager\n"); + if (!manager) goto error; + + service = OpenServiceA(manager, "TestService", GENERIC_ALL); + ok(service != NULL, "TestService not installed\n"); + CloseServiceHandle(service); + + service = OpenServiceA(manager, "TestService4", GENERIC_ALL); + ok(service == NULL, "TestService4 installed\n"); + CloseServiceHandle(manager); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout\\new", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\changed", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\first", FALSE), "Directory not created\n"); + ok(delete_pf("msitest\\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\one.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\service2.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "Directory not created\n"); + + manager = OpenSCManagerA(NULL, NULL, SC_MANAGER_ALL_ACCESS); + ok(manager != NULL, "can't open service manager\n"); + if (!manager) goto error; + + service = OpenServiceA(manager, "TestService", GENERIC_ALL); + ok(service != NULL, "TestService doesn't exist\n"); + + ret = DeleteService( service ); + ok( ret, "failed to delete service %u\n", GetLastError() ); + + CloseServiceHandle(service); + CloseServiceHandle(manager); + +error: + delete_test_files(); + DeleteFileA(msifile); +} + static void test_self_registration(void) { UINT r; @@ -6121,6 +6342,132 @@ DeleteFileA(msifile); } +static void test_register_progid_info(void) +{ + UINT r; + LONG res; + HKEY hkey; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + + create_test_files(); + create_file("msitest\\progid.txt", 1000); + create_database(msifile, rpi_tables, sizeof(rpi_tables) / sizeof(msi_table)); + + res = RegCreateKeyExA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", 0, NULL, 0, + KEY_ALL_ACCESS, NULL, &hkey, NULL); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + r = MsiInstallProductA(msifile, NULL); + if (r == ERROR_INSTALL_PACKAGE_REJECTED) + { + skip("Not enough rights to perform tests\n"); + goto error; + } + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + if (is_64bit) + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + else + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key created\n"); + if (res == ERROR_SUCCESS) RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key created\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey); + ok(res == ERROR_SUCCESS, "key deleted\n"); + if (res == ERROR_SUCCESS) RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key created\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey); + ok(res == ERROR_SUCCESS, "key not created\n"); + RegCloseKey(hkey); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + if (is_64bit) + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Wow6432Node\\CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + else + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "CLSID\\{110913E7-86D1-4BF3-9922-BA103FCDDDFA}", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Class.2", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.VerClass", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass.1", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.NoProgIdClass", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned", &hkey); + ok(res == ERROR_SUCCESS, "key deleted\n"); + if (res == ERROR_SUCCESS) RegCloseKey(hkey); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned2", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + res = RegOpenKeyA(HKEY_CLASSES_ROOT, "Winetest.Extension", &hkey); + ok(res == ERROR_FILE_NOT_FOUND, "key not removed\n"); + + ok(!delete_pf("msitest\\progid.txt", TRUE), "file not removed\n"); + ok(!delete_pf("msitest", FALSE), "directory not removed\n"); + +error: + DeleteFileA("msitest\\progid.txt"); + delete_test_files(); + DeleteFileA(msifile); + RegDeleteKeyA(HKEY_CLASSES_ROOT, "Winetest.Orphaned"); +} + static void test_register_mime_info(void) { UINT r; @@ -6476,6 +6823,7 @@ test_create_remove_folder(); test_start_services(); test_delete_services(); + test_install_services(); test_self_registration(); test_register_font(); test_validate_product_id(); @@ -6490,6 +6838,7 @@ test_remove_env_strings(); test_register_class_info(); test_register_extension_info(); + test_register_progid_info(); test_register_mime_info(); test_publish_assemblies(); test_remove_existing_products(); diff -Nru wine1.7-1.7.13/dlls/msi/tests/automation.c wine1.7-1.7.16/dlls/msi/tests/automation.c --- wine1.7-1.7.13/dlls/msi/tests/automation.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/tests/automation.c 2014-04-04 19:13:44.000000000 +0000 @@ -35,6 +35,8 @@ static BOOL is_wow64; +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); +static BOOL (WINAPI *pOpenProcessToken)(HANDLE, DWORD, PHANDLE); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); @@ -217,12 +219,50 @@ if(!p ## func) \ trace("GetProcAddress(%s) failed\n", #func); + GET_PROC(hadvapi32, CheckTokenMembership); + GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) GET_PROC(hkernel32, IsWow64Process) #undef GET_PROC } +static BOOL is_process_limited(void) +{ + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; + HANDLE token; + + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators have enough privileges for these tests */ + return TRUE; + } + + if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + { + BOOL ret; + TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; + DWORD size; + + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + CloseHandle(token); + return (ret && type == TokenElevationTypeLimited); + } + return FALSE; +} + static LONG delete_key_portable( HKEY key, LPCSTR subkey, REGSAM access ) { if (pRegDeleteKeyExA) @@ -2387,6 +2427,15 @@ IDispatch *pStringList = NULL; REGSAM access = KEY_ALL_ACCESS; + if (is_process_limited()) + { + /* In fact InstallProduct would succeed but then Windows XP + * would not allow us to clean up the registry! + */ + skip("Installer_InstallProduct (insufficient privileges)\n"); + return; + } + if (is_wow64) access |= KEY_WOW64_64KEY; diff -Nru wine1.7-1.7.13/dlls/msi/tests/install.c wine1.7-1.7.16/dlls/msi/tests/install.c --- wine1.7-1.7.13/dlls/msi/tests/install.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/tests/install.c 2014-04-04 19:13:44.000000000 +0000 @@ -43,6 +43,7 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA) (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE ); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); @@ -1167,6 +1168,75 @@ "PublishProduct\t\t1800\n" "InstallFinalize\t\t1900\n"; +static const char shc_property_dat[] = + "Property\tValue\n" + "s72\tl0\n" + "Property\tProperty\n" + "INSTALLLEVEL\t3\n" + "ProductCode\t{5CD99CD0-69C7-409B-9905-82DD743CC840}\n" + "ProductName\tMSITEST\n" + "ProductVersion\t1.1.1\n" + "MSIFASTINSTALL\t1\n"; + +static const char shc2_property_dat[] = + "Property\tValue\n" + "s72\tl0\n" + "Property\tProperty\n" + "INSTALLLEVEL\t3\n" + "ProductCode\t{4CEFADE5-DAFB-4C21-8EF2-4ED4F139F340}\n" + "ProductName\tMSITEST2\n" + "ProductVersion\t1.1.1\n" + "MSIFASTINSTALL\t1\n"; + +static const char shc_file_dat[] = + "File\tComponent_\tFileName\tFileSize\tVersion\tLanguage\tAttributes\tSequence\n" + "s72\ts72\tl255\ti4\tS72\tS20\tI2\ti2\n" + "File\tFile\n" + "sharedcomponent\tsharedcomponent\tsharedcomponent.txt\t1000\t\t\t8192\t1\n"; + +static const char shc_feature_dat[] = + "Feature\tFeature_Parent\tTitle\tDescription\tDisplay\tLevel\tDirectory_\tAttributes\n" + "s38\tS38\tL64\tL255\tI2\ti2\tS72\ti2\n" + "Feature\tFeature\n" + "feature\t\t\t\t1\t2\tMSITESTDIR\t0\n"; + +static const char shc_feature_comp_dat[] = + "Feature_\tComponent_\n" + "s38\ts72\n" + "FeatureComponents\tFeature_\tComponent_\n" + "feature\tsharedcomponent\n"; + +static const char shc_component_dat[] = + "Component\tComponentId\tDirectory_\tAttributes\tCondition\tKeyPath\n" + "s72\tS38\ts72\ti2\tS255\tS72\n" + "Component\tComponent\n" + "sharedcomponent\t{900A4ACB-DC6F-4795-A04B-81B530183D41}\tMSITESTDIR\t0\t\tsharedcomponent\n"; + +static const char shc_custom_action_dat[] = + "Action\tType\tSource\tTarget\tISComments\n" + "s72\ti2\tS64\tS0\tS255\n" + "CustomAction\tAction\n" + "TestComponentAction\t19\t\twrong component action on install\t\n"; + +static const char shc_install_exec_seq_dat[] = + "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "InstallExecuteSequence\tAction\n" + "LaunchConditions\t\t100\n" + "CostInitialize\t\t200\n" + "FileCost\t\t300\n" + "CostFinalize\t\t600\n" + "InstallValidate\t\t900\n" + "InstallInitialize\t\t1200\n" + "ProcessComponents\t\t1300\n" + "RemoveFiles\t\t1400\n" + "InstallFiles\t\t1500\n" + "TestComponentAction\tNOT REMOVE AND ($sharedcomponent <> 3)\t1600\n" + "RegisterProduct\t\t1700\n" + "PublishFeatures\t\t1800\n" + "PublishProduct\t\t1900\n" + "InstallFinalize\t\t2000\n"; + typedef struct _msi_table { const CHAR *filename; @@ -1806,6 +1876,32 @@ ADD_TABLE(property) }; +static const msi_table shc_tables[] = +{ + ADD_TABLE(media), + ADD_TABLE(directory), + ADD_TABLE(shc_file), + ADD_TABLE(shc_component), + ADD_TABLE(shc_feature), + ADD_TABLE(shc_feature_comp), + ADD_TABLE(shc_custom_action), + ADD_TABLE(shc_install_exec_seq), + ADD_TABLE(shc_property) +}; + +static const msi_table shc2_tables[] = +{ + ADD_TABLE(media), + ADD_TABLE(directory), + ADD_TABLE(shc_file), + ADD_TABLE(shc_component), + ADD_TABLE(shc_feature), + ADD_TABLE(shc_feature_comp), + ADD_TABLE(shc_custom_action), + ADD_TABLE(shc_install_exec_seq), + ADD_TABLE(shc2_property) +}; + /* cabinet definitions */ /* make the max size large so there is only one cab file */ @@ -1931,6 +2027,7 @@ GET_PROC(hmsi, MsiSourceListEnumSourcesA); GET_PROC(hmsi, MsiGetComponentPathExA); + GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) @@ -1945,9 +2042,26 @@ static BOOL is_process_limited(void) { + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; HANDLE token; - if (!pOpenProcessToken) return FALSE; + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators have enough privileges for these tests */ + return TRUE; + } if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { @@ -2263,7 +2377,8 @@ CloseHandle(hf); } -static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, const char *template) +static void write_msi_summary_info(MSIHANDLE db, INT version, INT wordcount, + const char *template, const char *packagecode) { MSIHANDLE summary; UINT r; @@ -2274,8 +2389,7 @@ r = MsiSummaryInfoSetPropertyA(summary, PID_TEMPLATE, VT_LPSTR, 0, NULL, template); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, - "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); + r = MsiSummaryInfoSetPropertyA(summary, PID_REVNUMBER, VT_LPSTR, 0, NULL, packagecode); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); r = MsiSummaryInfoSetPropertyA(summary, PID_PAGECOUNT, VT_I4, version, NULL, NULL); @@ -2295,14 +2409,16 @@ } #define create_database(name, tables, num_tables) \ - create_database_wordcount(name, tables, num_tables, 100, 0, ";1033"); + create_database_wordcount(name, tables, num_tables, 100, 0, ";1033", \ + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); #define create_database_template(name, tables, num_tables, version, template) \ - create_database_wordcount(name, tables, num_tables, version, 0, template); + create_database_wordcount(name, tables, num_tables, version, 0, template, \ + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); static void create_database_wordcount(const CHAR *name, const msi_table *tables, int num_tables, INT version, INT wordcount, - const char *template) + const char *template, const char *packagecode) { MSIHANDLE db; UINT r; @@ -2329,7 +2445,7 @@ DeleteFileA(table->filename); } - write_msi_summary_info(db, version, wordcount, template); + write_msi_summary_info(db, version, wordcount, template, packagecode); r = MsiDatabaseCommit(db); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); @@ -4547,7 +4663,8 @@ create_database_wordcount(msifile, ai_tables, sizeof(ai_tables) / sizeof(msi_table), - 100, msidbSumInfoSourceTypeAdminImage, ";1033"); + 100, msidbSumInfoSourceTypeAdminImage, ";1033", + "{004757CA-5092-49C2-AD20-28E1CE0DF5F2}"); MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); @@ -5659,6 +5776,50 @@ DeleteFileA(msifile); } +static void test_shared_component(void) +{ + UINT r; + + if (is_process_limited()) + { + skip("process is limited\n"); + return; + } + CreateDirectoryA("msitest", NULL); + create_file("msitest\\sharedcomponent.txt", 1000); + create_database_wordcount(msifile, shc_tables, sizeof(shc_tables)/sizeof(shc_tables[0]), + 100, 0, ";", "{A8826420-FD72-4E61-9E15-C1944CF4CBE1}"); + create_database_wordcount(msifile2, shc2_tables, sizeof(shc2_tables)/sizeof(shc2_tables[0]), + 100, 0, ";", "{A8B50B30-0E8A-4ACD-B3CF-1A5DC58B2739}"); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + r = MsiInstallProductA(msifile, NULL); + ok(r == ERROR_SUCCESS, "got %u\n", r); + + ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n"); + + r = MsiInstallProductA(msifile2, NULL); + ok(r == ERROR_SUCCESS, "got %u\n", r); + + ok(pf_exists("msitest\\sharedcomponent.txt"), "file not installed\n"); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "got %u\n", r); + + ok(pf_exists("msitest\\sharedcomponent.txt"), "file removed\n"); + + r = MsiInstallProductA(msifile2, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "got %u\n", r); + + ok(!pf_exists("msitest\\sharedcomponent.txt"), "file not removed\n"); + + DeleteFileA("msitest\\sharedcomponent.txt"); + RemoveDirectoryA("msitest"); + DeleteFileA(msifile); + DeleteFileA(msifile2); +} + START_TEST(install) { DWORD len; @@ -5743,6 +5904,7 @@ test_upgrade_code(); test_mixed_package(); test_volume_props(); + test_shared_component(); DeleteFileA(log_file); diff -Nru wine1.7-1.7.13/dlls/msi/tests/msi.c wine1.7-1.7.16/dlls/msi/tests/msi.c --- wine1.7-1.7.13/dlls/msi/tests/msi.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/tests/msi.c 2014-04-04 19:13:44.000000000 +0000 @@ -42,6 +42,7 @@ static char COMMON_FILES_DIR[MAX_PATH]; static char WINDOWS_DIR[MAX_PATH]; +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE ); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); @@ -100,6 +101,7 @@ GET_PROC(hmsi, MsiEnumComponentsExA) GET_PROC(hmsi, MsiSourceListGetInfoA) + GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA) GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) @@ -172,16 +174,38 @@ static BOOL is_process_limited(void) { + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; HANDLE token; - TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; - DWORD size; - BOOL ret; - if (!pOpenProcessToken) return FALSE; - if (!pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) return FALSE; - ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); - CloseHandle(token); - return (ret && type == TokenElevationTypeLimited); + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators have enough privileges for these tests */ + return TRUE; + } + + if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) + { + BOOL ret; + TOKEN_ELEVATION_TYPE type = TokenElevationTypeDefault; + DWORD size; + + ret = GetTokenInformation(token, TokenElevationType, &type, sizeof(type), &size); + CloseHandle(token); + return (ret && type == TokenElevationTypeLimited); + } + return FALSE; } /* cabinet definitions */ @@ -1690,6 +1714,7 @@ { skip("Not enough rights to perform tests\n"); RegDeleteKeyA(userkey, ""); + RegCloseKey(userkey); LocalFree(usersid); return; } @@ -1724,6 +1749,14 @@ lstrcatA(keypath, prod_squashed); res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &localkey, NULL); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + RegDeleteKeyA(userkey, ""); + RegCloseKey(userkey); + LocalFree(usersid); + return; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); /* local product key exists */ @@ -2560,6 +2593,12 @@ lstrcatA(keypath, "\\InstallProperties"); res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &prodkey, NULL); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + LocalFree(usersid); + return; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); /* local system product key exists */ @@ -10350,6 +10389,11 @@ lstrcatA(keypath, prod_squashed); res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &udprod, NULL); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + goto done; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); /* local UserData product key exists */ @@ -10577,15 +10621,17 @@ "Expected targetsid to be unchanged, got %s\n", targetsid); ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + delete_key(hpatch, "", access & KEY_WOW64_64KEY); + RegCloseKey(hpatch); + delete_key(udpatch, "", access & KEY_WOW64_64KEY); + RegCloseKey(udpatch); + +done: RegDeleteValueA(patches, patch_squashed); RegDeleteValueA(patches, "Patches"); delete_key(patches, "", access & KEY_WOW64_64KEY); RegCloseKey(patches); RegDeleteValueA(hpatch, "State"); - delete_key(hpatch, "", access & KEY_WOW64_64KEY); - RegCloseKey(hpatch); - delete_key(udpatch, "", access & KEY_WOW64_64KEY); - RegCloseKey(udpatch); delete_key(udprod, "", access & KEY_WOW64_64KEY); RegCloseKey(udprod); delete_key(prodkey, "", access & KEY_WOW64_64KEY); @@ -12665,6 +12711,11 @@ lstrcatA(keypath, prod_squashed); res = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath, 0, NULL, 0, access, NULL, &hkey_udproduct, NULL); + if (res == ERROR_ACCESS_DENIED) + { + skip("Not enough rights to perform tests\n"); + goto done; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS got %d\n", res); /* UserData product key exists */ @@ -12756,18 +12807,20 @@ RegCloseKey(hkey_udproductpatches); delete_key(hkey_udpatch, "", access & KEY_WOW64_64KEY); RegCloseKey(hkey_udpatch); - delete_key(hkey_patches, "", access & KEY_WOW64_64KEY); - RegCloseKey(hkey_patches); - delete_key(hkey_product, "", access & KEY_WOW64_64KEY); - RegCloseKey(hkey_product); - delete_key(hkey_patch, "", access & KEY_WOW64_64KEY); - RegCloseKey(hkey_patch); delete_key(hkey_udpatches, "", access & KEY_WOW64_64KEY); RegCloseKey(hkey_udpatches); delete_key(hkey_udprops, "", access & KEY_WOW64_64KEY); RegCloseKey(hkey_udprops); delete_key(hkey_udproduct, "", access & KEY_WOW64_64KEY); RegCloseKey(hkey_udproduct); + +done: + delete_key(hkey_patches, "", access & KEY_WOW64_64KEY); + RegCloseKey(hkey_patches); + delete_key(hkey_product, "", access & KEY_WOW64_64KEY); + RegCloseKey(hkey_product); + delete_key(hkey_patch, "", access & KEY_WOW64_64KEY); + RegCloseKey(hkey_patch); } static void test_MsiEnumProducts(void) @@ -12790,10 +12843,12 @@ if (is_wow64) access |= KEY_WOW64_64KEY; - strcpy(keypath1, "Software\\Classes\\Installer\\Products\\"); - strcat(keypath1, product_squashed1); + strcpy(keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); + strcat(keypath2, usersid); + strcat(keypath2, "\\Installer\\Products\\"); + strcat(keypath2, product_squashed2); - r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL); + r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath2, 0, NULL, 0, access, NULL, &key2, NULL); if (r == ERROR_ACCESS_DENIED) { skip("Not enough rights to perform tests\n"); @@ -12802,12 +12857,10 @@ } ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - strcpy(keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); - strcat(keypath2, usersid); - strcat(keypath2, "\\Installer\\Products\\"); - strcat(keypath2, product_squashed2); + strcpy(keypath1, "Software\\Classes\\Installer\\Products\\"); + strcat(keypath1, product_squashed1); - r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath2, 0, NULL, 0, access, NULL, &key2, NULL); + r = RegCreateKeyExA(HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); strcpy(keypath3, "Software\\Microsoft\\Installer\\Products\\"); @@ -12921,10 +12974,12 @@ if (is_wow64) access |= KEY_WOW64_64KEY; - strcpy( keypath1, "Software\\Classes\\Installer\\Products\\" ); - strcat( keypath1, product_squashed1 ); + strcpy( keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\" ); + strcat( keypath2, usersid ); + strcat( keypath2, "\\Installer\\Products\\" ); + strcat( keypath2, product_squashed2 ); - r = RegCreateKeyExA( HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL ); + r = RegCreateKeyExA( HKEY_LOCAL_MACHINE, keypath2, 0, NULL, 0, access, NULL, &key2, NULL ); if (r == ERROR_ACCESS_DENIED) { skip( "insufficient rights\n" ); @@ -12932,12 +12987,10 @@ } ok( r == ERROR_SUCCESS, "got %u\n", r ); - strcpy( keypath2, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\" ); - strcat( keypath2, usersid ); - strcat( keypath2, "\\Installer\\Products\\" ); - strcat( keypath2, product_squashed2 ); + strcpy( keypath1, "Software\\Classes\\Installer\\Products\\" ); + strcat( keypath1, product_squashed1 ); - r = RegCreateKeyExA( HKEY_LOCAL_MACHINE, keypath2, 0, NULL, 0, access, NULL, &key2, NULL ); + r = RegCreateKeyExA( HKEY_LOCAL_MACHINE, keypath1, 0, NULL, 0, access, NULL, &key1, NULL ); ok( r == ERROR_SUCCESS, "got %u\n", r ); strcpy( keypath3, usersid ); diff -Nru wine1.7-1.7.13/dlls/msi/tests/package.c wine1.7-1.7.16/dlls/msi/tests/package.c --- wine1.7-1.7.13/dlls/msi/tests/package.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/tests/package.c 2014-04-04 19:13:44.000000000 +0000 @@ -41,6 +41,7 @@ static INSTALLSTATE (WINAPI *pMsiGetComponentPathExA)(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPSTR, LPDWORD); static HRESULT (WINAPI *pSHGetFolderPathA)(HWND, int, HANDLE, DWORD, LPSTR); +static BOOL (WINAPI *pCheckTokenMembership)(HANDLE,PSID,PBOOL); static BOOL (WINAPI *pConvertSidToStringSidA)(PSID, LPSTR*); static BOOL (WINAPI *pOpenProcessToken)( HANDLE, DWORD, PHANDLE ); static LONG (WINAPI *pRegDeleteKeyExA)(HKEY, LPCSTR, REGSAM, DWORD); @@ -68,6 +69,7 @@ GET_PROC(hmsi, MsiGetComponentPathExA); GET_PROC(hshell32, SHGetFolderPathA); + GET_PROC(hadvapi32, CheckTokenMembership); GET_PROC(hadvapi32, ConvertSidToStringSidA); GET_PROC(hadvapi32, OpenProcessToken); GET_PROC(hadvapi32, RegDeleteKeyExA) @@ -85,9 +87,38 @@ static BOOL is_process_limited(void) { + SID_IDENTIFIER_AUTHORITY NtAuthority = {SECURITY_NT_AUTHORITY}; + PSID Group; + BOOL IsInGroup; HANDLE token; - if (!pOpenProcessToken) return FALSE; + if (!pCheckTokenMembership || !pOpenProcessToken) return FALSE; + + if (!AllocateAndInitializeSid(&NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is an administrator\n"); + return FALSE; + } + if (!IsInGroup) + { + if (!AllocateAndInitializeSid(&NtAuthority, 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_POWER_USERS, + 0, 0, 0, 0, 0, 0, &Group) || + !pCheckTokenMembership(NULL, Group, &IsInGroup)) + { + trace("Could not check if the current user is a power user\n"); + return FALSE; + } + if (!IsInGroup) + { + /* Only administrators and power users can be powerful */ + return TRUE; + } + } if (pOpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { diff -Nru wine1.7-1.7.13/dlls/msi/tests/source.c wine1.7-1.7.16/dlls/msi/tests/source.c --- wine1.7-1.7.13/dlls/msi/tests/source.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msi/tests/source.c 2014-04-04 19:13:44.000000000 +0000 @@ -1014,19 +1014,24 @@ r = pMsiSourceListAddSourceExA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT | MSISOURCETYPE_URL, "C:\\source", 0); - ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + if (r == ERROR_ACCESS_DENIED) + skip("MsiSourceListAddSourceEx (insufficient privileges)\n"); + else + { + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + res = RegOpenKeyExA(prodkey, "SourceList\\URL", 0, access, &url); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - size = MAX_PATH; - res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size); - ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); - ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value); - ok(size == 11, "Expected 11, got %d\n", size); + size = MAX_PATH; + res = RegQueryValueExA(url, "1", NULL, NULL, (LPBYTE)value, &size); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + ok(!lstrcmpA(value, "C:\\source/"), "Expected 'C:\\source/', got %s\n", value); + ok(size == 11, "Expected 11, got %d\n", size); - RegCloseKey(url); - RegCloseKey(prodkey); + RegCloseKey(url); + RegCloseKey(prodkey); + } LocalFree(usersid); } @@ -2050,6 +2055,11 @@ r = pMsiSourceListSetInfoA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); + if (r == ERROR_ACCESS_DENIED) + { + skip("MsiSourceListSetInfo (insufficient privileges)\n"); + goto done; + } ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Media key is created by MsiSourceListSetInfo */ @@ -2063,10 +2073,11 @@ INSTALLPROPERTY_MEDIAPACKAGEPATHA, "path"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - RegDeleteValueA(media, "MediaPackage"); delete_key(media, "", access); RegCloseKey(media); + +done: delete_key(source, "", access); RegCloseKey(source); delete_key(prodkey, "", access); @@ -2361,6 +2372,11 @@ r = pMsiSourceListAddMediaDiskA(prodcode, NULL, MSIINSTALLCONTEXT_MACHINE, MSICODE_PRODUCT, 1, "label", "prompt"); + if (r == ERROR_ACCESS_DENIED) + { + skip("MsiSourceListAddMediaDisk (insufficient privileges)\n"); + goto done; + } ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); /* Media subkey is created by MsiSourceListAddMediaDisk */ @@ -2375,10 +2391,11 @@ MSICODE_PRODUCT, 1, "label", "prompt"); ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r); - RegDeleteValueA(media, "1"); delete_key(media, "", access); RegCloseKey(media); + +done: delete_key(source, "", access); RegCloseKey(source); delete_key(prodkey, "", access); @@ -3452,6 +3469,11 @@ /* Net key is created */ res = RegOpenKeyExA(source, "Net", 0, access, &net); + if (res == ERROR_ACCESS_DENIED) + { + skip("MsiSourceListAddSource (insufficient privileges)\n"); + goto done; + } ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); CHECK_REG_STR(net, "1", "source\\"); @@ -3467,6 +3489,8 @@ RegDeleteValueA(net, "1"); delete_key(net, "", access); RegCloseKey(net); + +done: delete_key(source, "", access); RegCloseKey(source); delete_key(prodkey, "", access); diff -Nru wine1.7-1.7.13/dlls/msvcp100/msvcp100.spec wine1.7-1.7.16/dlls/msvcp100/msvcp100.spec --- wine1.7-1.7.13/dlls/msvcp100/msvcp100.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcp100/msvcp100.spec 2014-04-04 19:13:44.000000000 +0000 @@ -1214,7 +1214,7 @@ @ cdecl -arch=win64 ?_Putgrouped@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PEBD_K_W@Z(ptr ptr ptr str long long) num_put_wchar__Putgrouped @ stub -arch=win32 ?_Raise_handler@std@@3P6AXABVexception@stdext@@@ZA @ stub -arch=win64 ?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA -@ stub ?_Random_device@tr1@std@@YAIXZ +@ cdecl ?_Random_device@tr1@std@@YAIXZ() _Random_device @ cdecl -arch=win32 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@DI@Z(ptr ptr long ptr long long) num_put_char__Rep @ cdecl -arch=win64 ?_Rep@?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@DU?$char_traits@D@std@@@2@V32@D_K@Z(ptr ptr ptr long long) num_put_char__Rep @ cdecl -arch=win32 ?_Rep@?$num_put@GV?$ostreambuf_iterator@GU?$char_traits@G@std@@@std@@@std@@ABA?AV?$ostreambuf_iterator@GU?$char_traits@G@std@@@2@V32@GI@Z(ptr ptr long ptr long long) num_put_wchar__Rep diff -Nru wine1.7-1.7.13/dlls/msvcp110/msvcp110.spec wine1.7-1.7.16/dlls/msvcp110/msvcp110.spec --- wine1.7-1.7.13/dlls/msvcp110/msvcp110.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcp110/msvcp110.spec 2014-04-04 19:13:44.000000000 +0000 @@ -1710,7 +1710,7 @@ @ cdecl -arch=win64 ?_Put@?$num_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@PEB_W_K@Z(ptr ptr ptr wstr long) num_put_wchar__Put @ stub -arch=win32 ?_Raise_handler@std@@3P6AXABVexception@stdext@@@ZA @ stub -arch=win64 ?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA -@ stub ?_Random_device@std@@YAIXZ +@ cdecl ?_Random_device@std@@YAIXZ() _Random_device @ stub -arch=win32 ?_Read_dir@sys@tr2@std@@YAPADPADPAXAAW4file_type@123@@Z @ stub -arch=win64 ?_Read_dir@sys@tr2@std@@YAPEADPEADPEAXAEAW4file_type@123@@Z @ stub -arch=win32 ?_Read_dir@sys@tr2@std@@YAPA_WPA_WPAXAAW4file_type@123@@Z @@ -3891,7 +3891,7 @@ @ stub _Xp_subx @ stub _Xtime_diff_to_millis @ stub _Xtime_diff_to_millis2 -@ stub _Xtime_get_ticks +@ cdecl _Xtime_get_ticks() @ stub __Wcrtomb_lk # extern _Zero @ cdecl towctrans(long long) diff -Nru wine1.7-1.7.13/dlls/msvcp90/misc.c wine1.7-1.7.16/dlls/msvcp90/misc.c --- wine1.7-1.7.13/dlls/msvcp90/misc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcp90/misc.c 2014-04-04 19:13:44.000000000 +0000 @@ -28,6 +28,12 @@ #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcp); +#define SECSPERDAY 86400 +/* 1601 to 1970 is 369 years plus 89 leap days */ +#define SECS_1601_TO_1970 ((369 * 365 + 89) * (ULONGLONG)SECSPERDAY) +#define TICKSPERSEC 10000000 +#define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC) + struct __Container_proxy; typedef struct { @@ -343,3 +349,28 @@ if(that->proxy) that->proxy->cont = that; } + +/* _Xtime_get_ticks */ +LONGLONG __cdecl _Xtime_get_ticks(void) +{ + FILETIME ft; + + TRACE("\n"); + + GetSystemTimeAsFileTime(&ft); + return ((LONGLONG)ft.dwHighDateTime<<32) + ft.dwLowDateTime - TICKS_1601_TO_1970; +} + +#if _MSVCP_VER >= 90 +unsigned int __cdecl _Random_device(void) +{ + unsigned int ret; + + TRACE("\n"); + + /* TODO: throw correct exception in case of failure */ + if(rand_s(&ret)) + throw_exception(EXCEPTION, "random number generator failed\n"); + return ret; +} +#endif diff -Nru wine1.7-1.7.13/dlls/msvcp90/msvcp90.spec wine1.7-1.7.16/dlls/msvcp90/msvcp90.spec --- wine1.7-1.7.13/dlls/msvcp90/msvcp90.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcp90/msvcp90.spec 2014-04-04 19:13:44.000000000 +0000 @@ -3062,7 +3062,7 @@ @ stub -arch=win64 ?_Putmfld@?$money_put@_WV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@std@@@std@@AEBA?AV?$ostreambuf_iterator@_WU?$char_traits@_W@std@@@2@V32@_NAEAVios_base@2@_W1V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@2@@Z @ stub -arch=win32 ?_Raise_handler@std@@3P6AXABVexception@stdext@@@ZA @ stub -arch=win64 ?_Raise_handler@std@@3P6AXAEBVexception@stdext@@@ZEA -@ stub ?_Random_device@tr1@std@@YAIXZ +@ cdecl ?_Random_device@tr1@std@@YAIXZ() _Random_device @ thiscall -arch=win32 ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV12@PADIH@Z(ptr ptr long long) basic_istream_char__Read_s @ cdecl -arch=win64 ?_Read_s@?$basic_istream@DU?$char_traits@D@std@@@std@@QEAAAEAV12@PEAD_K_J@Z(ptr ptr long long) basic_istream_char__Read_s @ thiscall -arch=win32 ?_Read_s@?$basic_istream@GU?$char_traits@G@std@@@std@@QAEAAV12@PAGIH@Z(ptr ptr long long) basic_istream_wchar__Read_s diff -Nru wine1.7-1.7.13/dlls/msvcrt/ctype.c wine1.7-1.7.16/dlls/msvcrt/ctype.c --- wine1.7-1.7.13/dlls/msvcrt/ctype.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcrt/ctype.c 2014-04-04 19:13:44.000000000 +0000 @@ -339,37 +339,42 @@ int CDECL MSVCRT__toupper_l(int c, MSVCRT__locale_t locale) { MSVCRT_pthreadlocinfo locinfo; + unsigned char str[2], *p = str; + WCHAR wide, upper; if(!locale) locinfo = get_locinfo(); else locinfo = locale->locinfo; - if(c < 256) - return locinfo->pcumap[(unsigned char)c]; + if((unsigned)c < 256) + return locinfo->pcumap[c]; if(locinfo->pctype[(c>>8)&255] & MSVCRT__LEADBYTE) - { - WCHAR wide, upper; - char str[2], *p = str; *p++ = (c>>8) & 255; - *p++ = c & 255; + else { + *MSVCRT__errno() = MSVCRT_EILSEQ; + str[1] = 0; + } + *p++ = c & 255; - if(!MultiByteToWideChar(locinfo->lc_codepage, - MB_ERR_INVALID_CHARS, str, 2, &wide, 1)) - return c; - - upper = toupperW(wide); - if(upper == wide) - return c; + if(!MultiByteToWideChar(locinfo->lc_codepage, + MB_ERR_INVALID_CHARS, (char*)str, p-str, &wide, 1)) + return c; - WideCharToMultiByte(locinfo->lc_codepage, 0, - &upper, 1, str, 2, NULL, NULL); + upper = toupperW(wide); + if(upper == wide) + return str[0] + (str[1]<<8); + switch(WideCharToMultiByte(locinfo->lc_codepage, 0, + &upper, 1, (char*)str, 2, NULL, NULL)) { + case 0: + return c; + case 1: + return str[0]; + default: return str[0] + (str[1]<<8); } - - return c; } /********************************************************************* @@ -394,37 +399,42 @@ int CDECL MSVCRT__tolower_l(int c, MSVCRT__locale_t locale) { MSVCRT_pthreadlocinfo locinfo; + unsigned char str[2], *p = str; + WCHAR wide, lower; if(!locale) locinfo = get_locinfo(); else locinfo = locale->locinfo; - if(c < 256) - return locinfo->pclmap[(unsigned char)c]; + if((unsigned)c < 256) + return locinfo->pclmap[c]; if(locinfo->pctype[(c>>8)&255] & MSVCRT__LEADBYTE) - { - WCHAR wide, upper; - char str[2], *p = str; *p++ = (c>>8) & 255; - *p++ = c & 255; + else { + *MSVCRT__errno() = MSVCRT_EILSEQ; + str[1] = 0; + } + *p++ = c & 255; - if(!MultiByteToWideChar(locinfo->lc_codepage, - MB_ERR_INVALID_CHARS, str, 2, &wide, 1)) - return c; - - upper = tolowerW(wide); - if(upper == wide) - return c; + if(!MultiByteToWideChar(locinfo->lc_codepage, + MB_ERR_INVALID_CHARS, (char*)str, p-str, &wide, 1)) + return c; - WideCharToMultiByte(locinfo->lc_codepage, 0, - &upper, 1, str, 2, NULL, NULL); + lower = tolowerW(wide); + if(lower == wide) + return str[0] + (str[1]<<8); + switch(WideCharToMultiByte(locinfo->lc_codepage, 0, + &lower, 1, (char*)str, 2, NULL, NULL)) { + case 0: + return c; + case 1: + return str[0]; + default: return str[0] + (str[1]<<8); } - - return c; } /********************************************************************* diff -Nru wine1.7-1.7.13/dlls/msvcrt/printf.h wine1.7-1.7.16/dlls/msvcrt/printf.h --- wine1.7-1.7.13/dlls/msvcrt/printf.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcrt/printf.h 2014-04-04 19:13:44.000000000 +0000 @@ -265,9 +265,11 @@ } i = 0; - if(x==0 && flags->Precision) - buf[i++] = '0'; - else { + if(x == 0) { + flags->Alternate = 0; + if(flags->Precision) + buf[i++] = '0'; + } else { while(x != 0) { j = (ULONGLONG)x%base; x = (ULONGLONG)x/base; diff -Nru wine1.7-1.7.13/dlls/msvcrt/tests/locale.c wine1.7-1.7.16/dlls/msvcrt/tests/locale.c --- wine1.7-1.7.13/dlls/msvcrt/tests/locale.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcrt/tests/locale.c 2014-04-04 19:13:44.000000000 +0000 @@ -49,9 +49,6 @@ ret = setlocale(20, "C"); ok(ret == NULL, "ret = %s\n", ret); - ret = setlocale(LC_ALL, ""); - ok(ret != NULL, "ret == NULL\n"); - ret = setlocale(LC_ALL, "C"); ok(!strcmp(ret, "C"), "ret = %s\n", ret); @@ -785,10 +782,8 @@ static void test___mb_cur_max_func(void) { int mb_cur_max; - CPINFO cp; setlocale(LC_ALL, "C"); - GetCPInfo(CP_ACP, &cp); /* for newer Windows */ if(!p___mb_cur_max_func) @@ -812,13 +807,7 @@ win_skip("Skipping __p___mb_cur_max tests\n"); else { mb_cur_max = *p__p___mb_cur_max(); - if (cp.MaxCharSize != 1) { - todo_wine ok(mb_cur_max == cp.MaxCharSize, "mb_cur_max = %d, expected %d\n", - mb_cur_max, cp.MaxCharSize); - } - else { - ok(mb_cur_max == 1, "mb_cur_max = %d, expected 1\n", mb_cur_max); - } + ok(mb_cur_max == 1, "mb_cur_max = %d, expected 1\n", mb_cur_max); /* some old Windows don't set chinese */ if (!setlocale(LC_ALL, "chinese")) diff -Nru wine1.7-1.7.13/dlls/msvcrt/tests/printf.c wine1.7-1.7.16/dlls/msvcrt/tests/printf.c --- wine1.7-1.7.13/dlls/msvcrt/tests/printf.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcrt/tests/printf.c 2014-04-04 19:13:44.000000000 +0000 @@ -329,18 +329,52 @@ format = "%#012x"; r = sprintf(buffer,format,1); ok(!strcmp(buffer,"0x0000000001"),"Hexadecimal zero-padded \"%s\"\n",buffer); + ok( r==12, "return count wrong\n"); + + r = sprintf(buffer,format,0); + ok(!strcmp(buffer,"000000000000"),"Hexadecimal zero-padded \"%s\"\n",buffer); + ok( r==12, "return count wrong\n"); format = "%#04.8x"; r = sprintf(buffer,format,1); ok(!strcmp(buffer,"0x00000001"), "Hexadecimal zero-padded precision \"%s\"\n",buffer); + ok( r==10, "return count wrong\n"); + + r = sprintf(buffer,format,0); + ok(!strcmp(buffer,"00000000"), "Hexadecimal zero-padded precision \"%s\"\n",buffer); + ok( r==8, "return count wrong\n"); format = "%#-08.2x"; r = sprintf(buffer,format,1); ok(!strcmp(buffer,"0x01 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer); + ok( r==8, "return count wrong\n"); + + r = sprintf(buffer,format,0); + ok(!strcmp(buffer,"00 "), "Hexadecimal zero-padded not left-adjusted \"%s\"\n",buffer); + ok( r==8, "return count wrong\n"); + + format = "%#.0x"; + r = sprintf(buffer,format,1); + ok(!strcmp(buffer,"0x1"), "Hexadecimal zero-padded zero-precision \"%s\"\n",buffer); + ok( r==3, "return count wrong\n"); + + r = sprintf(buffer,format,0); + ok(!strcmp(buffer,""), "Hexadecimal zero-padded zero-precision \"%s\"\n",buffer); + ok( r==0, "return count wrong\n"); format = "%#08o"; r = sprintf(buffer,format,1); ok(!strcmp(buffer,"00000001"), "Octal zero-padded \"%s\"\n",buffer); + ok( r==8, "return count wrong\n"); + + format = "%#o"; + r = sprintf(buffer,format,1); + ok(!strcmp(buffer,"01"), "Octal zero-padded \"%s\"\n",buffer); + ok( r==2, "return count wrong\n"); + + r = sprintf(buffer,format,0); + ok(!strcmp(buffer,"0"), "Octal zero-padded \"%s\"\n",buffer); + ok( r==1, "return count wrong\n"); if (sizeof(void *) == 8) { diff -Nru wine1.7-1.7.13/dlls/msvcrt/tests/string.c wine1.7-1.7.16/dlls/msvcrt/tests/string.c --- wine1.7-1.7.13/dlls/msvcrt/tests/string.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvcrt/tests/string.c 2014-04-04 19:13:44.000000000 +0000 @@ -2419,29 +2419,59 @@ static void test_tolower(void) { - int ret; + char ch, lch; + int ret, len; + /* test C locale when locale was never changed */ ret = p_tolower(0x41); ok(ret == 0x61, "ret = %x\n", ret); ret = p_tolower(0xF4); ok(ret == 0xF4, "ret = %x\n", ret); + errno = 0xdeadbeef; ret = p_tolower((char)0xF4); - ok(ret==0xF4/*Vista+*/ || ret==(char)0xF4, "ret = %x\n", ret); + todo_wine ok(ret == (char)0xF4, "ret = %x\n", ret); + todo_wine ok(errno == 0xdeadbeef, "errno = %d\n", errno); - /* is it using different locale (CP_ACP) for negative values?? */ - /* current implementation matches msvcr90 behaviour */ + errno = 0xdeadbeef; ret = p_tolower((char)0xD0); - todo_wine ok(ret==0xF0/*Vista+*/ || ret==(char)0xD0, "ret = %x\n", ret); - - ret = p_tolower(0xD0); - ok(ret == 0xD0, "ret = %x\n", ret); + todo_wine ok(ret == (char)0xD0, "ret = %x\n", ret); + todo_wine ok(errno == 0xdeadbeef, "errno = %d\n", errno); + /* test C locale after setting locale */ if(!setlocale(LC_ALL, "us")) { win_skip("skipping tolower tests that depends on locale\n"); return; } + setlocale(LC_ALL, "C"); + + ch = 0xF4; + errno = 0xdeadbeef; + ret = p_tolower(ch); + len = LCMapStringA(0, LCMAP_LOWERCASE, &ch, 1, &lch, 1); + if(len) + ok(ret==(unsigned char)lch || broken(ret==ch)/*WinXP-*/, "ret = %x\n", ret); + else + ok(ret == ch, "ret = %x\n", ret); + if(!len || ret==(unsigned char)lch) + ok(errno == EILSEQ, "errno = %d\n", errno); + + ch = 0xD0; + errno = 0xdeadbeef; + ret = p_tolower(ch); + len = LCMapStringA(0, LCMAP_LOWERCASE, &ch, 1, &lch, 1); + if(len) + ok(ret==(unsigned char)lch || broken(ret==ch)/*WinXP-*/, "ret = %x\n", ret); + else + ok(ret == ch, "ret = %x\n", ret); + if(!len || ret==(unsigned char)lch) + ok(errno == EILSEQ, "errno = %d\n", errno); + + ret = p_tolower(0xD0); + ok(ret == 0xD0, "ret = %x\n", ret); + + ok(setlocale(LC_ALL, "us") != NULL, "setlocale failed\n"); ret = p_tolower((char)0xD0); ok(ret == 0xF0, "ret = %x\n", ret); @@ -2696,15 +2726,12 @@ ok(pmemcmp(mem+5,xilstring, nLen) == 0, "Got result %s\n",mem+5); - /* Test _swab function */ + /* run tolower tests first */ + test_tolower(); test_swab(); - - /* Test ismbblead*/ test_mbcp(); - /* test _mbsspn */ test_mbsspn(); test_mbsspnp(); - /* test _strdup */ test_strdup(); test_strcpy_s(); test_memcpy_s(); @@ -2736,7 +2763,6 @@ test__mbslwr_s(); test_wctob(); test_wctomb(); - test_tolower(); test__atodbl(); test__stricmp(); test__wcstoi64(); diff -Nru wine1.7-1.7.13/dlls/msvidc32/msvideo1.c wine1.7-1.7.16/dlls/msvidc32/msvideo1.c --- wine1.7-1.7.13/dlls/msvidc32/msvideo1.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msvidc32/msvideo1.c 2014-04-04 19:13:44.000000000 +0000 @@ -67,7 +67,7 @@ typedef struct Msvideo1Context { DWORD dwMagic; - int mode_8bit; /* if it's not 8-bit, it's 16-bit */ + BOOL mode_8bit; /* if it's not 8-bit, it's 16-bit */ } Msvideo1Context; static void @@ -370,12 +370,12 @@ TRACE("bitmap is %d bpp\n", in->bmiHeader.biBitCount); if( in->bmiHeader.biBitCount == 8 ) - info->mode_8bit = 1; + info->mode_8bit = TRUE; else if( in->bmiHeader.biBitCount == 16 ) - info->mode_8bit = 0; + info->mode_8bit = FALSE; else { - info->mode_8bit = 0; + info->mode_8bit = FALSE; FIXME("Unsupported output format %i\n", in->bmiHeader.biBitCount); } diff -Nru wine1.7-1.7.13/dlls/msxml3/dispex.c wine1.7-1.7.16/dlls/msxml3/dispex.c --- wine1.7-1.7.13/dlls/msxml3/dispex.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/dispex.c 2014-04-04 19:13:44.000000000 +0000 @@ -32,6 +32,7 @@ #include "winnls.h" #include "ole2.h" #include "msxml6.h" +#include "msxml6did.h" #include "wininet.h" #include "urlmon.h" #include "winreg.h" @@ -85,20 +86,6 @@ struct list entry; }; -typedef struct { - VARIANT var; - LPWSTR name; -} dynamic_prop_t; - -struct dispex_dynamic_data_t { - DWORD buf_size; - DWORD prop_cnt; - dynamic_prop_t *props; -}; - -#define DISPID_DYNPROP_0 0x50000000 -#define DISPID_DYNPROP_MAX 0x5fffffff - static struct list dispex_data_list = LIST_INIT(dispex_data_list); static ITypeLib *typelib[LibXml_Last]; static ITypeInfo *typeinfos[LAST_tid]; @@ -340,11 +327,6 @@ return This->data->data; } -static inline BOOL is_dynamic_dispid(DISPID id) -{ - return DISPID_DYNPROP_0 <= id && id <= DISPID_DYNPROP_MAX; -} - static inline DispatchEx *impl_from_IDispatchEx(IDispatchEx *iface) { return CONTAINING_RECORD(iface, DispatchEx, IDispatchEx_iface); @@ -417,7 +399,7 @@ { DispatchEx *This = impl_from_IDispatchEx(iface); - TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + TRACE("(%p)->(%x %s %x %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); return IDispatchEx_InvokeEx(&This->IDispatchEx_iface, dispIdMember, lcid, wFlags, @@ -460,17 +442,6 @@ min = n+1; } - if(This->dynamic_data) { - unsigned i; - - for(i=0; i < This->dynamic_data->prop_cnt; i++) { - if(!strcmpW(This->dynamic_data->props[i].name, bstrName)) { - *pid = DISPID_DYNPROP_0 + i; - return S_OK; - } - } - } - if(This->data->vtbl && This->data->vtbl->get_dispid) { HRESULT hres; @@ -479,46 +450,34 @@ return hres; } - if(grfdex & fdexNameEnsure) { - dispex_dynamic_data_t *dynamic_data; - - TRACE("creating dynamic prop %s\n", debugstr_w(bstrName)); - - if(This->dynamic_data) { - dynamic_data = This->dynamic_data; - }else { - dynamic_data = This->dynamic_data = heap_alloc_zero(sizeof(dispex_dynamic_data_t)); - if(!dynamic_data) - return E_OUTOFMEMORY; - } - - if(!dynamic_data->buf_size) { - dynamic_data->props = heap_alloc(sizeof(dynamic_prop_t)*4); - if(!dynamic_data->props) - return E_OUTOFMEMORY; - dynamic_data->buf_size = 4; - }else if(dynamic_data->buf_size == dynamic_data->prop_cnt) { - dynamic_prop_t *new_props; - - new_props = heap_realloc(dynamic_data->props, sizeof(dynamic_prop_t)*(dynamic_data->buf_size<<1)); - if(!new_props) - return E_OUTOFMEMORY; - - dynamic_data->props = new_props; - dynamic_data->buf_size <<= 1; - } - - dynamic_data->props[dynamic_data->prop_cnt].name = heap_strdupW(bstrName); - VariantInit(&dynamic_data->props[dynamic_data->prop_cnt].var); - *pid = DISPID_DYNPROP_0 + dynamic_data->prop_cnt++; - - return S_OK; - } - TRACE("not found %s\n", debugstr_w(bstrName)); return DISP_E_UNKNOWNNAME; } +static BOOL is_propputref_id(DISPID id) +{ + switch (id) + { + case DISPID_DOM_DOCUMENT_DOCUMENTELEMENT: + case DISPID_XMLDOM_DOCUMENT2_SCHEMAS: + case DISPID_XMLDOM_SELECTION_CONTEXT: + case DISPID_XMLDOM_TEMPLATE_STYLESHEET: + case DISPID_SAX_CONTENTHANDLER_DOCUMENTLOCATOR: + case DISPID_SAX_XMLFILTER_PARENT: + case DISPID_SAX_XMLREADER_ENTITYRESOLVER: + case DISPID_SAX_XMLREADER_CONTENTHANDLER: + case DISPID_SAX_XMLREADER_DTDHANDLER: + case DISPID_SAX_XMLREADER_ERRORHANDLER: + case DISPID_MXXML_FILTER_ENTITYRESOLVER: + case DISPID_MXXML_FILTER_CONTENTHANDLER: + case DISPID_MXXML_FILTER_DTDHANDLER: + case DISPID_MXXML_FILTER_ERRORHANDLER: + return TRUE; + default: + return FALSE; + } +} + static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) { @@ -542,28 +501,6 @@ return E_NOTIMPL; } - if(is_dynamic_dispid(id)) { - DWORD idx = id - DISPID_DYNPROP_0; - VARIANT *var; - - if(!This->dynamic_data || This->dynamic_data->prop_cnt <= idx) - return DISP_E_UNKNOWNNAME; - - var = &This->dynamic_data->props[idx].var; - - switch(wFlags) { - case INVOKE_PROPERTYGET: - V_VT(pvarRes) = VT_EMPTY; - return VariantCopy(pvarRes, var); - case INVOKE_PROPERTYPUT: - VariantClear(var); - return VariantCopy(var, pdp->rgvarg); - default: - FIXME("unhandled wFlags %x\n", wFlags); - return E_NOTIMPL; - } - } - data = get_dispex_data(This); if(!data) return E_FAIL; @@ -601,6 +538,8 @@ return E_FAIL; } + if (is_propputref_id(id) && wFlags == DISPATCH_PROPERTYPUT) + wFlags = DISPATCH_PROPERTYPUTREF; hres = ITypeInfo_Invoke(ti, unk, id, wFlags, pdp, pvarRes, pei, &argerr); ITypeInfo_Release(ti); @@ -699,26 +638,9 @@ return TRUE; } -void release_dispex(DispatchEx *This) -{ - dynamic_prop_t *prop; - - if(!This->dynamic_data) - return; - - for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) { - VariantClear(&prop->var); - heap_free(prop->name); - } - - heap_free(This->dynamic_data->props); - heap_free(This->dynamic_data); -} - void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data) { dispex->IDispatchEx_iface.lpVtbl = &DispatchExVtbl; dispex->outer = outer; dispex->data = data; - dispex->dynamic_data = NULL; } diff -Nru wine1.7-1.7.13/dlls/msxml3/domimpl.c wine1.7-1.7.16/dlls/msxml3/domimpl.c --- wine1.7-1.7.13/dlls/msxml3/domimpl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/domimpl.c 2014-04-04 19:13:44.000000000 +0000 @@ -101,10 +101,7 @@ TRACE("(%p)->(%d)\n", This, ref); if ( ref == 0 ) - { - release_dispex(&This->dispex); heap_free( This ); - } return ref; } diff -Nru wine1.7-1.7.13/dlls/msxml3/main.c wine1.7-1.7.16/dlls/msxml3/main.c --- wine1.7-1.7.13/dlls/msxml3/main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -63,9 +63,9 @@ void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) { - static const int max_size = 200; enum __wine_debug_class dbcl; - char buff[max_size]; + char buff[200]; + const int max_size = sizeof(buff) / sizeof(buff[0]); int len; switch (lvl) @@ -173,6 +173,7 @@ DECL_FUNCPTR(xsltNewTransformContext); DECL_FUNCPTR(xsltParseStylesheetDoc); DECL_FUNCPTR(xsltQuoteUserParams); +DECL_FUNCPTR(xsltSaveResultTo); # undef DECL_FUNCPTR #endif @@ -197,6 +198,7 @@ LOAD_FUNCPTR(xsltNewTransformContext, 1); LOAD_FUNCPTR(xsltParseStylesheetDoc, 1); LOAD_FUNCPTR(xsltQuoteUserParams, 1); + LOAD_FUNCPTR(xsltSaveResultTo, 1); #undef LOAD_FUNCPTR if (pxsltInit) diff -Nru wine1.7-1.7.13/dlls/msxml3/msxml_private.h wine1.7-1.7.16/dlls/msxml3/msxml_private.h --- wine1.7-1.7.13/dlls/msxml3/msxml_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/msxml_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -134,7 +134,6 @@ extern void release_typelib(void) DECLSPEC_HIDDEN; typedef struct dispex_data_t dispex_data_t; -typedef struct dispex_dynamic_data_t dispex_dynamic_data_t; typedef struct { HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*); @@ -154,7 +153,6 @@ IUnknown *outer; dispex_static_data_t *data; - dispex_dynamic_data_t *dynamic_data; } DispatchEx; extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN; @@ -456,6 +454,18 @@ return S_OK; } + +static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p) +{ + if(value) { + *p = SysAllocStringLen(value, len); + if(!*p) + return E_OUTOFMEMORY; + }else + *p = NULL; + + return S_OK; +} static inline HRESULT return_null_node(IXMLDOMNode **p) { diff -Nru wine1.7-1.7.13/dlls/msxml3/mxnamespace.c wine1.7-1.7.16/dlls/msxml3/mxnamespace.c --- wine1.7-1.7.13/dlls/msxml3/mxnamespace.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/mxnamespace.c 2014-04-04 19:13:44.000000000 +0000 @@ -460,7 +460,6 @@ free_ns_context(ctxt); } - release_dispex(&This->dispex); heap_free( This ); } diff -Nru wine1.7-1.7.13/dlls/msxml3/mxwriter.c wine1.7-1.7.16/dlls/msxml3/mxwriter.c --- wine1.7-1.7.13/dlls/msxml3/mxwriter.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/mxwriter.c 2014-04-04 19:13:44.000000000 +0000 @@ -1,7 +1,7 @@ /* * MXWriter implementation * - * Copyright 2011-2013 Nikolay Sivov for CodeWeavers + * Copyright 2011-2014 Nikolay Sivov for CodeWeavers * Copyright 2011 Thomas Mullaly * * This library is free software; you can redistribute it and/or @@ -140,6 +140,13 @@ ISAXContentHandler ISAXContentHandler_iface; ISAXLexicalHandler ISAXLexicalHandler_iface; ISAXDeclHandler ISAXDeclHandler_iface; + ISAXDTDHandler ISAXDTDHandler_iface; + ISAXErrorHandler ISAXErrorHandler_iface; + IVBSAXDeclHandler IVBSAXDeclHandler_iface; + IVBSAXLexicalHandler IVBSAXLexicalHandler_iface; + IVBSAXContentHandler IVBSAXContentHandler_iface; + IVBSAXDTDHandler IVBSAXDTDHandler_iface; + IVBSAXErrorHandler IVBSAXErrorHandler_iface; LONG ref; MSXML_VERSION class_version; @@ -391,11 +398,14 @@ get_code_page(This->xml_enc, &This->buffer->code_page); } -/* escapes special characters like: +/* Escapes special characters like: '<' -> "<" '&' -> "&" '"' -> """ '>' -> ">" + + On call 'len' contains a length of 'str' in chars or -1 if it's null terminated. + After a call it's updated with actual new length if it wasn't -1 initially. */ static WCHAR *get_escaped_string(const WCHAR *str, escape_mode mode, int *len) { @@ -627,16 +637,51 @@ return CONTAINING_RECORD(iface, mxwriter, ISAXContentHandler_iface); } +static inline mxwriter *impl_from_IVBSAXContentHandler(IVBSAXContentHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXContentHandler_iface); +} + static inline mxwriter *impl_from_ISAXLexicalHandler(ISAXLexicalHandler *iface) { return CONTAINING_RECORD(iface, mxwriter, ISAXLexicalHandler_iface); } +static inline mxwriter *impl_from_IVBSAXLexicalHandler(IVBSAXLexicalHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXLexicalHandler_iface); +} + static inline mxwriter *impl_from_ISAXDeclHandler(ISAXDeclHandler *iface) { return CONTAINING_RECORD(iface, mxwriter, ISAXDeclHandler_iface); } +static inline mxwriter *impl_from_IVBSAXDeclHandler(IVBSAXDeclHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXDeclHandler_iface); +} + +static inline mxwriter *impl_from_ISAXDTDHandler(ISAXDTDHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, ISAXDTDHandler_iface); +} + +static inline mxwriter *impl_from_IVBSAXDTDHandler(IVBSAXDTDHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXDTDHandler_iface); +} + +static inline mxwriter *impl_from_ISAXErrorHandler(ISAXErrorHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, ISAXErrorHandler_iface); +} + +static inline mxwriter *impl_from_IVBSAXErrorHandler(IVBSAXErrorHandler *iface) +{ + return CONTAINING_RECORD(iface, mxwriter, IVBSAXErrorHandler_iface); +} + static HRESULT WINAPI mxwriter_QueryInterface(IMXWriter *iface, REFIID riid, void **obj) { mxwriter *This = impl_from_IMXWriter( iface ); @@ -663,6 +708,34 @@ { *obj = &This->ISAXDeclHandler_iface; } + else if ( IsEqualGUID( riid, &IID_ISAXDTDHandler ) ) + { + *obj = &This->ISAXDTDHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_ISAXErrorHandler ) ) + { + *obj = &This->ISAXErrorHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXDeclHandler ) ) + { + *obj = &This->IVBSAXDeclHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXLexicalHandler ) ) + { + *obj = &This->IVBSAXLexicalHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXContentHandler ) ) + { + *obj = &This->IVBSAXContentHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXDTDHandler ) ) + { + *obj = &This->IVBSAXDTDHandler_iface; + } + else if ( IsEqualGUID( riid, &IID_IVBSAXErrorHandler ) ) + { + *obj = &This->IVBSAXErrorHandler_iface; + } else if (dispex_query_interface(&This->dispex, riid, obj)) { return *obj ? S_OK : E_NOINTERFACE; @@ -706,7 +779,6 @@ SysFreeString(This->encoding); SysFreeString(This->element); - release_dispex(&This->dispex); heap_free(This); } @@ -1085,8 +1157,8 @@ int nuri) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - FIXME("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri)); - return E_NOTIMPL; + TRACE("(%p)->(%s %s)\n", This, debugstr_wn(prefix, nprefix), debugstr_wn(uri, nuri)); + return S_OK; } static HRESULT WINAPI SAXContentHandler_endPrefixMapping( @@ -1095,8 +1167,42 @@ int nprefix) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - FIXME("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix)); - return E_NOTIMPL; + TRACE("(%p)->(%s)\n", This, debugstr_wn(prefix, nprefix)); + return S_OK; +} + +static void mxwriter_write_attribute(mxwriter *writer, const WCHAR *qname, int qname_len, + const WCHAR *value, int value_len, BOOL escape) +{ + static const WCHAR eqW[] = {'='}; + + /* space separator in front of every attribute */ + write_output_buffer(writer->buffer, spaceW, 1); + write_output_buffer(writer->buffer, qname, qname_len); + write_output_buffer(writer->buffer, eqW, 1); + + if (escape) + { + WCHAR *escaped = get_escaped_string(value, EscapeValue, &value_len); + write_output_buffer_quoted(writer->buffer, escaped, value_len); + heap_free(escaped); + } + else + write_output_buffer_quoted(writer->buffer, value, value_len); +} + +static void mxwriter_write_starttag(mxwriter *writer, const WCHAR *qname, int len) +{ + static const WCHAR ltW[] = {'<'}; + + close_element_starttag(writer); + set_element_name(writer, qname ? qname : emptyW, qname ? len : 0); + + write_node_indent(writer); + + write_output_buffer(writer->buffer, ltW, 1); + write_output_buffer(writer->buffer, qname ? qname : emptyW, qname ? len : 0); + writer_inc_indent(writer); } static HRESULT WINAPI SAXContentHandler_startElement( @@ -1110,7 +1216,6 @@ ISAXAttributes *attr) { mxwriter *This = impl_from_ISAXContentHandler( iface ); - static const WCHAR ltW[] = {'<'}; TRACE("(%p)->(%s %s %s %p)\n", This, debugstr_wn(namespaceUri, nnamespaceUri), debugstr_wn(local_name, nlocal_name), debugstr_wn(QName, nQName), attr); @@ -1119,15 +1224,7 @@ (nQName == -1 && This->class_version == MSXML6)) return E_INVALIDARG; - close_element_starttag(This); - set_element_name(This, QName ? QName : emptyW, - QName ? nQName : 0); - - write_node_indent(This); - - write_output_buffer(This->buffer, ltW, 1); - write_output_buffer(This->buffer, QName, nQName); - writer_inc_indent(This); + mxwriter_write_starttag(This, QName, nQName); if (attr) { @@ -1142,31 +1239,16 @@ for (i = 0; i < length; i++) { - static const WCHAR eqW[] = {'='}; - const WCHAR *str; - int len = 0; + int qname_len = 0, value_len = 0; + const WCHAR *qname, *value; - hr = ISAXAttributes_getQName(attr, i, &str, &len); + hr = ISAXAttributes_getQName(attr, i, &qname, &qname_len); if (FAILED(hr)) return hr; - /* space separator in front of every attribute */ - write_output_buffer(This->buffer, spaceW, 1); - write_output_buffer(This->buffer, str, len); - - write_output_buffer(This->buffer, eqW, 1); - - len = 0; - hr = ISAXAttributes_getValue(attr, i, &str, &len); + hr = ISAXAttributes_getValue(attr, i, &value, &value_len); if (FAILED(hr)) return hr; - if (escape) - { - WCHAR *escaped = get_escaped_string(str, EscapeValue, &len); - write_output_buffer_quoted(This->buffer, escaped, len); - heap_free(escaped); - } - else - write_output_buffer_quoted(This->buffer, str, len); + mxwriter_write_attribute(This, qname, qname_len, value, value_len, escape); } } @@ -1646,6 +1728,743 @@ SAXDeclHandler_externalEntityDecl }; +/*** IVBSAXDeclHandler ***/ +static HRESULT WINAPI VBSAXDeclHandler_QueryInterface(IVBSAXDeclHandler *iface, + REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXDeclHandler_AddRef(IVBSAXDeclHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXDeclHandler_Release(IVBSAXDeclHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetTypeInfoCount(IVBSAXDeclHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetTypeInfo(IVBSAXDeclHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXDeclHandler_GetIDsOfNames(IVBSAXDeclHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXDeclHandler_Invoke(IVBSAXDeclHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXDeclHandler_elementDecl(IVBSAXDeclHandler *iface, BSTR *name, BSTR *model) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, name, model); + + if (!name || !model) + return E_POINTER; + + return ISAXDeclHandler_elementDecl(&This->ISAXDeclHandler_iface, *name, -1, *model, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_attributeDecl(IVBSAXDeclHandler *iface, + BSTR *element, BSTR *attr, BSTR *type, BSTR *default_value, BSTR *value) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p %p %p %p)\n", This, element, attr, type, default_value, value); + + if (!element || !attr || !type || !default_value || !value) + return E_POINTER; + + return ISAXDeclHandler_attributeDecl(&This->ISAXDeclHandler_iface, *element, -1, *attr, -1, *type, -1, + *default_value, -1, *value, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_internalEntityDecl(IVBSAXDeclHandler *iface, BSTR *name, BSTR *value) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, name, value); + + if (!name || !value) + return E_POINTER; + + return ISAXDeclHandler_internalEntityDecl(&This->ISAXDeclHandler_iface, *name, -1, *value, -1); +} + +static HRESULT WINAPI VBSAXDeclHandler_externalEntityDecl(IVBSAXDeclHandler *iface, + BSTR *name, BSTR *publicid, BSTR *systemid) +{ + mxwriter *This = impl_from_IVBSAXDeclHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicid, systemid); + + if (!name || !publicid || !systemid) + return E_POINTER; + + return ISAXDeclHandler_externalEntityDecl(&This->ISAXDeclHandler_iface, *name, -1, *publicid, -1, *systemid, -1); +} + +static const IVBSAXDeclHandlerVtbl VBSAXDeclHandlerVtbl = { + VBSAXDeclHandler_QueryInterface, + VBSAXDeclHandler_AddRef, + VBSAXDeclHandler_Release, + VBSAXDeclHandler_GetTypeInfoCount, + VBSAXDeclHandler_GetTypeInfo, + VBSAXDeclHandler_GetIDsOfNames, + VBSAXDeclHandler_Invoke, + VBSAXDeclHandler_elementDecl, + VBSAXDeclHandler_attributeDecl, + VBSAXDeclHandler_internalEntityDecl, + VBSAXDeclHandler_externalEntityDecl +}; + +/*** IVBSAXLexicalHandler ***/ +static HRESULT WINAPI VBSAXLexicalHandler_QueryInterface(IVBSAXLexicalHandler *iface, + REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXLexicalHandler_AddRef(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXLexicalHandler_Release(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetTypeInfoCount(IVBSAXLexicalHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetTypeInfo(IVBSAXLexicalHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXLexicalHandler_GetIDsOfNames(IVBSAXLexicalHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXLexicalHandler_Invoke(IVBSAXLexicalHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startDTD(IVBSAXLexicalHandler *iface, BSTR *name, BSTR *publicId, BSTR *systemId) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicId, systemId); + + if (!name || !publicId || !systemId) + return E_POINTER; + + return ISAXLexicalHandler_startDTD(&This->ISAXLexicalHandler_iface, *name, -1, *publicId, -1, *systemId, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endDTD(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_endDTD(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startEntity(IVBSAXLexicalHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXLexicalHandler_startEntity(&This->ISAXLexicalHandler_iface, *name, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endEntity(IVBSAXLexicalHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXLexicalHandler_endEntity(&This->ISAXLexicalHandler_iface, *name, -1); +} + +static HRESULT WINAPI VBSAXLexicalHandler_startCDATA(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_startCDATA(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_endCDATA(IVBSAXLexicalHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + return ISAXLexicalHandler_endCDATA(&This->ISAXLexicalHandler_iface); +} + +static HRESULT WINAPI VBSAXLexicalHandler_comment(IVBSAXLexicalHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXLexicalHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXLexicalHandler_comment(&This->ISAXLexicalHandler_iface, *chars, -1); +} + +static const IVBSAXLexicalHandlerVtbl VBSAXLexicalHandlerVtbl = { + VBSAXLexicalHandler_QueryInterface, + VBSAXLexicalHandler_AddRef, + VBSAXLexicalHandler_Release, + VBSAXLexicalHandler_GetTypeInfoCount, + VBSAXLexicalHandler_GetTypeInfo, + VBSAXLexicalHandler_GetIDsOfNames, + VBSAXLexicalHandler_Invoke, + VBSAXLexicalHandler_startDTD, + VBSAXLexicalHandler_endDTD, + VBSAXLexicalHandler_startEntity, + VBSAXLexicalHandler_endEntity, + VBSAXLexicalHandler_startCDATA, + VBSAXLexicalHandler_endCDATA, + VBSAXLexicalHandler_comment +}; + +/*** IVBSAXContentHandler ***/ +static HRESULT WINAPI VBSAXContentHandler_QueryInterface(IVBSAXContentHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXContentHandler_AddRef(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXContentHandler_Release(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_GetTypeInfoCount(IVBSAXContentHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXContentHandler_GetTypeInfo(IVBSAXContentHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXContentHandler_GetIDsOfNames(IVBSAXContentHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXContentHandler_Invoke(IVBSAXContentHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXContentHandler_putref_documentLocator(IVBSAXContentHandler *iface, IVBSAXLocator *locator) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + TRACE("(%p)->(%p)\n", This, locator); + return S_OK; +} + +static HRESULT WINAPI VBSAXContentHandler_startDocument(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return ISAXContentHandler_startDocument(&This->ISAXContentHandler_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_endDocument(IVBSAXContentHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + return ISAXContentHandler_endDocument(&This->ISAXContentHandler_iface); +} + +static HRESULT WINAPI VBSAXContentHandler_startPrefixMapping(IVBSAXContentHandler *iface, BSTR *prefix, BSTR *uri) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, prefix, uri); + + if (!prefix || !uri) + return E_POINTER; + + return ISAXContentHandler_startPrefixMapping(&This->ISAXContentHandler_iface, *prefix, -1, *uri, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_endPrefixMapping(IVBSAXContentHandler *iface, BSTR *prefix) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, prefix); + + if (!prefix) + return E_POINTER; + + return ISAXContentHandler_endPrefixMapping(&This->ISAXContentHandler_iface, *prefix, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_startElement(IVBSAXContentHandler *iface, + BSTR *namespaceURI, BSTR *localName, BSTR *QName, IVBSAXAttributes *attrs) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p %p %p)\n", This, namespaceURI, localName, QName, attrs); + + if (!namespaceURI || !localName || !QName) + return E_POINTER; + + TRACE("(%s %s %s)\n", debugstr_w(*namespaceURI), debugstr_w(*localName), debugstr_w(*QName)); + + mxwriter_write_starttag(This, *QName, SysStringLen(*QName)); + + if (attrs) + { + int length, i, escape; + HRESULT hr; + + hr = IVBSAXAttributes_get_length(attrs, &length); + if (FAILED(hr)) return hr; + + escape = This->props[MXWriter_DisableEscaping] == VARIANT_FALSE || + (This->class_version == MSXML4 || This->class_version == MSXML6); + + for (i = 0; i < length; i++) + { + BSTR qname, value; + + hr = IVBSAXAttributes_getQName(attrs, i, &qname); + if (FAILED(hr)) return hr; + + hr = IVBSAXAttributes_getValue(attrs, i, &value); + if (FAILED(hr)) + { + SysFreeString(qname); + return hr; + } + + mxwriter_write_attribute(This, qname, SysStringLen(qname), value, SysStringLen(value), escape); + SysFreeString(qname); + SysFreeString(value); + } + } + + return S_OK; +} + +static HRESULT WINAPI VBSAXContentHandler_endElement(IVBSAXContentHandler *iface, BSTR *namespaceURI, + BSTR *localName, BSTR *QName) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, namespaceURI, localName, QName); + + if (!namespaceURI || !localName || !QName) + return E_POINTER; + + return ISAXContentHandler_endElement(&This->ISAXContentHandler_iface, + *namespaceURI, SysStringLen(*namespaceURI), + *localName, SysStringLen(*localName), + *QName, SysStringLen(*QName)); +} + +static HRESULT WINAPI VBSAXContentHandler_characters(IVBSAXContentHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXContentHandler_characters(&This->ISAXContentHandler_iface, *chars, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_ignorableWhitespace(IVBSAXContentHandler *iface, BSTR *chars) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, chars); + + if (!chars) + return E_POINTER; + + return ISAXContentHandler_ignorableWhitespace(&This->ISAXContentHandler_iface, *chars, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_processingInstruction(IVBSAXContentHandler *iface, + BSTR *target, BSTR *data) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p %p)\n", This, target, data); + + if (!target || !data) + return E_POINTER; + + return ISAXContentHandler_processingInstruction(&This->ISAXContentHandler_iface, *target, -1, *data, -1); +} + +static HRESULT WINAPI VBSAXContentHandler_skippedEntity(IVBSAXContentHandler *iface, BSTR *name) +{ + mxwriter *This = impl_from_IVBSAXContentHandler( iface ); + + TRACE("(%p)->(%p)\n", This, name); + + if (!name) + return E_POINTER; + + return ISAXContentHandler_skippedEntity(&This->ISAXContentHandler_iface, *name, -1); +} + +static const IVBSAXContentHandlerVtbl VBSAXContentHandlerVtbl = { + VBSAXContentHandler_QueryInterface, + VBSAXContentHandler_AddRef, + VBSAXContentHandler_Release, + VBSAXContentHandler_GetTypeInfoCount, + VBSAXContentHandler_GetTypeInfo, + VBSAXContentHandler_GetIDsOfNames, + VBSAXContentHandler_Invoke, + VBSAXContentHandler_putref_documentLocator, + VBSAXContentHandler_startDocument, + VBSAXContentHandler_endDocument, + VBSAXContentHandler_startPrefixMapping, + VBSAXContentHandler_endPrefixMapping, + VBSAXContentHandler_startElement, + VBSAXContentHandler_endElement, + VBSAXContentHandler_characters, + VBSAXContentHandler_ignorableWhitespace, + VBSAXContentHandler_processingInstruction, + VBSAXContentHandler_skippedEntity +}; + +static HRESULT WINAPI SAXDTDHandler_QueryInterface(ISAXDTDHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI SAXDTDHandler_AddRef(ISAXDTDHandler *iface) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI SAXDTDHandler_Release(ISAXDTDHandler *iface) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI SAXDTDHandler_notationDecl(ISAXDTDHandler *iface, + const WCHAR *name, INT nname, + const WCHAR *publicid, INT npublicid, + const WCHAR *systemid, INT nsystemid) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + FIXME("(%p)->(%s:%d, %s:%d, %s:%d): stub\n", This, debugstr_wn(name, nname), nname, + debugstr_wn(publicid, npublicid), npublicid, debugstr_wn(systemid, nsystemid), nsystemid); + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXDTDHandler_unparsedEntityDecl(ISAXDTDHandler *iface, + const WCHAR *name, INT nname, + const WCHAR *publicid, INT npublicid, + const WCHAR *systemid, INT nsystemid, + const WCHAR *notation, INT nnotation) +{ + mxwriter *This = impl_from_ISAXDTDHandler( iface ); + FIXME("(%p)->(%s:%d, %s:%d, %s:%d, %s:%d): stub\n", This, debugstr_wn(name, nname), nname, + debugstr_wn(publicid, npublicid), npublicid, debugstr_wn(systemid, nsystemid), nsystemid, + debugstr_wn(notation, nnotation), nnotation); + return E_NOTIMPL; +} + +static const ISAXDTDHandlerVtbl SAXDTDHandlerVtbl = { + SAXDTDHandler_QueryInterface, + SAXDTDHandler_AddRef, + SAXDTDHandler_Release, + SAXDTDHandler_notationDecl, + SAXDTDHandler_unparsedEntityDecl +}; + +/*** IVBSAXDTDHandler ***/ +static HRESULT WINAPI VBSAXDTDHandler_QueryInterface(IVBSAXDTDHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXDTDHandler_AddRef(IVBSAXDTDHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXDTDHandler_Release(IVBSAXDTDHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetTypeInfoCount(IVBSAXDTDHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetTypeInfo(IVBSAXDTDHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXDTDHandler_GetIDsOfNames(IVBSAXDTDHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXDTDHandler_Invoke(IVBSAXDTDHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXDTDHandler_notationDecl(IVBSAXDTDHandler *iface, BSTR *name, BSTR *publicId, BSTR *systemId) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + + TRACE("(%p)->(%p %p %p)\n", This, name, publicId, systemId); + + if (!name || !publicId || !systemId) + return E_POINTER; + + return ISAXDTDHandler_notationDecl(&This->ISAXDTDHandler_iface, *name, -1, *publicId, -1, *systemId, -1); +} + +static HRESULT WINAPI VBSAXDTDHandler_unparsedEntityDecl(IVBSAXDTDHandler *iface, BSTR *name, BSTR *publicId, + BSTR *systemId, BSTR *notation) +{ + mxwriter *This = impl_from_IVBSAXDTDHandler( iface ); + + TRACE("(%p)->(%p %p %p %p)\n", This, name, publicId, systemId, notation); + + if (!name || !publicId || !systemId || !notation) + return E_POINTER; + + return ISAXDTDHandler_unparsedEntityDecl(&This->ISAXDTDHandler_iface, *name, -1, *publicId, -1, + *systemId, -1, *notation, -1); +} + +static const IVBSAXDTDHandlerVtbl VBSAXDTDHandlerVtbl = { + VBSAXDTDHandler_QueryInterface, + VBSAXDTDHandler_AddRef, + VBSAXDTDHandler_Release, + VBSAXDTDHandler_GetTypeInfoCount, + VBSAXDTDHandler_GetTypeInfo, + VBSAXDTDHandler_GetIDsOfNames, + VBSAXDTDHandler_Invoke, + VBSAXDTDHandler_notationDecl, + VBSAXDTDHandler_unparsedEntityDecl +}; + +/* ISAXErrorHandler */ +static HRESULT WINAPI SAXErrorHandler_QueryInterface(ISAXErrorHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI SAXErrorHandler_AddRef(ISAXErrorHandler *iface) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI SAXErrorHandler_Release(ISAXErrorHandler *iface) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI SAXErrorHandler_error(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXErrorHandler_fatalError(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static HRESULT WINAPI SAXErrorHandler_ignorableWarning(ISAXErrorHandler *iface, + ISAXLocator *locator, const WCHAR *message, HRESULT hr) +{ + mxwriter *This = impl_from_ISAXErrorHandler( iface ); + + FIXME("(%p)->(%p %s 0x%08x)\n", This, locator, debugstr_w(message), hr); + + return E_NOTIMPL; +} + +static const ISAXErrorHandlerVtbl SAXErrorHandlerVtbl = { + SAXErrorHandler_QueryInterface, + SAXErrorHandler_AddRef, + SAXErrorHandler_Release, + SAXErrorHandler_error, + SAXErrorHandler_fatalError, + SAXErrorHandler_ignorableWarning +}; + +/*** IVBSAXErrorHandler ***/ +static HRESULT WINAPI VBSAXErrorHandler_QueryInterface(IVBSAXErrorHandler *iface, REFIID riid, void **obj) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_QueryInterface(&This->IMXWriter_iface, riid, obj); +} + +static ULONG WINAPI VBSAXErrorHandler_AddRef(IVBSAXErrorHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_AddRef(&This->IMXWriter_iface); +} + +static ULONG WINAPI VBSAXErrorHandler_Release(IVBSAXErrorHandler *iface) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_Release(&This->IMXWriter_iface); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetTypeInfoCount(IVBSAXErrorHandler *iface, UINT* pctinfo) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetTypeInfoCount(&This->IMXWriter_iface, pctinfo); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetTypeInfo(IVBSAXErrorHandler *iface, UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetTypeInfo(&This->IMXWriter_iface, iTInfo, lcid, ppTInfo); +} + +static HRESULT WINAPI VBSAXErrorHandler_GetIDsOfNames(IVBSAXErrorHandler *iface, REFIID riid, LPOLESTR* rgszNames, + UINT cNames, LCID lcid, DISPID* rgDispId ) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_GetIDsOfNames(&This->IMXWriter_iface, riid, rgszNames, cNames, lcid, rgDispId); +} + +static HRESULT WINAPI VBSAXErrorHandler_Invoke(IVBSAXErrorHandler *iface, DISPID dispIdMember, REFIID riid, LCID lcid, + WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr ) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + return IMXWriter_Invoke(&This->IMXWriter_iface, dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, + pExcepInfo, puArgErr); +} + +static HRESULT WINAPI VBSAXErrorHandler_error(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBSAXErrorHandler_fatalError(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static HRESULT WINAPI VBSAXErrorHandler_ignorableWarning(IVBSAXErrorHandler *iface, IVBSAXLocator *locator, BSTR *message, LONG code) +{ + mxwriter *This = impl_from_IVBSAXErrorHandler( iface ); + FIXME("(%p)->(%p %p %x): stub\n", This, locator, message, code); + return E_NOTIMPL; +} + +static const IVBSAXErrorHandlerVtbl VBSAXErrorHandlerVtbl = { + VBSAXErrorHandler_QueryInterface, + VBSAXErrorHandler_AddRef, + VBSAXErrorHandler_Release, + VBSAXErrorHandler_GetTypeInfoCount, + VBSAXErrorHandler_GetTypeInfo, + VBSAXErrorHandler_GetIDsOfNames, + VBSAXErrorHandler_Invoke, + VBSAXErrorHandler_error, + VBSAXErrorHandler_fatalError, + VBSAXErrorHandler_ignorableWarning +}; + static const tid_t mxwriter_iface_tids[] = { IMXWriter_tid, 0 @@ -1674,6 +2493,13 @@ This->ISAXContentHandler_iface.lpVtbl = &SAXContentHandlerVtbl; This->ISAXLexicalHandler_iface.lpVtbl = &SAXLexicalHandlerVtbl; This->ISAXDeclHandler_iface.lpVtbl = &SAXDeclHandlerVtbl; + This->ISAXDTDHandler_iface.lpVtbl = &SAXDTDHandlerVtbl; + This->ISAXErrorHandler_iface.lpVtbl = &SAXErrorHandlerVtbl; + This->IVBSAXDeclHandler_iface.lpVtbl = &VBSAXDeclHandlerVtbl; + This->IVBSAXLexicalHandler_iface.lpVtbl = &VBSAXLexicalHandlerVtbl; + This->IVBSAXContentHandler_iface.lpVtbl = &VBSAXContentHandlerVtbl; + This->IVBSAXDTDHandler_iface.lpVtbl = &VBSAXDTDHandlerVtbl; + This->IVBSAXErrorHandler_iface.lpVtbl = &VBSAXErrorHandlerVtbl; This->ref = 1; This->class_version = version; @@ -1778,7 +2604,6 @@ SysFreeString(This->attr[i].value); } - release_dispex(&This->dispex); heap_free(This->attr); heap_free(This); } @@ -2389,25 +3214,61 @@ static HRESULT WINAPI VBSAXAttributes_getURI(IVBSAXAttributes* iface, int index, BSTR *uri) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *uriW; + HRESULT hr; int len; - return ISAXAttributes_getURI(&This->ISAXAttributes_iface, index, (const WCHAR**)uri, &len); + TRACE("(%p)->(%d %p)\n", This, index, uri); + + if (!uri) + return E_POINTER; + + *uri = NULL; + hr = ISAXAttributes_getURI(&This->ISAXAttributes_iface, index, &uriW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(uriW, len, uri); } static HRESULT WINAPI VBSAXAttributes_getLocalName(IVBSAXAttributes* iface, int index, BSTR *name) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *nameW; + HRESULT hr; int len; - return ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, index, (const WCHAR**)name, &len); + TRACE("(%p)->(%d %p)\n", This, index, name); + + if (!name) + return E_POINTER; + + *name = NULL; + hr = ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, index, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, name); } static HRESULT WINAPI VBSAXAttributes_getQName(IVBSAXAttributes* iface, int index, BSTR *qname) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *qnameW; + HRESULT hr; int len; - return ISAXAttributes_getQName(&This->ISAXAttributes_iface, index, (const WCHAR**)qname, &len); + TRACE("(%p)->(%d %p)\n", This, index, qname); + + if (!qname) + return E_POINTER; + + *qname = NULL; + hr = ISAXAttributes_getQName(&This->ISAXAttributes_iface, index, &qnameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(qnameW, len, qname); } static HRESULT WINAPI VBSAXAttributes_getIndexFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, int *index) @@ -2424,58 +3285,130 @@ SysStringLen(qname), index); } -static HRESULT WINAPI VBSAXAttributes_getType(IVBSAXAttributes* iface, int index,BSTR *type) +static HRESULT WINAPI VBSAXAttributes_getType(IVBSAXAttributes* iface, int index, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getType(&This->ISAXAttributes_iface, index, (const WCHAR**)type, &len); + TRACE("(%p)->(%d %p)\n", This, index, type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getType(&This->ISAXAttributes_iface, index, &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getTypeFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - name, SysStringLen(name), (const WCHAR**)type, &len); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(name), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + name, SysStringLen(name), &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getTypeFromQName(IVBSAXAttributes* iface, BSTR qname, BSTR *type) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *typeW; + HRESULT hr; int len; - return ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), - (const WCHAR**)type, &len); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(qname), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), + &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI VBSAXAttributes_getValue(IVBSAXAttributes* iface, int index, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValue(&This->ISAXAttributes_iface, index, (const WCHAR**)value, &len); + TRACE("(%p)->(%d %p)\n", This, index, value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValue(&This->ISAXAttributes_iface, index, &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI VBSAXAttributes_getValueFromName(IVBSAXAttributes* iface, BSTR uri, BSTR name, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - name, SysStringLen(name), (const WCHAR**)value, &len); + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(name), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + name, SysStringLen(name), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI VBSAXAttributes_getValueFromQName(IVBSAXAttributes* iface, BSTR qname, BSTR *value) { mxattributes *This = impl_from_IVBSAXAttributes( iface ); + const WCHAR *valueW; + HRESULT hr; int len; - return ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), - (const WCHAR**)value, &len); + TRACE("(%p)->(%s %p)\n", This, debugstr_w(qname), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, qname, SysStringLen(qname), + &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static const struct IVBSAXAttributesVtbl VBSAXAttributesVtbl = diff -Nru wine1.7-1.7.13/dlls/msxml3/node.c wine1.7-1.7.16/dlls/msxml3/node.c --- wine1.7-1.7.13/dlls/msxml3/node.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/node.c 2014-04-04 19:13:44.000000000 +0000 @@ -67,6 +67,7 @@ MAKE_FUNCPTR(xsltNewTransformContext); MAKE_FUNCPTR(xsltParseStylesheetDoc); MAKE_FUNCPTR(xsltQuoteUserParams); +MAKE_FUNCPTR(xsltSaveResultTo); # undef MAKE_FUNCPTR #endif @@ -624,6 +625,9 @@ VARIANT var; HRESULT hr; + if (!child) + return E_INVALIDARG; + hr = IXMLDOMNode_get_nodeType(child, &type); if(FAILED(hr) || type == NODE_ATTRIBUTE) { if (outChild) *outChild = NULL; @@ -1058,30 +1062,16 @@ { const xmlChar *content; - if(result->type == XML_HTML_DOCUMENT_NODE) + xmlOutputBufferPtr output = xmlAllocOutputBuffer(NULL); + if (output) { - xmlOutputBufferPtr output = xmlAllocOutputBuffer(NULL); - if (output) - { + if(result->type == XML_HTML_DOCUMENT_NODE) htmldoc_dumpcontent(output, result->doc); - content = get_output_buffer_content(output); - *p = bstr_from_xmlChar(content); - xmlOutputBufferClose(output); - } - } - else - { - xmlBufferPtr buf = xmlBufferCreate(); - if (buf) - { - int size = xmlNodeDump(buf, NULL, (xmlNodePtr)result, 0, 0); - if(size > 0) - { - content = xmlBufferContent(buf); - *p = bstr_from_xmlChar(content); - } - xmlBufferFree(buf); - } + else + pxsltSaveResultTo(output, result->doc, xsltSS); + content = get_output_buffer_content(output); + *p = bstr_from_xmlChar(content); + xmlOutputBufferClose(output); } xmlFreeDoc(result); } @@ -1198,7 +1188,6 @@ xmlnode_release(This->node); xmldoc_release(This->node->doc); } - release_dispex(&This->dispex); } void init_xmlnode(xmlnode *This, xmlNodePtr node, IXMLDOMNode *node_iface, dispex_static_data_t *dispex_data) diff -Nru wine1.7-1.7.13/dlls/msxml3/nodemap.c wine1.7-1.7.16/dlls/msxml3/nodemap.c --- wine1.7-1.7.13/dlls/msxml3/nodemap.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/nodemap.c 2014-04-04 19:13:44.000000000 +0000 @@ -142,7 +142,6 @@ { xmldoc_release( This->node->doc ); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); - release_dispex(&This->dispex); heap_free( This ); } diff -Nru wine1.7-1.7.13/dlls/msxml3/parseerror.c wine1.7-1.7.16/dlls/msxml3/parseerror.c --- wine1.7-1.7.13/dlls/msxml3/parseerror.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/parseerror.c 2014-04-04 19:13:44.000000000 +0000 @@ -109,7 +109,6 @@ SysFreeString(This->url); SysFreeString(This->reason); SysFreeString(This->srcText); - release_dispex(&This->dispex); heap_free( This ); } diff -Nru wine1.7-1.7.13/dlls/msxml3/saxreader.c wine1.7-1.7.16/dlls/msxml3/saxreader.c --- wine1.7-1.7.13/dlls/msxml3/saxreader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/saxreader.c 2014-04-04 19:13:44.000000000 +0000 @@ -705,7 +705,6 @@ } /*** IVBSAXAttributes interface ***/ -/*** IUnknown methods ***/ static HRESULT WINAPI ivbsaxattributes_QueryInterface( IVBSAXAttributes* iface, REFIID riid, @@ -719,16 +718,15 @@ static ULONG WINAPI ivbsaxattributes_AddRef(IVBSAXAttributes* iface) { saxlocator *This = impl_from_IVBSAXAttributes(iface); - return ISAXLocator_AddRef(&This->ISAXLocator_iface); + return IVBSAXLocator_AddRef(&This->IVBSAXLocator_iface); } static ULONG WINAPI ivbsaxattributes_Release(IVBSAXAttributes* iface) { saxlocator *This = impl_from_IVBSAXAttributes(iface); - return ISAXLocator_Release(&This->ISAXLocator_iface); + return IVBSAXLocator_Release(&This->IVBSAXLocator_iface); } -/*** IDispatch methods ***/ static HRESULT WINAPI ivbsaxattributes_GetTypeInfoCount( IVBSAXAttributes *iface, UINT* pctinfo ) { saxlocator *This = impl_from_IVBSAXAttributes( iface ); @@ -745,13 +743,10 @@ UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo ) { saxlocator *This = impl_from_IVBSAXAttributes( iface ); - HRESULT hr; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - hr = get_typeinfo(IVBSAXAttributes_tid, ppTInfo); - - return hr; + return get_typeinfo(IVBSAXAttributes_tid, ppTInfo); } static HRESULT WINAPI ivbsaxattributes_GetIDsOfNames( @@ -825,20 +820,45 @@ int nIndex, BSTR *uri) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getURI(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)uri, &len); + const WCHAR *uriW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, uri); + + if (!uri) + return E_POINTER; + + *uri = NULL; + hr = ISAXAttributes_getURI(&This->ISAXAttributes_iface, nIndex, &uriW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(uriW, len, uri); } static HRESULT WINAPI ivbsaxattributes_getLocalName( IVBSAXAttributes* iface, int nIndex, - BSTR *localName) + BSTR *name) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, nIndex, - (const WCHAR**)localName, &len); + const WCHAR *nameW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, name); + + if (!name) + return E_POINTER; + + *name = NULL; + hr = ISAXAttributes_getLocalName(&This->ISAXAttributes_iface, nIndex, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, name); } static HRESULT WINAPI ivbsaxattributes_getQName( @@ -846,9 +866,22 @@ int nIndex, BSTR *QName) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getQName(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)QName, &len); + const WCHAR *nameW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, QName); + + if (!QName) + return E_POINTER; + + *QName = NULL; + hr = ISAXAttributes_getQName(&This->ISAXAttributes_iface, nIndex, &nameW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(nameW, len, QName); } static HRESULT WINAPI ivbsaxattributes_getIndexFromName( @@ -877,9 +910,22 @@ int nIndex, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getType(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getType(&This->ISAXAttributes_iface, nIndex, &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getTypeFromName( @@ -888,10 +934,23 @@ BSTR localName, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - localName, SysStringLen(localName), (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(localName), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + localName, SysStringLen(localName), &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getTypeFromQName( @@ -899,10 +958,23 @@ BSTR QName, BSTR *type) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, QName, SysStringLen(QName), - (const WCHAR**)type, &len); + const WCHAR *typeW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(QName), type); + + if (!type) + return E_POINTER; + + *type = NULL; + hr = ISAXAttributes_getTypeFromQName(&This->ISAXAttributes_iface, QName, SysStringLen(QName), + &typeW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(typeW, len, type); } static HRESULT WINAPI ivbsaxattributes_getValue( @@ -910,9 +982,22 @@ int nIndex, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValue(&This->ISAXAttributes_iface, nIndex, (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%d %p)\n", This, nIndex, value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValue(&This->ISAXAttributes_iface, nIndex, &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI ivbsaxattributes_getValueFromName( @@ -921,10 +1006,23 @@ BSTR localName, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), - localName, SysStringLen(localName), (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(uri), debugstr_w(localName), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromName(&This->ISAXAttributes_iface, uri, SysStringLen(uri), + localName, SysStringLen(localName), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static HRESULT WINAPI ivbsaxattributes_getValueFromQName( @@ -932,10 +1030,23 @@ BSTR QName, BSTR *value) { - int len; saxlocator *This = impl_from_IVBSAXAttributes( iface ); - return ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, QName, - SysStringLen(QName), (const WCHAR**)value, &len); + const WCHAR *valueW; + HRESULT hr; + int len; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(QName), value); + + if (!value) + return E_POINTER; + + *value = NULL; + hr = ISAXAttributes_getValueFromQName(&This->ISAXAttributes_iface, QName, + SysStringLen(QName), &valueW, &len); + if (FAILED(hr)) + return hr; + + return return_bstrn(valueW, len, value); } static const struct IVBSAXAttributesVtbl ivbsaxattributes_vtbl = @@ -1969,14 +2080,13 @@ { saxlocator *This = impl_from_IVBSAXLocator( iface ); TRACE("%p\n", This ); - return InterlockedIncrement( &This->ref ); + return ISAXLocator_AddRef(&This->ISAXLocator_iface); } -static ULONG WINAPI ivbsaxlocator_Release( - IVBSAXLocator* iface) +static ULONG WINAPI ivbsaxlocator_Release(IVBSAXLocator* iface) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_Release((ISAXLocator*)&This->IVBSAXLocator_iface); + return ISAXLocator_Release(&This->ISAXLocator_iface); } /*** IDispatch methods ***/ @@ -1996,13 +2106,10 @@ UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo ) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - HRESULT hr; TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - hr = get_typeinfo(IVBSAXLocator_tid, ppTInfo); - - return hr; + return get_typeinfo(IVBSAXLocator_tid, ppTInfo); } static HRESULT WINAPI ivbsaxlocator_GetIDsOfNames( @@ -2068,7 +2175,7 @@ int *pnColumn) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getColumnNumber((ISAXLocator*)&This->IVBSAXLocator_iface, pnColumn); + return ISAXLocator_getColumnNumber(&This->ISAXLocator_iface, pnColumn); } static HRESULT WINAPI ivbsaxlocator_get_lineNumber( @@ -2076,25 +2183,45 @@ int *pnLine) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getLineNumber((ISAXLocator*)&This->IVBSAXLocator_iface, pnLine); + return ISAXLocator_getLineNumber(&This->ISAXLocator_iface, pnLine); } -static HRESULT WINAPI ivbsaxlocator_get_publicId( - IVBSAXLocator* iface, - BSTR* publicId) +static HRESULT WINAPI ivbsaxlocator_get_publicId(IVBSAXLocator* iface, BSTR *ret) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getPublicId((ISAXLocator*)&This->IVBSAXLocator_iface, - (const WCHAR**)publicId); + const WCHAR *publicidW; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, ret); + + if (!ret) + return E_POINTER; + + *ret = NULL; + hr = ISAXLocator_getPublicId(&This->ISAXLocator_iface, &publicidW); + if (FAILED(hr)) + return hr; + + return return_bstr(publicidW, ret); } -static HRESULT WINAPI ivbsaxlocator_get_systemId( - IVBSAXLocator* iface, - BSTR* systemId) +static HRESULT WINAPI ivbsaxlocator_get_systemId(IVBSAXLocator* iface, BSTR *ret) { saxlocator *This = impl_from_IVBSAXLocator( iface ); - return ISAXLocator_getSystemId((ISAXLocator*)&This->IVBSAXLocator_iface, - (const WCHAR**)systemId); + const WCHAR *systemidW; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, ret); + + if (!ret) + return E_POINTER; + + *ret = NULL; + hr = ISAXLocator_getSystemId(&This->ISAXLocator_iface, &systemidW); + if (FAILED(hr)) + return hr; + + return return_bstr(systemidW, ret); } static const struct IVBSAXLocatorVtbl VBSAXLocatorVtbl = @@ -2472,9 +2599,12 @@ switch(V_VT(&varInput)) { case VT_BSTR: - hr = internal_parseBuffer(This, (const char*)V_BSTR(&varInput), - strlenW(V_BSTR(&varInput))*sizeof(WCHAR), vbInterface); + case VT_BSTR|VT_BYREF: + { + BSTR str = V_ISBYREF(&varInput) ? *V_BSTRREF(&varInput) : V_BSTR(&varInput); + hr = internal_parseBuffer(This, (const char*)str, strlenW(str)*sizeof(WCHAR), vbInterface); break; + } case VT_ARRAY|VT_UI1: { void *pSAData; LONG lBound, uBound; @@ -2599,99 +2729,85 @@ return detach_bsc(bsc); } -static HRESULT internal_putProperty( - saxreader* This, - const WCHAR *prop, - VARIANT value, - BOOL vbInterface) +static HRESULT saxreader_put_handler_from_variant(saxreader *This, enum saxhandler_type type, const VARIANT *v, BOOL vb) { - TRACE("(%p)->(%s %s)\n", This, debugstr_w(prop), debugstr_variant(&value)); + const IID *riid; - if(!memcmp(prop, PropertyDeclHandlerW, sizeof(PropertyDeclHandlerW))) - { - if(This->isParsing) return E_FAIL; - - switch (V_VT(&value)) - { - case VT_EMPTY: - saxreader_put_handler(This, SAXDeclHandler, NULL, vbInterface); - break; - case VT_UNKNOWN: - { - IUnknown *handler = NULL; + if (V_VT(v) == VT_EMPTY) + return saxreader_put_handler(This, type, NULL, vb); - if (V_UNKNOWN(&value)) - { - HRESULT hr; + switch (type) + { + case SAXDeclHandler: + riid = vb ? &IID_IVBSAXDeclHandler : &IID_ISAXDeclHandler; + break; + case SAXLexicalHandler: + riid = vb ? &IID_IVBSAXLexicalHandler : &IID_ISAXLexicalHandler; + break; + default: + ERR("wrong handler type %d\n", type); + return E_FAIL; + } - if (vbInterface) - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_IVBSAXDeclHandler, (void**)&handler); - else - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_ISAXDeclHandler, (void**)&handler); - if (FAILED(hr)) return hr; - } + switch (V_VT(v)) + { + case VT_DISPATCH: + case VT_UNKNOWN: + { + IUnknown *handler = NULL; - saxreader_put_handler(This, SAXDeclHandler, handler, vbInterface); - if (handler) IUnknown_Release(handler); - break; - } - default: - return E_INVALIDARG; + if (V_UNKNOWN(v)) + { + HRESULT hr = IUnknown_QueryInterface(V_UNKNOWN(v), riid, (void**)&handler); + if (FAILED(hr)) return hr; } - return S_OK; + saxreader_put_handler(This, type, handler, vb); + if (handler) IUnknown_Release(handler); + break; + } + default: + ERR("value type %d not supported\n", V_VT(v)); + return E_INVALIDARG; } - if(!memcmp(prop, PropertyLexicalHandlerW, sizeof(PropertyLexicalHandlerW))) - { - if(This->isParsing) return E_FAIL; + return S_OK; +} - switch (V_VT(&value)) - { - case VT_EMPTY: - saxreader_put_handler(This, SAXLexicalHandler, NULL, vbInterface); - break; - case VT_UNKNOWN: - { - IUnknown *handler = NULL; +static HRESULT internal_putProperty( + saxreader* This, + const WCHAR *prop, + VARIANT value, + BOOL vbInterface) +{ + VARIANT *v; - if (V_UNKNOWN(&value)) - { - HRESULT hr; + TRACE("(%p)->(%s %s)\n", This, debugstr_w(prop), debugstr_variant(&value)); - if (vbInterface) - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_IVBSAXLexicalHandler, (void**)&handler); - else - hr = IUnknown_QueryInterface(V_UNKNOWN(&value), &IID_ISAXLexicalHandler, (void**)&handler); - if (FAILED(hr)) return hr; - } + if (This->isParsing) return E_FAIL; - saxreader_put_handler(This, SAXLexicalHandler, handler, vbInterface); - if (handler) IUnknown_Release(handler); - break; - } - default: - return E_INVALIDARG; - } + v = V_VT(&value) == (VT_VARIANT|VT_BYREF) ? V_VARIANTREF(&value) : &value; + if(!memcmp(prop, PropertyDeclHandlerW, sizeof(PropertyDeclHandlerW))) + return saxreader_put_handler_from_variant(This, SAXDeclHandler, v, vbInterface); - return S_OK; - } + if(!memcmp(prop, PropertyLexicalHandlerW, sizeof(PropertyLexicalHandlerW))) + return saxreader_put_handler_from_variant(This, SAXLexicalHandler, v, vbInterface); if(!memcmp(prop, PropertyMaxXMLSizeW, sizeof(PropertyMaxXMLSizeW))) { - if (V_VT(&value) == VT_I4 && V_I4(&value) == 0) return S_OK; - FIXME("(%p)->(%s): max-xml-size unsupported\n", This, debugstr_variant(&value)); + if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; + FIXME("(%p)->(%s): max-xml-size unsupported\n", This, debugstr_variant(v)); return E_NOTIMPL; } if(!memcmp(prop, PropertyMaxElementDepthW, sizeof(PropertyMaxElementDepthW))) { - if (V_VT(&value) == VT_I4 && V_I4(&value) == 0) return S_OK; - FIXME("(%p)->(%s): max-element-depth unsupported\n", This, debugstr_variant(&value)); + if (V_VT(v) == VT_I4 && V_I4(v) == 0) return S_OK; + FIXME("(%p)->(%s): max-element-depth unsupported\n", This, debugstr_variant(v)); return E_NOTIMPL; } - FIXME("(%p)->(%s:%s): unsupported property\n", This, debugstr_w(prop), debugstr_variant(&value)); + FIXME("(%p)->(%s:%s): unsupported property\n", This, debugstr_w(prop), debugstr_variant(v)); if(!memcmp(prop, PropertyCharsetW, sizeof(PropertyCharsetW))) return E_NOTIMPL; @@ -2818,7 +2934,6 @@ SysFreeString(This->xmldecl_version); free_bstr_pool(&This->pool); - release_dispex(&This->dispex); heap_free( This ); } @@ -2872,56 +2987,25 @@ /*** IVBSAXXMLReader methods ***/ static HRESULT WINAPI saxxmlreader_getFeature( IVBSAXXMLReader* iface, - const WCHAR *feature_name, + BSTR feature_name, VARIANT_BOOL *value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - saxreader_feature feature; - - TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value); - - feature = get_saxreader_feature(feature_name); - if (feature == Namespaces || feature == NamespacePrefixes) - return get_feature_value(This, feature, value); - - FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); - return E_NOTIMPL; + return ISAXXMLReader_getFeature(&This->ISAXXMLReader_iface, feature_name, value); } static HRESULT WINAPI saxxmlreader_putFeature( IVBSAXXMLReader* iface, - const WCHAR *feature_name, + BSTR feature_name, VARIANT_BOOL value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - saxreader_feature feature; - - TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature_name), value); - - feature = get_saxreader_feature(feature_name); - - /* accepted cases */ - if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || - (feature == ExternalParameterEntities && value == VARIANT_FALSE) || - feature == Namespaces || - feature == NamespacePrefixes) - { - return set_feature_value(This, feature, value); - } - - if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) - { - FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); - return set_feature_value(This, feature, value); - } - - FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); - return E_NOTIMPL; + return ISAXXMLReader_putFeature(&This->ISAXXMLReader_iface, feature_name, value); } static HRESULT WINAPI saxxmlreader_getProperty( IVBSAXXMLReader* iface, - const WCHAR *prop, + BSTR prop, VARIANT *value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -2930,7 +3014,7 @@ static HRESULT WINAPI saxxmlreader_putProperty( IVBSAXXMLReader* iface, - const WCHAR *pProp, + BSTR pProp, VARIANT value) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3003,7 +3087,7 @@ static HRESULT WINAPI saxxmlreader_get_baseURL( IVBSAXXMLReader* iface, - const WCHAR **pBaseUrl) + BSTR *pBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3013,17 +3097,15 @@ static HRESULT WINAPI saxxmlreader_put_baseURL( IVBSAXXMLReader* iface, - const WCHAR *pBaseUrl) + BSTR pBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - - FIXME("(%p)->(%s) stub\n", This, debugstr_w(pBaseUrl)); - return E_NOTIMPL; + return ISAXXMLReader_putBaseURL(&This->ISAXXMLReader_iface, pBaseUrl); } static HRESULT WINAPI saxxmlreader_get_secureBaseURL( IVBSAXXMLReader* iface, - const WCHAR **pSecureBaseUrl) + BSTR *pSecureBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); @@ -3031,15 +3113,12 @@ return E_NOTIMPL; } - static HRESULT WINAPI saxxmlreader_put_secureBaseURL( IVBSAXXMLReader* iface, - const WCHAR *secureBaseUrl) + BSTR secureBaseUrl) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); - - FIXME("(%p)->(%s) stub\n", This, debugstr_w(secureBaseUrl)); - return E_NOTIMPL; + return ISAXXMLReader_putSecureBaseURL(&This->ISAXXMLReader_iface, secureBaseUrl); } static HRESULT WINAPI saxxmlreader_parse( @@ -3052,7 +3131,7 @@ static HRESULT WINAPI saxxmlreader_parseURL( IVBSAXXMLReader* iface, - const WCHAR *url) + BSTR url) { saxreader *This = impl_from_IVBSAXXMLReader( iface ); return internal_parseURL(This, url, TRUE); @@ -3092,38 +3171,69 @@ static HRESULT WINAPI isaxxmlreader_QueryInterface(ISAXXMLReader* iface, REFIID riid, void **ppvObject) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_QueryInterface(&This->IVBSAXXMLReader_iface, riid, ppvObject); + return IVBSAXXMLReader_QueryInterface(&This->IVBSAXXMLReader_iface, riid, ppvObject); } static ULONG WINAPI isaxxmlreader_AddRef(ISAXXMLReader* iface) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_AddRef(&This->IVBSAXXMLReader_iface); + return IVBSAXXMLReader_AddRef(&This->IVBSAXXMLReader_iface); } static ULONG WINAPI isaxxmlreader_Release(ISAXXMLReader* iface) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return saxxmlreader_Release(&This->IVBSAXXMLReader_iface); + return IVBSAXXMLReader_Release(&This->IVBSAXXMLReader_iface); } /*** ISAXXMLReader methods ***/ static HRESULT WINAPI isaxxmlreader_getFeature( ISAXXMLReader* iface, - const WCHAR *pFeature, - VARIANT_BOOL *pValue) + const WCHAR *feature_name, + VARIANT_BOOL *value) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_getFeature(&This->IVBSAXXMLReader_iface, pFeature, pValue); + saxreader_feature feature; + + TRACE("(%p)->(%s %p)\n", This, debugstr_w(feature_name), value); + + feature = get_saxreader_feature(feature_name); + if (feature == Namespaces || feature == NamespacePrefixes) + return get_feature_value(This, feature, value); + + FIXME("(%p)->(%s %p) stub\n", This, debugstr_w(feature_name), value); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putFeature( ISAXXMLReader* iface, - const WCHAR *pFeature, - VARIANT_BOOL vfValue) + const WCHAR *feature_name, + VARIANT_BOOL value) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_putFeature(&This->IVBSAXXMLReader_iface, pFeature, vfValue); + saxreader_feature feature; + + TRACE("(%p)->(%s %x)\n", This, debugstr_w(feature_name), value); + + feature = get_saxreader_feature(feature_name); + + /* accepted cases */ + if ((feature == ExternalGeneralEntities && value == VARIANT_FALSE) || + (feature == ExternalParameterEntities && value == VARIANT_FALSE) || + feature == Namespaces || + feature == NamespacePrefixes) + { + return set_feature_value(This, feature, value); + } + + if (feature == LexicalHandlerParEntities || feature == ProhibitDTD) + { + FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); + return set_feature_value(This, feature, value); + } + + FIXME("(%p)->(%s %x) stub\n", This, debugstr_w(feature_name), value); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_getProperty( @@ -3208,10 +3318,12 @@ static HRESULT WINAPI isaxxmlreader_getBaseURL( ISAXXMLReader* iface, - const WCHAR **pBaseUrl) + const WCHAR **base_url) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_get_baseURL(&This->IVBSAXXMLReader_iface, pBaseUrl); + + FIXME("(%p)->(%p) stub\n", This, base_url); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putBaseURL( @@ -3219,7 +3331,9 @@ const WCHAR *pBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_put_baseURL(&This->IVBSAXXMLReader_iface, pBaseUrl); + + FIXME("(%p)->(%s) stub\n", This, debugstr_w(pBaseUrl)); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_getSecureBaseURL( @@ -3227,7 +3341,8 @@ const WCHAR **pSecureBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_get_secureBaseURL(&This->IVBSAXXMLReader_iface, pSecureBaseUrl); + FIXME("(%p)->(%p) stub\n", This, pSecureBaseUrl); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_putSecureBaseURL( @@ -3235,7 +3350,9 @@ const WCHAR *secureBaseUrl) { saxreader *This = impl_from_ISAXXMLReader( iface ); - return IVBSAXXMLReader_put_secureBaseURL(&This->IVBSAXXMLReader_iface, secureBaseUrl); + + FIXME("(%p)->(%s) stub\n", This, debugstr_w(secureBaseUrl)); + return E_NOTIMPL; } static HRESULT WINAPI isaxxmlreader_parse( diff -Nru wine1.7-1.7.13/dlls/msxml3/schema.c wine1.7-1.7.16/dlls/msxml3/schema.c --- wine1.7-1.7.13/dlls/msxml3/schema.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/schema.c 2014-04-04 19:13:44.000000000 +0000 @@ -1149,7 +1149,6 @@ heap_free(This->uris[i]); heap_free(This->uris); xmlHashFree(This->cache, cache_free); - release_dispex(&This->dispex); heap_free(This); } @@ -1293,11 +1292,17 @@ TRACE("(%p)->(%s %p)\n", This, debugstr_w(uri), node); - if (This->version == MSXML6) return E_NOTIMPL; + if (This->version == MSXML6) + { + if (node) *node = NULL; + return E_NOTIMPL; + } if (!node) return E_POINTER; + *node = NULL; + name = uri ? xmlchar_from_wchar(uri) : xmlchar_from_wchar(emptyW); entry = (cache_entry*) xmlHashLookup(This->cache, name); heap_free(name); @@ -1306,7 +1311,6 @@ if (entry && entry->doc) return get_domdoc_from_xmldoc(entry->doc, (IXMLDOMDocument3**)node); - *node = NULL; return S_OK; } @@ -1345,6 +1349,9 @@ if (!uri) return E_POINTER; + if (This->version == MSXML6) + *uri = NULL; + if (index >= This->count) return E_FAIL; diff -Nru wine1.7-1.7.13/dlls/msxml3/selection.c wine1.7-1.7.16/dlls/msxml3/selection.c --- wine1.7-1.7.13/dlls/msxml3/selection.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/selection.c 2014-04-04 19:13:44.000000000 +0000 @@ -177,7 +177,6 @@ xmlXPathFreeObject(This->result); xmldoc_release(This->node->doc); if (This->enumvariant) IEnumVARIANT_Release(This->enumvariant); - release_dispex(&This->dispex); heap_free(This); } diff -Nru wine1.7-1.7.13/dlls/msxml3/stylesheet.c wine1.7-1.7.16/dlls/msxml3/stylesheet.c --- wine1.7-1.7.13/dlls/msxml3/stylesheet.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/stylesheet.c 2014-04-04 19:13:44.000000000 +0000 @@ -138,7 +138,6 @@ if ( ref == 0 ) { if (This->node) IXMLDOMNode_Release( This->node ); - release_dispex(&This->dispex); heap_free( This ); } @@ -326,7 +325,6 @@ xslprocessor_par_free(&This->params, par); IXSLTemplate_Release(&This->stylesheet->IXSLTemplate_iface); - release_dispex(&This->dispex); heap_free( This ); } diff -Nru wine1.7-1.7.13/dlls/msxml3/tests/domdoc.c wine1.7-1.7.16/dlls/msxml3/tests/domdoc.c --- wine1.7-1.7.13/dlls/msxml3/tests/domdoc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/tests/domdoc.c 2014-04-04 19:13:44.000000000 +0000 @@ -6077,7 +6077,8 @@ hr = IXMLDOMDocument_loadXML(doc, _bstr_(""), &b); EXPECT_HR(hr, S_OK); - CreateStreamOnHGlobal(NULL, TRUE, &stream); + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); V_VT(&dest) = VT_UNKNOWN; V_UNKNOWN(&dest) = (IUnknown*)stream; hr = IXMLDOMDocument_save(doc, dest); @@ -8417,7 +8418,8 @@ hr = IXSLProcessor_put_output(processor, v); ok(hr == S_OK, "got 0x%08x\n", hr); - CreateStreamOnHGlobal(NULL, TRUE, &stream); + hr = CreateStreamOnHGlobal(NULL, TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); EXPECT_REF(stream, 1); V_VT(&v) = VT_UNKNOWN; @@ -8876,6 +8878,12 @@ EXPECT_NO_CHILDREN(doc); EXPECT_NO_CHILDREN(doc2); + hr = IXMLDOMDocument_appendChild(doc2, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IXMLDOMElement_appendChild(elem, NULL, NULL); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + /* append from another document */ hr = IXMLDOMDocument_appendChild(doc2, (IXMLDOMNode*)elem, NULL); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -9734,6 +9742,7 @@ static void test_domobj_dispex(IUnknown *obj) { + static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0}; DISPID dispid = DISPID_XMLDOM_NODELIST_RESET; IDispatchEx *dispex; IUnknown *unk; @@ -9771,9 +9780,15 @@ hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_NODELIST_RESET, &dispid); EXPECT_HR(hr, E_NOTIMPL); + unk = (IUnknown*)0xdeadbeef; hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); EXPECT_HR(hr, E_NOTIMPL); - if (hr == S_OK && unk) IUnknown_Release(unk); + ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); + + name = SysAllocString(testW); + hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid); + ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr); + SysFreeString(name); IDispatchEx_Release(dispex); } @@ -10309,7 +10324,8 @@ doc = create_document(&IID_IXMLDOMDocument); - IXMLDOMDocument_QueryInterface(doc, &IID_IUnknown, (void**)&unk); + hr = IXMLDOMDocument_QueryInterface(doc, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "got 0x%08x\n", hr); test_domobj_dispex(unk); IUnknown_Release(unk); @@ -10342,7 +10358,8 @@ /* IXMLDOMNodeList for children list */ hr = IXMLDOMDocument_get_childNodes(doc, &node_list); EXPECT_HR(hr, S_OK); - IXMLDOMNodeList_QueryInterface(node_list, &IID_IUnknown, (void**)&unk); + hr = IXMLDOMNodeList_QueryInterface(node_list, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "got 0x%08x\n", hr); test_domobj_dispex(unk); IUnknown_Release(unk); @@ -10375,7 +10392,8 @@ hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL); ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); +todo_wine + ok(broken(V_DISPATCH(&ret) == (void*)0x1) || (V_DISPATCH(&ret) == NULL), "got %p\n", V_DISPATCH(&ret)); V_VT(&arg) = VT_I4; V_I4(&arg) = 0; @@ -10389,7 +10407,8 @@ hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL); ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); +todo_wine + ok(broken(V_DISPATCH(&ret) == (void*)0x1) || (V_DISPATCH(&ret) == NULL), "got %p\n", V_DISPATCH(&ret)); V_VT(&arg) = VT_I4; V_I4(&arg) = 0; @@ -10441,7 +10460,8 @@ hr = IDispatchEx_Invoke(dispex, DISPID_DOM_NODELIST_LENGTH, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL); ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x\n", hr); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_I4(&ret) == 1, "got %d\n", V_I4(&ret)); +todo_wine + ok(broken(V_I4(&ret) == 1) || (V_I4(&ret) == 0), "got %d\n", V_I4(&ret)); IXMLDOMNodeList_Release(node_list); @@ -10466,7 +10486,8 @@ hr = IDispatchEx_Invoke(dispex, DISPID_VALUE, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL); ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x\n", hr); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); +todo_wine + ok(broken(V_DISPATCH(&ret) == (void*)0x1) || (V_DISPATCH(&ret) == NULL), "got %p\n", V_DISPATCH(&ret)); IDispatchEx_Release(dispex); @@ -10540,8 +10561,9 @@ todo_wine { ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); } + ok(broken(V_DISPATCH(&ret) == (void*)0x1) || (V_DISPATCH(&ret) == NULL), "got %p\n", V_DISPATCH(&ret)); + V_VT(&arg) = VT_I4; V_I4(&arg) = 0; dispparams.cArgs = 2; @@ -10555,8 +10577,9 @@ todo_wine { ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr); ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); } + ok(broken(V_DISPATCH(&ret) == (void*)0x1) || (V_DISPATCH(&ret) == NULL), "got %p\n", V_DISPATCH(&ret)); + V_VT(&arg) = VT_I4; V_I4(&arg) = 0; dispparams.cArgs = 1; @@ -10607,10 +10630,10 @@ V_I4(&ret) = 1; hr = IDispatchEx_Invoke(dispex, DISPID_DOM_NODELIST_LENGTH, &IID_NULL, 0, DISPATCH_METHOD, &dispparams, &ret, NULL, NULL); ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x\n", hr); -todo_wine { +todo_wine ok(V_VT(&ret) == VT_EMPTY, "got %d\n", V_VT(&ret)); - ok(V_I4(&ret) == 1, "got %d\n", V_I4(&ret)); -} + ok(broken(V_I4(&ret) == 1) || (V_I4(&ret) == 0), "got %d\n", V_I4(&ret)); + IXMLDOMNamedNodeMap_Release(map); IXMLDOMElement_Release(elem); @@ -10670,6 +10693,13 @@ IXSLProcessor_Release(processor); IXSLTemplate_Release(template); + if (is_clsid_supported(&CLSID_DOMDocument60, &IID_IXMLDOMDocument)) + { + doc = create_document_version(60, &IID_IXMLDOMDocument); + test_domobj_dispex((IUnknown*)doc); + IXMLDOMDocument_Release(doc); + } + free_bstrs(); } @@ -11251,7 +11281,7 @@ node = (void*)0xdeadbeef; hr = IXMLDOMSchemaCollection_get(collection, _bstr_("http://blah.org"), &node); EXPECT_HR(hr, E_NOTIMPL); - ok(node == (void*)0xdeadbeef, "got %p\n", node); + ok(broken(node == (void*)0xdeadbeef) || (node == NULL), "got %p\n", node); /* load schema and try to add it */ doc2 = create_document(&IID_IXMLDOMDocument2); @@ -11277,7 +11307,7 @@ s = (void*)0xdeadbeef; hr = IXMLDOMSchemaCollection_get_namespaceURI(collection, 2, &s); EXPECT_HR(hr, E_FAIL); - ok(s == (void*)0xdeadbeef, "got %p\n", s); + ok(broken(s == (void*)0xdeadbeef) || (s == NULL), "got %p\n", s); /* enumerate */ enumv = (void*)0xdeadbeef; @@ -11645,6 +11675,32 @@ "" ""; +static const char omitxmldecl_xsl[] = +"" +"" +"" +"" +" " +" " +" " +" " +" " +"" +""; + +static const char omitxmldecl_doc[] = +"" +"" +" " +" " +""; + +static const char omitxmldecl_result[] = +"item1item2"; + +static const char omitxmldecl_result2[] = +"item1item2\n"; + static void test_xsltext(void) { IXMLDOMDocument *doc, *doc2; @@ -11666,6 +11722,19 @@ ok(!lstrcmpW(ret, _bstr_("testdata")), "transform result %s\n", wine_dbgstr_w(ret)); SysFreeString(ret); + /* omit-xml-declaration */ + hr = IXMLDOMDocument_loadXML(doc, _bstr_(omitxmldecl_xsl), &b); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IXMLDOMDocument_loadXML(doc2, _bstr_(omitxmldecl_doc), &b); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IXMLDOMDocument_transformNode(doc2, (IXMLDOMNode*)doc, &ret); + ok(hr == S_OK, "got 0x%08x\n", hr); + /* Old enough libxslt places extra '\n' at the end of the output. */ + ok(!lstrcmpW(ret, _bstr_(omitxmldecl_result)) || + !lstrcmpW(ret, _bstr_(omitxmldecl_result2)), "transform result %s\n", wine_dbgstr_w(ret)); + SysFreeString(ret); + IXMLDOMDocument_Release(doc2); IXMLDOMDocument_Release(doc); free_bstrs(); diff -Nru wine1.7-1.7.13/dlls/msxml3/tests/saxreader.c wine1.7-1.7.16/dlls/msxml3/tests/saxreader.c --- wine1.7-1.7.13/dlls/msxml3/tests/saxreader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/tests/saxreader.c 2014-04-04 19:13:44.000000000 +0000 @@ -1092,6 +1092,7 @@ ISAXLocator *pLocator) { struct call_entry call; + IUnknown *unk; HRESULT hr; locator = pLocator; @@ -1100,6 +1101,9 @@ call.id = CH_PUTDOCUMENTLOCATOR; add_call(sequences, CONTENT_HANDLER_INDEX, &call); + hr = ISAXLocator_QueryInterface(pLocator, &IID_IVBSAXLocator, (void**)&unk); + EXPECT_HR(hr, E_NOINTERFACE); + if (msxml_version >= 6) { ISAXAttributes *attr, *attr1; IMXAttributes *mxattr; @@ -1113,6 +1117,12 @@ EXPECT_REF(pLocator, 3); ok(attr == attr1, "got %p, %p\n", attr, attr1); + hr = ISAXAttributes_QueryInterface(attr, &IID_IVBSAXAttributes, (void**)&unk); + EXPECT_HR(hr, E_NOINTERFACE); + + hr = ISAXLocator_QueryInterface(pLocator, &IID_IVBSAXAttributes, (void**)&unk); + EXPECT_HR(hr, E_NOINTERFACE); + hr = ISAXAttributes_QueryInterface(attr, &IID_IMXAttributes, (void**)&mxattr); EXPECT_HR(hr, E_NOINTERFACE); @@ -2114,6 +2124,7 @@ static const CHAR testXmlA[] = "test.xml"; static const WCHAR testXmlW[] = {'t','e','s','t','.','x','m','l',0}; IXMLDOMDocument *doc; + char seqname[50]; VARIANT_BOOL v; while (table->clsid) @@ -2443,7 +2454,8 @@ V_VT(&var) = VT_UNKNOWN; V_UNKNOWN(&var) = (IUnknown*)stream; - if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60)) + if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60) || + IsEqualGUID(table->clsid, &CLSID_SAXXMLReader40)) test_seq = cdata_test_alt; else test_seq = cdata_test; @@ -2451,14 +2463,16 @@ set_expected_seq(test_seq); hr = ISAXXMLReader_parse(reader, var); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "cdata test", TRUE); + sprintf(seqname, "%s: cdata test", table->name); + ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, seqname, TRUE); /* 2. CDATA sections */ stream = create_test_stream(test2_cdata_xml, -1); V_VT(&var) = VT_UNKNOWN; V_UNKNOWN(&var) = (IUnknown*)stream; - if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60)) + if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60) || + IsEqualGUID(table->clsid, &CLSID_SAXXMLReader40)) test_seq = cdata_test2_alt; else test_seq = cdata_test2; @@ -2466,7 +2480,8 @@ set_expected_seq(test_seq); hr = ISAXXMLReader_parse(reader, var); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "cdata test 2", TRUE); + sprintf(seqname, "%s: cdata test 2", table->name); + ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, seqname, TRUE); IStream_Release(stream); @@ -2475,7 +2490,8 @@ V_VT(&var) = VT_UNKNOWN; V_UNKNOWN(&var) = (IUnknown*)stream; - if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60)) + if (IsEqualGUID(table->clsid, &CLSID_SAXXMLReader60) || + IsEqualGUID(table->clsid, &CLSID_SAXXMLReader40)) test_seq = cdata_test3_alt; else test_seq = cdata_test3; @@ -2483,7 +2499,8 @@ set_expected_seq(test_seq); hr = ISAXXMLReader_parse(reader, var); ok(hr == S_OK, "got 0x%08x\n", hr); - ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, "cdata test 3", TRUE); + sprintf(seqname, "%s: cdata test 3", table->name); + ok_sequence(sequences, CONTENT_HANDLER_INDEX, test_seq, seqname, TRUE); IStream_Release(stream); @@ -2512,6 +2529,7 @@ ISAXXMLReader *reader; HRESULT hr; VARIANT v; + BSTR str; hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER, &IID_ISAXXMLReader, (void**)&reader); @@ -2522,6 +2540,7 @@ while (ptr->prop_name) { + VARIANT varref; LONG ref; init_saxlexicalhandler(&lexicalhandler, S_OK); @@ -2534,6 +2553,7 @@ ok(V_VT(&v) == VT_UNKNOWN, "got %d\n", V_VT(&v)); ok(V_UNKNOWN(&v) == NULL, "got %p\n", V_UNKNOWN(&v)); + /* VT_UNKNOWN */ V_VT(&v) = VT_UNKNOWN; V_UNKNOWN(&v) = ptr->iface; ref = get_refcount(ptr->iface); @@ -2541,6 +2561,36 @@ EXPECT_HR(hr, S_OK); ok(ref < get_refcount(ptr->iface), "expected inreased refcount\n"); + /* VT_DISPATCH */ + V_VT(&v) = VT_DISPATCH; + V_UNKNOWN(&v) = ptr->iface; + ref = get_refcount(ptr->iface); + hr = ISAXXMLReader_putProperty(reader, _bstr_(ptr->prop_name), v); + EXPECT_HR(hr, S_OK); + ok(ref == get_refcount(ptr->iface), "got wrong refcount %d, expected %d\n", get_refcount(ptr->iface), ref); + + /* VT_VARIANT|VT_BYREF with VT_UNKNOWN in referenced variant */ + V_VT(&varref) = VT_UNKNOWN; + V_UNKNOWN(&varref) = ptr->iface; + + V_VT(&v) = VT_VARIANT|VT_BYREF; + V_VARIANTREF(&v) = &varref; + ref = get_refcount(ptr->iface); + hr = ISAXXMLReader_putProperty(reader, _bstr_(ptr->prop_name), v); + EXPECT_HR(hr, S_OK); + ok(ref == get_refcount(ptr->iface), "got wrong refcount %d, expected %d\n", get_refcount(ptr->iface), ref); + + /* VT_VARIANT|VT_BYREF with VT_DISPATCH in referenced variant */ + V_VT(&varref) = VT_DISPATCH; + V_UNKNOWN(&varref) = ptr->iface; + + V_VT(&v) = VT_VARIANT|VT_BYREF; + V_VARIANTREF(&v) = &varref; + ref = get_refcount(ptr->iface); + hr = ISAXXMLReader_putProperty(reader, _bstr_(ptr->prop_name), v); + EXPECT_HR(hr, S_OK); + ok(ref == get_refcount(ptr->iface), "got wrong refcount %d, expected %d\n", get_refcount(ptr->iface), ref); + V_VT(&v) = VT_EMPTY; V_UNKNOWN(&v) = (IUnknown*)0xdeadbeef; @@ -2659,6 +2709,13 @@ hr = ISAXXMLReader_parse(reader, v); EXPECT_HR(hr, S_OK); + /* VT_BSTR|VT_BYREF input type */ + str = _bstr_(""); + V_VT(&v) = VT_BSTR|VT_BYREF; + V_BSTRREF(&v) = &str; + hr = ISAXXMLReader_parse(reader, v); + EXPECT_HR(hr, S_OK); + V_VT(&v) = VT_EMPTY; V_BSTR(&v) = (void*)0xdeadbeef; hr = ISAXXMLReader_getProperty(reader, _bstr_("xmldecl-version"), &v); @@ -2822,11 +2879,23 @@ static void test_mxwriter_handlers(void) { - ISAXContentHandler *handler; - IMXWriter *writer, *writer2; - ISAXDeclHandler *decl; - ISAXLexicalHandler *lh; + IMXWriter *writer; HRESULT hr; + int i; + + static const REFIID riids[] = + { + &IID_ISAXContentHandler, + &IID_ISAXLexicalHandler, + &IID_ISAXDeclHandler, + &IID_ISAXDTDHandler, + &IID_ISAXErrorHandler, + &IID_IVBSAXDeclHandler, + &IID_IVBSAXLexicalHandler, + &IID_IVBSAXContentHandler, + &IID_IVBSAXDTDHandler, + &IID_IVBSAXErrorHandler + }; hr = CoCreateInstance(&CLSID_MXXMLWriter, NULL, CLSCTX_INPROC_SERVER, &IID_IMXWriter, (void**)&writer); @@ -2834,52 +2903,30 @@ EXPECT_REF(writer, 1); - /* ISAXContentHandler */ - hr = IMXWriter_QueryInterface(writer, &IID_ISAXContentHandler, (void**)&handler); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - EXPECT_REF(writer, 2); - EXPECT_REF(handler, 2); - - hr = ISAXContentHandler_QueryInterface(handler, &IID_IMXWriter, (void**)&writer2); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - ok(writer2 == writer, "got %p, expected %p\n", writer2, writer); - EXPECT_REF(writer, 3); - EXPECT_REF(writer2, 3); - IMXWriter_Release(writer2); - ISAXContentHandler_Release(handler); - - /* ISAXLexicalHandler */ - hr = IMXWriter_QueryInterface(writer, &IID_ISAXLexicalHandler, (void**)&lh); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - EXPECT_REF(writer, 2); - EXPECT_REF(lh, 2); - - hr = ISAXLexicalHandler_QueryInterface(lh, &IID_IMXWriter, (void**)&writer2); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - ok(writer2 == writer, "got %p, expected %p\n", writer2, writer); - EXPECT_REF(writer, 3); - EXPECT_REF(writer2, 3); - IMXWriter_Release(writer2); - ISAXLexicalHandler_Release(lh); - - /* ISAXDeclHandler */ - hr = IMXWriter_QueryInterface(writer, &IID_ISAXDeclHandler, (void**)&decl); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - EXPECT_REF(writer, 2); - EXPECT_REF(lh, 2); + for (i = 0; i < sizeof(riids)/sizeof(REFIID); i++) + { + IUnknown *handler; + IMXWriter *writer2; - hr = ISAXDeclHandler_QueryInterface(decl, &IID_IMXWriter, (void**)&writer2); - ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - ok(writer2 == writer, "got %p, expected %p\n", writer2, writer); - EXPECT_REF(writer, 3); - EXPECT_REF(writer2, 3); - IMXWriter_Release(writer2); - ISAXDeclHandler_Release(decl); + /* handler from IMXWriter */ + hr = IMXWriter_QueryInterface(writer, riids[i], (void**)&handler); + ok(hr == S_OK, "%s, expected S_OK, got %08x\n", wine_dbgstr_guid(riids[i]), hr); + EXPECT_REF(writer, 2); + EXPECT_REF(handler, 2); + + /* IMXWriter from a handler */ + hr = IUnknown_QueryInterface(handler, &IID_IMXWriter, (void**)&writer2); + ok(hr == S_OK, "%s, expected S_OK, got %08x\n", wine_dbgstr_guid(riids[i]), hr); + ok(writer2 == writer, "got %p, expected %p\n", writer2, writer); + EXPECT_REF(writer, 3); + EXPECT_REF(writer2, 3); + IMXWriter_Release(writer2); + IUnknown_Release(handler); + } IMXWriter_Release(writer); } - static struct msxmlsupported_data_t mxwriter_support_data[] = { { &CLSID_MXXMLWriter, "MXXMLWriter" }, @@ -4347,6 +4394,7 @@ static void test_obj_dispex(IUnknown *obj) { + static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0}; static const WCHAR starW[] = {'*',0}; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; IDispatchEx *dispex; @@ -4355,6 +4403,7 @@ UINT ticnt; HRESULT hr; BSTR name; + DISPID did; hr = IUnknown_QueryInterface(obj, &IID_IDispatchEx, (void**)&dispex); EXPECT_HR(hr, S_OK); @@ -4385,38 +4434,87 @@ hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_SAX_XMLREADER_GETFEATURE, &dispid); EXPECT_HR(hr, E_NOTIMPL); + unk = (IUnknown*)0xdeadbeef; hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); EXPECT_HR(hr, E_NOTIMPL); - if (hr == S_OK && unk) IUnknown_Release(unk); + ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); + + name = SysAllocString(testW); + hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &did); + ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr); + SysFreeString(name); IDispatchEx_Release(dispex); } -static void test_dispex(void) +static void test_saxreader_dispex(void) { - IVBSAXXMLReader *vbreader; - ISAXXMLReader *reader; - IUnknown *unk; - HRESULT hr; + IVBSAXXMLReader *vbreader; + ISAXXMLReader *reader; + DISPPARAMS dispparams; + DISPID dispid; + IUnknown *unk; + VARIANT arg; + HRESULT hr; - hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER, + hr = CoCreateInstance(&CLSID_SAXXMLReader, NULL, CLSCTX_INPROC_SERVER, &IID_ISAXXMLReader, (void**)&reader); - EXPECT_HR(hr, S_OK); + EXPECT_HR(hr, S_OK); - hr = ISAXXMLReader_QueryInterface(reader, &IID_IUnknown, (void**)&unk); - EXPECT_HR(hr, S_OK); - test_obj_dispex(unk); - IUnknown_Release(unk); - - hr = ISAXXMLReader_QueryInterface(reader, &IID_IVBSAXXMLReader, (void**)&vbreader); - EXPECT_HR(hr, S_OK); - hr = IVBSAXXMLReader_QueryInterface(vbreader, &IID_IUnknown, (void**)&unk); - EXPECT_HR(hr, S_OK); - test_obj_dispex(unk); - IUnknown_Release(unk); - IVBSAXXMLReader_Release(vbreader); + hr = ISAXXMLReader_QueryInterface(reader, &IID_IUnknown, (void**)&unk); + EXPECT_HR(hr, S_OK); + test_obj_dispex(unk); + IUnknown_Release(unk); + + hr = ISAXXMLReader_QueryInterface(reader, &IID_IVBSAXXMLReader, (void**)&vbreader); + EXPECT_HR(hr, S_OK); + hr = IVBSAXXMLReader_QueryInterface(vbreader, &IID_IUnknown, (void**)&unk); + EXPECT_HR(hr, S_OK); + test_obj_dispex(unk); + IUnknown_Release(unk); + + dispid = DISPID_PROPERTYPUT; + dispparams.cArgs = 1; + dispparams.cNamedArgs = 1; + dispparams.rgdispidNamedArgs = &dispid; + dispparams.rgvarg = &arg; + + V_VT(&arg) = VT_DISPATCH; + V_DISPATCH(&arg) = NULL; + + /* propputref is callable as PROPERTYPUT and PROPERTYPUTREF */ + hr = IVBSAXXMLReader_Invoke(vbreader, + DISPID_SAX_XMLREADER_CONTENTHANDLER, + &IID_NULL, + 0, + DISPATCH_PROPERTYPUT, + &dispparams, + NULL, + NULL, + NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IVBSAXXMLReader_Invoke(vbreader, + DISPID_SAX_XMLREADER_CONTENTHANDLER, + &IID_NULL, + 0, + DISPATCH_PROPERTYPUTREF, + &dispparams, + NULL, + NULL, + NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + IVBSAXXMLReader_Release(vbreader); + ISAXXMLReader_Release(reader); - ISAXXMLReader_Release(reader); + if (is_clsid_supported(&CLSID_SAXXMLReader60, reader_support_data)) + { + hr = CoCreateInstance(&CLSID_SAXXMLReader60, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "got 0x%08x\n", hr); + test_obj_dispex(unk); + IUnknown_Release(unk); + } } static void test_mxwriter_dispex(void) @@ -4436,13 +4534,21 @@ test_obj_dispex(unk); IUnknown_Release(unk); IDispatchEx_Release(dispex); - IMXWriter_Release(writer); + + if (is_clsid_supported(&CLSID_MXXMLWriter60, mxwriter_support_data)) + { + hr = CoCreateInstance(&CLSID_MXXMLWriter60, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&unk); + ok(hr == S_OK, "got 0x%08x\n", hr); + test_obj_dispex(unk); + IUnknown_Release(unk); + } } static void test_mxwriter_comment(void) { static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0}; + IVBSAXLexicalHandler *vblexical; ISAXContentHandler *content; ISAXLexicalHandler *lexical; IMXWriter *writer; @@ -4459,6 +4565,9 @@ hr = IMXWriter_QueryInterface(writer, &IID_ISAXLexicalHandler, (void**)&lexical); EXPECT_HR(hr, S_OK); + hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXLexicalHandler, (void**)&vblexical); + EXPECT_HR(hr, S_OK); + hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE); EXPECT_HR(hr, S_OK); @@ -4468,6 +4577,9 @@ hr = ISAXLexicalHandler_comment(lexical, NULL, 0); EXPECT_HR(hr, E_INVALIDARG); + hr = IVBSAXLexicalHandler_comment(vblexical, NULL); + EXPECT_HR(hr, E_POINTER); + hr = ISAXLexicalHandler_comment(lexical, commentW, 0); EXPECT_HR(hr, S_OK); @@ -4490,12 +4602,14 @@ ISAXContentHandler_Release(content); ISAXLexicalHandler_Release(lexical); + IVBSAXLexicalHandler_Release(vblexical); IMXWriter_Release(writer); free_bstrs(); } static void test_mxwriter_cdata(void) { + IVBSAXLexicalHandler *vblexical; ISAXContentHandler *content; ISAXLexicalHandler *lexical; IMXWriter *writer; @@ -4512,6 +4626,9 @@ hr = IMXWriter_QueryInterface(writer, &IID_ISAXLexicalHandler, (void**)&lexical); EXPECT_HR(hr, S_OK); + hr = IMXWriter_QueryInterface(writer, &IID_IVBSAXLexicalHandler, (void**)&vblexical); + EXPECT_HR(hr, S_OK); + hr = IMXWriter_put_omitXMLDeclaration(writer, VARIANT_TRUE); EXPECT_HR(hr, S_OK); @@ -4528,7 +4645,7 @@ ok(!lstrcmpW(_bstr_("uri), _bstr_(table->local), _bstr_(table->qname), _bstr_(table->type), _bstr_(table->value)); @@ -5047,22 +5187,22 @@ IsEqualGUID(table->clsid, &CLSID_SAXAttributes60)) { hr = ISAXAttributes_getValueFromQName(saxattr, NULL, 0, NULL, NULL); - EXPECT_HR(hr, E_INVALIDARG); + ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, NULL, NULL); - EXPECT_HR(hr, E_INVALIDARG); + ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = ISAXAttributes_getValueFromQName(saxattr, _bstr_(table->qname), 0, &value, NULL); - EXPECT_HR(hr, E_INVALIDARG); + ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = ISAXAttributes_getValueFromName(saxattr, NULL, 0, NULL, 0, NULL, NULL); - EXPECT_HR(hr, E_INVALIDARG); + ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, NULL, 0, NULL, NULL); - EXPECT_HR(hr, E_INVALIDARG); + ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr); hr = ISAXAttributes_getValueFromName(saxattr, _bstr_(table->uri), 0, NULL, 0, &value, NULL); - EXPECT_HR(hr, E_INVALIDARG); + ok(hr == E_POINTER /* win8 */ || hr == E_INVALIDARG, "got 0x%08x\n", hr); } else { @@ -5443,7 +5583,7 @@ test_saxreader_properties(); test_saxreader_features(); test_saxreader_encoding(); - test_dispex(); + test_saxreader_dispex(); /* MXXMLWriter tests */ get_class_support_data(mxwriter_support_data, &IID_IMXWriter); diff -Nru wine1.7-1.7.13/dlls/msxml3/tests/schema.c wine1.7-1.7.16/dlls/msxml3/tests/schema.c --- wine1.7-1.7.13/dlls/msxml3/tests/schema.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/msxml3/tests/schema.c 2014-04-04 19:13:44.000000000 +0000 @@ -1416,6 +1416,7 @@ static void test_obj_dispex(IUnknown *obj) { + static const WCHAR testW[] = {'t','e','s','t','p','r','o','p',0}; static const WCHAR starW[] = {'*',0}; DISPID dispid = DISPID_SAX_XMLREADER_GETFEATURE; IDispatchEx *dispex; @@ -1454,9 +1455,15 @@ hr = IDispatchEx_GetNextDispID(dispex, fdexEnumDefault, DISPID_XMLDOM_SCHEMACOLLECTION_ADD, &dispid); EXPECT_HR(hr, E_NOTIMPL); + unk = (IUnknown*)0xdeadbeef; hr = IDispatchEx_GetNameSpaceParent(dispex, &unk); EXPECT_HR(hr, E_NOTIMPL); - if (hr == S_OK && unk) IUnknown_Release(unk); + ok(unk == (IUnknown*)0xdeadbeef, "got %p\n", unk); + + name = SysAllocString(testW); + hr = IDispatchEx_GetDispID(dispex, name, fdexNameEnsure, &dispid); + ok(hr == DISP_E_UNKNOWNNAME, "got 0x%08x\n", hr); + SysFreeString(name); IDispatchEx_Release(dispex); } @@ -1496,8 +1503,14 @@ ok(V_DISPATCH(&ret) == (void*)0x1, "got %p\n", V_DISPATCH(&ret)); IDispatchEx_Release(dispex); - IXMLDOMSchemaCollection_Release(cache); + + cache = create_cache_version(60, &IID_IXMLDOMSchemaCollection); + if (cache) + { + test_obj_dispex((IUnknown*)cache); + IXMLDOMSchemaCollection_Release(cache); + } } static void test_get(void) diff -Nru wine1.7-1.7.13/dlls/netapi32/netapi32.c wine1.7-1.7.16/dlls/netapi32/netapi32.c --- wine1.7-1.7.13/dlls/netapi32/netapi32.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/netapi32/netapi32.c 2014-04-04 19:13:44.000000000 +0000 @@ -1098,6 +1098,12 @@ return NERR_Success; } +NET_API_STATUS WINAPI NetScheduleJobDel(LPCWSTR server, DWORD minjobid, DWORD maxjobid) +{ + FIXME("stub (%s, %d, %d)\n", debugstr_w(server), minjobid, maxjobid); + return NERR_Success; +} + NET_API_STATUS WINAPI NetScheduleJobEnum(LPCWSTR server, LPBYTE* bufptr, DWORD prefmaxsize, LPDWORD entriesread, LPDWORD totalentries, LPDWORD resumehandle) { diff -Nru wine1.7-1.7.13/dlls/netapi32/netapi32.spec wine1.7-1.7.16/dlls/netapi32/netapi32.spec --- wine1.7-1.7.13/dlls/netapi32/netapi32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/netapi32/netapi32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -167,7 +167,7 @@ @ stub NetRplWkstaGetInfo @ stub NetRplWkstaSetInfo @ stdcall NetScheduleJobAdd(wstr ptr ptr) -@ stub NetScheduleJobDel +@ stdcall NetScheduleJobDel(wstr long long) @ stdcall NetScheduleJobEnum(wstr ptr long ptr ptr ptr) @ stub NetScheduleJobGetInfo @ stub NetServerComputerNameAdd diff -Nru wine1.7-1.7.13/dlls/netcfgx/main.c wine1.7-1.7.16/dlls/netcfgx/main.c --- wine1.7-1.7.13/dlls/netcfgx/main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -19,16 +19,113 @@ */ #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" +#include "ole2.h" +#include "rpcproxy.h" #include "wine/debug.h" +#include "netcfgx.h" +#include "netcfg_private.h" + WINE_DEFAULT_DEBUG_CHANNEL(netcfgx); +static HINSTANCE NETCFGX_hInstance; + +typedef HRESULT (*ClassFactoryCreateInstanceFunc)(IUnknown **); + +typedef struct netcfgcf +{ + IClassFactory IClassFactory_iface; + ClassFactoryCreateInstanceFunc fnCreateInstance; +} netcfgcf; + +static inline netcfgcf *impl_from_IClassFactory( IClassFactory *iface ) +{ + return CONTAINING_RECORD(iface, netcfgcf, IClassFactory_iface); +} + +static HRESULT WINAPI netcfgcf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppobj ) +{ + TRACE("%s %p\n", debugstr_guid(riid), ppobj); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IClassFactory)) + { + IClassFactory_AddRef( iface ); + *ppobj = iface; + return S_OK; + } + + ERR("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI netcfgcf_AddRef(IClassFactory *iface ) +{ + TRACE("%p\n", iface); + + return 2; +} + +static ULONG WINAPI netcfgcf_Release(IClassFactory *iface ) +{ + TRACE("%p\n", iface); + + return 1; +} + +static HRESULT WINAPI netcfgcf_CreateInstance(IClassFactory *iface,LPUNKNOWN pOuter, + REFIID riid, LPVOID *ppobj ) +{ + netcfgcf *This = impl_from_IClassFactory( iface ); + HRESULT hr; + IUnknown *punk; + + TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj ); + + *ppobj = NULL; + + if (pOuter) + return CLASS_E_NOAGGREGATION; + + hr = This->fnCreateInstance( &punk ); + if (SUCCEEDED(hr)) + { + hr = IUnknown_QueryInterface( punk, riid, ppobj ); + + IUnknown_Release( punk ); + } + else + { + WARN("Cannot create an instance object. 0x%08x\n", hr); + } + return hr; +} + +static HRESULT WINAPI netcfgcf_LockServer(IClassFactory *iface, BOOL dolock) +{ + FIXME("(%p)->(%d),stub!\n",iface,dolock); + return S_OK; +} + +static const struct IClassFactoryVtbl netcfgcf_vtbl = +{ + netcfgcf_QueryInterface, + netcfgcf_AddRef, + netcfgcf_Release, + netcfgcf_CreateInstance, + netcfgcf_LockServer +}; + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + NETCFGX_hInstance = hinstDLL; + switch (fdwReason) { case DLL_WINE_PREATTACH: @@ -42,3 +139,37 @@ return TRUE; } + +static netcfgcf netconfigcf = { {&netcfgcf_vtbl}, INetCfg_CreateInstance }; + +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) +{ + IClassFactory *cf = NULL; + + TRACE("(%s, %s, %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + + if(IsEqualCLSID(rclsid, &CLSID_CNetCfg)) + { + cf = &netconfigcf.IClassFactory_iface; + } + + if(!cf) + return CLASS_E_CLASSNOTAVAILABLE; + + return IClassFactory_QueryInterface(cf, riid, ppv); +} + +HRESULT WINAPI DllRegisterServer(void) +{ + return __wine_register_resources( NETCFGX_hInstance ); +} + +HRESULT WINAPI DllUnregisterServer(void) +{ + return __wine_unregister_resources( NETCFGX_hInstance ); +} + +HRESULT WINAPI DllCanUnloadNow(void) +{ + return S_FALSE; +} diff -Nru wine1.7-1.7.13/dlls/netcfgx/Makefile.in wine1.7-1.7.16/dlls/netcfgx/Makefile.in --- wine1.7-1.7.13/dlls/netcfgx/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -1,4 +1,8 @@ MODULE = netcfgx.dll +IMPORTS = uuid C_SRCS = \ - main.c + main.c \ + netcfg.c + +IDL_SRCS = netcfgx_classes.idl diff -Nru wine1.7-1.7.13/dlls/netcfgx/netcfg.c wine1.7-1.7.16/dlls/netcfgx/netcfg.c --- wine1.7-1.7.13/dlls/netcfgx/netcfg.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/netcfg.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,239 @@ +/* + * Copyright 2014 Alistair Leslie-Hughes + * + * 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 +#include +#include + +#define COBJMACROS + +#include "netcfgx.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL( netcfgx ); + + +typedef struct NetConfiguration +{ + INetCfg INetCfg_iface; + INetCfgLock INetCfgLock_iface; + + LONG ref; +} NetConfiguration; + +static inline NetConfiguration *impl_from_INetCfg(INetCfg *iface) +{ + return CONTAINING_RECORD(iface, NetConfiguration, INetCfg_iface); +} + +static inline NetConfiguration *impl_from_INetCfgLock(INetCfgLock *iface) +{ + return CONTAINING_RECORD(iface, NetConfiguration, INetCfgLock_iface); +} + +static HRESULT WINAPI netcfg_QueryInterface(INetCfg *iface, REFIID riid, void **ppvObject) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_INetCfg) || + IsEqualGUID(riid, &IID_IUnknown)) + { + *ppvObject = &This->INetCfg_iface; + } + else if(IsEqualGUID(riid, &IID_INetCfgLock)) + { + *ppvObject = &This->INetCfgLock_iface; + } + else + { + FIXME("Unsupported interface %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppvObject); + + return S_OK; +} + +static ULONG WINAPI netcfg_AddRef(INetCfg *iface) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("%p ref=%u\n", This, ref); + + return ref; +} + +static ULONG WINAPI netcfg_Release(INetCfg *iface) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("%p ref=%u\n", This, ref); + + if (ref == 0) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI netcfg_Initialize(INetCfg *iface, PVOID pvReserved) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p %p\n", This, pvReserved); + + return S_OK; +} + +static HRESULT WINAPI netcfg_Uninitialize(INetCfg *iface) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p\n", This); + + return S_OK; +} + +static HRESULT WINAPI netcfg_Apply(INetCfg *iface) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI netcfg_Cancel(INetCfg *iface) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p\n", This); + + return E_NOTIMPL; +} + +static HRESULT WINAPI netcfg_EnumComponents(INetCfg *iface, const GUID *pguidClass, IEnumNetCfgComponent **ppenumComponent) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p %s %p\n", This, debugstr_guid(pguidClass), ppenumComponent); + + return E_NOTIMPL; +} + +static HRESULT WINAPI netcfg_FindComponent(INetCfg *iface, LPCWSTR pszwInfId, INetCfgComponent **pComponent) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p %s %p\n", This, debugstr_w(pszwInfId), pComponent); + + return E_NOTIMPL; +} + +static HRESULT WINAPI netcfg_QueryNetCfgClass(INetCfg *iface, const GUID *pguidClass, REFIID riid, void **ppvObject) +{ + NetConfiguration *This = impl_from_INetCfg(iface); + FIXME("%p %s %p\n", This, debugstr_guid(pguidClass), ppvObject); + + return E_NOTIMPL; +} + +static const struct INetCfgVtbl NetCfgVtbl = +{ + netcfg_QueryInterface, + netcfg_AddRef, + netcfg_Release, + netcfg_Initialize, + netcfg_Uninitialize, + netcfg_Apply, + netcfg_Cancel, + netcfg_EnumComponents, + netcfg_FindComponent, + netcfg_QueryNetCfgClass +}; + + +static HRESULT WINAPI netcfglock_QueryInterface(INetCfgLock *iface, REFIID riid,void **ppvObject) +{ + NetConfiguration *This = impl_from_INetCfgLock(iface); + + return netcfg_QueryInterface(&This->INetCfg_iface, riid, ppvObject); +} + +static ULONG WINAPI netcfglock_AddRef(INetCfgLock *iface) +{ + NetConfiguration *This = impl_from_INetCfgLock(iface); + + return netcfg_AddRef(&This->INetCfg_iface); +} + +static ULONG WINAPI netcfglock_Release(INetCfgLock *iface) +{ + NetConfiguration *This = impl_from_INetCfgLock(iface); + return netcfg_Release(&This->INetCfg_iface); +} + +static HRESULT WINAPI netcfglock_AcquireWriteLock(INetCfgLock *iface, DWORD cmsTimeout, + LPCWSTR pszwClientDescription, LPWSTR *ppszwClientDescription) +{ + NetConfiguration *This = impl_from_INetCfgLock(iface); + FIXME("%p %d %s %p\n", This, cmsTimeout, debugstr_w(pszwClientDescription), ppszwClientDescription); + + return S_OK; +} + +static HRESULT WINAPI netcfglock_ReleaseWriteLock(INetCfgLock *iface) +{ + NetConfiguration *This = impl_from_INetCfgLock(iface); + FIXME("%p\n", This); + + return S_OK; +} + +static HRESULT WINAPI netcfglock_IsWriteLocked(INetCfgLock *iface, LPWSTR *ppszwClientDescription) +{ + NetConfiguration *This = impl_from_INetCfgLock(iface); + FIXME("%p %p\n", This, ppszwClientDescription); + + return E_NOTIMPL; +} + +static const struct INetCfgLockVtbl NetCfgLockVtbl = +{ + netcfglock_QueryInterface, + netcfglock_AddRef, + netcfglock_Release, + netcfglock_AcquireWriteLock, + netcfglock_ReleaseWriteLock, + netcfglock_IsWriteLocked +}; + +HRESULT INetCfg_CreateInstance(IUnknown **ppUnk) +{ + NetConfiguration *This; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(NetConfiguration)); + if (!This) + return E_OUTOFMEMORY; + + This->INetCfg_iface.lpVtbl = &NetCfgVtbl; + This->INetCfgLock_iface.lpVtbl = &NetCfgLockVtbl; + This->ref = 1; + + *ppUnk = (IUnknown*)This; + + return S_OK; +} diff -Nru wine1.7-1.7.13/dlls/netcfgx/netcfg_private.h wine1.7-1.7.16/dlls/netcfgx/netcfg_private.h --- wine1.7-1.7.13/dlls/netcfgx/netcfg_private.h 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/netcfg_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,23 @@ +/* + * Copyright 2014 Alistair Leslie-Hughes + * + * 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 + */ +#ifndef __NETCFG_PRIVATE_H__ +#define __NETCFG_PRIVATE_H__ + +extern HRESULT INetCfg_CreateInstance(IUnknown **ppUnk) DECLSPEC_HIDDEN; + +#endif diff -Nru wine1.7-1.7.13/dlls/netcfgx/netcfgx_classes.idl wine1.7-1.7.16/dlls/netcfgx/netcfgx_classes.idl --- wine1.7-1.7.13/dlls/netcfgx/netcfgx_classes.idl 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/netcfgx_classes.idl 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,21 @@ +/* + * Copyright 2014 Alistair Leslie-Hughes + * + * 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 + */ + +#pragma makedep register + +#include "netcfgx.idl" diff -Nru wine1.7-1.7.13/dlls/netcfgx/netcfgx.spec wine1.7-1.7.16/dlls/netcfgx/netcfgx.spec --- wine1.7-1.7.13/dlls/netcfgx/netcfgx.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/netcfgx.spec 2014-04-04 19:13:44.000000000 +0000 @@ -1,7 +1,7 @@ -@ stub DllCanUnloadNow -@ stub DllGetClassObject -@ stub DllRegisterServer -@ stub DllUnregisterServer +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() @ stub HrDiAddComponentToINetCfg @ stub LanaCfgFromCommandArgs @ stub ModemClassCoInstaller diff -Nru wine1.7-1.7.13/dlls/netcfgx/tests/Makefile.in wine1.7-1.7.16/dlls/netcfgx/tests/Makefile.in --- wine1.7-1.7.13/dlls/netcfgx/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/tests/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,5 @@ +TESTDLL = netcfgx.dll +IMPORTS = uuid ole32 + +C_SRCS = \ + netcfgx.c diff -Nru wine1.7-1.7.13/dlls/netcfgx/tests/netcfgx.c wine1.7-1.7.16/dlls/netcfgx/tests/netcfgx.c --- wine1.7-1.7.13/dlls/netcfgx/tests/netcfgx.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/netcfgx/tests/netcfgx.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,93 @@ +/* + * Copyright 2014 Alistair Leslie-Hughes + * + * 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 WIN32_LEAN_AND_MEAN +#include + +#define COBJMACROS + +#include "netcfgx.h" +#include "wine/test.h" + +static void create_configuration(void) +{ + static const WCHAR tcpipW[] = {'M','S','_','T','C','P','I','P',0}; + static const WCHAR myclient[] = {'M','Y',' ','C','L','I','E','N','T',0}; + HRESULT hr; + INetCfg *config = NULL; + INetCfgLock *netlock = NULL; + INetCfgComponent *component = NULL; + LPWSTR client = NULL; + + hr = CoCreateInstance( &CLSID_CNetCfg, NULL, CLSCTX_ALL, &IID_INetCfg, (LPVOID*)&config); + ok(hr == S_OK, "Failed to create object\n"); + if(SUCCEEDED(hr)) + { + hr = INetCfg_QueryInterface(config, &IID_INetCfgLock, (LPVOID*)&netlock); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = INetCfgLock_AcquireWriteLock(netlock, 5000, myclient, &client); + ok(hr == S_OK || + hr == E_ACCESSDENIED /* Not run as admin */, "got 0x%08x\n", hr); + if(hr == S_OK) + { + trace("Lock value: %s\n", wine_dbgstr_w(client)); + CoTaskMemFree(client); + } + else if(hr == E_ACCESSDENIED) + trace("Not run with Admin permissions\n"); + + hr = INetCfg_Initialize(config, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* AcquireWriteLock needs to be run before Initialize */ + hr = INetCfgLock_AcquireWriteLock(netlock, 5000, myclient, &client); + todo_wine ok(hr == NETCFG_E_ALREADY_INITIALIZED || hr == E_ACCESSDENIED, "got 0x%08x\n", hr); + + hr = INetCfg_FindComponent(config, tcpipW, &component); + todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); + if(hr == S_OK) + { + INetCfgComponent_Release(component); + } + + hr = INetCfg_Apply(config); + todo_wine ok(hr == S_OK || hr == NETCFG_E_NO_WRITE_LOCK, "got 0x%08x\n", hr); + + hr = INetCfg_Uninitialize(config); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = INetCfgLock_ReleaseWriteLock(netlock); + ok(hr == S_OK, "got 0x%08x\n", hr); + + INetCfg_Release(config); + } +} + +START_TEST(netcfgx) +{ + HRESULT hr; + + hr = CoInitialize(0); + ok( hr == S_OK, "failed to init com\n"); + if (hr != S_OK) + return; + + create_configuration(); + + CoUninitialize(); +} diff -Nru wine1.7-1.7.13/dlls/ntdll/actctx.c wine1.7-1.7.16/dlls/ntdll/actctx.c --- wine1.7-1.7.13/dlls/ntdll/actctx.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/actctx.c 2014-04-04 19:13:44.000000000 +0000 @@ -1646,13 +1646,13 @@ start = str; while (*str != ',' && (i++ < value->len)) str++; - if (!strncmpW(start, restrictedW, str-start)) + if (!strncmpiW(start, restrictedW, str-start)) *flags |= LIBFLAG_FRESTRICTED; - else if (!strncmpW(start, controlW, str-start)) + else if (!strncmpiW(start, controlW, str-start)) *flags |= LIBFLAG_FCONTROL; - else if (!strncmpW(start, hiddenW, str-start)) + else if (!strncmpiW(start, hiddenW, str-start)) *flags |= LIBFLAG_FHIDDEN; - else if (!strncmpW(start, hasdiskimageW, str-start)) + else if (!strncmpiW(start, hasdiskimageW, str-start)) *flags |= LIBFLAG_FHASDISKIMAGE; else { diff -Nru wine1.7-1.7.13/dlls/ntdll/heap.c wine1.7-1.7.16/dlls/ntdll/heap.c --- wine1.7-1.7.13/dlls/ntdll/heap.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/heap.c 2014-04-04 19:13:44.000000000 +0000 @@ -879,7 +879,7 @@ commitSize = min( totalSize, (commitSize + COMMIT_MASK) & ~COMMIT_MASK ); /* allocate the memory block */ - if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 5, &totalSize, + if (NtAllocateVirtualMemory( NtCurrentProcess(), &address, 0, &totalSize, MEM_RESERVE, get_protection_type( flags ) )) { WARN("Could not allocate %08lx bytes\n", totalSize ); diff -Nru wine1.7-1.7.13/dlls/ntdll/loader.c wine1.7-1.7.16/dlls/ntdll/loader.c --- wine1.7-1.7.13/dlls/ntdll/loader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/loader.c 2014-04-04 19:13:44.000000000 +0000 @@ -1464,6 +1464,22 @@ } +/************************************************************************* + * is_16bit_builtin + */ +static BOOL is_16bit_builtin( HMODULE module ) +{ + const IMAGE_EXPORT_DIRECTORY *exports; + DWORD exp_size; + + if (!(exports = RtlImageDirectoryEntryToData( module, TRUE, + IMAGE_DIRECTORY_ENTRY_EXPORT, &exp_size ))) + return FALSE; + + return find_named_export( module, exports, exp_size, "__wine_spec_dos_header", -1, NULL ) != NULL; +} + + /*********************************************************************** * load_builtin_callback * @@ -1511,7 +1527,8 @@ wm->ldr.Flags |= LDR_WINE_INTERNAL; if ((nt->FileHeader.Characteristics & IMAGE_FILE_DLL) || - nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE) + nt->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_NATIVE || + is_16bit_builtin( module )) { /* fixup imports */ diff -Nru wine1.7-1.7.13/dlls/ntdll/ntdll.spec wine1.7-1.7.16/dlls/ntdll/ntdll.spec --- wine1.7-1.7.13/dlls/ntdll/ntdll.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/ntdll.spec 2014-04-04 19:13:44.000000000 +0000 @@ -797,6 +797,7 @@ @ stub RtlQuerySecurityObject @ stub RtlQueryTagHeap @ stdcall RtlQueryTimeZoneInformation(ptr) +@ stdcall RtlQueryUnbiasedInterruptTime(ptr) @ stub RtlQueueApcWow64Thread @ stdcall RtlQueueWorkItem(ptr ptr long) @ stdcall -register RtlRaiseException(ptr) diff -Nru wine1.7-1.7.13/dlls/ntdll/tests/file.c wine1.7-1.7.16/dlls/ntdll/tests/file.c --- wine1.7-1.7.13/dlls/ntdll/tests/file.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/tests/file.c 2014-04-04 19:13:44.000000000 +0000 @@ -2363,12 +2363,14 @@ offset.QuadPart = 0; status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, contents, sizeof(contents), &offset, NULL); ok(status == STATUS_PENDING || status == STATUS_SUCCESS /* before Vista */, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status); + if (status == STATUS_PENDING) + { + ret = WaitForSingleObject(hfile, 3000); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); + } ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status); ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information); - ret = WaitForSingleObject(hfile, 3000); - ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); - off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT); ok(off == 0, "expected 0, got %u\n", off); @@ -2501,6 +2503,8 @@ status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL); if (status == STATUS_PENDING) { + ret = WaitForSingleObject(hfile, 3000); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); ok(U(iob).Status == STATUS_END_OF_FILE, "expected STATUS_END_OF_FILE, got %#x\n", U(iob).Status); ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information); } @@ -2520,6 +2524,8 @@ status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, 0, &offset, NULL); if (status == STATUS_PENDING) { + ret = WaitForSingleObject(hfile, 3000); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status); ok(iob.Information == 0, "expected 0, got %lu\n", iob.Information); } @@ -2574,31 +2580,33 @@ offset.QuadPart = (LONGLONG)-1 /* FILE_WRITE_TO_END_OF_FILE */; status = pNtWriteFile(hfile, 0, NULL, NULL, &iob, "DCBA", 4, &offset, NULL); ok(status == STATUS_PENDING || status == STATUS_SUCCESS /* before Vista */, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status); + if (status == STATUS_PENDING) + { + ret = WaitForSingleObject(hfile, 3000); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); + } ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status); ok(iob.Information == 4, "expected 4, got %lu\n", iob.Information); off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT); ok(off == 0, "expected 0, got %u\n", off); - ret = WaitForSingleObject(hfile, 3000); - ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); - - off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT); - ok(off == 0, "expected 0, got %u\n", off); - U(iob).Status = -1; iob.Information = -1; offset.QuadPart = 0; status = pNtReadFile(hfile, 0, NULL, NULL, &iob, buf, sizeof(buf), &offset, NULL); ok(status == STATUS_PENDING || status == STATUS_SUCCESS, "expected STATUS_PENDING or STATUS_SUCCESS, got %#x\n", status); + if (status == STATUS_PENDING) + { + ret = WaitForSingleObject(hfile, 3000); + ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); + } ok(U(iob).Status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %#x\n", U(iob).Status); ok(iob.Information == sizeof(contents), "expected sizeof(contents), got %lu\n", iob.Information); off = SetFilePointer(hfile, 0, NULL, FILE_CURRENT); ok(off == 0, "expected 0, got %u\n", off); - ret = WaitForSingleObject(hfile, 3000); - ok(ret == WAIT_OBJECT_0, "WaitForSingleObject error %d\n", ret); ok(!memcmp(contents, buf, sizeof(contents) - 4), "file contents mismatch\n"); ok(!memcmp(buf + sizeof(contents) - 4, "DCBA", 4), "file contents mismatch\n"); diff -Nru wine1.7-1.7.13/dlls/ntdll/thread.c wine1.7-1.7.16/dlls/ntdll/thread.c --- wine1.7-1.7.13/dlls/ntdll/thread.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/thread.c 2014-04-04 19:13:44.000000000 +0000 @@ -256,6 +256,8 @@ RtlInitializeBitMap( &tls_expansion_bitmap, peb->TlsExpansionBitmapBits, sizeof(peb->TlsExpansionBitmapBits) * 8 ); RtlInitializeBitMap( &fls_bitmap, peb->FlsBitmapBits, sizeof(peb->FlsBitmapBits) * 8 ); + RtlSetBits( peb->TlsBitmap, 0, 1 ); /* TLS index 0 is reserved and should be initialized to NULL. */ + RtlSetBits( peb->FlsBitmap, 0, 1 ); InitializeListHead( &peb->FlsListHead ); InitializeListHead( &ldr.InLoadOrderModuleList ); InitializeListHead( &ldr.InMemoryOrderModuleList ); diff -Nru wine1.7-1.7.13/dlls/ntdll/threadpool.c wine1.7-1.7.16/dlls/ntdll/threadpool.c --- wine1.7-1.7.13/dlls/ntdll/threadpool.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/threadpool.c 2014-04-04 19:13:44.000000000 +0000 @@ -39,12 +39,13 @@ #define WORKER_TIMEOUT 30000 /* 30 seconds */ +/* threadpool_cs must be held while modifying the following elements */ +static struct list work_item_list = LIST_INIT(work_item_list); static LONG num_workers; -static LONG num_work_items; static LONG num_busy_workers; +static LONG num_items_processed; -static struct list work_item_list = LIST_INIT(work_item_list); -static HANDLE work_item_event; +static RTL_CONDITION_VARIABLE threadpool_cond = RTL_CONDITION_VARIABLE_INIT; static RTL_CRITICAL_SECTION threadpool_cs; static RTL_CRITICAL_SECTION_DEBUG critsect_debug = @@ -84,80 +85,44 @@ static void WINAPI worker_thread_proc(void * param) { - interlocked_inc(&num_workers); + struct list *item; + struct work_item *work_item_ptr, work_item; + LARGE_INTEGER timeout; + timeout.QuadPart = -(WORKER_TIMEOUT * (ULONGLONG)10000); + + RtlEnterCriticalSection( &threadpool_cs ); + num_workers++; - /* free the work item memory sooner to reduce memory usage */ - while (TRUE) + for (;;) { - if (num_work_items > 0) + if ((item = list_head( &work_item_list ))) { - struct list *item; - RtlEnterCriticalSection(&threadpool_cs); - item = list_head(&work_item_list); - if (item) - { - struct work_item *work_item_ptr = LIST_ENTRY(item, struct work_item, entry); - struct work_item work_item; - list_remove(&work_item_ptr->entry); - interlocked_dec(&num_work_items); - - RtlLeaveCriticalSection(&threadpool_cs); - - work_item = *work_item_ptr; - RtlFreeHeap(GetProcessHeap(), 0, work_item_ptr); + work_item_ptr = LIST_ENTRY( item, struct work_item, entry ); + list_remove( &work_item_ptr->entry ); + num_busy_workers++; + num_items_processed++; + RtlLeaveCriticalSection( &threadpool_cs ); + + /* copy item to stack and do the work */ + work_item = *work_item_ptr; + RtlFreeHeap( GetProcessHeap(), 0, work_item_ptr ); + TRACE("executing %p(%p)\n", work_item.function, work_item.context); + work_item.function( work_item.context ); - TRACE("executing %p(%p)\n", work_item.function, work_item.context); - - interlocked_inc(&num_busy_workers); - - /* do the work */ - work_item.function(work_item.context); - - interlocked_dec(&num_busy_workers); - } - else - RtlLeaveCriticalSection(&threadpool_cs); - } - else - { - NTSTATUS status; - LARGE_INTEGER timeout; - timeout.QuadPart = -(WORKER_TIMEOUT * (ULONGLONG)10000); - status = NtWaitForSingleObject(work_item_event, FALSE, &timeout); - if (status != STATUS_WAIT_0) - break; + RtlEnterCriticalSection( &threadpool_cs ); + num_busy_workers--; } + else if (RtlSleepConditionVariableCS( &threadpool_cond, &threadpool_cs, &timeout ) != STATUS_SUCCESS) + break; } - interlocked_dec(&num_workers); - - RtlExitUserThread(0); + num_workers--; + RtlLeaveCriticalSection( &threadpool_cs ); + RtlExitUserThread( 0 ); /* never reached */ } -static NTSTATUS add_work_item_to_queue(struct work_item *work_item) -{ - NTSTATUS status; - - RtlEnterCriticalSection(&threadpool_cs); - list_add_tail(&work_item_list, &work_item->entry); - num_work_items++; - RtlLeaveCriticalSection(&threadpool_cs); - - if (!work_item_event) - { - HANDLE sem; - status = NtCreateSemaphore(&sem, SEMAPHORE_ALL_ACCESS, NULL, 1, INT_MAX); - if (interlocked_cmpxchg_ptr( &work_item_event, sem, 0 )) - NtClose(sem); /* somebody beat us to it */ - } - else - status = NtReleaseSemaphore(work_item_event, 1, NULL); - - return status; -} - /*********************************************************************** * RtlQueueWorkItem (NTDLL.@) * @@ -184,6 +149,7 @@ { HANDLE thread; NTSTATUS status; + LONG items_processed; struct work_item *work_item = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(struct work_item)); if (!work_item) @@ -195,39 +161,40 @@ if (Flags & ~WT_EXECUTELONGFUNCTION) FIXME("Flags 0x%x not supported\n", Flags); - status = add_work_item_to_queue(work_item); + RtlEnterCriticalSection( &threadpool_cs ); + list_add_tail( &work_item_list, &work_item->entry ); + status = (num_workers > num_busy_workers) ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; + items_processed = num_items_processed; + RtlLeaveCriticalSection( &threadpool_cs ); /* FIXME: tune this algorithm to not be as aggressive with creating threads * if WT_EXECUTELONGFUNCTION isn't specified */ - if ((status == STATUS_SUCCESS) && - ((num_workers == 0) || (num_workers == num_busy_workers))) + if (status == STATUS_SUCCESS) + RtlWakeConditionVariable( &threadpool_cond ); + else { - status = RtlCreateUserThread( GetCurrentProcess(), NULL, FALSE, - NULL, 0, 0, - worker_thread_proc, NULL, &thread, NULL ); - if (status == STATUS_SUCCESS) - NtClose( thread ); + status = RtlCreateUserThread( GetCurrentProcess(), NULL, FALSE, NULL, 0, 0, + worker_thread_proc, NULL, &thread, NULL ); /* NOTE: we don't care if we couldn't create the thread if there is at * least one other available to process the request */ - if ((num_workers > 0) && (status != STATUS_SUCCESS)) - status = STATUS_SUCCESS; - } - - if (status != STATUS_SUCCESS) - { - RtlEnterCriticalSection(&threadpool_cs); - - interlocked_dec(&num_work_items); - list_remove(&work_item->entry); - RtlFreeHeap(GetProcessHeap(), 0, work_item); - - RtlLeaveCriticalSection(&threadpool_cs); + if (status == STATUS_SUCCESS) + NtClose( thread ); + else + { + RtlEnterCriticalSection( &threadpool_cs ); + if (num_workers > 0 || num_items_processed != items_processed) + status = STATUS_SUCCESS; + else + list_remove( &work_item->entry ); + RtlLeaveCriticalSection( &threadpool_cs ); - return status; + if (status != STATUS_SUCCESS) + RtlFreeHeap( GetProcessHeap(), 0, work_item ); + } } - return STATUS_SUCCESS; + return status; } /*********************************************************************** @@ -235,12 +202,14 @@ */ static DWORD CALLBACK iocp_poller(LPVOID Arg) { + HANDLE cport = Arg; + while( TRUE ) { PRTL_OVERLAPPED_COMPLETION_ROUTINE callback; LPVOID overlapped; IO_STATUS_BLOCK iosb; - NTSTATUS res = NtRemoveIoCompletion( compl_port, (PULONG_PTR)&callback, (PULONG_PTR)&overlapped, &iosb, NULL ); + NTSTATUS res = NtRemoveIoCompletion( cport, (PULONG_PTR)&callback, (PULONG_PTR)&overlapped, &iosb, NULL ); if (res) { ERR("NtRemoveIoCompletion failed: 0x%x\n", res); @@ -297,7 +266,7 @@ if (!res) { /* FIXME native can start additional threads in case of e.g. hung callback function. */ - res = RtlQueueWorkItem( iocp_poller, NULL, WT_EXECUTEDEFAULT ); + res = RtlQueueWorkItem( iocp_poller, cport, WT_EXECUTEDEFAULT ); if (!res) compl_port = cport; else diff -Nru wine1.7-1.7.13/dlls/ntdll/time.c wine1.7-1.7.16/dlls/ntdll/time.c --- wine1.7-1.7.13/dlls/ntdll/time.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntdll/time.c 2014-04-04 19:13:44.000000000 +0000 @@ -931,3 +931,12 @@ return STATUS_NOT_IMPLEMENTED; #endif } + +/*********************************************************************** + * RtlQueryUnbiasedInterruptTime [NTDLL.@] + */ +NTSTATUS WINAPI RtlQueryUnbiasedInterruptTime(ULONGLONG *time) +{ + *time = monotonic_counter(); + return STATUS_SUCCESS; +} diff -Nru wine1.7-1.7.13/dlls/ntoskrnl.exe/ntoskrnl.c wine1.7-1.7.16/dlls/ntoskrnl.exe/ntoskrnl.c --- wine1.7-1.7.13/dlls/ntoskrnl.exe/ntoskrnl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntoskrnl.exe/ntoskrnl.c 2014-04-04 19:13:44.000000000 +0000 @@ -34,6 +34,7 @@ #include "excpt.h" #include "winioctl.h" #include "ddk/ntddk.h" +#include "ddk/ntifs.h" #include "wine/unicode.h" #include "wine/server.h" #include "wine/list.h" @@ -1287,6 +1288,14 @@ KeInitializeTimerEx(Timer, NotificationTimer); } +/*********************************************************************** + * KeInsertQueue (NTOSKRNL.EXE.@) + */ +LONG WINAPI KeInsertQueue(PRKQUEUE Queue, PLIST_ENTRY Entry) +{ + FIXME( "stub: %p %p\n", Queue, Entry ); + return 0; +} /********************************************************************** * KeQueryActiveProcessors (NTOSKRNL.EXE.@) @@ -1503,6 +1512,14 @@ /*********************************************************************** + * MmLockPagableSectionByHandle (NTOSKRNL.EXE.@) + */ +VOID WINAPI MmLockPagableSectionByHandle(PVOID ImageSectionHandle) +{ + FIXME("stub %p\n", ImageSectionHandle); +} + +/*********************************************************************** * MmMapLockedPagesSpecifyCache (NTOSKRNL.EXE.@) */ PVOID WINAPI MmMapLockedPagesSpecifyCache(PMDLX MemoryDescriptorList, KPROCESSOR_MODE AccessMode, MEMORY_CACHING_TYPE CacheType, @@ -1513,6 +1530,13 @@ return NULL; } +/*********************************************************************** + * MmUnlockPagableImageSection (NTOSKRNL.EXE.@) + */ +VOID WINAPI MmUnlockPagableImageSection(PVOID ImageSectionHandle) +{ + FIXME("stub %p\n", ImageSectionHandle); +} /*********************************************************************** * MmPageEntireDriver (NTOSKRNL.EXE.@) diff -Nru wine1.7-1.7.13/dlls/ntoskrnl.exe/ntoskrnl.exe.spec wine1.7-1.7.16/dlls/ntoskrnl.exe/ntoskrnl.exe.spec --- wine1.7-1.7.13/dlls/ntoskrnl.exe/ntoskrnl.exe.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ntoskrnl.exe/ntoskrnl.exe.spec 2014-04-04 19:13:44.000000000 +0000 @@ -558,7 +558,7 @@ @ stub KeInsertByKeyDeviceQueue @ stub KeInsertDeviceQueue @ stub KeInsertHeadQueue -@ stub KeInsertQueue +@ stdcall KeInsertQueue(ptr ptr) @ stub KeInsertQueueApc @ stub KeInsertQueueDpc @ stub KeIsAttachedProcess @@ -687,7 +687,7 @@ @ stub MmIsVerifierEnabled @ stub MmLockPagableDataSection @ stub MmLockPagableImageSection -@ stub MmLockPagableSectionByHandle +@ stdcall MmLockPagableSectionByHandle(ptr) @ stdcall MmMapIoSpace(long long long long) @ stub MmMapLockedPages @ stdcall MmMapLockedPagesSpecifyCache(ptr long long ptr long long) @@ -716,7 +716,7 @@ @ stub MmSizeOfMdl @ stub MmSystemRangeStart @ stub MmTrimAllSystemPagableMemory -@ stub MmUnlockPagableImageSection +@ stdcall MmUnlockPagableImageSection(ptr) @ stdcall MmUnlockPages(ptr) @ stdcall MmUnmapIoSpace(ptr long) @ stub MmUnmapLockedPages diff -Nru wine1.7-1.7.13/dlls/odbccp32/odbccp32.spec wine1.7-1.7.16/dlls/odbccp32/odbccp32.spec --- wine1.7-1.7.13/dlls/odbccp32/odbccp32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/odbccp32/odbccp32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -1,57 +1,57 @@ -@ stdcall ODBCCPlApplet( long long ptr ptr) -@ stdcall SQLConfigDataSource(ptr long str str) -@ stdcall SQLConfigDataSourceW(ptr long wstr wstr) -@ stdcall SQLConfigDriver(ptr long str str ptr long ptr) -@ stdcall SQLConfigDriverW(ptr long wstr wstr ptr long ptr) -@ stdcall SQLCreateDataSource(ptr str) -@ stub SQLCreateDataSourceEx -@ stub SQLCreateDataSourceExW -@ stdcall SQLCreateDataSourceW(ptr wstr) -@ stdcall SQLGetAvailableDrivers(str ptr long ptr) -@ stdcall SQLGetAvailableDriversW(wstr ptr long ptr) -@ stdcall SQLGetConfigMode(ptr) -@ stdcall SQLGetInstalledDrivers(str long ptr) -@ stdcall SQLGetInstalledDriversW(wstr long ptr) -@ stdcall SQLGetPrivateProfileString(str str str str long str) -@ stdcall SQLGetPrivateProfileStringW(wstr wstr wstr wstr long wstr) -@ stdcall SQLGetTranslator(ptr str long ptr ptr long ptr ptr) -@ stdcall SQLGetTranslatorW(ptr wstr long ptr ptr long ptr ptr) -@ stdcall SQLInstallDriver(str str str long ptr) -@ stdcall SQLInstallDriverEx(str str str long ptr long ptr) -@ stdcall SQLInstallDriverExW(wstr wstr wstr long ptr long ptr) -@ stdcall SQLInstallDriverManager(ptr long ptr) -@ stdcall SQLInstallDriverManagerW(ptr long ptr) -@ stdcall SQLInstallDriverW(wstr wstr wstr long ptr) -@ stdcall SQLInstallODBC(ptr str str str) -@ stdcall SQLInstallODBCW(ptr wstr wstr wstr) -@ stdcall SQLInstallTranslator(str str str ptr long ptr long ptr) -@ stdcall SQLInstallTranslatorEx(str str ptr long ptr long ptr) -@ stdcall SQLInstallTranslatorExW(wstr wstr ptr long ptr long ptr) -@ stdcall SQLInstallTranslatorW(wstr wstr wstr ptr long ptr long ptr) -@ stdcall SQLInstallerError(long ptr ptr long ptr) -@ stdcall SQLInstallerErrorW(long ptr ptr long ptr) -@ stub SQLLoadDataSourcesListBox -@ stub SQLLoadDriverListBox -@ stdcall SQLManageDataSources(ptr) -@ stdcall SQLPostInstallerError(long ptr) -@ stdcall SQLPostInstallerErrorW(long ptr) -@ stdcall SQLReadFileDSN(str str str ptr long ptr) -@ stdcall SQLReadFileDSNW(wstr wstr wstr ptr long ptr) -@ stdcall SQLRemoveDSNFromIni(str) -@ stdcall SQLRemoveDSNFromIniW(wstr) -@ stdcall SQLRemoveDefaultDataSource() -@ stdcall SQLRemoveDriver(str long ptr) -@ stdcall SQLRemoveDriverManager(ptr) -@ stdcall SQLRemoveDriverW(wstr long ptr) -@ stdcall SQLRemoveTranslator(str ptr) -@ stdcall SQLRemoveTranslatorW(wstr ptr) -@ stdcall SQLSetConfigMode(long) -@ stdcall SQLValidDSN(str) -@ stdcall SQLValidDSNW(wstr) -@ stdcall SQLWriteDSNToIni(str str) -@ stdcall SQLWriteDSNToIniW(wstr wstr) -@ stdcall SQLWriteFileDSN(str str str str) -@ stdcall SQLWriteFileDSNW(wstr wstr wstr wstr) -@ stdcall SQLWritePrivateProfileString(str str str str) -@ stdcall SQLWritePrivateProfileStringW(wstr wstr wstr wstr) -@ stub SelectTransDlg +2 stdcall SQLInstallDriver(str str str long ptr) +3 stdcall SQLInstallDriverManager(ptr long ptr) +4 stdcall SQLGetInstalledDrivers(str long ptr) +5 stdcall SQLGetAvailableDrivers(str ptr long ptr) +6 stdcall SQLConfigDataSource(ptr long str str) +7 stdcall SQLRemoveDefaultDataSource() +8 stdcall SQLWriteDSNToIni(str str) +9 stdcall SQLRemoveDSNFromIni(str) +10 stdcall SQLInstallODBC(ptr str str str) +11 stdcall SQLManageDataSources(ptr) +12 stdcall SQLCreateDataSource(ptr str) +13 stdcall SQLGetTranslator(ptr str long ptr ptr long ptr ptr) +14 stdcall SQLWritePrivateProfileString(str str str str) +15 stdcall SQLGetPrivateProfileString(str str str str long str) +16 stdcall SQLValidDSN(str) +17 stdcall SQLRemoveDriverManager(ptr) +18 stdcall SQLInstallTranslator(str str str ptr long ptr long ptr) +19 stdcall SQLRemoveTranslator(str ptr) +20 stdcall SQLRemoveDriver(str long ptr) +21 stdcall SQLConfigDriver(ptr long str str ptr long ptr) +22 stdcall SQLInstallerError(long ptr ptr long ptr) +23 stdcall SQLPostInstallerError(long ptr) +24 stdcall SQLReadFileDSN(str str str ptr long ptr) +25 stdcall SQLWriteFileDSN(str str str str) +26 stdcall SQLInstallDriverEx(str str str long ptr long ptr) +27 stdcall SQLGetConfigMode(ptr) +28 stdcall SQLSetConfigMode(long) +29 stdcall SQLInstallTranslatorEx(str str ptr long ptr long ptr) +30 stub SQLCreateDataSourceEx +101 stdcall ODBCCPlApplet( long long ptr ptr) +112 stub SelectTransDlg +202 stdcall SQLInstallDriverW(wstr wstr wstr long ptr) +203 stdcall SQLInstallDriverManagerW(ptr long ptr) +204 stdcall SQLGetInstalledDriversW(wstr long ptr) +205 stdcall SQLGetAvailableDriversW(wstr ptr long ptr) +206 stdcall SQLConfigDataSourceW(ptr long wstr wstr) +208 stdcall SQLWriteDSNToIniW(wstr wstr) +209 stdcall SQLRemoveDSNFromIniW(wstr) +210 stdcall SQLInstallODBCW(ptr wstr wstr wstr) +212 stdcall SQLCreateDataSourceW(ptr wstr) +213 stdcall SQLGetTranslatorW(ptr wstr long ptr ptr long ptr ptr) +214 stdcall SQLWritePrivateProfileStringW(wstr wstr wstr wstr) +215 stdcall SQLGetPrivateProfileStringW(wstr wstr wstr wstr long wstr) +216 stdcall SQLValidDSNW(wstr) +218 stdcall SQLInstallTranslatorW(wstr wstr wstr ptr long ptr long ptr) +219 stdcall SQLRemoveTranslatorW(wstr ptr) +220 stdcall SQLRemoveDriverW(wstr long ptr) +221 stdcall SQLConfigDriverW(ptr long wstr wstr ptr long ptr) +222 stdcall SQLInstallerErrorW(long ptr ptr long ptr) +223 stdcall SQLPostInstallerErrorW(long ptr) +224 stdcall SQLReadFileDSNW(wstr wstr wstr ptr long ptr) +225 stdcall SQLWriteFileDSNW(wstr wstr wstr wstr) +226 stdcall SQLInstallDriverExW(wstr wstr wstr long ptr long ptr) +229 stdcall SQLInstallTranslatorExW(wstr wstr ptr long ptr long ptr) +230 stub SQLCreateDataSourceExW +231 stub SQLLoadDriverListBox +232 stub SQLLoadDataSourcesListBox diff -Nru wine1.7-1.7.13/dlls/ole32/compobj.c wine1.7-1.7.16/dlls/ole32/compobj.c --- wine1.7-1.7.13/dlls/ole32/compobj.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/compobj.c 2014-04-04 19:13:44.000000000 +0000 @@ -2369,7 +2369,7 @@ * E_OUTOFMEMORY * REGDB_E_CLASSNOTREG if the given clsid has no associated ProgID */ -HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID) +HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID) { static const WCHAR wszProgID[] = {'P','r','o','g','I','D',0}; ACTCTX_SECTION_KEYED_DATA data; @@ -2441,7 +2441,7 @@ * Success: S_OK * Failure: CO_E_CLASSSTRING - the given ProgID cannot be found. */ -HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid) +HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, LPCLSID clsid) { ACTCTX_SECTION_KEYED_DATA data; @@ -2921,7 +2921,7 @@ * SEE ALSO * CoCreateInstance() */ -HRESULT WINAPI CoGetClassObject( +HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject( REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID iid, LPVOID *ppv) { @@ -3146,7 +3146,7 @@ * SEE ALSO * CoGetClassObject() */ -HRESULT WINAPI CoCreateInstance( +HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, @@ -3254,7 +3254,7 @@ /*********************************************************************** * CoCreateInstanceEx [OLE32.@] */ -HRESULT WINAPI CoCreateInstanceEx( +HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstanceEx( REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, @@ -3493,7 +3493,7 @@ * SEE ALSO * CoLoadLibrary, CoFreeAllLibraries, CoFreeLibrary */ -void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved) +void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved) { struct apartment *apt = COM_CurrentApt(); if (!apt) @@ -3517,7 +3517,7 @@ * SEE ALSO * CoLoadLibrary, CoFreeAllLibraries, CoFreeLibrary */ -void WINAPI CoFreeUnusedLibraries(void) +void WINAPI DECLSPEC_HOTPATCH CoFreeUnusedLibraries(void) { CoFreeUnusedLibrariesEx(INFINITE, 0); } diff -Nru wine1.7-1.7.13/dlls/ole32/compositemoniker.c wine1.7-1.7.16/dlls/ole32/compositemoniker.c --- wine1.7-1.7.13/dlls/ole32/compositemoniker.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/compositemoniker.c 2014-04-04 19:13:44.000000000 +0000 @@ -1938,10 +1938,12 @@ if (pmkFirst==NULL && pmkRest!=NULL){ *ppmkComposite=pmkRest; + IMoniker_AddRef(pmkRest); return S_OK; } else if (pmkFirst!=NULL && pmkRest==NULL){ *ppmkComposite=pmkFirst; + IMoniker_AddRef(pmkFirst); return S_OK; } else if (pmkFirst==NULL && pmkRest==NULL) diff -Nru wine1.7-1.7.13/dlls/ole32/filemoniker.c wine1.7-1.7.16/dlls/ole32/filemoniker.c --- wine1.7-1.7.13/dlls/ole32/filemoniker.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/filemoniker.c 2014-04-04 19:13:44.000000000 +0000 @@ -935,11 +935,12 @@ FileMonikerImpl_CommonPrefixWith(IMoniker* iface,IMoniker* pmkOther,IMoniker** ppmkPrefix) { - LPOLESTR pathThis,pathOther,*stringTable1,*stringTable2,commonPath; - IBindCtx *pbind; + LPOLESTR pathThis = NULL, pathOther = NULL,*stringTable1,*stringTable2,commonPath = NULL; + IBindCtx *bindctx; DWORD mkSys; ULONG nb1,nb2,i,sameIdx; BOOL machineNameCase = FALSE; + HRESULT ret; if (ppmkPrefix==NULL) return E_POINTER; @@ -951,81 +952,81 @@ /* check if we have the same type of moniker */ IMoniker_IsSystemMoniker(pmkOther,&mkSys); + if (mkSys != MKSYS_FILEMONIKER) + return MonikerCommonPrefixWith(iface, pmkOther, ppmkPrefix); - if(mkSys==MKSYS_FILEMONIKER){ - HRESULT ret; - - ret = CreateBindCtx(0,&pbind); - if (FAILED(ret)) - return ret; - - /* create a string based on common part of the two paths */ - - ret = IMoniker_GetDisplayName(iface,pbind,NULL,&pathThis); - if (FAILED(ret)) - return ret; - ret = IMoniker_GetDisplayName(pmkOther,pbind,NULL,&pathOther); - if (FAILED(ret)) - return ret; - - nb1=FileMonikerImpl_DecomposePath(pathThis,&stringTable1); - if (FAILED(nb1)) - return nb1; - nb2=FileMonikerImpl_DecomposePath(pathOther,&stringTable2); - if (FAILED(nb2)) - { - free_stringtable(stringTable1); - return nb2; - } - - if (nb1==0 || nb2==0) - { - free_stringtable(stringTable1); - free_stringtable(stringTable2); - return MK_E_NOPREFIX; - } - - commonPath=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(min(lstrlenW(pathThis),lstrlenW(pathOther))+1)); - if (!commonPath) - return E_OUTOFMEMORY; - - *commonPath=0; + ret = CreateBindCtx(0, &bindctx); + if (FAILED(ret)) + return ret; - for(sameIdx=0; ( (stringTable1[sameIdx]!=NULL) && - (stringTable2[sameIdx]!=NULL) && - (lstrcmpiW(stringTable1[sameIdx],stringTable2[sameIdx])==0)); sameIdx++); + /* create a string based on common part of the two paths */ + ret = IMoniker_GetDisplayName(iface, bindctx, NULL, &pathThis); + if (FAILED(ret)) + goto failed; + + ret = IMoniker_GetDisplayName(pmkOther, bindctx, NULL, &pathOther); + if (FAILED(ret)) + goto failed; + + nb1 = FileMonikerImpl_DecomposePath(pathThis, &stringTable1); + if (FAILED(nb1)) { + ret = nb1; + goto failed; + } - if (sameIdx > 1 && *stringTable1[0]=='\\' && *stringTable2[1]=='\\'){ + nb2 = FileMonikerImpl_DecomposePath(pathOther, &stringTable2); + if (FAILED(nb2)) { + ret = nb2; + goto failed; + } - machineNameCase = TRUE; + if (nb1 == 0 || nb2 == 0) { + ret = MK_E_NOPREFIX; + goto failed; + } - for(i=2;i 1 && *stringTable1[0]=='\\' && *stringTable2[1]=='\\'){ + machineNameCase = TRUE; + + for(i=2;i 3 || nb2 > 3) ) - ret = MK_E_NOPREFIX; - else - { - for(i=0;i 3 || nb2 > 3) ) + ret = MK_E_NOPREFIX; else - return MonikerCommonPrefixWith(iface,pmkOther,ppmkPrefix); + { + for (i = 0; i < sameIdx; i++) + strcatW(commonPath,stringTable1[i]); + ret = CreateFileMoniker(commonPath, ppmkPrefix); + } + +failed: + IBindCtx_Release(bindctx); + CoTaskMemFree(pathThis); + CoTaskMemFree(pathOther); + CoTaskMemFree(commonPath); + free_stringtable(stringTable1); + free_stringtable(stringTable2); + + return ret; } /****************************************************************************** @@ -1105,8 +1106,7 @@ CoTaskMemFree(strgtable); } - if (word) - CoTaskMemFree(word); + CoTaskMemFree(word); return ret; } diff -Nru wine1.7-1.7.13/dlls/ole32/moniker.c wine1.7-1.7.16/dlls/ole32/moniker.c --- wine1.7-1.7.13/dlls/ole32/moniker.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/moniker.c 2014-04-04 19:13:44.000000000 +0000 @@ -1248,8 +1248,10 @@ absFile=pathDec[nbElm-1]; /* failed if the path represents a directory and not an absolute file name*/ - if (!lstrcmpW(absFile, bkslashW)) + if (!lstrcmpW(absFile, bkslashW)) { + CoTaskMemFree(pathDec); return MK_E_INVALIDEXTENSION; + } /* get the extension of the file */ extension = NULL; @@ -1257,8 +1259,10 @@ for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--) /* nothing */; - if (!extension || !lstrcmpW(extension, dotW)) + if (!extension || !lstrcmpW(extension, dotW)) { + CoTaskMemFree(pathDec); return MK_E_INVALIDEXTENSION; + } res=RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId); diff -Nru wine1.7-1.7.13/dlls/ole32/ole2.c wine1.7-1.7.16/dlls/ole32/ole2.c --- wine1.7-1.7.13/dlls/ole32/ole2.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/ole2.c 2014-04-04 19:13:44.000000000 +0000 @@ -157,7 +157,6 @@ */ static void OLEDD_Initialize(void); static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo); static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo); static DWORD OLEDD_GetButtonState(void); @@ -2199,10 +2198,6 @@ } case WM_TIMER: case WM_MOUSEMOVE: - { - OLEDD_TrackMouseMove((TrackerWindowInfo*)GetWindowLongPtrA(hwnd, 0)); - break; - } case WM_LBUTTONUP: case WM_MBUTTONUP: case WM_RBUTTONUP: @@ -2227,19 +2222,16 @@ } /*** - * OLEDD_TrackMouseMove() + * OLEDD_TrackStateChange() * * This method is invoked while a drag and drop operation is in effect. - * it will generate the appropriate callbacks in the drop source - * and drop target. It will also provide the expected feedback to - * the user. * * params: * trackerInfo - Pointer to the structure identifying the * drag & drop operation that is currently * active. */ -static void OLEDD_TrackMouseMove(TrackerWindowInfo* trackerInfo) +static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo) { HWND hwndNewTarget = 0; HRESULT hr = S_OK; @@ -2252,6 +2244,10 @@ pt.y = trackerInfo->curMousePos.y; hwndNewTarget = WindowFromPoint(pt); + trackerInfo->returnValue = IDropSource_QueryContinueDrag(trackerInfo->dropSource, + trackerInfo->escPressed, + trackerInfo->dwKeyState); + /* * Every time, we re-initialize the effects passed to the * IDropTarget to the effects allowed by the source. @@ -2268,7 +2264,8 @@ IDropTarget_DragOver(trackerInfo->curDragTarget, trackerInfo->dwKeyState, trackerInfo->curMousePos, - trackerInfo->pdwEffect); + trackerInfo->pdwEffect); + *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect; } else { @@ -2310,6 +2307,7 @@ trackerInfo->dwKeyState, trackerInfo->curMousePos, trackerInfo->pdwEffect); + *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect; /* failed DragEnter() means invalid target */ if (hr != S_OK) @@ -2375,29 +2373,6 @@ SetCursor(hCur); } -} - -/*** - * OLEDD_TrackStateChange() - * - * This method is invoked while a drag and drop operation is in effect. - * It is used to notify the drop target/drop source callbacks when - * the state of the keyboard or mouse button change. - * - * params: - * trackerInfo - Pointer to the structure identifying the - * drag & drop operation that is currently - * active. - */ -static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo) -{ - /* - * Ask the drop source what to do with the operation. - */ - trackerInfo->returnValue = IDropSource_QueryContinueDrag( - trackerInfo->dropSource, - trackerInfo->escPressed, - trackerInfo->dwKeyState); /* * All the return valued will stop the operation except the S_OK @@ -2430,11 +2405,11 @@ */ case DRAGDROP_S_DROP: if (*trackerInfo->pdwEffect != DROPEFFECT_NONE) - IDropTarget_Drop(trackerInfo->curDragTarget, - trackerInfo->dataObject, - trackerInfo->dwKeyState, - trackerInfo->curMousePos, - trackerInfo->pdwEffect); + trackerInfo->returnValue = IDropTarget_Drop(trackerInfo->curDragTarget, + trackerInfo->dataObject, + trackerInfo->dwKeyState, + trackerInfo->curMousePos, + trackerInfo->pdwEffect); else IDropTarget_DragLeave(trackerInfo->curDragTarget); break; diff -Nru wine1.7-1.7.13/dlls/ole32/storage32.c wine1.7-1.7.16/dlls/ole32/storage32.c --- wine1.7-1.7.13/dlls/ole32/storage32.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/storage32.c 2014-04-04 19:13:44.000000000 +0000 @@ -7609,11 +7609,21 @@ HANDLE hFile = 0; DWORD shareMode; DWORD accessMode; + LPWSTR temp_name = NULL; TRACE("(%s, %p, %x, %p, %d, %p)\n", debugstr_w(pwcsName), pstgPriority, grfMode, snbExclude, reserved, ppstgOpen); + if (pstgPriority) + { + /* FIXME: Copy ILockBytes instead? But currently for STGM_PRIORITY it'll be read-only. */ + hr = StorageBaseImpl_GetFilename((StorageBaseImpl*)pstgPriority, &temp_name); + if (FAILED(hr)) goto end; + pwcsName = temp_name; + TRACE("using filename %s\n", debugstr_w(temp_name)); + } + if (pwcsName == 0) { hr = STG_E_INVALIDNAME; @@ -7775,6 +7785,8 @@ *ppstgOpen = &newStorage->IStorage_iface; end: + CoTaskMemFree(temp_name); + if (pstgPriority) IStorage_Release(pstgPriority); TRACE("<-- %08x, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL); return hr; } diff -Nru wine1.7-1.7.13/dlls/ole32/tests/dragdrop.c wine1.7-1.7.16/dlls/ole32/tests/dragdrop.c --- wine1.7-1.7.13/dlls/ole32/tests/dragdrop.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/tests/dragdrop.c 2014-04-04 19:13:44.000000000 +0000 @@ -31,6 +31,40 @@ #include "wine/test.h" +#define DEFINE_EXPECT(func) \ + static BOOL expect_ ## func = FALSE, called_ ## func = FALSE + +#define SET_EXPECT(func) \ + expect_ ## func = TRUE + +#define CHECK_EXPECT2(func) \ + do { \ + ok(expect_ ##func, "unexpected call " #func "\n"); \ + called_ ## func = TRUE; \ + }while(0) + +#define CHECK_EXPECT(func) \ + do { \ + CHECK_EXPECT2(func); \ + expect_ ## func = FALSE; \ + }while(0) + +#define CHECK_CALLED(func) \ + do { \ + ok(called_ ## func, "expected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + +DEFINE_EXPECT(DataObject_EnumFormatEtc); +DEFINE_EXPECT(EnumFORMATETC_Next); +DEFINE_EXPECT(EnumFORMATETC_Reset); +DEFINE_EXPECT(DataObject_QueryGetData); +DEFINE_EXPECT(DropSource_QueryContinueDrag); +DEFINE_EXPECT(DropTarget_DragEnter); +DEFINE_EXPECT(DropSource_GiveFeedback); +DEFINE_EXPECT(DropTarget_Drop); +DEFINE_EXPECT(DropTarget_DragLeave); + static int droptarget_refs; /* helper macros to make tests a bit leaner */ @@ -68,7 +102,9 @@ DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) { - return E_NOTIMPL; + CHECK_EXPECT(DropTarget_DragEnter); + *pdwEffect = DROPEFFECT_COPY; + return S_OK; } static HRESULT WINAPI DropTarget_DragOver(IDropTarget* iface, @@ -76,11 +112,14 @@ POINTL pt, DWORD* pdwEffect) { - return E_NOTIMPL; + ok(0, "unexpected call\n"); + *pdwEffect = DROPEFFECT_COPY; + return S_OK; } static HRESULT WINAPI DropTarget_DragLeave(IDropTarget* iface) { + CHECK_EXPECT(DropTarget_DragLeave); return E_NOTIMPL; } @@ -88,7 +127,8 @@ IDataObject* pDataObj, DWORD grfKeyState, POINTL pt, DWORD* pdwEffect) { - return E_NOTIMPL; + CHECK_EXPECT(DropTarget_Drop); + return 0xbeefbeef; } static const IDropTargetVtbl DropTarget_VTbl = @@ -104,7 +144,6 @@ static IDropTarget DropTarget = { &DropTarget_VTbl }; -/** stub IDropSource **/ static HRESULT WINAPI DropSource_QueryInterface(IDropSource *iface, REFIID riid, void **ppObj) { if (IsEqualIID(riid, &IID_IUnknown) || @@ -132,7 +171,7 @@ BOOL fEscapePressed, DWORD grfKeyState) { - /* always drop */ + CHECK_EXPECT(DropSource_QueryContinueDrag); return DRAGDROP_S_DROP; } @@ -140,6 +179,7 @@ IDropSource *iface, DWORD dwEffect) { + CHECK_EXPECT(DropSource_GiveFeedback); return DRAGDROP_S_USEDEFAULTCURSORS; } @@ -153,7 +193,75 @@ static IDropSource DropSource = { &dropsource_vtbl }; -/** IDataObject stub **/ +static HRESULT WINAPI EnumFORMATETC_QueryInterface(IEnumFORMATETC *iface, + REFIID riid, void **ppvObj) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static ULONG WINAPI EnumFORMATETC_AddRef(IEnumFORMATETC *iface) +{ + return 2; +} + +static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface) +{ + return 1; +} + +static BOOL formats_enumerated; +static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface, + ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched) +{ + static FORMATETC format = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + + CHECK_EXPECT2(EnumFORMATETC_Next); + + ok(celt == 1, "celt = %d\n", celt); + ok(rgelt != NULL, "rgelt == NULL\n"); + ok(pceltFetched == NULL, "pceltFetched != NULL\n"); + + if(formats_enumerated) + return S_FALSE; + + *rgelt = format; + formats_enumerated = TRUE; + return S_OK; +} + +static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface) +{ + CHECK_EXPECT(EnumFORMATETC_Reset); + formats_enumerated = FALSE; + return S_OK; +} + +static HRESULT WINAPI EnumFORMATETC_Clone(IEnumFORMATETC *iface, + IEnumFORMATETC **ppenum) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static const IEnumFORMATETCVtbl enumformatetc_vtbl = { + EnumFORMATETC_QueryInterface, + EnumFORMATETC_AddRef, + EnumFORMATETC_Release, + EnumFORMATETC_Next, + EnumFORMATETC_Skip, + EnumFORMATETC_Reset, + EnumFORMATETC_Clone +}; + +static IEnumFORMATETC EnumFORMATETC = { &enumformatetc_vtbl }; + static HRESULT WINAPI DataObject_QueryInterface( IDataObject *iface, REFIID riid, @@ -166,6 +274,8 @@ IDataObject_AddRef(iface); return S_OK; } + + trace("DataObject_QueryInterface: %s\n", wine_dbgstr_guid(riid)); return E_NOINTERFACE; } @@ -184,6 +294,7 @@ FORMATETC *pformatetcIn, STGMEDIUM *pmedium) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -192,6 +303,7 @@ FORMATETC *pformatetc, STGMEDIUM *pmedium) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -199,6 +311,7 @@ IDataObject *iface, FORMATETC *pformatetc) { + CHECK_EXPECT(DataObject_QueryGetData); return S_OK; } @@ -207,6 +320,7 @@ FORMATETC *pformatectIn, FORMATETC *pformatetcOut) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -216,6 +330,7 @@ STGMEDIUM *pmedium, BOOL fRelease) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -224,6 +339,9 @@ DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc) { + CHECK_EXPECT(DataObject_EnumFormatEtc); + *ppenumFormatEtc = &EnumFORMATETC; + formats_enumerated = FALSE; return S_OK; } @@ -234,6 +352,7 @@ IAdviseSink *pAdvSink, DWORD *pdwConnection) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -241,6 +360,7 @@ IDataObject *iface, DWORD dwConnection) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -248,6 +368,7 @@ IDataObject *iface, IEnumSTATDATA **ppenumAdvise) { + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -362,9 +483,10 @@ DWORD effect; HRESULT hr; HWND hwnd; + RECT rect; - hwnd = CreateWindowA("WineOleTestClass", "Test", 0, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, + hwnd = CreateWindowExA(WS_EX_TOPMOST, "WineOleTestClass", "Test", 0, + CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, NULL, NULL); ok(IsWindow(hwnd), "failed to create window\n"); @@ -396,6 +518,47 @@ hr = DoDragDrop(&DataObject, NULL, 0, &effect); ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + ShowWindow(hwnd, SW_SHOW); + GetWindowRect(hwnd, &rect); + ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n"); + SET_EXPECT(DataObject_EnumFormatEtc); + SET_EXPECT(EnumFORMATETC_Next); + SET_EXPECT(EnumFORMATETC_Reset); + SET_EXPECT(DataObject_QueryGetData); + SET_EXPECT(DropSource_QueryContinueDrag); + SET_EXPECT(DropTarget_DragEnter); + SET_EXPECT(DropSource_GiveFeedback); + SET_EXPECT(DropTarget_Drop); + hr = DoDragDrop(&DataObject, &DropSource, DROPEFFECT_COPY, &effect); + ok(hr == 0xbeefbeef, "got 0x%08x\n", hr); + todo_wine CHECK_CALLED(DataObject_EnumFormatEtc); + todo_wine CHECK_CALLED(EnumFORMATETC_Next); + todo_wine CHECK_CALLED(EnumFORMATETC_Reset); + todo_wine CHECK_CALLED(DataObject_QueryGetData); + CHECK_CALLED(DropSource_QueryContinueDrag); + CHECK_CALLED(DropTarget_DragEnter); + CHECK_CALLED(DropSource_GiveFeedback); + CHECK_CALLED(DropTarget_Drop); + + SET_EXPECT(DataObject_EnumFormatEtc); + SET_EXPECT(EnumFORMATETC_Next); + SET_EXPECT(EnumFORMATETC_Reset); + SET_EXPECT(DataObject_QueryGetData); + SET_EXPECT(DropSource_QueryContinueDrag); + SET_EXPECT(DropTarget_DragEnter); + SET_EXPECT(DropSource_GiveFeedback); + SET_EXPECT(DropTarget_DragLeave); + hr = DoDragDrop(&DataObject, &DropSource, 0, &effect); + ok(hr == DRAGDROP_S_DROP, "got 0x%08x\n", hr); + todo_wine CHECK_CALLED(DataObject_EnumFormatEtc); + todo_wine CHECK_CALLED(EnumFORMATETC_Next); + todo_wine CHECK_CALLED(EnumFORMATETC_Reset); + todo_wine CHECK_CALLED(DataObject_QueryGetData); + CHECK_CALLED(DropSource_QueryContinueDrag); + CHECK_CALLED(DropTarget_DragEnter); + CHECK_CALLED(DropSource_GiveFeedback); + CHECK_CALLED(DropTarget_DragLeave); + OleUninitialize(); DestroyWindow(hwnd); diff -Nru wine1.7-1.7.13/dlls/ole32/tests/storage32.c wine1.7-1.7.16/dlls/ole32/tests/storage32.c --- wine1.7-1.7.13/dlls/ole32/tests/storage32.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ole32/tests/storage32.c 2014-04-04 19:13:44.000000000 +0000 @@ -929,7 +929,48 @@ r = IStorage_Release(stg); ok(r == 0, "wrong ref count\n"); } - IStorage_Release(stgprio); + + /* Multiple STGM_PRIORITY opens are possible. */ + r = StgOpenStorage( filename, NULL, STGM_PRIORITY, NULL, 0, &stg); + ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r); + if(stg) + { + r = IStorage_Release(stg); + ok(r == 0, "wrong ref count\n"); + } + + r = StgOpenStorage( NULL, stgprio, STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE, NULL, 0, &stg); + ok(r==S_OK, "StgOpenStorage failed with error 0x%08x\n", r); + if(stg) + { + static const WCHAR stgname[] = { ' ',' ',' ','2','9',0 }; + IStorage *stg2; + STATSTG statstg; + + r = IStorage_Stat( stg, &statstg, STATFLAG_NONAME ); + ok(r == S_OK, "Stat should have succeeded instead of returning 0x%08x\n", r); + ok(statstg.type == STGTY_STORAGE, "Statstg type should have been STGTY_STORAGE instead of %d\n", statstg.type); + ok(U(statstg.cbSize).LowPart == 0, "Statstg cbSize.LowPart should have been 0 instead of %d\n", U(statstg.cbSize).LowPart); + ok(U(statstg.cbSize).HighPart == 0, "Statstg cbSize.HighPart should have been 0 instead of %d\n", U(statstg.cbSize).HighPart); + ok(statstg.grfMode == (STGM_TRANSACTED|STGM_SHARE_DENY_WRITE|STGM_READWRITE), + "Statstg grfMode should have been 0x10022 instead of 0x%x\n", statstg.grfMode); + ok(statstg.grfLocksSupported == 0, "Statstg grfLocksSupported should have been 0 instead of %d\n", statstg.grfLocksSupported); + ok(IsEqualCLSID(&statstg.clsid, &test_stg_cls), "Statstg clsid is not test_stg_cls\n"); + ok(statstg.grfStateBits == 0, "Statstg grfStateBits should have been 0 instead of %d\n", statstg.grfStateBits); + ok(statstg.reserved == 0, "Statstg reserved should have been 0 instead of %d\n", statstg.reserved); + + r = IStorage_CreateStorage( stg, stgname, STGM_SHARE_EXCLUSIVE, 0, 0, &stg2 ); + ok(r == S_OK, "CreateStorage should have succeeded instead of returning 0x%08x\n", r); + + IStorage_Release(stg2); + + r = IStorage_Commit( stg, 0 ); + ok(r == S_OK, "Commit should have succeeded instead of returning 0x%08x\n", r); + + r = IStorage_Release(stg); + ok(r == 0, "wrong ref count\n"); + } + /* IStorage_Release(stgprio) not necessary because StgOpenStorage released it. */ DeleteFileA(filenameA); } diff -Nru wine1.7-1.7.13/dlls/oleaut32/olefont.c wine1.7-1.7.16/dlls/oleaut32/olefont.c --- wine1.7-1.7.13/dlls/oleaut32/olefont.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/olefont.c 2014-04-04 19:13:44.000000000 +0000 @@ -388,7 +388,7 @@ static const WCHAR wszUnder[] = {'U','n','d','e','r','l','i','n','e',0}; static const WCHAR wszStrike[] = {'S','t','r','i','k','e','t','h','r','o','u','g','h',0}; static const WCHAR wszWeight[] = {'W','e','i','g','h','t',0}; - static const WCHAR wszCharset[] = {'C','h','a','r','s','s','e','t',0}; + static const WCHAR wszCharset[] = {'C','h','a','r','s','e','t',0}; static const LPCWSTR dispid_mapping[] = { wszName, @@ -1305,9 +1305,6 @@ /************************************************************************ * OLEFontImpl_Invoke (IDispatch) * - * Note: Do not call _put_Xxx methods, since setting things here - * should not call notify functions as I found out debugging the generic - * MS VB5 installer. */ static HRESULT WINAPI OLEFontImpl_Invoke( IDispatch* iface, diff -Nru wine1.7-1.7.13/dlls/oleaut32/olepicture.c wine1.7-1.7.16/dlls/oleaut32/olepicture.c --- wine1.7-1.7.13/dlls/oleaut32/olepicture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/olepicture.c 2014-04-04 19:13:44.000000000 +0000 @@ -1995,6 +1995,7 @@ UINT* puArgErr) { OLEPictureImpl *This = impl_from_IDispatch(iface); + HRESULT hr; /* validate parameters */ @@ -2052,7 +2053,7 @@ else if (wFlags & DISPATCH_PROPERTYPUT) { VARIANTARG vararg; - HRESULT hr; + TRACE("DISPID_PICT_HPAL\n"); VariantInit(&vararg); @@ -2090,6 +2091,40 @@ return IPicture_get_Height(&This->IPicture_iface, &V_I4(pVarResult)); } break; + case DISPID_PICT_RENDER: + if (wFlags & DISPATCH_METHOD) + { + VARIANTARG *args = pDispParams->rgvarg; + int i; + + TRACE("DISPID_PICT_RENDER\n"); + + if (pDispParams->cArgs != 10) + return DISP_E_BADPARAMCOUNT; + + /* All parameters are supposed to be VT_I4 (on 64 bits too). */ + for (i = 0; i < pDispParams->cArgs; i++) + if (V_VT(&args[i]) != VT_I4) + { + ERR("DISPID_PICT_RENDER: wrong argument type %d:%d\n", i, V_VT(&args[i])); + return DISP_E_TYPEMISMATCH; + } + + /* FIXME: rectangle pointer argument handling seems broken on 64 bits, + currently Render() doesn't use it at all so for now NULL is passed. */ + return IPicture_Render(&This->IPicture_iface, + LongToHandle(V_I4(&args[9])), + V_I4(&args[8]), + V_I4(&args[7]), + V_I4(&args[6]), + V_I4(&args[5]), + V_I4(&args[4]), + V_I4(&args[3]), + V_I4(&args[2]), + V_I4(&args[1]), + NULL); + } + break; } ERR("invalid dispid 0x%x or wFlags 0x%x\n", dispIdMember, wFlags); diff -Nru wine1.7-1.7.13/dlls/oleaut32/recinfo.c wine1.7-1.7.16/dlls/oleaut32/recinfo.c --- wine1.7-1.7.13/dlls/oleaut32/recinfo.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/recinfo.c 2014-04-04 19:13:44.000000000 +0000 @@ -266,20 +266,19 @@ return S_OK; } -static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, PVOID pvExisting, - PVOID pvNew) +static HRESULT WINAPI IRecordInfoImpl_RecordCopy(IRecordInfo *iface, void *src_rec, void *dest_rec) { IRecordInfoImpl *This = impl_from_IRecordInfo(iface); HRESULT hr = S_OK; int i; - TRACE("(%p)->(%p %p)\n", This, pvExisting, pvNew); + TRACE("(%p)->(%p %p)\n", This, src_rec, dest_rec); - if(!pvExisting || !pvNew) + if(!src_rec || !dest_rec) return E_INVALIDARG; /* release already stored data */ - IRecordInfo_RecordClear(iface, pvNew); + IRecordInfo_RecordClear(iface, dest_rec); for (i = 0; i < This->n_vars; i++) { @@ -290,8 +289,8 @@ continue; } - src = ((BYTE*)pvExisting) + This->fields[i].offset; - dest = ((BYTE*)pvNew) + This->fields[i].offset; + src = ((BYTE*)src_rec) + This->fields[i].offset; + dest = ((BYTE*)dest_rec) + This->fields[i].offset; switch (This->fields[i].vt) { case VT_BSTR: @@ -333,7 +332,7 @@ } if (FAILED(hr)) - IRecordInfo_RecordClear(iface, pvNew); + IRecordInfo_RecordClear(iface, dest_rec); return hr; } diff -Nru wine1.7-1.7.13/dlls/oleaut32/safearray.c wine1.7-1.7.16/dlls/oleaut32/safearray.c --- wine1.7-1.7.13/dlls/oleaut32/safearray.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/safearray.c 2014-04-04 19:13:44.000000000 +0000 @@ -186,7 +186,7 @@ if (!ptr) { *ppsaOut = NULL; - return E_UNEXPECTED; + return E_OUTOFMEMORY; } *ppsaOut = (SAFEARRAY*)(ptr + SAFEARRAY_HIDDEN_SIZE); @@ -401,7 +401,6 @@ } else if (psa->fFeatures & FADF_RECORD) { - const SAFEARRAYBOUND* psab = psa->rgsabound; BYTE *dest_data = dest->pvData; BYTE *src_data = psa->pvData; IRecordInfo *record; @@ -412,11 +411,14 @@ /* RecordCopy() clears destination record */ hr = IRecordInfo_RecordCopy(record, src_data, dest_data); if (FAILED(hr)) break; - src_data += psab->cElements; - dest_data += psab->cElements; + src_data += psa->cbElements; + dest_data += psa->cbElements; } SafeArraySetRecordInfo(dest, record); + /* This value is set to 32 bytes by default on descriptor creation, + update with actual structure size. */ + dest->cbElements = psa->cbElements; IRecordInfo_Release(record); } else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) @@ -476,6 +478,7 @@ HRESULT WINAPI SafeArrayAllocDescriptor(UINT cDims, SAFEARRAY **ppsaOut) { LONG allocSize; + HRESULT hr; TRACE("(%d,%p)\n", cDims, ppsaOut); @@ -488,8 +491,9 @@ /* We need enough space for the header and its bounds */ allocSize = sizeof(SAFEARRAY) + sizeof(SAFEARRAYBOUND) * (cDims - 1); - if (FAILED(SAFEARRAY_AllocDescriptor(allocSize, ppsaOut))) - return E_UNEXPECTED; + hr = SAFEARRAY_AllocDescriptor(allocSize, ppsaOut); + if (FAILED(hr)) + return hr; (*ppsaOut)->cDims = cDims; @@ -519,7 +523,7 @@ HRESULT WINAPI SafeArrayAllocDescriptorEx(VARTYPE vt, UINT cDims, SAFEARRAY **ppsaOut) { ULONG cbElements; - HRESULT hRet = E_UNEXPECTED; + HRESULT hRet; TRACE("(%d->%s,%d,%p)\n", vt, debugstr_vt(vt), cDims, ppsaOut); @@ -898,23 +902,27 @@ if (!*lpDest) hRet = E_OUTOFMEMORY; } - else + else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) { - if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) - { - LPUNKNOWN lpUnknown = pvData; - LPUNKNOWN *lpDest = lpvDest; + IUnknown *lpUnknown = pvData; + IUnknown **lpDest = lpvDest; - if (lpUnknown) - IUnknown_AddRef(lpUnknown); - if (*lpDest) - IUnknown_Release(*lpDest); - *lpDest = lpUnknown; - } else { - /* Copy the data over */ - memcpy(lpvDest, pvData, psa->cbElements); - } + if (lpUnknown) + IUnknown_AddRef(lpUnknown); + if (*lpDest) + IUnknown_Release(*lpDest); + *lpDest = lpUnknown; } + else if (psa->fFeatures & FADF_RECORD) + { + IRecordInfo *record; + + SafeArrayGetRecordInfo(psa, &record); + hRet = IRecordInfo_RecordCopy(record, pvData, lpvDest); + IRecordInfo_Release(record); + } else + /* Copy the data over */ + memcpy(lpvDest, pvData, psa->cbElements); } SafeArrayUnlock(psa); } @@ -982,18 +990,26 @@ else *lpDest = NULL; } - else + else if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) { - if (psa->fFeatures & (FADF_UNKNOWN|FADF_DISPATCH)) - { - LPUNKNOWN *lpUnknown = lpvSrc; + IUnknown **src_unk = lpvSrc; + IUnknown **dest_unk = pvData; - if (*lpUnknown) - IUnknown_AddRef(*lpUnknown); - } + if (*src_unk) + IUnknown_AddRef(*src_unk); + *dest_unk = *src_unk; + } + else if (psa->fFeatures & FADF_RECORD) + { + IRecordInfo *record; + + SafeArrayGetRecordInfo(psa, &record); + hRet = IRecordInfo_RecordCopy(record, lpvSrc, pvData); + IRecordInfo_Release(record); + } + else /* Copy the data over */ memcpy(pvData, lpvSrc, psa->cbElements); - } } SafeArrayUnlock(psa); } @@ -1123,18 +1139,17 @@ */ HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData) { + HRESULT hr; + TRACE("(%p,%p)\n", psa, ppvData); if(!psa || !ppvData) return E_INVALIDARG; - if (SUCCEEDED(SafeArrayLock(psa))) - { - *ppvData = psa->pvData; - return S_OK; - } - *ppvData = NULL; - return E_UNEXPECTED; + hr = SafeArrayLock(psa); + *ppvData = SUCCEEDED(hr) ? psa->pvData : NULL; + + return hr; } @@ -1243,6 +1258,8 @@ */ HRESULT WINAPI SafeArrayDestroyData(SAFEARRAY *psa) { + HRESULT hr; + TRACE("(%p)\n", psa); if (!psa) @@ -1252,8 +1269,9 @@ return DISP_E_ARRAYISLOCKED; /* Can't delete a locked array */ /* Delete the actual item data */ - if (FAILED(SAFEARRAY_DestroyData(psa, 0))) - return E_UNEXPECTED; + hr = SAFEARRAY_DestroyData(psa, 0); + if (FAILED(hr)) + return hr; if (psa->pvData) { @@ -1382,9 +1400,9 @@ if (psa->fFeatures & (FADF_RECORD|FADF_HAVEIID|FADF_HAVEVARTYPE)) { VARTYPE vt; - if (FAILED(SafeArrayGetVartype(psa, &vt))) - hRet = E_UNEXPECTED; - else + + hRet = SafeArrayGetVartype(psa, &vt); + if (SUCCEEDED(hRet)) hRet = SafeArrayAllocDescriptorEx(vt, psa->cDims, ppsaOut); } else @@ -1403,19 +1421,23 @@ memcpy((*ppsaOut)->rgsabound, psa->rgsabound, psa->cDims * sizeof(SAFEARRAYBOUND)); (*ppsaOut)->pvData = SAFEARRAY_Malloc(SAFEARRAY_GetCellCount(psa) * psa->cbElements); - - if ((*ppsaOut)->pvData) + if (!(*ppsaOut)->pvData) { - hRet = SAFEARRAY_CopyData(psa, *ppsaOut); - - if (SUCCEEDED(hRet)) - return hRet; + SafeArrayDestroyDescriptor(*ppsaOut); + *ppsaOut = NULL; + return E_OUTOFMEMORY; + } + hRet = SAFEARRAY_CopyData(psa, *ppsaOut); + if (FAILED(hRet)) + { SAFEARRAY_Free((*ppsaOut)->pvData); + SafeArrayDestroyDescriptor(*ppsaOut); + *ppsaOut = NULL; + return hRet; } - SafeArrayDestroyDescriptor(*ppsaOut); } - *ppsaOut = NULL; + return hRet; } @@ -1438,6 +1460,7 @@ HRESULT WINAPI SafeArrayRedim(SAFEARRAY *psa, SAFEARRAYBOUND *psabound) { SAFEARRAYBOUND *oldBounds; + HRESULT hr; TRACE("(%p,%p)\n", psa, psabound); @@ -1447,8 +1470,9 @@ if (psa->cLocks > 0) return DISP_E_ARRAYISLOCKED; - if (FAILED(SafeArrayLock(psa))) - return E_UNEXPECTED; + hr = SafeArrayLock(psa); + if (FAILED(hr)) + return hr; oldBounds = psa->rgsabound; oldBounds->lLbound = psabound->lLbound; @@ -1481,7 +1505,7 @@ if (!(pvNewData = SAFEARRAY_Malloc(ulNewSize))) { SafeArrayUnlock(psa); - return E_UNEXPECTED; + return E_OUTOFMEMORY; } memcpy(pvNewData, psa->pvData, ulOldSize); diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/olefont.c wine1.7-1.7.16/dlls/oleaut32/tests/olefont.c --- wine1.7-1.7.13/dlls/oleaut32/tests/olefont.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/olefont.c 2014-04-04 19:13:44.000000000 +0000 @@ -261,10 +261,7 @@ IFontDisp_Release(fontdisp); } -static HRESULT WINAPI FontEventsDisp_QueryInterface( - IFontEventsDisp *iface, - /* [in] */ REFIID riid, - /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) +static HRESULT WINAPI FontEventsDisp_QueryInterface(IFontEventsDisp *iface, REFIID riid, void **ppvObject) { if (IsEqualIID(riid, &IID_IFontEventsDisp) || IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDispatch)) { @@ -291,26 +288,48 @@ return 1; } -static int fonteventsdisp_invoke_called = 0; +static HRESULT WINAPI FontEventsDisp_GetTypeInfoCount(IFontEventsDisp *iface, UINT *pctinfo) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI FontEventsDisp_GetTypeInfo(IFontEventsDisp *iface, UINT itinfo, LCID lcid, ITypeInfo **pptinfo) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI FontEventsDisp_GetIDsOfNames(IFontEventsDisp *iface, REFIID riid, LPOLESTR *names, UINT cNames, LCID lcid, + DISPID *dispid) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static int fonteventsdisp_invoke_called; +static BSTR fonteventsdisp_invoke_arg0; static HRESULT WINAPI FontEventsDisp_Invoke( - IFontEventsDisp __RPC_FAR * iface, - /* [in] */ DISPID dispIdMember, - /* [in] */ REFIID riid, - /* [in] */ LCID lcid, - /* [in] */ WORD wFlags, - /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, - /* [out] */ VARIANT __RPC_FAR *pVarResult, - /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, - /* [out] */ UINT __RPC_FAR *puArgErr) -{ - static const WCHAR wszBold[] = {'B','o','l','d',0}; - ok(wFlags == INVOKE_FUNC, "invoke flags should have been INVOKE_FUNC instead of 0x%x\n", wFlags); - ok(dispIdMember == DISPID_FONT_CHANGED, "dispIdMember should have been DISPID_FONT_CHANGED instead of 0x%x\n", dispIdMember); - ok(pDispParams->cArgs == 1, "pDispParams->cArgs should have been 1 instead of %d\n", pDispParams->cArgs); - ok(V_VT(&pDispParams->rgvarg[0]) == VT_BSTR, "VT of first param should have been VT_BSTR instead of %d\n", V_VT(&pDispParams->rgvarg[0])); - ok(!lstrcmpW(V_BSTR(&pDispParams->rgvarg[0]), wszBold), "String in first param should have been \"Bold\"\n"); + IFontEventsDisp *iface, + DISPID dispid, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr) +{ + VARIANTARG *arg0 = &pDispParams->rgvarg[0]; + + ok(dispid == DISPID_FONT_CHANGED, "expected DISPID_FONT_CHANGED instead of 0x%x\n", dispid); + ok(IsEqualGUID(riid, &GUID_NULL), "got riid %s\n", wine_dbgstr_guid(riid)); + ok(wFlags == INVOKE_FUNC, "expected INVOKE_FUNC instead of 0x%x\n", wFlags); + ok(pDispParams->cArgs == 1, "expected arg count 1, got %d\n", pDispParams->cArgs); + ok(V_VT(arg0) == VT_BSTR, "expected VT_BSTR, got %d\n", V_VT(arg0)); + fonteventsdisp_invoke_arg0 = SysAllocString(V_BSTR(arg0)); fonteventsdisp_invoke_called++; return S_OK; } @@ -320,16 +339,43 @@ FontEventsDisp_QueryInterface, FontEventsDisp_AddRef, FontEventsDisp_Release, - NULL, - NULL, - NULL, + FontEventsDisp_GetTypeInfoCount, + FontEventsDisp_GetTypeInfo, + FontEventsDisp_GetIDsOfNames, FontEventsDisp_Invoke }; static IFontEventsDisp FontEventsDisp = { &FontEventsDisp_Vtbl }; + struct font_dispid + { + DISPID dispid; + const WCHAR *name; + }; + static void test_font_events_disp(void) { + static const WCHAR nameW[] = {'N','a','m','e',0}; + static const WCHAR sizeW[] = {'S','i','z','e',0}; + static const WCHAR boldW[] = {'B','o','l','d',0}; + static const WCHAR italicW[] = {'I','t','a','l','i','c',0}; + static const WCHAR underlineW[] = {'U','n','d','e','r','l','i','n','e',0}; + static const WCHAR strikeW[] = {'S','t','r','i','k','e','t','h','r','o','u','g','h',0}; + static const WCHAR weightW[] = {'W','e','i','g','h','t',0}; + static const WCHAR charsetW[] = {'C','h','a','r','s','e','t',0}; + + static const struct font_dispid font_dispids[] = + { + { DISPID_FONT_NAME, nameW }, + { DISPID_FONT_SIZE, sizeW }, + { DISPID_FONT_BOLD, boldW }, + { DISPID_FONT_ITALIC, italicW }, + { DISPID_FONT_UNDER, underlineW }, + { DISPID_FONT_STRIKE, strikeW }, + { DISPID_FONT_WEIGHT, weightW }, + { DISPID_FONT_CHARSET, charsetW } + }; + IFont *pFont; IFont *pFont2; IConnectionPointContainer *pCPC; @@ -340,6 +386,7 @@ IFontDisp *pFontDisp; DISPPARAMS dispparams; VARIANTARG vararg; + INT i; fontdesc.cbSizeofstruct = sizeof(fontdesc); fontdesc.lpstrName = MSSansSerif_font; @@ -364,6 +411,7 @@ EXPECT_HR(hr, S_OK); IConnectionPoint_Release(pCP); + fonteventsdisp_invoke_called = 0; hr = IFont_put_Bold(pFont, TRUE); EXPECT_HR(hr, S_OK); @@ -372,30 +420,73 @@ hr = IFont_QueryInterface(pFont, &IID_IFontDisp, (void **)&pFontDisp); EXPECT_HR(hr, S_OK); - V_VT(&vararg) = VT_BOOL; - V_BOOL(&vararg) = VARIANT_FALSE; - dispparams.cNamedArgs = 0; - dispparams.rgdispidNamedArgs = NULL; - dispparams.cArgs = 1; - dispparams.rgvarg = &vararg; - hr = IFontDisp_Invoke(pFontDisp, DISPID_FONT_BOLD, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); - EXPECT_HR(hr, S_OK); + for (i = 0; i < sizeof(font_dispids)/sizeof(font_dispids[0]); i++) + { + switch (font_dispids[i].dispid) + { + case DISPID_FONT_NAME: + { + static const WCHAR arialW[] = {'A','r','i','a','l',0}; + V_VT(&vararg) = VT_BSTR; + V_BSTR(&vararg) = SysAllocString(arialW); + break; + } + case DISPID_FONT_SIZE: + V_VT(&vararg) = VT_CY; + S(V_CY(&vararg)).Lo = 25; + S(V_CY(&vararg)).Hi = 0; + break; + case DISPID_FONT_BOLD: + V_VT(&vararg) = VT_BOOL; + V_BOOL(&vararg) = VARIANT_FALSE; + break; + case DISPID_FONT_ITALIC: + case DISPID_FONT_UNDER: + case DISPID_FONT_STRIKE: + V_VT(&vararg) = VT_BOOL; + V_BOOL(&vararg) = VARIANT_TRUE; + break; + case DISPID_FONT_WEIGHT: + V_VT(&vararg) = VT_I2; + V_I2(&vararg) = FW_BLACK; + break; + case DISPID_FONT_CHARSET: + V_VT(&vararg) = VT_I2; + V_I2(&vararg) = 1; + break; + default: + ; + } + + dispparams.cNamedArgs = 0; + dispparams.rgdispidNamedArgs = NULL; + dispparams.cArgs = 1; + dispparams.rgvarg = &vararg; + fonteventsdisp_invoke_called = 0; + hr = IFontDisp_Invoke(pFontDisp, font_dispids[i].dispid, &IID_NULL, 0, DISPATCH_PROPERTYPUT, &dispparams, NULL, NULL, NULL); + ok(hr == S_OK, "dispid=%d, got 0x%08x\n", font_dispids[i].dispid, hr); + ok(fonteventsdisp_invoke_called == 1, "dispid=%d, DISPID_FONT_CHANGED not called, got %d\n", font_dispids[i].dispid, + fonteventsdisp_invoke_called); + if (hr == S_OK) + { + ok(!lstrcmpW(font_dispids[i].name, fonteventsdisp_invoke_arg0), "dispid=%d, got %s, expected %s\n", + font_dispids[i].dispid, wine_dbgstr_w(fonteventsdisp_invoke_arg0), wine_dbgstr_w(font_dispids[i].name)); + SysFreeString(fonteventsdisp_invoke_arg0); + } + VariantClear(&vararg); + } IFontDisp_Release(pFontDisp); - ok(fonteventsdisp_invoke_called == 2, "IFontEventDisp::Invoke was called %d times instead of twice\n", - fonteventsdisp_invoke_called); - hr = IFont_Clone(pFont, &pFont2); EXPECT_HR(hr, S_OK); IFont_Release(pFont); + /* this test shows that the notification routine isn't called again */ + fonteventsdisp_invoke_called = 0; hr = IFont_put_Bold(pFont2, FALSE); EXPECT_HR(hr, S_OK); - - /* this test shows that the notification routine isn't called again */ - ok(fonteventsdisp_invoke_called == 2, "IFontEventDisp::Invoke was called %d times instead of twice\n", - fonteventsdisp_invoke_called); + ok(fonteventsdisp_invoke_called == 0, "got %d\n", fonteventsdisp_invoke_called); IFont_Release(pFont2); } diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/olepicture.c wine1.7-1.7.16/dlls/oleaut32/tests/olepicture.c --- wine1.7-1.7.13/dlls/oleaut32/tests/olepicture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/olepicture.c 2014-04-04 19:13:44.000000000 +0000 @@ -412,12 +412,14 @@ { IPictureDisp *picdisp; HRESULT hr; - VARIANTARG vararg; + VARIANTARG vararg, args[10]; DISPPARAMS dispparams; VARIANT varresult; IStream *stream; HGLOBAL hglob; void *data; + HDC hdc; + int i; hglob = GlobalAlloc (0, sizeof(gifimage)); data = GlobalLock(hglob); @@ -477,6 +479,44 @@ hr = IPictureDisp_Invoke(picdisp, DISPID_PICT_HPAL, &IID_NULL, 0, DISPATCH_PROPERTYGET, &dispparams, &varresult, NULL, NULL); ok(hr == DISP_E_BADPARAMCOUNT, "IPictureDisp_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08x\n", hr); + /* DISPID_PICT_RENDER */ + hdc = GetDC(0); + + for (i = 0; i < sizeof(args)/sizeof(args[0]); i++) + V_VT(&args[i]) = VT_I4; + + V_I4(&args[0]) = 0; + V_I4(&args[1]) = 10; + V_I4(&args[2]) = 10; + V_I4(&args[3]) = 0; + V_I4(&args[4]) = 0; + V_I4(&args[5]) = 10; + V_I4(&args[6]) = 10; + V_I4(&args[7]) = 0; + V_I4(&args[8]) = 0; + V_I4(&args[9]) = HandleToLong(hdc); + + dispparams.rgvarg = args; + dispparams.rgdispidNamedArgs = NULL; + dispparams.cArgs = 10; + dispparams.cNamedArgs = 0; + + V_VT(&varresult) = VT_EMPTY; + hr = IPictureDisp_Invoke(picdisp, DISPID_PICT_RENDER, &GUID_NULL, 0, DISPATCH_METHOD, &dispparams, &varresult, NULL, NULL); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* Try with one argument set to VT_I2, it'd still work if coerced. */ + V_VT(&args[3]) = VT_I2; + hr = IPictureDisp_Invoke(picdisp, DISPID_PICT_RENDER, &GUID_NULL, 0, DISPATCH_METHOD, &dispparams, &varresult, NULL, NULL); + ok(hr == DISP_E_TYPEMISMATCH, "got 0x%08x\n", hr); + V_VT(&args[3]) = VT_I4; + + /* Wrong argument count */ + dispparams.cArgs = 9; + hr = IPictureDisp_Invoke(picdisp, DISPID_PICT_RENDER, &GUID_NULL, 0, DISPATCH_METHOD, &dispparams, &varresult, NULL, NULL); + ok(hr == DISP_E_BADPARAMCOUNT, "got 0x%08x\n", hr); + + ReleaseDC(NULL, hdc); IPictureDisp_Release(picdisp); } @@ -602,6 +642,55 @@ IStream_Release(stream); } +static HRESULT picture_render(IPicture *iface, HDC hdc, LONG x, LONG y, LONG cx, LONG cy, + OLE_XPOS_HIMETRIC xSrc, + OLE_YPOS_HIMETRIC ySrc, + OLE_XSIZE_HIMETRIC cxSrc, + OLE_YSIZE_HIMETRIC cySrc, + const RECT *bounds) +{ + VARIANT ret, args[10]; + HRESULT hr, hr_disp; + DISPPARAMS params; + IDispatch *disp; + int i; + + hr = IPicture_Render(iface, hdc, x, y, cx, cy, xSrc, ySrc, cxSrc, cySrc, bounds); + + IPicture_QueryInterface(iface, &IID_IDispatch, (void**)&disp); + + /* This is broken on 64 bits - accepted pointer argument type is still VT_I4 */ + for (i = 0; i < sizeof(args)/sizeof(args[0]); i++) + V_VT(&args[i]) = VT_I4; + + /* pack arguments and call */ + V_INT_PTR(&args[0]) = (INT_PTR)bounds; + V_I4(&args[1]) = cySrc; + V_I4(&args[2]) = cxSrc; + V_I4(&args[3]) = ySrc; + V_I4(&args[4]) = xSrc; + V_I4(&args[5]) = cy; + V_I4(&args[6]) = cx; + V_I4(&args[7]) = y; + V_I4(&args[8]) = x; + V_I4(&args[9]) = HandleToLong(hdc); + + params.rgvarg = args; + params.rgdispidNamedArgs = NULL; + params.cArgs = 10; + params.cNamedArgs = 0; + + V_VT(&ret) = VT_EMPTY; + hr_disp = IDispatch_Invoke(disp, DISPID_PICT_RENDER, &GUID_NULL, 0, DISPATCH_METHOD, + ¶ms, &ret, NULL, NULL); + ok(hr == hr_disp, "DISPID_PICT_RENDER returned wrong code, 0x%08x, expected 0x%08x\n", + hr_disp, hr); + + IDispatch_Release(disp); + + return hr; +} + static void test_Render(void) { IPicture *pic; @@ -619,22 +708,22 @@ ok(hres == S_OK, "IPicture_get_Type does not return S_OK, but 0x%08x\n", hres); ok(type == PICTYPE_UNINITIALIZED, "Expected type = PICTYPE_UNINITIALIZED, got = %d\n", type); /* zero dimensions */ - hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL); + hres = picture_render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); /* nonzero dimensions, PICTYPE_UNINITIALIZED */ - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 10, NULL); ole_expect(hres, S_OK); IPicture_Release(pic); @@ -649,19 +738,19 @@ OleCreatePictureIndirect(&desc, &IID_IPicture, TRUE, (VOID**)&pic); /* zero dimensions, PICTYPE_ICON */ - hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL); + hres = picture_render(pic, hdc, 0, 0, 0, 0, 0, 0, 0, 0, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 10, 0, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 10, 0, 0, 0, 0, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 0, 10, 0, 0, 10, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 10, 0, 0, 0, 10, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); - hres = IPicture_Render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL); + hres = picture_render(pic, hdc, 0, 0, 0, 0, 0, 0, 10, 10, NULL); ole_expect(hres, CTL_E_INVALIDPROPERTYVALUE); /* Check if target size and position is respected */ @@ -673,7 +762,7 @@ SetPixelV(hdc, 10, 10, 0x00223344); expected = GetPixel(hdc, 0, 0); - hres = IPicture_Render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL); + hres = picture_render(pic, hdc, 1, 1, 9, 9, 0, 0, pWidth, -pHeight, NULL); ole_expect(hres, S_OK); if(hres != S_OK) { diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/safearray.c wine1.7-1.7.16/dlls/oleaut32/tests/safearray.c --- wine1.7-1.7.13/dlls/oleaut32/tests/safearray.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/safearray.c 2014-04-04 19:13:44.000000000 +0000 @@ -123,7 +123,7 @@ static HRESULT WINAPI RecordInfo_RecordInit(IRecordInfo *iface, PVOID pvNew) { - ok(0, "enexpected call\n"); + ok(0, "unexpected call\n"); return E_NOTIMPL; } @@ -1062,10 +1062,11 @@ static void test_SafeArrayGetPutElement(void) { SAFEARRAYBOUND sab[4]; - LONG indices[NUM_DIMENSIONS]; + LONG indices[NUM_DIMENSIONS], index; SAFEARRAY *sa; HRESULT hres; int value = 0, gotvalue, dimension; + IRecordInfoImpl *irec; unsigned int x,y,z,a; for (dimension = 0; dimension < NUM_DIMENSIONS; dimension++) @@ -1079,8 +1080,6 @@ return; /* Some early versions can't handle > 3 dims */ ok(sa->cbElements == sizeof(value), "int size mismatch\n"); - if (sa->cbElements != sizeof(value)) - return; /* Failure cases */ for (x = 0; x < NUM_DIMENSIONS; x++) @@ -1184,6 +1183,34 @@ } hres = SafeArrayDestroy(sa); ok(hres == S_OK, "got 0x%08x\n", hres); + + /* VT_RECORD array */ + irec = IRecordInfoImpl_Construct(); + irec->ref = 1; + + sab[0].lLbound = 0; + sab[0].cElements = 8; + + sa = pSafeArrayCreateEx(VT_RECORD, 1, sab, &irec->IRecordInfo_iface); + ok(sa != NULL, "failed to create array\n"); + ok(irec->ref == 2, "got %d\n", irec->ref); + + index = 0; + irec->recordcopy = 0; + hres = SafeArrayPutElement(sa, &index, (void*)0xdeadbeef); + ok(hres == S_OK, "got 0x%08x\n", hres); + ok(irec->recordcopy == 1, "got %d\n", irec->recordcopy); + + index = 0; + irec->recordcopy = 0; + hres = SafeArrayGetElement(sa, &index, (void*)0xdeadbeef); + ok(hres == S_OK, "got 0x%08x\n", hres); + ok(irec->recordcopy == 1, "got %d\n", irec->recordcopy); + + hres = SafeArrayDestroy(sa); + ok(hres == S_OK, "got 0x%08x\n", hres); + ok(irec->ref == 1, "got %d\n", irec->ref); + IRecordInfo_Release(&irec->IRecordInfo_iface); } static void test_SafeArrayGetPutElement_BSTR(void) @@ -1204,8 +1231,6 @@ return; ok(sa->cbElements == sizeof(BSTR), "BSTR size mismatch\n"); - if (sa->cbElements != sizeof(BSTR)) - return; indices[0] = sab.lLbound; value = SysAllocString(szTest); @@ -1268,8 +1293,6 @@ return; ok(sa->cbElements == sizeof(LPUNKNOWN), "LPUNKNOWN size mismatch\n"); - if (sa->cbElements != sizeof(LPUNKNOWN)) - return; indices[0] = sab.lLbound; xtunk.ref = 1; @@ -1302,8 +1325,6 @@ return; ok(sa->cbElements == sizeof(LPUNKNOWN), "LPUNKNOWN size mismatch\n"); - if (sa->cbElements != sizeof(LPUNKNOWN)) - return; indices[0] = 2; xtunk.ref = 1; @@ -1334,8 +1355,6 @@ return; ok(sa->cbElements == sizeof(VARIANT), "VARIANT size mismatch\n"); - if (sa->cbElements != sizeof(VARIANT)) - return; indices[0] = sab.lLbound; V_VT(&value) = VT_I4; @@ -1389,8 +1408,6 @@ return; ok(sa->cbElements == sizeof(int), "int size mismatch\n"); - if (sa->cbElements != sizeof(int)) - return; /* Fill the source array with some data; it doesn't matter what */ for (dimension = 0; dimension < size; dimension++) @@ -1980,6 +1997,63 @@ ok(hres == S_OK, "SAD failed, error code %x.\n", hres); } +static void test_safearray_layout(void) +{ + IRecordInfoImpl *irec; + IRecordInfo *record; + GUID guid, *guidptr; + SAFEARRAYBOUND sab; + SAFEARRAY *sa; + DWORD *dwptr; + HRESULT hr; + + sab.lLbound = 0; + sab.cElements = 10; + + /* GUID field */ + sa = SafeArrayCreate(VT_UNKNOWN, 1, &sab); + ok(sa != NULL, "got %p\n", sa); + + guidptr = (GUID*)sa - 1; + ok(IsEqualIID(guidptr, &IID_IUnknown), "got %s\n", wine_dbgstr_guid(guidptr)); + + hr = SafeArraySetIID(sa, &IID_IDispatch); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualIID(guidptr, &IID_IDispatch), "got %s\n", wine_dbgstr_guid(guidptr)); + + memcpy(guidptr, &IID_IUnknown, sizeof(GUID)); + hr = SafeArrayGetIID(sa, &guid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualIID(&guid, &IID_IUnknown), "got %s\n", wine_dbgstr_guid(&guid)); + + hr = SafeArrayDestroy(sa); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* VARTYPE field */ + sa = SafeArrayCreate(VT_UI1, 1, &sab); + ok(sa != NULL, "got %p\n", sa); + + dwptr = (DWORD*)sa - 1; + ok(*dwptr == VT_UI1, "got %d\n", *dwptr); + + hr = SafeArrayDestroy(sa); + ok(hr == S_OK, "got 0x%08x\n", hr); + + /* IRecordInfo pointer */ + irec = IRecordInfoImpl_Construct(); + irec->ref = 1; + + sa = pSafeArrayCreateEx(VT_RECORD, 1, &sab, &irec->IRecordInfo_iface); + ok(sa != NULL, "failed to create array\n"); + + record = *((IRecordInfo**)sa - 1); + ok(record == &irec->IRecordInfo_iface, "got %p\n", record); + + hr = SafeArrayDestroy(sa); + ok(hr == S_OK, "got 0x%08x\n", hr); + IRecordInfo_Release(&irec->IRecordInfo_iface); +} + START_TEST(safearray) { hOleaut32 = GetModuleHandleA("oleaut32.dll"); @@ -2012,4 +2086,5 @@ test_SafeArrayGetPutElement_IUnknown(); test_SafeArrayRedim_IUnknown(); test_SafeArrayGetPutElement_VARIANT(); + test_safearray_layout(); } diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/test_reg.idl wine1.7-1.7.16/dlls/oleaut32/tests/test_reg.idl --- wine1.7-1.7.13/dlls/oleaut32/tests/test_reg.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/test_reg.idl 2014-04-04 19:13:44.000000000 +0000 @@ -137,5 +137,9 @@ { [propget, id(DISPID_VALUE)] LONG test([in] LONG i); + [propputref, id(1)] + LONG testprop([in] LONG *i); + [propputref, id(2)] + LONG testprop2([in] IUnknown *i); } } diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/typelib.c wine1.7-1.7.16/dlls/oleaut32/tests/typelib.c --- wine1.7-1.7.13/dlls/oleaut32/tests/typelib.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/typelib.c 2014-04-04 19:13:44.000000000 +0000 @@ -136,6 +136,16 @@ return i+1; } +static LONG WINAPI invoketest_putref_testprop(IInvokeTest *iface, LONG *i) +{ + return *i+2; +} + +static LONG WINAPI invoketest_putref_testprop2(IInvokeTest *iface, IUnknown *i) +{ + return 6; +} + static const IInvokeTestVtbl invoketestvtbl = { invoketest_QueryInterface, invoketest_AddRef, @@ -144,7 +154,9 @@ invoketest_GetTypeInfo, invoketest_GetIDsOfNames, invoketest_Invoke, - invoketest_get_test + invoketest_get_test, + invoketest_putref_testprop, + invoketest_putref_testprop2 }; static IInvokeTest invoketest = { &invoketestvtbl }; @@ -672,6 +684,7 @@ const char *filenameA; WCHAR filename[MAX_PATH]; TYPEATTR *attr; + LONG l; hr = LoadTypeLib(wszStdOle2, &pTypeLib); ok_ole_success(hr, LoadTypeLib); @@ -866,8 +879,6 @@ V_VT(&args[0]) = VT_I4; V_I4(&args[0]) = 0; - V_VT(&res) = VT_EMPTY; - i = 0; V_VT(&res) = VT_EMPTY; V_I4(&res) = 0; @@ -893,6 +904,48 @@ ok(V_VT(&res) == VT_I4, "got %d\n", V_VT(&res)); ok(V_I4(&res) == 1, "got %d\n", V_I4(&res)); + /* DISPATCH_PROPERTYPUTREF */ + l = 1; + V_VT(&args[0]) = VT_I4|VT_BYREF; + V_I4REF(&args[0]) = &l; + + dispidMember = DISPID_PROPERTYPUT; + dispparams.cArgs = 1; + dispparams.cNamedArgs = 1; + dispparams.rgdispidNamedArgs = &dispidMember; + dispparams.rgvarg = args; + + i = 0; + V_VT(&res) = VT_EMPTY; + V_I4(&res) = 0; + hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, 1, DISPATCH_PROPERTYPUTREF, &dispparams, &res, NULL, &i); + ok(hr == S_OK, "got 0x%08x, %d\n", hr, i); + ok(V_VT(&res) == VT_I4, "got %d\n", V_VT(&res)); + ok(V_I4(&res) == 3, "got %d\n", V_I4(&res)); + + i = 0; + V_VT(&res) = VT_EMPTY; + V_I4(&res) = 0; + hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, 1, DISPATCH_PROPERTYPUT, &dispparams, &res, NULL, &i); + ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x, %d\n", hr, i); + + i = 0; + V_VT(&args[0]) = VT_UNKNOWN; + V_UNKNOWN(&args[0]) = NULL; + + V_VT(&res) = VT_EMPTY; + V_I4(&res) = 0; + hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, 2, DISPATCH_PROPERTYPUTREF, &dispparams, &res, NULL, &i); + ok(hr == S_OK, "got 0x%08x, %d\n", hr, i); + ok(V_VT(&res) == VT_I4, "got %d\n", V_VT(&res)); + ok(V_I4(&res) == 6, "got %d\n", V_I4(&res)); + + i = 0; + V_VT(&res) = VT_EMPTY; + V_I4(&res) = 0; + hr = ITypeInfo_Invoke(pTypeInfo, &invoketest, 2, DISPATCH_PROPERTYPUT, &dispparams, &res, NULL, &i); + ok(hr == DISP_E_MEMBERNOTFOUND, "got 0x%08x, %d\n", hr, i); + ITypeInfo_Release(pTypeInfo); ITypeLib_Release(pTypeLib); DeleteFileA(filenameA); @@ -4806,7 +4859,7 @@ "" "" " " "" "" @@ -5323,6 +5376,14 @@ ok(hr == S_OK, "got %08x\n", hr); hr = RegisterTypeLib(tl, filenameW, NULL); + if (hr == TYPE_E_REGISTRYACCESS) + { + win_skip("Insufficient privileges to register typelib in the registry\n"); + ITypeLib_Release(tl); + DeleteFileW(filenameW); + CoUninitialize(); + return; + } ok(hr == S_OK, "got %08x\n", hr); ITypeLib_Release(tl); diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/vartest.c wine1.7-1.7.16/dlls/oleaut32/tests/vartest.c --- wine1.7-1.7.13/dlls/oleaut32/tests/vartest.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/vartest.c 2014-04-04 19:13:44.000000000 +0000 @@ -24,6 +24,7 @@ #include #include +#define COBJMACROS #define CONST_VTABLE #include "windef.h" @@ -96,6 +97,198 @@ #define R8_MAX DBL_MAX #define R8_MIN DBL_MIN +typedef struct IRecordInfoImpl +{ + IRecordInfo IRecordInfo_iface; + LONG ref; + unsigned int recordclear; + unsigned int getsize; + unsigned int recordcopy; + struct __tagBRECORD *rec; +} IRecordInfoImpl; + +static inline IRecordInfoImpl *impl_from_IRecordInfo(IRecordInfo *iface) +{ + return CONTAINING_RECORD(iface, IRecordInfoImpl, IRecordInfo_iface); +} + +static HRESULT WINAPI RecordInfo_QueryInterface(IRecordInfo *iface, REFIID riid, void **obj) +{ + *obj = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IRecordInfo)) + { + *obj = iface; + IRecordInfo_AddRef(iface); + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI RecordInfo_AddRef(IRecordInfo *iface) +{ + IRecordInfoImpl* This = impl_from_IRecordInfo(iface); + return InterlockedIncrement(&This->ref); +} + +static ULONG WINAPI RecordInfo_Release(IRecordInfo *iface) +{ + IRecordInfoImpl* This = impl_from_IRecordInfo(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + if (!ref) + HeapFree(GetProcessHeap(), 0, This); + + return ref; +} + +static HRESULT WINAPI RecordInfo_RecordInit(IRecordInfo *iface, PVOID pvNew) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_RecordClear(IRecordInfo *iface, void *data) +{ + IRecordInfoImpl* This = impl_from_IRecordInfo(iface); + This->recordclear++; + This->rec->pvRecord = NULL; + return S_OK; +} + +static HRESULT WINAPI RecordInfo_RecordCopy(IRecordInfo *iface, void *src, void *dest) +{ + IRecordInfoImpl* This = impl_from_IRecordInfo(iface); + This->recordcopy++; + ok(src == (void*)0xdeadbeef, "wrong src pointer %p\n", src); + return S_OK; +} + +static HRESULT WINAPI RecordInfo_GetGuid(IRecordInfo *iface, GUID *pguid) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_GetName(IRecordInfo *iface, BSTR *pbstrName) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_GetSize(IRecordInfo *iface, ULONG* size) +{ + IRecordInfoImpl* This = impl_from_IRecordInfo(iface); + This->getsize++; + *size = 0; + return S_OK; +} + +static HRESULT WINAPI RecordInfo_GetTypeInfo(IRecordInfo *iface, ITypeInfo **ppTypeInfo) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_GetField(IRecordInfo *iface, PVOID pvData, + LPCOLESTR szFieldName, VARIANT *pvarField) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_GetFieldNoCopy(IRecordInfo *iface, PVOID pvData, + LPCOLESTR szFieldName, VARIANT *pvarField, PVOID *ppvDataCArray) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_PutField(IRecordInfo *iface, ULONG wFlags, PVOID pvData, + LPCOLESTR szFieldName, VARIANT *pvarField) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_PutFieldNoCopy(IRecordInfo *iface, ULONG wFlags, + PVOID pvData, LPCOLESTR szFieldName, VARIANT *pvarField) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_GetFieldNames(IRecordInfo *iface, ULONG *pcNames, + BSTR *rgBstrNames) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static BOOL WINAPI RecordInfo_IsMatchingType(IRecordInfo *iface, IRecordInfo *info2) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static PVOID WINAPI RecordInfo_RecordCreate(IRecordInfo *iface) +{ + ok(0, "unexpected call\n"); + return NULL; +} + +static HRESULT WINAPI RecordInfo_RecordCreateCopy(IRecordInfo *iface, PVOID pvSource, + PVOID *ppvDest) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI RecordInfo_RecordDestroy(IRecordInfo *iface, PVOID pvRecord) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static const IRecordInfoVtbl RecordInfoVtbl = +{ + RecordInfo_QueryInterface, + RecordInfo_AddRef, + RecordInfo_Release, + RecordInfo_RecordInit, + RecordInfo_RecordClear, + RecordInfo_RecordCopy, + RecordInfo_GetGuid, + RecordInfo_GetName, + RecordInfo_GetSize, + RecordInfo_GetTypeInfo, + RecordInfo_GetField, + RecordInfo_GetFieldNoCopy, + RecordInfo_PutField, + RecordInfo_PutFieldNoCopy, + RecordInfo_GetFieldNames, + RecordInfo_IsMatchingType, + RecordInfo_RecordCreate, + RecordInfo_RecordCreateCopy, + RecordInfo_RecordDestroy +}; + +static IRecordInfoImpl *get_test_recordinfo(void) +{ + IRecordInfoImpl *rec; + + rec = HeapAlloc(GetProcessHeap(), 0, sizeof(IRecordInfoImpl)); + rec->IRecordInfo_iface.lpVtbl = &RecordInfoVtbl; + rec->ref = 1; + rec->recordclear = 0; + rec->getsize = 0; + rec->recordcopy = 0; + + return rec; +} + static void init(void) { BSTR bstr; @@ -349,14 +542,11 @@ static void test_VariantInit(void) { - VARIANTARG v1, v2; + VARIANT v; - /* Test that VariantInit() only sets the type */ - memset(&v1, -1, sizeof(v1)); - v2 = v1; - V_VT(&v2) = VT_EMPTY; - VariantInit(&v1); - ok(!memcmp(&v1, &v2, sizeof(v1)), "VariantInit() set extra fields\n"); + memset(&v, -1, sizeof(v)); + VariantInit(&v); + ok(V_VT(&v) == VT_EMPTY, "VariantInit() returned vt %d\n", V_VT(&v)); } /* All possible combinations of extra V_VT() flags */ @@ -441,6 +631,8 @@ static void test_VariantClear(void) { + struct __tagBRECORD *rec; + IRecordInfoImpl *recinfo; HRESULT hres; VARIANTARG v; VARIANT v2; @@ -559,10 +751,28 @@ ok(V_DISPATCHREF(&v) == (IDispatch**)&punk, "dispatch ref %p\n", V_DISPATCHREF(&v)); /* Check that nothing got called */ ok(test_myVariantClearImpl.events == 0, "Unexpected call. events %08x\n", test_myVariantClearImpl.events); + + /* RECORD */ + recinfo = get_test_recordinfo(); + V_VT(&v) = VT_RECORD; + rec = &V_UNION(&v, brecVal); + rec->pRecInfo = &recinfo->IRecordInfo_iface; + rec->pvRecord = (void*)0xdeadbeef; + recinfo->recordclear = 0; + recinfo->ref = 2; + recinfo->rec = rec; + hres = VariantClear(&v); + ok(hres == S_OK, "ret %08x\n", hres); + ok(rec->pvRecord == NULL, "got %p\n", rec->pvRecord); + ok(recinfo->recordclear == 1, "got %d\n", recinfo->recordclear); + ok(recinfo->ref == 1, "got %d\n", recinfo->ref); + IRecordInfo_Release(&recinfo->IRecordInfo_iface); } static void test_VariantCopy(void) { + struct __tagBRECORD *rec; + IRecordInfoImpl *recinfo; VARIANTARG vSrc, vDst; VARTYPE vt; size_t i; @@ -678,6 +888,33 @@ } VariantClear(&vDst); } + + /* copy RECORD */ + recinfo = get_test_recordinfo(); + + memset(&vDst, 0, sizeof(vDst)); + V_VT(&vDst) = VT_EMPTY; + + V_VT(&vSrc) = VT_RECORD; + rec = &V_UNION(&vSrc, brecVal); + rec->pRecInfo = &recinfo->IRecordInfo_iface; + rec->pvRecord = (void*)0xdeadbeef; + + recinfo->recordclear = 0; + recinfo->recordcopy = 0; + recinfo->getsize = 0; + recinfo->rec = rec; + hres = VariantCopy(&vDst, &vSrc); + ok(hres == S_OK, "ret %08x\n", hres); + + rec = &V_UNION(&vDst, brecVal); + ok(rec->pvRecord != (void*)0xdeadbeef && rec->pvRecord != NULL, "got %p\n", rec->pvRecord); + ok(rec->pRecInfo == &recinfo->IRecordInfo_iface, "got %p\n", rec->pRecInfo); + ok(recinfo->getsize == 1, "got %d\n", recinfo->recordclear); + ok(recinfo->recordcopy == 1, "got %d\n", recinfo->recordclear); + + VariantClear(&vDst); + VariantClear(&vSrc); } /* Determine if a vt is valid for VariantCopyInd() */ @@ -5763,11 +6000,11 @@ VARTYPE i; HRESULT hres; + CHECKPTR(VarAnd); + true_str = SysAllocString(szTrue); false_str = SysAllocString(szFalse); - CHECKPTR(VarAnd); - /* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < sizeof(ExtraFlags)/sizeof(ExtraFlags[0]); i++) { @@ -7242,11 +7479,11 @@ HRESULT hres; double r; + CHECKPTR(VarDiv); + num1_str = SysAllocString(str1); num2_str = SysAllocString(str2); - CHECKPTR(VarDiv); - /* Test all possible flag/vt combinations & the resulting vt type */ for (i = 0; i < sizeof(ExtraFlags)/sizeof(ExtraFlags[0]); i++) { diff -Nru wine1.7-1.7.13/dlls/oleaut32/tests/vartype.c wine1.7-1.7.16/dlls/oleaut32/tests/vartype.c --- wine1.7-1.7.13/dlls/oleaut32/tests/vartype.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/tests/vartype.c 2014-04-04 19:13:44.000000000 +0000 @@ -739,11 +739,15 @@ CHECKPTR(VarI1FromR4); CONVERT(VarI1FromR4, -129.0f); EXPECT_OVERFLOW; + CONVERT(VarI1FromR4, -128.51f); EXPECT_OVERFLOW; + CONVERT(VarI1FromR4, -128.5f); EXPECT(-128); CONVERT(VarI1FromR4, -128.0f); EXPECT(-128); CONVERT(VarI1FromR4, -1.0f); EXPECT(-1); CONVERT(VarI1FromR4, 0.0f); EXPECT(0); CONVERT(VarI1FromR4, 1.0f); EXPECT(1); CONVERT(VarI1FromR4, 127.0f); EXPECT(127); + CONVERT(VarI1FromR4, 127.49f); EXPECT(127); + CONVERT(VarI1FromR4, 127.5f); EXPECT_OVERFLOW; CONVERT(VarI1FromR4, 128.0f); EXPECT_OVERFLOW; CONVERT(VarI1FromR4, -1.5f); EXPECT(-2); @@ -762,11 +766,15 @@ CHECKPTR(VarI1FromR8); CONVERT(VarI1FromR8, -129.0); EXPECT_OVERFLOW; + CONVERT(VarI1FromR8, -128.51); EXPECT_OVERFLOW; + CONVERT(VarI1FromR8, -128.5); EXPECT(-128); CONVERT(VarI1FromR8, -128.0); EXPECT(-128); CONVERT(VarI1FromR8, -1.0); EXPECT(-1); CONVERT(VarI1FromR8, 0.0); EXPECT(0); CONVERT(VarI1FromR8, 1.0); EXPECT(1); CONVERT(VarI1FromR8, 127.0); EXPECT(127); + CONVERT(VarI1FromR8, 127.49); EXPECT(127); + CONVERT(VarI1FromR8, 127.5); EXPECT_OVERFLOW; CONVERT(VarI1FromR8, 128.0); EXPECT_OVERFLOW; CONVERT(VarI1FromR8, -1.5); EXPECT(-2); @@ -983,9 +991,13 @@ CHECKPTR(VarUI1FromR4); CONVERT(VarUI1FromR4, -1.0f); EXPECT_OVERFLOW; + CONVERT(VarUI1FromR4, -0.51f); EXPECT_OVERFLOW; + CONVERT(VarUI1FromR4, -0.5f); EXPECT(0); CONVERT(VarUI1FromR4, 0.0f); EXPECT(0); CONVERT(VarUI1FromR4, 1.0f); EXPECT(1); CONVERT(VarUI1FromR4, 255.0f); EXPECT(255); + CONVERT(VarUI1FromR4, 255.49f); EXPECT(255); + CONVERT(VarUI1FromR4, 255.5f); EXPECT_OVERFLOW; CONVERT(VarUI1FromR4, 256.0f); EXPECT_OVERFLOW; /* Rounding */ @@ -1005,9 +1017,13 @@ CHECKPTR(VarUI1FromR8); CONVERT(VarUI1FromR8, -1.0); EXPECT_OVERFLOW; + CONVERT(VarUI1FromR8, -0.51); EXPECT_OVERFLOW; + CONVERT(VarUI1FromR8, -0.5); EXPECT(0); CONVERT(VarUI1FromR8, 0.0); EXPECT(0); CONVERT(VarUI1FromR8, 1.0); EXPECT(1); CONVERT(VarUI1FromR8, 255.0); EXPECT(255); + CONVERT(VarUI1FromR8, 255.49); EXPECT(255); + CONVERT(VarUI1FromR8, 255.5); EXPECT_OVERFLOW; CONVERT(VarUI1FromR8, 256.0); EXPECT_OVERFLOW; /* Rounding */ @@ -1281,11 +1297,15 @@ CHECKPTR(VarI2FromR4); CONVERT(VarI2FromR4, -32769.0f); EXPECT_OVERFLOW; + CONVERT(VarI2FromR4, -32768.51f); EXPECT_OVERFLOW; + CONVERT(VarI2FromR4, -32768.5f); EXPECT(-32768); CONVERT(VarI2FromR4, -32768.0f); EXPECT(-32768); CONVERT(VarI2FromR4, -1.0f); EXPECT(-1); CONVERT(VarI2FromR4, 0.0f); EXPECT(0); CONVERT(VarI2FromR4, 1.0f); EXPECT(1); CONVERT(VarI2FromR4, 32767.0f); EXPECT(32767); + CONVERT(VarI2FromR4, 32767.49f); EXPECT(32767); + CONVERT(VarI2FromR4, 32767.5f); EXPECT_OVERFLOW; CONVERT(VarI2FromR4, 32768.0f); EXPECT_OVERFLOW; /* Rounding */ @@ -1305,11 +1325,15 @@ CHECKPTR(VarI2FromR8); CONVERT(VarI2FromR8, -32769.0); EXPECT_OVERFLOW; + CONVERT(VarI2FromR8, -32768.51); EXPECT_OVERFLOW; + CONVERT(VarI2FromR8, -32768.5); EXPECT(-32768); CONVERT(VarI2FromR8, -32768.0); EXPECT(-32768); CONVERT(VarI2FromR8, -1.0); EXPECT(-1); CONVERT(VarI2FromR8, 0.0); EXPECT(0); CONVERT(VarI2FromR8, 1.0); EXPECT(1); CONVERT(VarI2FromR8, 32767.0); EXPECT(32767); + CONVERT(VarI2FromR8, 32767.49); EXPECT(32767); + CONVERT(VarI2FromR8, 32767.5); EXPECT_OVERFLOW; CONVERT(VarI2FromR8, 32768.0); EXPECT_OVERFLOW; /* Rounding */ @@ -1529,9 +1553,13 @@ CHECKPTR(VarUI2FromR4); CONVERT(VarUI2FromR4, -1.0f); EXPECT_OVERFLOW; + CONVERT(VarUI2FromR4, -0.51f); EXPECT_OVERFLOW; + CONVERT(VarUI2FromR4, -0.5f); EXPECT(0); CONVERT(VarUI2FromR4, 0.0f); EXPECT(0); CONVERT(VarUI2FromR4, 1.0f); EXPECT(1); CONVERT(VarUI2FromR4, 65535.0f); EXPECT(65535); + CONVERT(VarUI2FromR4, 65535.49f); EXPECT(65535); + CONVERT(VarUI2FromR4, 65535.5f); EXPECT_OVERFLOW; CONVERT(VarUI2FromR4, 65536.0f); EXPECT_OVERFLOW; /* Rounding */ @@ -1551,9 +1579,13 @@ CHECKPTR(VarUI2FromR8); CONVERT(VarUI2FromR8, -1.0); EXPECT_OVERFLOW; + CONVERT(VarUI2FromR8, -0.51); EXPECT_OVERFLOW; + CONVERT(VarUI2FromR8, -0.5); EXPECT(0); CONVERT(VarUI2FromR8, 0.0); EXPECT(0); CONVERT(VarUI2FromR8, 1.0); EXPECT(1); CONVERT(VarUI2FromR8, 65535.0); EXPECT(65535); + CONVERT(VarUI2FromR8, 65535.49); EXPECT(65535); + CONVERT(VarUI2FromR8, 65535.5); EXPECT_OVERFLOW; CONVERT(VarUI2FromR8, 65536.0); EXPECT_OVERFLOW; /* Rounding */ @@ -1792,11 +1824,15 @@ CHECKPTR(VarI4FromR8); CONVERT(VarI4FromR8, -2147483649.0); EXPECT_OVERFLOW; + CONVERT(VarI4FromR8, -2147483648.51); EXPECT_OVERFLOW; + CONVERT(VarI4FromR8, -2147483648.5); EXPECT(-2147483647 - 1); CONVERT(VarI4FromR8, -2147483648.0); EXPECT(-2147483647 - 1); CONVERT(VarI4FromR8, -1.0); EXPECT(-1); CONVERT(VarI4FromR8, 0.0); EXPECT(0); CONVERT(VarI4FromR8, 1.0); EXPECT(1); CONVERT(VarI4FromR8, 2147483647.0); EXPECT(2147483647); + CONVERT(VarI4FromR8, 2147483647.49); EXPECT(2147483647); + CONVERT(VarI4FromR8, 2147483647.5); EXPECT_OVERFLOW; CONVERT(VarI4FromR8, 2147483648.0); EXPECT_OVERFLOW; CONVERT(VarI4FromR8, -1.5); EXPECT(-2); @@ -2017,6 +2053,8 @@ CHECKPTR(VarUI4FromR4); /* We can't test max values as they are not exactly representable in a float */ CONVERT(VarUI4FromR4, -1.0f); EXPECT_OVERFLOW; + CONVERT(VarUI4FromR4, -0.51f); EXPECT_OVERFLOW; + CONVERT(VarUI4FromR4, -0.5f); EXPECT(0); CONVERT(VarUI4FromR4, 0.0f); EXPECT(0); CONVERT(VarUI4FromR4, 1.0f); EXPECT(1); @@ -2037,9 +2075,13 @@ CHECKPTR(VarUI4FromR8); CONVERT(VarUI4FromR8, -1.0); EXPECT_OVERFLOW; + CONVERT(VarUI4FromR4, -0.51f); EXPECT_OVERFLOW; + CONVERT(VarUI4FromR4, -0.5f); EXPECT(0); CONVERT(VarUI4FromR8, 0.0); EXPECT(0); CONVERT(VarUI4FromR8, 1.0); EXPECT(1); CONVERT(VarUI4FromR8, 4294967295.0); EXPECT(4294967295ul); + CONVERT(VarUI4FromR8, 4294967295.49); EXPECT(4294967295ul); + CONVERT(VarUI4FromR8, 4294967295.5); EXPECT_OVERFLOW; CONVERT(VarUI4FromR8, 4294967296.0); EXPECT_OVERFLOW; CONVERT(VarUI4FromR8, -1.5); EXPECT_OVERFLOW; diff -Nru wine1.7-1.7.13/dlls/oleaut32/variant.c wine1.7-1.7.16/dlls/oleaut32/variant.c --- wine1.7-1.7.13/dlls/oleaut32/variant.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/variant.c 2014-04-04 19:13:44.000000000 +0000 @@ -575,7 +575,8 @@ { TRACE("(%p)\n", pVarg); - V_VT(pVarg) = VT_EMPTY; /* Native doesn't set any other fields */ + /* Win8.1 zeroes whole struct. Previous implementations don't set any other fields. */ + V_VT(pVarg) = VT_EMPTY; } HRESULT VARIANT_ClearInd(VARIANTARG *pVarg) @@ -694,34 +695,32 @@ /****************************************************************************** * Copy an IRecordInfo object contained in a variant. */ -static HRESULT VARIANT_CopyIRecordInfo(struct __tagBRECORD* pBr) +static HRESULT VARIANT_CopyIRecordInfo(VARIANT *dest, VARIANT *src) { - HRESULT hres = S_OK; + struct __tagBRECORD *dest_rec = &V_UNION(dest, brecVal); + struct __tagBRECORD *src_rec = &V_UNION(src, brecVal); + HRESULT hr = S_OK; + ULONG size; - if (pBr->pRecInfo) + if (!src_rec->pRecInfo) { - ULONG ulSize; + if (src_rec->pvRecord) return E_INVALIDARG; + return S_OK; + } - hres = IRecordInfo_GetSize(pBr->pRecInfo, &ulSize); - if (SUCCEEDED(hres)) - { - PVOID pvRecord = HeapAlloc(GetProcessHeap(), 0, ulSize); - if (!pvRecord) - hres = E_OUTOFMEMORY; - else - { - memcpy(pvRecord, pBr->pvRecord, ulSize); - pBr->pvRecord = pvRecord; + hr = IRecordInfo_GetSize(src_rec->pRecInfo, &size); + if (FAILED(hr)) return hr; - hres = IRecordInfo_RecordCopy(pBr->pRecInfo, pvRecord, pvRecord); - if (SUCCEEDED(hres)) - IRecordInfo_AddRef(pBr->pRecInfo); - } - } - } - else if (pBr->pvRecord) - hres = E_INVALIDARG; - return hres; + /* This could look cleaner if only RecordCreate() was used, but native doesn't use it. + Memory should be allocated in a same way as RecordCreate() does, so RecordDestroy() + could free it later. */ + dest_rec->pvRecord = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + if (!dest_rec->pvRecord) return E_OUTOFMEMORY; + + dest_rec->pRecInfo = src_rec->pRecInfo; + IRecordInfo_AddRef(src_rec->pRecInfo); + + return IRecordInfo_RecordCopy(src_rec->pRecInfo, src_rec->pvRecord, dest_rec->pvRecord); } /****************************************************************************** @@ -771,29 +770,25 @@ if (!V_ISBYREF(pvargSrc)) { - if (V_ISARRAY(pvargSrc)) - { - if (V_ARRAY(pvargSrc)) - hres = SafeArrayCopy(V_ARRAY(pvargSrc), &V_ARRAY(pvargDest)); - } - else if (V_VT(pvargSrc) == VT_BSTR) + switch (V_VT(pvargSrc)) { + case VT_BSTR: V_BSTR(pvargDest) = SysAllocStringByteLen((char*)V_BSTR(pvargSrc), SysStringByteLen(V_BSTR(pvargSrc))); if (!V_BSTR(pvargDest)) - { - TRACE("!V_BSTR(pvargDest), SysAllocStringByteLen() failed to allocate %d bytes\n", SysStringByteLen(V_BSTR(pvargSrc))); hres = E_OUTOFMEMORY; - } - } - else if (V_VT(pvargSrc) == VT_RECORD) - { - hres = VARIANT_CopyIRecordInfo(&V_UNION(pvargDest,brecVal)); - } - else if (V_VT(pvargSrc) == VT_DISPATCH || - V_VT(pvargSrc) == VT_UNKNOWN) - { + break; + case VT_RECORD: + hres = VARIANT_CopyIRecordInfo(pvargDest, pvargSrc); + break; + case VT_DISPATCH: + case VT_UNKNOWN: + V_UNKNOWN(pvargDest) = V_UNKNOWN(pvargSrc); if (V_UNKNOWN(pvargSrc)) IUnknown_AddRef(V_UNKNOWN(pvargSrc)); + break; + default: + if (V_ISARRAY(pvargSrc)) + hres = SafeArrayCopy(V_ARRAY(pvargSrc), &V_ARRAY(pvargDest)); } } } @@ -912,8 +907,7 @@ } else if (V_VT(pSrc) == (VT_RECORD|VT_BYREF)) { - V_UNION(pvargDest,brecVal) = V_UNION(pvargSrc,brecVal); - hres = VARIANT_CopyIRecordInfo(&V_UNION(pvargDest,brecVal)); + hres = VARIANT_CopyIRecordInfo(pvargDest, pvargSrc); } else if (V_VT(pSrc) == (VT_DISPATCH|VT_BYREF) || V_VT(pSrc) == (VT_UNKNOWN|VT_BYREF)) diff -Nru wine1.7-1.7.13/dlls/oleaut32/vartype.c wine1.7-1.7.16/dlls/oleaut32/vartype.c --- wine1.7-1.7.13/dlls/oleaut32/vartype.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/oleaut32/vartype.c 2014-04-04 19:13:44.000000000 +0000 @@ -362,7 +362,7 @@ */ HRESULT WINAPI VarI1FromR8(double dblIn, signed char* pcOut) { - if (dblIn < (double)I1_MIN || dblIn > (double)I1_MAX) + if (dblIn < I1_MIN - 0.5 || dblIn >= I1_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(CHAR, dblIn, *pcOut); return S_OK; @@ -652,7 +652,7 @@ */ HRESULT WINAPI VarUI1FromR8(double dblIn, BYTE* pbOut) { - if (dblIn < -0.5 || dblIn > (double)UI1_MAX) + if (dblIn < -0.5 || dblIn >= UI1_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(BYTE, dblIn, *pbOut); return S_OK; @@ -958,7 +958,7 @@ */ HRESULT WINAPI VarI2FromR8(double dblIn, SHORT* psOut) { - if (dblIn < (double)I2_MIN || dblIn > (double)I2_MAX) + if (dblIn < I2_MIN - 0.5 || dblIn >= I2_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(SHORT, dblIn, *psOut); return S_OK; @@ -1270,7 +1270,7 @@ */ HRESULT WINAPI VarUI2FromR8(double dblIn, USHORT* pusOut) { - if (dblIn < -0.5 || dblIn > (double)UI2_MAX) + if (dblIn < -0.5 || dblIn >= UI2_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(USHORT, dblIn, *pusOut); return S_OK; @@ -1550,7 +1550,7 @@ */ HRESULT WINAPI VarI4FromR8(double dblIn, LONG *piOut) { - if (dblIn < (double)I4_MIN || dblIn > (double)I4_MAX) + if (dblIn < I4_MIN - 0.5 || dblIn >= I4_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(LONG, dblIn, *piOut); return S_OK; @@ -1859,7 +1859,7 @@ */ HRESULT WINAPI VarUI4FromR8(double dblIn, ULONG *pulOut) { - if (dblIn < -0.5 || dblIn > (double)UI4_MAX) + if (dblIn < -0.5 || dblIn >= UI4_MAX + 0.5) return DISP_E_OVERFLOW; VARIANT_DutchRound(ULONG, dblIn, *pulOut); return S_OK; diff -Nru wine1.7-1.7.13/dlls/opengl32/tests/opengl.c wine1.7-1.7.16/dlls/opengl32/tests/opengl.c --- wine1.7-1.7.13/dlls/opengl32/tests/opengl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/opengl32/tests/opengl.c 2014-04-04 19:13:44.000000000 +0000 @@ -1509,7 +1509,7 @@ 0, 0, 0 /* layer masks */ }; int pixel_format; - HWND window1, window2; + HWND window1, window2, old_parent; HGLRC ctx1, ctx2, oldctx; BOOL ret; HDC dc1, dc2; @@ -1550,7 +1550,7 @@ ok(ret, "Failed to set swap interval to 0, last error %#x.\n", GetLastError()); interval = pwglGetSwapIntervalEXT(); - ok(interval == 0, "Expected default swap interval 0, got %d\n", interval); + ok(interval == 0, "Expected swap interval 0, got %d\n", interval); /* Check what interval we get on a second context on the same drawable.*/ ctx2 = wglCreateContext(dc1); @@ -1582,7 +1582,17 @@ * is not global or shared among contexts. */ interval = pwglGetSwapIntervalEXT(); - ok(interval == 1, "Expected swap interval 1, got %d\n", interval); + ok(interval == 1, "Expected default swap interval 1, got %d\n", interval); + + /* Test if setting the parent of a window resets the swap interval. */ + ret = wglMakeCurrent(dc1, ctx1); + ok(ret, "Failed to make context current, last error %#x.\n", GetLastError()); + + old_parent = SetParent(window1, window2); + ok(!!old_parent, "Failed to make window1 a child of window2, last error %#x.\n", GetLastError()); + + interval = pwglGetSwapIntervalEXT(); + ok(interval == 0, "Expected swap interval 0, got %d\n", interval); ret = wglDeleteContext(ctx1); ok(ret, "Failed to delete GL context, last error %#x.\n", GetLastError()); diff -Nru wine1.7-1.7.13/dlls/qcap/avico.c wine1.7-1.7.16/dlls/qcap/avico.c --- wine1.7-1.7.13/dlls/qcap/avico.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/qcap/avico.c 2014-04-04 19:13:44.000000000 +0000 @@ -416,8 +416,17 @@ static HRESULT WINAPI AVICompressorIn_Disconnect(IPin *iface) { AVICompressor *This = impl_from_IPin(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; + HRESULT hres; + + TRACE("(%p)\n", This); + + hres = BasePinImpl_Disconnect(iface); + if(FAILED(hres)) + return hres; + + heap_free(This->videoinfo); + This->videoinfo = NULL; + return S_OK; } static const IPinVtbl AVICompressorInputPinVtbl = { diff -Nru wine1.7-1.7.13/dlls/qcap/avimux.c wine1.7-1.7.16/dlls/qcap/avimux.c --- wine1.7-1.7.13/dlls/qcap/avimux.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/qcap/avimux.c 2014-04-04 19:13:44.000000000 +0000 @@ -25,6 +25,8 @@ #include "winbase.h" #include "wtypes.h" #include "dshow.h" +#include "vfw.h" +#include "aviriff.h" #include "qcap_main.h" @@ -33,18 +35,54 @@ WINE_DEFAULT_DEBUG_CHANNEL(qcap); #define MAX_PIN_NO 128 +#define AVISUPERINDEX_ENTRIES 2000 +#define AVISTDINDEX_ENTRIES 4000 +#define ALIGN(x) ((x+1)/2*2) typedef struct { BaseOutputPin pin; IQualityControl IQualityControl_iface; + + int cur_stream; + LONGLONG cur_time; + + int buf_pos; + BYTE buf[65536]; + + int movi_off; + int out_pos; + int size; + IStream *stream; } AviMuxOut; typedef struct { BaseInputPin pin; IAMStreamControl IAMStreamControl_iface; - IMemInputPin IMemInputPin_iface; IPropertyBag IPropertyBag_iface; IQualityControl IQualityControl_iface; + + REFERENCE_TIME avg_time_per_frame; + REFERENCE_TIME stop; + int stream_id; + LONGLONG stream_time; + + /* strl chunk */ + AVISTREAMHEADER strh; + struct { + FOURCC fcc; + DWORD cb; + BYTE data[1]; + } *strf; + AVISUPERINDEX *indx; + BYTE indx_data[FIELD_OFFSET(AVISUPERINDEX, aIndex[AVISUPERINDEX_ENTRIES])]; + + /* movi chunk */ + int ix_off; + AVISTDINDEX *ix; + BYTE ix_data[FIELD_OFFSET(AVISTDINDEX, aIndex[AVISTDINDEX_ENTRIES])]; + + IMediaSample *samples_head; + IMemAllocator *samples_allocator; } AviMuxIn; typedef struct { @@ -55,9 +93,20 @@ IPersistMediaPropertyBag IPersistMediaPropertyBag_iface; ISpecifyPropertyPages ISpecifyPropertyPages_iface; + InterleavingMode mode; + REFERENCE_TIME interleave; + REFERENCE_TIME preroll; + AviMuxOut *out; int input_pin_no; AviMuxIn *in[MAX_PIN_NO-1]; + + REFERENCE_TIME start, stop; + AVIMAINHEADER avih; + + int idx1_entries; + int idx1_size; + AVIINDEXENTRY *idx1; } AviMux; static HRESULT create_input_pin(AviMux*); @@ -143,20 +192,399 @@ BaseOutputPinImpl_Release(&This->out->pin.pin.IPin_iface); - for(i=0; iinput_pin_no; i++) + for(i=0; iinput_pin_no; i++) { + IPin_Disconnect(&This->in[i]->pin.pin.IPin_iface); + IMemAllocator_Release(This->in[i]->samples_allocator); + This->in[i]->samples_allocator = NULL; BaseInputPinImpl_Release(&This->in[i]->pin.pin.IPin_iface); + } + HeapFree(GetProcessHeap(), 0, This->idx1); HeapFree(GetProcessHeap(), 0, This); ObjectRefCount(FALSE); } return ref; } +static HRESULT out_flush(AviMux *This) +{ + ULONG written; + HRESULT hr; + + if(!This->out->buf_pos) + return S_OK; + + hr = IStream_Write(This->out->stream, This->out->buf, This->out->buf_pos, &written); + if(FAILED(hr)) + return hr; + if(written != This->out->buf_pos) + return E_FAIL; + + This->out->buf_pos = 0; + return S_OK; +} + +static HRESULT out_seek(AviMux *This, int pos) +{ + LARGE_INTEGER li; + HRESULT hr; + + hr = out_flush(This); + if(FAILED(hr)) + return hr; + + li.QuadPart = pos; + hr = IStream_Seek(This->out->stream, li, STREAM_SEEK_SET, NULL); + if(FAILED(hr)) + return hr; + + This->out->out_pos = pos; + if(This->out->out_pos > This->out->size) + This->out->size = This->out->out_pos; + return hr; +} + +static HRESULT out_write(AviMux *This, const void *data, int size) +{ + int chunk_size; + HRESULT hr; + + while(1) { + if(size > sizeof(This->out->buf)-This->out->buf_pos) + chunk_size = sizeof(This->out->buf)-This->out->buf_pos; + else + chunk_size = size; + + memcpy(This->out->buf + This->out->buf_pos, data, chunk_size); + size -= chunk_size; + data = (const BYTE*)data + chunk_size; + This->out->buf_pos += chunk_size; + This->out->out_pos += chunk_size; + if(This->out->out_pos > This->out->size) + This->out->size = This->out->out_pos; + + if(!size) + break; + hr = out_flush(This); + if(FAILED(hr)) + return hr; + } + + return S_OK; +} + +static inline HRESULT idx1_add_entry(AviMux *avimux, DWORD ckid, DWORD flags, DWORD off, DWORD len) +{ + if(avimux->idx1_entries == avimux->idx1_size) { + AVIINDEXENTRY *new_idx = HeapReAlloc(GetProcessHeap(), 0, avimux->idx1, + sizeof(*avimux->idx1)*2*avimux->idx1_size); + if(!new_idx) + return E_OUTOFMEMORY; + + avimux->idx1_size *= 2; + avimux->idx1 = new_idx; + } + + avimux->idx1[avimux->idx1_entries].ckid = ckid; + avimux->idx1[avimux->idx1_entries].dwFlags = flags; + avimux->idx1[avimux->idx1_entries].dwChunkOffset = off; + avimux->idx1[avimux->idx1_entries].dwChunkLength = len; + avimux->idx1_entries++; + return S_OK; +} + +static HRESULT flush_queue(AviMux *avimux, AviMuxIn *avimuxin, BOOL closing) +{ + IMediaSample *sample, **prev, **head_prev; + BYTE *data; + RIFFCHUNK rf; + DWORD size; + DWORD flags; + HRESULT hr; + + if(avimux->out->cur_stream != avimuxin->stream_id) + return S_OK; + + while(avimuxin->samples_head) { + hr = IMediaSample_GetPointer(avimuxin->samples_head, (BYTE**)&head_prev); + if(FAILED(hr)) + return hr; + head_prev--; + + hr = IMediaSample_GetPointer(*head_prev, (BYTE**)&prev); + if(FAILED(hr)) + return hr; + prev--; + + sample = *head_prev; + size = IMediaSample_GetActualDataLength(sample); + hr = IMediaSample_GetPointer(sample, &data); + if(FAILED(hr)) + return hr; + flags = IMediaSample_IsDiscontinuity(sample)==S_OK ? AM_SAMPLE_TIMEDISCONTINUITY : 0; + if(IMediaSample_IsSyncPoint(sample) == S_OK) + flags |= AM_SAMPLE_SPLICEPOINT; + + if(avimuxin->stream_time + (closing ? 0 : avimuxin->strh.dwScale) > avimux->out->cur_time && + !(flags & AM_SAMPLE_TIMEDISCONTINUITY)) { + if(closing) + break; + + avimux->out->cur_stream++; + if(avimux->out->cur_stream >= avimux->input_pin_no-1) { + avimux->out->cur_time += avimux->interleave; + avimux->out->cur_stream = 0; + } + avimuxin = avimux->in[avimux->out->cur_stream]; + continue; + } + + if(avimuxin->ix->nEntriesInUse == AVISTDINDEX_ENTRIES) { + /* TODO: use output pins Deliver/Receive method */ + hr = out_seek(avimux, avimuxin->ix_off); + if(FAILED(hr)) + return hr; + hr = out_write(avimux, avimuxin->ix, sizeof(avimuxin->ix_data)); + if(FAILED(hr)) + return hr; + + avimuxin->indx->aIndex[avimuxin->indx->nEntriesInUse].qwOffset = avimuxin->ix_off; + avimuxin->indx->aIndex[avimuxin->indx->nEntriesInUse].dwSize = sizeof(avimuxin->ix_data); + avimuxin->indx->aIndex[avimuxin->indx->nEntriesInUse].dwDuration = AVISTDINDEX_ENTRIES; + avimuxin->indx->nEntriesInUse++; + + memset(avimuxin->ix->aIndex, 0, sizeof(avimuxin->ix->aIndex)*avimuxin->ix->nEntriesInUse); + avimuxin->ix->nEntriesInUse = 0; + avimuxin->ix->qwBaseOffset = 0; + + avimuxin->ix_off = avimux->out->size; + avimux->out->size += sizeof(avimuxin->ix_data); + } + + if(*head_prev == avimuxin->samples_head) + avimuxin->samples_head = NULL; + else + *head_prev = *prev; + + avimuxin->stream_time += avimuxin->strh.dwScale; + avimuxin->strh.dwLength++; + if(!(flags & AM_SAMPLE_TIMEDISCONTINUITY)) { + if(!avimuxin->ix->qwBaseOffset) + avimuxin->ix->qwBaseOffset = avimux->out->size; + avimuxin->ix->aIndex[avimuxin->ix->nEntriesInUse].dwOffset = avimux->out->size + + sizeof(RIFFCHUNK) - avimuxin->ix->qwBaseOffset; + + hr = out_seek(avimux, avimux->out->size); + if(FAILED(hr)) { + IMediaSample_Release(sample); + return hr; + } + } + avimuxin->ix->aIndex[avimuxin->ix->nEntriesInUse].dwSize = size | + (flags & AM_SAMPLE_SPLICEPOINT ? 0 : AVISTDINDEX_DELTAFRAME); + avimuxin->ix->nEntriesInUse++; + + rf.fcc = FCC('0'+avimuxin->stream_id/10, '0'+avimuxin->stream_id%10, + 'd', flags & AM_SAMPLE_SPLICEPOINT ? 'b' : 'c'); + rf.cb = size; + hr = idx1_add_entry(avimux, rf.fcc, flags & AM_SAMPLE_SPLICEPOINT ? AVIIF_KEYFRAME : 0, + flags & AM_SAMPLE_TIMEDISCONTINUITY ? + avimux->idx1[avimux->idx1_entries-1].dwChunkOffset : avimux->out->size, size); + if(FAILED(hr)) { + IMediaSample_Release(sample); + return hr; + } + + if(!(flags & AM_SAMPLE_TIMEDISCONTINUITY)) { + hr = out_write(avimux, &rf, sizeof(rf)); + if(FAILED(hr)) { + IMediaSample_Release(sample); + return hr; + } + hr = out_write(avimux, data, size); + if(FAILED(hr)) { + IMediaSample_Release(sample); + return hr; + } + flags = 0; + hr = out_write(avimux, &flags, ALIGN(rf.cb)-rf.cb); + if(FAILED(hr)) { + IMediaSample_Release(sample); + return hr; + } + } + IMediaSample_Release(sample); + } + return S_OK; +} + +static HRESULT queue_sample(AviMux *avimux, AviMuxIn *avimuxin, IMediaSample *sample) +{ + IMediaSample **prev, **head_prev; + HRESULT hr; + + hr = IMediaSample_GetPointer(sample, (BYTE**)&prev); + if(FAILED(hr)) + return hr; + prev--; + + if(avimuxin->samples_head) { + hr = IMediaSample_GetPointer(avimuxin->samples_head, (BYTE**)&head_prev); + if(FAILED(hr)) + return hr; + head_prev--; + + *prev = *head_prev; + *head_prev = sample; + }else { + *prev = sample; + } + avimuxin->samples_head = sample; + IMediaSample_AddRef(sample); + + return flush_queue(avimux, avimuxin, FALSE); +} + static HRESULT WINAPI AviMux_Stop(IBaseFilter *iface) { AviMux *This = impl_from_IBaseFilter(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; + HRESULT hr; + int i; + + TRACE("(%p)\n", This); + + if(This->filter.state == State_Stopped) + return S_OK; + + if(This->out->stream) { + AVIEXTHEADER dmlh; + RIFFCHUNK rc; + RIFFLIST rl; + int idx1_off, empty_stream; + + empty_stream = This->out->cur_stream; + for(i=empty_stream+1; ; i++) { + if(i >= This->input_pin_no-1) + i = 0; + if(i == empty_stream) + break; + + This->out->cur_stream = i; + hr = flush_queue(This, This->in[This->out->cur_stream], TRUE); + if(FAILED(hr)) + return hr; + } + + idx1_off = This->out->size; + rc.fcc = ckidAVIOLDINDEX; + rc.cb = This->idx1_entries * sizeof(*This->idx1); + hr = out_write(This, &rc, sizeof(rc)); + if(FAILED(hr)) + return hr; + hr = out_write(This, This->idx1, This->idx1_entries * sizeof(*This->idx1)); + if(FAILED(hr)) + return hr; + /* native writes 8 '\0' characters after the end of RIFF data */ + i = 0; + hr = out_write(This, &i, sizeof(i)); + if(FAILED(hr)) + return hr; + hr = out_write(This, &i, sizeof(i)); + if(FAILED(hr)) + return hr; + + for(i=0; iinput_pin_no; i++) { + if(!This->in[i]->pin.pin.pConnectedTo) + continue; + + hr = out_seek(This, This->in[i]->ix_off); + if(FAILED(hr)) + return hr; + + This->in[i]->indx->aIndex[This->in[i]->indx->nEntriesInUse].qwOffset = This->in[i]->ix_off; + This->in[i]->indx->aIndex[This->in[i]->indx->nEntriesInUse].dwSize = sizeof(This->in[i]->ix_data); + This->in[i]->indx->aIndex[This->in[i]->indx->nEntriesInUse].dwDuration = This->in[i]->strh.dwLength; + if(This->in[i]->indx->nEntriesInUse) { + This->in[i]->indx->aIndex[This->in[i]->indx->nEntriesInUse].dwDuration -= + This->in[i]->indx->aIndex[This->in[i]->indx->nEntriesInUse-1].dwDuration; + } + This->in[i]->indx->nEntriesInUse++; + hr = out_write(This, This->in[i]->ix, sizeof(This->in[i]->ix_data)); + if(FAILED(hr)) + return hr; + } + + hr = out_seek(This, 0); + if(FAILED(hr)) + return hr; + + rl.fcc = FCC('R','I','F','F'); + rl.cb = This->out->size-sizeof(RIFFCHUNK)-2*sizeof(int); + rl.fccListType = FCC('A','V','I',' '); + hr = out_write(This, &rl, sizeof(rl)); + if(FAILED(hr)) + return hr; + + rl.fcc = FCC('L','I','S','T'); + rl.cb = This->out->movi_off - sizeof(RIFFLIST) - sizeof(RIFFCHUNK); + rl.fccListType = FCC('h','d','r','l'); + hr = out_write(This, &rl, sizeof(rl)); + if(FAILED(hr)) + return hr; + + /* FIXME: set This->avih.dwMaxBytesPerSec value */ + This->avih.dwTotalFrames = (This->stop-This->start) / 10 / This->avih.dwMicroSecPerFrame; + hr = out_write(This, &This->avih, sizeof(This->avih)); + if(FAILED(hr)) + return hr; + + for(i=0; iinput_pin_no; i++) { + if(!This->in[i]->pin.pin.pConnectedTo) + continue; + + rl.cb = sizeof(FOURCC) + sizeof(AVISTREAMHEADER) + sizeof(RIFFCHUNK) + + This->in[i]->strf->cb + sizeof(This->in[i]->indx_data); + rl.fccListType = ckidSTREAMLIST; + hr = out_write(This, &rl, sizeof(rl)); + if(FAILED(hr)) + return hr; + + hr = out_write(This, &This->in[i]->strh, sizeof(AVISTREAMHEADER)); + if(FAILED(hr)) + return hr; + + hr = out_write(This, This->in[i]->strf, sizeof(RIFFCHUNK) + This->in[i]->strf->cb); + if(FAILED(hr)) + return hr; + + hr = out_write(This, This->in[i]->indx, sizeof(This->in[i]->indx_data)); + if(FAILED(hr)) + return hr; + } + + rl.cb = sizeof(dmlh) + sizeof(FOURCC); + rl.fccListType = ckidODML; + hr = out_write(This, &rl, sizeof(rl)); + if(FAILED(hr)) + return hr; + + memset(&dmlh, 0, sizeof(dmlh)); + dmlh.fcc = ckidAVIEXTHEADER; + dmlh.cb = sizeof(dmlh) - sizeof(RIFFCHUNK); + dmlh.dwGrandFrames = This->in[0]->strh.dwLength; + hr = out_write(This, &dmlh, sizeof(dmlh)); + + rl.cb = idx1_off - This->out->movi_off - sizeof(RIFFCHUNK); + rl.fccListType = FCC('m','o','v','i'); + out_write(This, &rl, sizeof(rl)); + out_flush(This); + + IStream_Release(This->out->stream); + This->out->stream = NULL; + } + + This->filter.state = State_Stopped; + return S_OK; } static HRESULT WINAPI AviMux_Pause(IBaseFilter *iface) @@ -169,8 +597,127 @@ static HRESULT WINAPI AviMux_Run(IBaseFilter *iface, REFERENCE_TIME tStart) { AviMux *This = impl_from_IBaseFilter(iface); - FIXME("(%p)->(0x%x%08x)\n", This, (ULONG)(tStart >> 32), (ULONG)tStart); - return E_NOTIMPL; + HRESULT hr; + int i, stream_id; + + TRACE("(%p)->(0x%x%08x)\n", This, (ULONG)(tStart >> 32), (ULONG)tStart); + + if(This->filter.state == State_Running) + return S_OK; + + if(This->mode != INTERLEAVE_FULL) { + FIXME("mode not supported (%d)\n", This->mode); + return E_NOTIMPL; + } + + if(tStart) + FIXME("tStart parameter ignored\n"); + + for(i=0; iinput_pin_no; i++) { + IMediaSeeking *ms; + LONGLONG cur, stop; + + if(!This->in[i]->pin.pin.pConnectedTo) + continue; + + hr = IPin_QueryInterface(This->in[i]->pin.pin.pConnectedTo, + &IID_IMediaSeeking, (void**)&ms); + if(FAILED(hr)) + continue; + + hr = IMediaSeeking_GetPositions(ms, &cur, &stop); + if(FAILED(hr)) { + IMediaSeeking_Release(ms); + continue; + } + + FIXME("Use IMediaSeeking to fill stream header\n"); + IMediaSeeking_Release(ms); + } + + if(This->out->pin.pMemInputPin) { + hr = IMemInputPin_QueryInterface(This->out->pin.pMemInputPin, + &IID_IStream, (void**)&This->out->stream); + if(FAILED(hr)) + return hr; + } + + This->idx1_entries = 0; + if(!This->idx1_size) { + This->idx1_size = 1024; + This->idx1 = HeapAlloc(GetProcessHeap(), 0, sizeof(*This->idx1)*This->idx1_size); + if(!This->idx1) + return E_OUTOFMEMORY; + } + + This->out->size = 3*sizeof(RIFFLIST) + sizeof(AVIMAINHEADER) + sizeof(AVIEXTHEADER); + This->start = -1; + This->stop = -1; + memset(&This->avih, 0, sizeof(This->avih)); + for(i=0; iinput_pin_no; i++) { + if(!This->in[i]->pin.pin.pConnectedTo) + continue; + + This->avih.dwStreams++; + This->out->size += sizeof(RIFFLIST) + sizeof(AVISTREAMHEADER) + sizeof(RIFFCHUNK) + + This->in[i]->strf->cb + sizeof(This->in[i]->indx_data); + + This->in[i]->strh.dwScale = MulDiv(This->in[i]->avg_time_per_frame, This->interleave, 10000000); + This->in[i]->strh.dwRate = This->interleave; + + hr = IMemAllocator_Commit(This->in[i]->pin.pAllocator); + if(FAILED(hr)) { + if(This->out->stream) { + IStream_Release(This->out->stream); + This->out->stream = NULL; + } + return hr; + } + } + + This->out->movi_off = This->out->size; + This->out->size += sizeof(RIFFLIST); + + idx1_add_entry(This, FCC('7','F','x','x'), 0, This->out->movi_off+sizeof(RIFFLIST), 0); + + stream_id = 0; + for(i=0; iinput_pin_no; i++) { + if(!This->in[i]->pin.pin.pConnectedTo) + continue; + + This->in[i]->ix_off = This->out->size; + This->out->size += sizeof(This->in[i]->ix_data); + This->in[i]->ix->fcc = FCC('i','x','0'+stream_id/10,'0'+stream_id%10); + This->in[i]->ix->cb = sizeof(This->in[i]->ix_data) - sizeof(RIFFCHUNK); + This->in[i]->ix->wLongsPerEntry = 2; + This->in[i]->ix->bIndexSubType = 0; + This->in[i]->ix->bIndexType = AVI_INDEX_OF_CHUNKS; + This->in[i]->ix->dwChunkId = FCC('0'+stream_id/10,'0'+stream_id%10,'d','b'); + This->in[i]->ix->qwBaseOffset = 0; + + This->in[i]->indx->fcc = ckidAVISUPERINDEX; + This->in[i]->indx->cb = sizeof(This->in[i]->indx_data) - sizeof(RIFFCHUNK); + This->in[i]->indx->wLongsPerEntry = 4; + This->in[i]->indx->bIndexSubType = 0; + This->in[i]->indx->bIndexType = AVI_INDEX_OF_INDEXES; + This->in[i]->indx->dwChunkId = This->in[i]->ix->dwChunkId; + This->in[i]->stream_id = stream_id++; + } + + This->out->buf_pos = 0; + This->out->out_pos = 0; + + This->avih.fcc = ckidMAINAVIHEADER; + This->avih.cb = sizeof(AVIMAINHEADER) - sizeof(RIFFCHUNK); + /* TODO: Use first video stream */ + This->avih.dwMicroSecPerFrame = This->in[0]->avg_time_per_frame/10; + This->avih.dwPaddingGranularity = 1; + This->avih.dwFlags = AVIF_TRUSTCKTYPE | AVIF_HASINDEX; + This->avih.dwWidth = ((BITMAPINFOHEADER*)This->in[0]->strf->data)->biWidth; + This->avih.dwHeight = ((BITMAPINFOHEADER*)This->in[0]->strf->data)->biHeight; + + This->filter.state = State_Running; + return S_OK; } static HRESULT WINAPI AviMux_EnumPins(IBaseFilter *iface, IEnumPins **ppEnum) @@ -332,8 +879,24 @@ IConfigInterleaving *iface, InterleavingMode mode) { AviMux *This = impl_from_IConfigInterleaving(iface); - FIXME("(%p)->(%d)\n", This, mode); - return E_NOTIMPL; + + TRACE("(%p)->(%d)\n", This, mode); + + if(mode>INTERLEAVE_NONE_BUFFERED) + return E_INVALIDARG; + + if(This->mode != mode) { + if(This->out->pin.pin.pConnectedTo) { + HRESULT hr = IFilterGraph_Reconnect(This->filter.filterInfo.pGraph, + &This->out->pin.pin.IPin_iface); + if(FAILED(hr)) + return hr; + } + + This->mode = mode; + } + + return S_OK; } static HRESULT WINAPI ConfigInterleaving_get_Mode( @@ -348,8 +911,14 @@ const REFERENCE_TIME *prtInterleave, const REFERENCE_TIME *prtPreroll) { AviMux *This = impl_from_IConfigInterleaving(iface); - FIXME("(%p)->(%p %p)\n", This, prtInterleave, prtPreroll); - return E_NOTIMPL; + + TRACE("(%p)->(%p %p)\n", This, prtInterleave, prtPreroll); + + if(prtInterleave) + This->interleave = *prtInterleave; + if(prtPreroll) + This->preroll = *prtPreroll; + return S_OK; } static HRESULT WINAPI ConfigInterleaving_get_Interleaving(IConfigInterleaving *iface, @@ -992,7 +1561,7 @@ static HRESULT WINAPI AviMuxIn_CheckMediaType(BasePin *base, const AM_MEDIA_TYPE *pmt) { - FIXME("(%p:%s)->(AM_MEDIA_TYPE(%p))\n", base, debugstr_w(base->pinInfo.achName), pmt); + TRACE("(%p:%s)->(AM_MEDIA_TYPE(%p))\n", base, debugstr_w(base->pinInfo.achName), pmt); dump_AM_MEDIA_TYPE(pmt); if(IsEqualIID(&pmt->majortype, &MEDIATYPE_Audio) && @@ -1020,8 +1589,105 @@ static HRESULT WINAPI AviMuxIn_Receive(BaseInputPin *base, IMediaSample *pSample) { - FIXME("(%p:%s)->(%p)\n", base, debugstr_w(base->pin.pinInfo.achName), pSample); - return E_NOTIMPL; + AviMuxIn *avimuxin = CONTAINING_RECORD(base, AviMuxIn, pin); + AviMux *avimux = impl_from_IBaseFilter(base->pin.pinInfo.pFilter); + REFERENCE_TIME start, stop; + IMediaSample *sample; + int frames_no; + IMediaSample2 *ms2; + BYTE *frame, *buf; + DWORD max_size, size; + DWORD flags; + HRESULT hr; + + TRACE("(%p:%s)->(%p)\n", base, debugstr_w(base->pin.pinInfo.achName), pSample); + + hr = IMediaSample_QueryInterface(pSample, &IID_IMediaSample2, (void**)&ms2); + if(SUCCEEDED(hr)) { + AM_SAMPLE2_PROPERTIES props; + + memset(&props, 0, sizeof(props)); + hr = IMediaSample2_GetProperties(ms2, sizeof(props), (BYTE*)&props); + IMediaSample2_Release(ms2); + if(FAILED(hr)) + return hr; + + flags = props.dwSampleFlags; + frame = props.pbBuffer; + size = props.lActual; + }else { + flags = IMediaSample_IsSyncPoint(pSample) == S_OK ? AM_SAMPLE_SPLICEPOINT : 0; + hr = IMediaSample_GetPointer(pSample, &frame); + if(FAILED(hr)) + return hr; + size = IMediaSample_GetActualDataLength(pSample); + } + + if(!avimuxin->pin.pin.mtCurrent.bTemporalCompression) + flags |= AM_SAMPLE_SPLICEPOINT; + + hr = IMediaSample_GetTime(pSample, &start, &stop); + if(FAILED(hr)) + return hr; + + if(avimuxin->stop>stop) + return VFW_E_START_TIME_AFTER_END; + + if(avimux->start == -1) + avimux->start = start; + if(avimux->stop < stop) + avimux->stop = stop; + + if(avimux->avih.dwSuggestedBufferSize < ALIGN(size)+sizeof(RIFFCHUNK)) + avimux->avih.dwSuggestedBufferSize = ALIGN(size) + sizeof(RIFFCHUNK); + if(avimuxin->strh.dwSuggestedBufferSize < ALIGN(size)+sizeof(RIFFCHUNK)) + avimuxin->strh.dwSuggestedBufferSize = ALIGN(size) + sizeof(RIFFCHUNK); + + frames_no = 1; + if(avimuxin->stop!=-1 && start > avimuxin->stop) { + frames_no += (double)(start - avimuxin->stop) / 10000000 + * avimuxin->strh.dwRate / avimuxin->strh.dwScale + 0.5; + } + avimuxin->stop = stop; + + while(--frames_no) { + /* TODO: store all control frames in one buffer */ + hr = IMemAllocator_GetBuffer(avimuxin->samples_allocator, &sample, NULL, NULL, 0); + if(FAILED(hr)) + return hr; + hr = IMediaSample_SetActualDataLength(sample, 0); + if(SUCCEEDED(hr)) + hr = IMediaSample_SetDiscontinuity(sample, TRUE); + if(SUCCEEDED(hr)) + hr = IMediaSample_SetSyncPoint(sample, FALSE); + if(SUCCEEDED(hr)) + hr = queue_sample(avimux, avimuxin, sample); + IMediaSample_Release(sample); + if(FAILED(hr)) + return hr; + } + + hr = IMemAllocator_GetBuffer(avimuxin->samples_allocator, &sample, NULL, NULL, 0); + if(FAILED(hr)) + return hr; + max_size = IMediaSample_GetSize(sample); + if(size > max_size) + size = max_size; + hr = IMediaSample_SetActualDataLength(sample, size); + if(SUCCEEDED(hr)) + hr = IMediaSample_SetDiscontinuity(sample, FALSE); + if(SUCCEEDED(hr)) + hr = IMediaSample_SetSyncPoint(sample, flags & AM_SAMPLE_SPLICEPOINT); + /* TODO: avoid unnecesarry copying */ + if(SUCCEEDED(hr)) + hr = IMediaSample_GetPointer(sample, &buf); + if(SUCCEEDED(hr)) { + memcpy(buf, frame, size); + hr = queue_sample(avimux, avimuxin, sample); + } + IMediaSample_Release(sample); + + return hr; } static const BaseInputPinFuncTable AviMuxIn_BaseInputFuncTable = { @@ -1062,7 +1728,7 @@ else if(IsEqualIID(riid, &IID_IAMStreamControl)) *ppv = &avimuxin->IAMStreamControl_iface; else if(IsEqualIID(riid, &IID_IMemInputPin)) - *ppv = &avimuxin->IMemInputPin_iface; + *ppv = &avimuxin->pin.IMemInputPin_iface; else if(IsEqualIID(riid, &IID_IPropertyBag)) *ppv = &avimuxin->IPropertyBag_iface; else if(IsEqualIID(riid, &IID_IQualityControl)) @@ -1118,6 +1784,47 @@ if(FAILED(hr)) return hr; + if(IsEqualIID(&pmt->majortype, &MEDIATYPE_Video) && + IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) { + ALLOCATOR_PROPERTIES req, act; + VIDEOINFOHEADER *vih; + int size; + + vih = (VIDEOINFOHEADER*)pmt->pbFormat; + avimuxin->strh.fcc = ckidSTREAMHEADER; + avimuxin->strh.cb = sizeof(AVISTREAMHEADER) - FIELD_OFFSET(AVISTREAMHEADER, fccType); + avimuxin->strh.fccType = streamtypeVIDEO; + /* FIXME: fccHandler should be set differently */ + avimuxin->strh.fccHandler = vih->bmiHeader.biCompression ? + vih->bmiHeader.biCompression : FCC('D','I','B',' '); + avimuxin->avg_time_per_frame = vih->AvgTimePerFrame; + avimuxin->stop = -1; + + req.cBuffers = 32; + req.cbBuffer = vih->bmiHeader.biSizeImage; + req.cbAlign = 1; + req.cbPrefix = sizeof(void*); + hr = IMemAllocator_SetProperties(avimuxin->samples_allocator, &req, &act); + if(SUCCEEDED(hr)) + hr = IMemAllocator_Commit(avimuxin->samples_allocator); + if(FAILED(hr)) { + BasePinImpl_Disconnect(iface); + return hr; + } + + size = pmt->cbFormat - FIELD_OFFSET(VIDEOINFOHEADER, bmiHeader); + avimuxin->strf = CoTaskMemAlloc(sizeof(RIFFCHUNK) + ALIGN(FIELD_OFFSET(BITMAPINFO, bmiColors[vih->bmiHeader.biClrUsed]))); + avimuxin->strf->fcc = ckidSTREAMFORMAT; + avimuxin->strf->cb = FIELD_OFFSET(BITMAPINFO, bmiColors[vih->bmiHeader.biClrUsed]); + if(size > avimuxin->strf->cb) + size = avimuxin->strf->cb; + memcpy(avimuxin->strf->data, &vih->bmiHeader, size); + }else { + FIXME("format not supported: %s %s\n", debugstr_guid(&pmt->majortype), + debugstr_guid(&pmt->formattype)); + return E_NOTIMPL; + } + return create_input_pin(This); } @@ -1125,8 +1832,33 @@ { AviMux *This = impl_from_in_IPin(iface); AviMuxIn *avimuxin = AviMuxIn_from_IPin(iface); + IMediaSample **prev, *cur; + HRESULT hr; + TRACE("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); - return BasePinImpl_Disconnect(iface); + + hr = BasePinImpl_Disconnect(iface); + if(FAILED(hr)) + return hr; + + IMemAllocator_Decommit(avimuxin->samples_allocator); + while(avimuxin->samples_head) { + cur = avimuxin->samples_head; + hr = IMediaSample_GetPointer(cur, (BYTE**)&prev); + if(FAILED(hr)) + break; + prev--; + + cur = avimuxin->samples_head; + avimuxin->samples_head = *prev; + IMediaSample_Release(cur); + + if(cur == avimuxin->samples_head) + avimuxin->samples_head = NULL; + } + CoTaskMemFree(avimuxin->strf); + avimuxin->strf = NULL; + return hr; } static HRESULT WINAPI AviMuxIn_ConnectedTo(IPin *iface, IPin **pPin) @@ -1317,7 +2049,8 @@ static inline AviMuxIn* AviMuxIn_from_IMemInputPin(IMemInputPin *iface) { - return CONTAINING_RECORD(iface, AviMuxIn, IMemInputPin_iface); + BaseInputPin *bip = CONTAINING_RECORD(iface, BaseInputPin, IMemInputPin_iface); + return CONTAINING_RECORD(bip, AviMuxIn, pin); } static HRESULT WINAPI AviMuxIn_MemInputPin_QueryInterface( @@ -1346,8 +2079,15 @@ { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), ppAllocator); - return E_NOTIMPL; + + TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), ppAllocator); + + if(!ppAllocator) + return E_POINTER; + + IMemAllocator_AddRef(avimuxin->pin.pAllocator); + *ppAllocator = avimuxin->pin.pAllocator; + return S_OK; } static HRESULT WINAPI AviMuxIn_MemInputPin_NotifyAllocator( @@ -1355,9 +2095,23 @@ { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%p %x)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), + ALLOCATOR_PROPERTIES props; + HRESULT hr; + + TRACE("(%p:%s)->(%p %x)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pAllocator, bReadOnly); - return E_NOTIMPL; + + if(!pAllocator) + return E_POINTER; + + memset(&props, 0, sizeof(props)); + hr = IMemAllocator_GetProperties(pAllocator, &props); + if(FAILED(hr)) + return hr; + + props.cbAlign = 1; + props.cbPrefix = 8; + return IMemAllocator_SetProperties(avimuxin->pin.pAllocator, &props, &props); } static HRESULT WINAPI AviMuxIn_MemInputPin_GetAllocatorRequirements( @@ -1365,8 +2119,15 @@ { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pProps); - return E_NOTIMPL; + + TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pProps); + + if(!pProps) + return E_POINTER; + + pProps->cbAlign = 1; + pProps->cbPrefix = 8; + return S_OK; } static HRESULT WINAPI AviMuxIn_MemInputPin_Receive( @@ -1374,8 +2135,10 @@ { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pSample); - return E_NOTIMPL; + + TRACE("(%p:%s)->(%p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pSample); + + return avimuxin->pin.pFuncsTable->pfnReceive(&avimuxin->pin, pSample); } static HRESULT WINAPI AviMuxIn_MemInputPin_ReceiveMultiple(IMemInputPin *iface, @@ -1383,17 +2146,34 @@ { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)->(%p %d %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), + HRESULT hr = S_OK; + + TRACE("(%p:%s)->(%p %d %p)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName), pSamples, nSamples, nSamplesProcessed); - return E_NOTIMPL; + + for(*nSamplesProcessed=0; *nSamplesProcessedpin.pFuncsTable->pfnReceive(&avimuxin->pin, pSamples[*nSamplesProcessed]); + if(hr != S_OK) + break; + } + + return hr; } static HRESULT WINAPI AviMuxIn_MemInputPin_ReceiveCanBlock(IMemInputPin *iface) { AviMuxIn *avimuxin = AviMuxIn_from_IMemInputPin(iface); AviMux *This = impl_from_in_IPin(&avimuxin->pin.pin.IPin_iface); - FIXME("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p:%s)\n", This, debugstr_w(avimuxin->pin.pin.pinInfo.achName)); + + if(!This->out->pin.pMemInputPin) + return S_FALSE; + + hr = IMemInputPin_ReceiveCanBlock(This->out->pin.pMemInputPin); + return hr != S_FALSE ? S_OK : S_FALSE; } static const IMemInputPinVtbl AviMuxIn_MemInputPinVtbl = { @@ -1533,11 +2313,35 @@ &AviMuxIn_BaseInputFuncTable, &avimux->filter.csFilter, NULL, (IPin**)&avimux->in[avimux->input_pin_no]); if(FAILED(hr)) return hr; + avimux->in[avimux->input_pin_no]->pin.IMemInputPin_iface.lpVtbl = &AviMuxIn_MemInputPinVtbl; avimux->in[avimux->input_pin_no]->IAMStreamControl_iface.lpVtbl = &AviMuxIn_AMStreamControlVtbl; - avimux->in[avimux->input_pin_no]->IMemInputPin_iface.lpVtbl = &AviMuxIn_MemInputPinVtbl; avimux->in[avimux->input_pin_no]->IPropertyBag_iface.lpVtbl = &AviMuxIn_PropertyBagVtbl; avimux->in[avimux->input_pin_no]->IQualityControl_iface.lpVtbl = &AviMuxIn_QualityControlVtbl; + avimux->in[avimux->input_pin_no]->samples_head = NULL; + hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, + &IID_IMemAllocator, (void**)&avimux->in[avimux->input_pin_no]->samples_allocator); + if(FAILED(hr)) { + BaseInputPinImpl_Release(&avimux->in[avimux->input_pin_no]->pin.pin.IPin_iface); + return hr; + } + + hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, + &IID_IMemAllocator, (void**)&avimux->in[avimux->input_pin_no]->pin.pAllocator); + if(FAILED(hr)) { + IMemAllocator_Release(avimux->in[avimux->input_pin_no]->samples_allocator); + BaseInputPinImpl_Release(&avimux->in[avimux->input_pin_no]->pin.pin.IPin_iface); + return hr; + } + + avimux->in[avimux->input_pin_no]->stream_time = 0; + memset(&avimux->in[avimux->input_pin_no]->strh, 0, sizeof(avimux->in[avimux->input_pin_no]->strh)); + avimux->in[avimux->input_pin_no]->strf = NULL; + memset(&avimux->in[avimux->input_pin_no]->indx_data, 0, sizeof(avimux->in[avimux->input_pin_no]->indx_data)); + memset(&avimux->in[avimux->input_pin_no]->ix_data, 0, sizeof(avimux->in[avimux->input_pin_no]->ix_data)); + avimux->in[avimux->input_pin_no]->indx = (AVISUPERINDEX*)&avimux->in[avimux->input_pin_no]->indx_data; + avimux->in[avimux->input_pin_no]->ix = (AVISTDINDEX*)avimux->in[avimux->input_pin_no]->ix_data; + avimux->input_pin_no++; return S_OK; } @@ -1557,7 +2361,7 @@ return NULL; } - avimux = HeapAlloc(GetProcessHeap(), 0, sizeof(AviMux)); + avimux = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(AviMux)); if(!avimux) { *phr = E_OUTOFMEMORY; return NULL; @@ -1570,7 +2374,6 @@ avimux->IMediaSeeking_iface.lpVtbl = &MediaSeekingVtbl; avimux->IPersistMediaPropertyBag_iface.lpVtbl = &PersistMediaPropertyBagVtbl; avimux->ISpecifyPropertyPages_iface.lpVtbl = &SpecifyPropertyPagesVtbl; - avimux->input_pin_no = 0; info.dir = PINDIR_OUTPUT; info.pFilter = &avimux->filter.IBaseFilter_iface; @@ -1584,6 +2387,9 @@ return NULL; } avimux->out->IQualityControl_iface.lpVtbl = &AviMuxOut_QualityControlVtbl; + avimux->out->cur_stream = 0; + avimux->out->cur_time = 0; + avimux->out->stream = NULL; hr = create_input_pin(avimux); if(FAILED(hr)) { @@ -1594,6 +2400,8 @@ return NULL; } + avimux->interleave = 10000000; + ObjectRefCount(TRUE); *phr = S_OK; return (IUnknown*)&avimux->filter.IBaseFilter_iface; diff -Nru wine1.7-1.7.13/dlls/qcap/tests/qcap.c wine1.7-1.7.16/dlls/qcap/tests/qcap.c --- wine1.7-1.7.13/dlls/qcap/tests/qcap.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/qcap/tests/qcap.c 2014-04-04 19:13:44.000000000 +0000 @@ -60,6 +60,19 @@ DEFINE_EXPECT(NotifyAllocator); DEFINE_EXPECT(Reconnect); DEFINE_EXPECT(Read_FccHandler); +DEFINE_EXPECT(MediaSeeking_GetPositions); +DEFINE_EXPECT(MemAllocator_GetProperties); +DEFINE_EXPECT(MemInputPin_QueryInterface_IStream); +DEFINE_EXPECT(MediaSample_QueryInterface_MediaSample2); +DEFINE_EXPECT(MediaSample_IsDiscontinuity); +DEFINE_EXPECT(MediaSample_IsPreroll); +DEFINE_EXPECT(MediaSample_IsSyncPoint); +DEFINE_EXPECT(MediaSample_GetTime); +DEFINE_EXPECT(MediaSample_GetMediaType); +DEFINE_EXPECT(MediaSample_GetPointer); +DEFINE_EXPECT(MediaSample_GetActualDataLength); +DEFINE_EXPECT(MediaSample_GetSize); +DEFINE_EXPECT(MediaSample_GetMediaTime); static int strcmp_wa(LPCWSTR strw, const char *stra) { @@ -524,6 +537,7 @@ IPin IPin_iface; IKsPropertySet IKsPropertySet_iface; IMemInputPin IMemInputPin_iface; + IMediaSeeking IMediaSeeking_iface; IEnumMediaTypes IEnumMediaTypes_iface; PIN_DIRECTION dir; @@ -756,6 +770,11 @@ return S_OK; } + if(IsEqualIID(riid, &IID_IMediaSeeking)) { + *ppv = &This->IMediaSeeking_iface; + return S_OK; + } + ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid)); *ppv = NULL; return E_NOINTERFACE; @@ -970,9 +989,21 @@ KsPropertySet_QuerySupported }; +static IStream *avi_stream; static HRESULT WINAPI MemInputPin_QueryInterface(IMemInputPin *iface, REFIID riid, void **ppv) { - ok(0, "unexpected call\n"); + if(IsEqualIID(riid, &IID_IStream)) { + CHECK_EXPECT(MemInputPin_QueryInterface_IStream); + + if(!avi_stream) + return E_NOINTERFACE; + + *ppv = avi_stream; + IStream_AddRef(avi_stream); + return S_OK; + } + + ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid)); return E_NOTIMPL; } @@ -1021,8 +1052,19 @@ static HRESULT WINAPI MemInputPin_Receive(IMemInputPin *iface, IMediaSample *pSample) { - ok(0, "unexpected call\n"); - return E_NOTIMPL; + REFERENCE_TIME off, tmp; + LARGE_INTEGER li; + BYTE *data; + HRESULT hr; + + hr = IMediaSample_GetTime(pSample, &off, &tmp); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = IMediaSample_GetPointer(pSample, &data); + ok(hr == S_OK, "got 0x%08x\n", hr); + li.QuadPart = off; + IStream_Seek(avi_stream, li, STREAM_SEEK_SET, NULL); + IStream_Write(avi_stream, data, IMediaSample_GetActualDataLength(pSample), NULL); + return S_OK; } static HRESULT WINAPI MemInputPin_ReceiveMultiple(IMemInputPin *iface, @@ -1050,6 +1092,162 @@ MemInputPin_ReceiveCanBlock }; +static HRESULT WINAPI MediaSeeking_QueryInterface( + IMediaSeeking *iface, REFIID riid, void **ppv) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface) +{ + return 2; +} + +static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface) +{ + return 1; +} + +static HRESULT WINAPI MediaSeeking_GetCapabilities( + IMediaSeeking *iface, DWORD *pCapabilities) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_CheckCapabilities( + IMediaSeeking *iface, DWORD *pCapabilities) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_IsFormatSupported( + IMediaSeeking *iface, const GUID *pFormat) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_QueryPreferredFormat( + IMediaSeeking *iface, GUID *pFormat) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetTimeFormat( + IMediaSeeking *iface, GUID *pFormat) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat( + IMediaSeeking *iface, const GUID *pFormat) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_SetTimeFormat( + IMediaSeeking *iface, const GUID *pFormat) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetDuration( + IMediaSeeking *iface, LONGLONG *pDuration) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetStopPosition( + IMediaSeeking *iface, LONGLONG *pStop) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetCurrentPosition( + IMediaSeeking *iface, LONGLONG *pCurrent) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *pTarget, + const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *pCurrent, + DWORD dwCurrentFlags, LONGLONG *pStop, DWORD dwStopFlags) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface, + LONGLONG *pCurrent, LONGLONG *pStop) +{ + CHECK_EXPECT(MediaSeeking_GetPositions); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface, + LONGLONG *pEarliest, LONGLONG *pLatest) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface, double dRate) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface, double *pdRate) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface, LONGLONG *pllPreroll) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static const IMediaSeekingVtbl MediaSeekingVtbl = { + MediaSeeking_QueryInterface, + MediaSeeking_AddRef, + MediaSeeking_Release, + MediaSeeking_GetCapabilities, + MediaSeeking_CheckCapabilities, + MediaSeeking_IsFormatSupported, + MediaSeeking_QueryPreferredFormat, + MediaSeeking_GetTimeFormat, + MediaSeeking_IsUsingTimeFormat, + MediaSeeking_SetTimeFormat, + MediaSeeking_GetDuration, + MediaSeeking_GetStopPosition, + MediaSeeking_GetCurrentPosition, + MediaSeeking_ConvertTimeFormat, + MediaSeeking_SetPositions, + MediaSeeking_GetPositions, + MediaSeeking_GetAvailable, + MediaSeeking_SetRate, + MediaSeeking_GetRate, + MediaSeeking_GetPreroll +}; + static test_filter* impl_from_IEnumMediaTypes(IEnumMediaTypes *iface) { return CONTAINING_RECORD(iface, test_filter, IEnumMediaTypes_iface); @@ -1132,6 +1330,7 @@ This->IPin_iface.lpVtbl = &PinVtbl; This->IKsPropertySet_iface.lpVtbl = &KsPropertySetVtbl; This->IMemInputPin_iface.lpVtbl = &MemInputPinVtbl; + This->IMediaSeeking_iface.lpVtbl = &MediaSeekingVtbl; This->IEnumMediaTypes_iface.lpVtbl = &EnumMediaTypesVtbl; This->dir = dir; @@ -1221,10 +1420,238 @@ IUnknown_Release(avimux); } -static void test_AviMux(void) +static HRESULT WINAPI MemAllocator_QueryInterface(IMemAllocator *iface, REFIID riid, void **ppvObject) +{ + if(IsEqualIID(riid, &IID_IUnknown)) { + *ppvObject = iface; + return S_OK; + } + + ok(0, "unexpected call: %s\n", wine_dbgstr_guid(riid)); + return E_NOTIMPL; +} + +static ULONG WINAPI MemAllocator_AddRef(IMemAllocator *iface) +{ + return 2; +} + +static ULONG WINAPI MemAllocator_Release(IMemAllocator *iface) +{ + return 1; +} + +static HRESULT WINAPI MemAllocator_SetProperties(IMemAllocator *iface, + ALLOCATOR_PROPERTIES *pRequest, ALLOCATOR_PROPERTIES *pActual) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MemAllocator_GetProperties(IMemAllocator *iface, ALLOCATOR_PROPERTIES *pProps) +{ + CHECK_EXPECT2(MemAllocator_GetProperties); + + pProps->cBuffers = 1; + pProps->cbBuffer = 1024; + pProps->cbAlign = 0; + pProps->cbPrefix = 0; + return S_OK; +} + +static HRESULT WINAPI MemAllocator_Commit(IMemAllocator *iface) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MemAllocator_Decommit(IMemAllocator *iface) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MemAllocator_GetBuffer(IMemAllocator *iface, IMediaSample **ppBuffer, + REFERENCE_TIME *pStartTime, REFERENCE_TIME *pEndTime, DWORD dwFlags) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MemAllocator_ReleaseBuffer(IMemAllocator *iface, IMediaSample *pBuffer) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static const IMemAllocatorVtbl MemAllocatorVtbl = { + MemAllocator_QueryInterface, + MemAllocator_AddRef, + MemAllocator_Release, + MemAllocator_SetProperties, + MemAllocator_GetProperties, + MemAllocator_Commit, + MemAllocator_Decommit, + MemAllocator_GetBuffer, + MemAllocator_ReleaseBuffer +}; +IMemAllocator MemAllocator = {&MemAllocatorVtbl}; + +static HRESULT WINAPI MediaSample_QueryInterface(IMediaSample* This, REFIID riid, void **ppv) +{ + if(IsEqualIID(riid, &IID_IMediaSample2)) + CHECK_EXPECT(MediaSample_QueryInterface_MediaSample2); + else + ok(0, "MediaSample_QueryInterface: %s\n", wine_dbgstr_guid(riid)); + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI MediaSample_AddRef(IMediaSample* This) +{ + return 2; +} + +static ULONG WINAPI MediaSample_Release(IMediaSample* This) +{ + return 1; +} + +static BYTE buf[1024]; +static HRESULT WINAPI MediaSample_GetPointer(IMediaSample* This, BYTE **ppBuffer) +{ + CHECK_EXPECT2(MediaSample_GetPointer); + *ppBuffer = buf; + memset(buf, 'z', sizeof(buf)); + return S_OK; +} + +static LONG WINAPI MediaSample_GetSize(IMediaSample* This) +{ + CHECK_EXPECT2(MediaSample_GetSize); + return sizeof(buf); +} + +static REFERENCE_TIME start_time, end_time; +static HRESULT WINAPI MediaSample_GetTime(IMediaSample* This, + REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd) +{ + CHECK_EXPECT2(MediaSample_GetTime); + *pTimeStart = start_time; + *pTimeEnd = end_time; + return S_OK; +} + +static HRESULT WINAPI MediaSample_SetTime(IMediaSample* This, + REFERENCE_TIME *pTimeStart, REFERENCE_TIME *pTimeEnd) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSample_IsSyncPoint(IMediaSample* This) +{ + CHECK_EXPECT2(MediaSample_IsSyncPoint); + return S_OK; +} + +static HRESULT WINAPI MediaSample_SetSyncPoint(IMediaSample* This, BOOL bIsSyncPoint) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSample_IsPreroll(IMediaSample* This) +{ + CHECK_EXPECT2(MediaSample_IsPreroll); + return S_FALSE; +} + +static HRESULT WINAPI MediaSample_SetPreroll(IMediaSample* This, BOOL bIsPreroll) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static LONG WINAPI MediaSample_GetActualDataLength(IMediaSample* This) +{ + CHECK_EXPECT2(MediaSample_GetActualDataLength); + return sizeof(buf); +} + +static HRESULT WINAPI MediaSample_SetActualDataLength(IMediaSample* This, LONG length) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSample_GetMediaType(IMediaSample* This, AM_MEDIA_TYPE **ppMediaType) +{ + CHECK_EXPECT2(MediaSample_GetMediaType); + *ppMediaType = NULL; + return S_FALSE; +} + +static HRESULT WINAPI MediaSample_SetMediaType(IMediaSample* This, AM_MEDIA_TYPE *pMediaType) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSample_IsDiscontinuity(IMediaSample* This) +{ + CHECK_EXPECT(MediaSample_IsDiscontinuity); + return S_FALSE; +} + +static HRESULT WINAPI MediaSample_SetDiscontinuity(IMediaSample* This, BOOL bDiscontinuity) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSample_GetMediaTime(IMediaSample* This, + LONGLONG *pTimeStart, LONGLONG *pTimeEnd) +{ + CHECK_EXPECT(MediaSample_GetMediaTime); + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaSample_SetMediaTime(IMediaSample* This, + LONGLONG *pTimeStart, LONGLONG *pTimeEnd) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static const IMediaSampleVtbl MediaSampleVtbl = { + MediaSample_QueryInterface, + MediaSample_AddRef, + MediaSample_Release, + MediaSample_GetPointer, + MediaSample_GetSize, + MediaSample_GetTime, + MediaSample_SetTime, + MediaSample_IsSyncPoint, + MediaSample_SetSyncPoint, + MediaSample_IsPreroll, + MediaSample_SetPreroll, + MediaSample_GetActualDataLength, + MediaSample_SetActualDataLength, + MediaSample_GetMediaType, + MediaSample_SetMediaType, + MediaSample_IsDiscontinuity, + MediaSample_SetDiscontinuity, + MediaSample_GetMediaTime, + MediaSample_SetMediaTime, +}; +IMediaSample MediaSample = {&MediaSampleVtbl}; + +static void test_AviMux(char *arg) { test_filter source_filter, sink_filter; - VIDEOINFOHEADER videoinfoheader; + VIDEOINFO videoinfo; IPin *avimux_in, *avimux_out, *pin; AM_MEDIA_TYPE source_media_type; AM_MEDIA_TYPE *media_type; @@ -1232,7 +1659,13 @@ IBaseFilter *avimux; IEnumPins *ep; IEnumMediaTypes *emt; + IMemInputPin *memin; + ALLOCATOR_PROPERTIES props; + IMemAllocator *memalloc; + IConfigInterleaving *ci; + FILTER_STATE state; HRESULT hr; + ULONG ref; init_test_filter(&source_filter, PINDIR_OUTPUT, SOURCE_FILTER); init_test_filter(&sink_filter, PINDIR_INPUT, SINK_FILTER); @@ -1295,22 +1728,22 @@ current_calls_list = NULL; memset(&source_media_type, 0, sizeof(AM_MEDIA_TYPE)); - memset(&videoinfoheader, 0, sizeof(VIDEOINFOHEADER)); + memset(&videoinfo, 0, sizeof(VIDEOINFO)); source_media_type.majortype = MEDIATYPE_Video; source_media_type.subtype = MEDIASUBTYPE_RGB32; source_media_type.formattype = FORMAT_VideoInfo; source_media_type.bFixedSizeSamples = TRUE; source_media_type.lSampleSize = 40000; - source_media_type.cbFormat = sizeof(VIDEOINFOHEADER); - source_media_type.pbFormat = (BYTE*)&videoinfoheader; - videoinfoheader.AvgTimePerFrame = 333333; - videoinfoheader.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - videoinfoheader.bmiHeader.biWidth = 100; - videoinfoheader.bmiHeader.biHeight = 100; - videoinfoheader.bmiHeader.biPlanes = 1; - videoinfoheader.bmiHeader.biBitCount = 32; - videoinfoheader.bmiHeader.biSizeImage = 40000; - videoinfoheader.bmiHeader.biClrImportant = 256; + source_media_type.cbFormat = sizeof(VIDEOINFO); + source_media_type.pbFormat = (BYTE*)&videoinfo; + videoinfo.AvgTimePerFrame = 333333; + videoinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + videoinfo.bmiHeader.biWidth = 100; + videoinfo.bmiHeader.biHeight = 100; + videoinfo.bmiHeader.biPlanes = 1; + videoinfo.bmiHeader.biBitCount = 32; + videoinfo.bmiHeader.biSizeImage = 40000; + videoinfo.bmiHeader.biClrImportant = 256; hr = IPin_ReceiveConnection(avimux_in, &source_filter.IPin_iface, &source_media_type); ok(hr == S_OK, "ReceiveConnection returned %x\n", hr); @@ -1336,12 +1769,198 @@ CHECK_CALLED(NotifyAllocator); CHECK_CALLED(Reconnect); + hr = IPin_ConnectedTo(avimux_out, &pin); + ok(hr == S_OK, "ConnectedTo returned %x\n", hr); + ok(pin == &sink_filter.IPin_iface, "incorrect pin: %p, expected %p\n", + pin, &source_filter.IPin_iface); + + hr = IPin_QueryInterface(avimux_in, &IID_IMemInputPin, (void**)&memin); + ok(hr == S_OK, "QueryInterface returned %x\n", hr); + + props.cBuffers = 0xdeadbee1; + props.cbBuffer = 0xdeadbee2; + props.cbAlign = 0xdeadbee3; + props.cbPrefix = 0xdeadbee4; + hr = IMemInputPin_GetAllocatorRequirements(memin, &props); + ok(hr==S_OK || broken(hr==E_INVALIDARG), "GetAllocatorRequirments returned %x\n", hr); + if(hr == S_OK) { + ok(props.cBuffers == 0xdeadbee1, "cBuffers = %d\n", props.cBuffers); + ok(props.cbBuffer == 0xdeadbee2, "cbBuffer = %d\n", props.cbBuffer); + ok(props.cbAlign == 1, "cbAlign = %d\n", props.cbAlign); + ok(props.cbPrefix == 8, "cbPrefix = %d\n", props.cbPrefix); + } + + hr = IMemInputPin_GetAllocator(memin, &memalloc); + ok(hr == S_OK, "GetAllocator returned %x\n", hr); + + props.cBuffers = 0xdeadbee1; + props.cbBuffer = 0xdeadbee2; + props.cbAlign = 0xdeadbee3; + props.cbPrefix = 0xdeadbee4; + hr = IMemAllocator_GetProperties(memalloc, &props); + ok(hr == S_OK, "GetProperties returned %x\n", hr); + ok(props.cBuffers == 0, "cBuffers = %d\n", props.cBuffers); + ok(props.cbBuffer == 0, "cbBuffer = %d\n", props.cbBuffer); + ok(props.cbAlign == 0, "cbAlign = %d\n", props.cbAlign); + ok(props.cbPrefix == 0, "cbPrefix = %d\n", props.cbPrefix); + IMemAllocator_Release(memalloc); + + hr = IBaseFilter_QueryInterface(avimux, &IID_IConfigInterleaving, (void**)&ci); + ok(hr == S_OK, "QueryInterface(IID_IConfigInterleaving) returned %x\n", hr); + hr = IConfigInterleaving_put_Mode(ci, 5); + ok(hr == E_INVALIDARG, "put_Mode returned %x\n", hr); + SET_EXPECT(Reconnect); + hr = IConfigInterleaving_put_Mode(ci, INTERLEAVE_FULL); + ok(hr == S_OK, "put_Mode returned %x\n", hr); + CHECK_CALLED(Reconnect); + IConfigInterleaving_Release(ci); + + hr = IBaseFilter_GetState(avimux, 0, &state); + ok(hr == S_OK, "GetState returned %x\n", hr); + ok(state == State_Stopped, "state = %d\n", state); + + SET_EXPECT(MemAllocator_GetProperties); + hr = IMemInputPin_NotifyAllocator(memin, &MemAllocator, TRUE); + ok(hr == S_OK, "NotifyAllocator returned %x\n", hr); + CHECK_CALLED(MemAllocator_GetProperties); + + hr = IMemInputPin_GetAllocator(memin, &memalloc); + ok(hr == S_OK, "GetAllocator returned %x\n", hr); + ok(memalloc != &MemAllocator, "memalloc == &MemAllocator\n"); + IMemAllocator_Release(memalloc); + + hr = CreateStreamOnHGlobal(NULL, TRUE, &avi_stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + SET_EXPECT(MediaSeeking_GetPositions); + SET_EXPECT(MemInputPin_QueryInterface_IStream); + hr = IBaseFilter_Run(avimux, 0); + ok(hr == S_OK, "Run returned %x\n", hr); + CHECK_CALLED(MediaSeeking_GetPositions); + + hr = IBaseFilter_GetState(avimux, 0, &state); + ok(hr == S_OK, "GetState returned %x\n", hr); + ok(state == State_Running, "state = %d\n", state); + + SET_EXPECT(MediaSample_QueryInterface_MediaSample2); + SET_EXPECT(MediaSample_IsDiscontinuity); + SET_EXPECT(MediaSample_IsPreroll); + SET_EXPECT(MediaSample_IsSyncPoint); + SET_EXPECT(MediaSample_GetTime); + SET_EXPECT(MediaSample_GetMediaType); + SET_EXPECT(MediaSample_GetPointer); + SET_EXPECT(MediaSample_GetActualDataLength); + SET_EXPECT(MediaSample_GetSize); + SET_EXPECT(MediaSample_GetMediaTime); + start_time = end_time = 0; + hr = IMemInputPin_Receive(memin, &MediaSample); + ok(hr == S_OK, "Receive returned %x\n", hr); + CHECK_CALLED(MediaSample_QueryInterface_MediaSample2); + todo_wine CHECK_CALLED(MediaSample_IsDiscontinuity); + todo_wine CHECK_CALLED(MediaSample_IsPreroll); + CHECK_CALLED(MediaSample_IsSyncPoint); + CHECK_CALLED(MediaSample_GetTime); + todo_wine CHECK_CALLED(MediaSample_GetMediaType); + CHECK_CALLED(MediaSample_GetPointer); + CHECK_CALLED(MediaSample_GetActualDataLength); + todo_wine CHECK_CALLED(MediaSample_GetSize); + todo_wine CHECK_CALLED(MediaSample_GetMediaTime); + + SET_EXPECT(MediaSample_QueryInterface_MediaSample2); + SET_EXPECT(MediaSample_IsDiscontinuity); + SET_EXPECT(MediaSample_IsPreroll); + SET_EXPECT(MediaSample_IsSyncPoint); + SET_EXPECT(MediaSample_GetTime); + SET_EXPECT(MediaSample_GetMediaType); + SET_EXPECT(MediaSample_GetPointer); + SET_EXPECT(MediaSample_GetActualDataLength); + SET_EXPECT(MediaSample_GetSize); + SET_EXPECT(MediaSample_GetMediaTime); + hr = IMemInputPin_Receive(memin, &MediaSample); + ok(hr == S_OK, "Receive returned %x\n", hr); + CHECK_CALLED(MediaSample_QueryInterface_MediaSample2); + todo_wine CHECK_CALLED(MediaSample_IsDiscontinuity); + todo_wine CHECK_CALLED(MediaSample_IsPreroll); + CHECK_CALLED(MediaSample_IsSyncPoint); + CHECK_CALLED(MediaSample_GetTime); + todo_wine CHECK_CALLED(MediaSample_GetMediaType); + CHECK_CALLED(MediaSample_GetPointer); + CHECK_CALLED(MediaSample_GetActualDataLength); + todo_wine CHECK_CALLED(MediaSample_GetSize); + todo_wine CHECK_CALLED(MediaSample_GetMediaTime); + + SET_EXPECT(MediaSample_QueryInterface_MediaSample2); + SET_EXPECT(MediaSample_IsDiscontinuity); + SET_EXPECT(MediaSample_IsPreroll); + SET_EXPECT(MediaSample_IsSyncPoint); + SET_EXPECT(MediaSample_GetTime); + SET_EXPECT(MediaSample_GetMediaType); + SET_EXPECT(MediaSample_GetPointer); + SET_EXPECT(MediaSample_GetActualDataLength); + SET_EXPECT(MediaSample_GetSize); + SET_EXPECT(MediaSample_GetMediaTime); + start_time = 20000000; + end_time = 21000000; + hr = IMemInputPin_Receive(memin, &MediaSample); + ok(hr == S_OK, "Receive returned %x\n", hr); + CHECK_CALLED(MediaSample_QueryInterface_MediaSample2); + todo_wine CHECK_CALLED(MediaSample_IsDiscontinuity); + todo_wine CHECK_CALLED(MediaSample_IsPreroll); + CHECK_CALLED(MediaSample_IsSyncPoint); + CHECK_CALLED(MediaSample_GetTime); + todo_wine CHECK_CALLED(MediaSample_GetMediaType); + CHECK_CALLED(MediaSample_GetPointer); + CHECK_CALLED(MediaSample_GetActualDataLength); + todo_wine CHECK_CALLED(MediaSample_GetSize); + todo_wine CHECK_CALLED(MediaSample_GetMediaTime); + IMemInputPin_Release(memin); + + hr = IBaseFilter_Stop(avimux); + ok(hr == S_OK, "Stop returned %x\n", hr); + CHECK_CALLED(MemInputPin_QueryInterface_IStream); + + hr = IBaseFilter_GetState(avimux, 0, &state); + ok(hr == S_OK, "GetState returned %x\n", hr); + ok(state == State_Stopped, "state = %d\n", state); + hr = IPin_Disconnect(avimux_out); ok(hr == S_OK, "Disconnect returned %x\n", hr); IPin_Release(avimux_in); IPin_Release(avimux_out); - IBaseFilter_Release(avimux); + ref = IBaseFilter_Release(avimux); + ok(ref == 0, "Avi Mux filter was not destroyed (%d)\n", ref); + + if(arg && !strcmp(arg, "save")) { + LARGE_INTEGER li; + char buf[1024]; + ULONG read; + HANDLE *f; + + f = CreateFileA("avimux.avi", GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + ok(f != INVALID_HANDLE_VALUE, "CreateFile failed\n"); + + li.QuadPart = 0; + hr = IStream_Seek(avi_stream, li, STREAM_SEEK_SET, NULL); + ok(hr == S_OK, "IStream_Seek failed: %x\n", hr); + + while(1) { + hr = IStream_Read(avi_stream, buf, sizeof(buf), &read); + if(FAILED(hr)) { + ok(0, "IStream_Read failed: %x\n", hr); + break; + } + if(!read) + break; + ok(WriteFile(f, buf, read, &read, NULL), "WriteFile failed\n"); + if(hr == S_FALSE) + break; + } + CloseHandle(f); + } + + ref = IStream_Release(avi_stream); + ok(ref == 0, "IStream was not destroyed (%d)\n", ref); } static HRESULT WINAPI PropertyBag_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv) @@ -1411,7 +2030,7 @@ hres = CoCreateInstance(&CLSID_AVICo, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void**)&avico); if(hres == REGDB_E_CLASSNOTREG) { - win_skip("CLSID_AVICo not restered\n"); + win_skip("CLSID_AVICo not registered\n"); return; } ok(hres == S_OK, "Could not create CLSID_AVICo class: %08x\n", hres); @@ -1461,10 +2080,15 @@ { if (SUCCEEDED(CoInitialize(NULL))) { + int arg_c; + char **arg_v; + + arg_c = winetest_get_mainargs(&arg_v); + test_smart_tee_filter(); test_CaptureGraphBuilder_RenderStream(); test_AviMux_QueryInterface(); - test_AviMux(); + test_AviMux(arg_c>2 ? arg_v[2] : NULL); test_AviCo(); CoUninitialize(); diff -Nru wine1.7-1.7.13/dlls/qcap/v4l.c wine1.7-1.7.16/dlls/qcap/v4l.c --- wine1.7-1.7.13/dlls/qcap/v4l.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/qcap/v4l.c 2014-04-04 19:13:44.000000000 +0000 @@ -110,7 +110,7 @@ IPin *pOut; int fd, mmap; - int iscommitted, stopped; + BOOL iscommitted, stopped; struct video_picture pict; int dbrightness, dhue, dcolour, dcontrast; @@ -661,7 +661,8 @@ LeaveCriticalSection(&capBox->CritSect); fail: - capBox->thread = 0; capBox->stopped = 1; + capBox->thread = 0; + capBox->stopped = TRUE; FIXME("Stop IFilterGraph\n"); return 0; } @@ -677,16 +678,18 @@ EnterCriticalSection(&capBox->CritSect); - capBox->stopped = 0; + capBox->stopped = FALSE; if (*state == State_Stopped) { *state = State_Running; - if (!capBox->iscommitted++) + if (!capBox->iscommitted) { ALLOCATOR_PROPERTIES ap, actual; BaseOutputPin *out; + capBox->iscommitted = TRUE; + ap.cBuffers = 3; if (!capBox->swresize) ap.cbBuffer = capBox->width * capBox->height; @@ -755,14 +758,14 @@ { if (*state == State_Paused) ResumeThread(capBox->thread); - capBox->stopped = 1; + capBox->stopped = TRUE; capBox->thread = 0; if (capBox->iscommitted) { BaseOutputPin *out; HRESULT hr; - capBox->iscommitted = 0; + capBox->iscommitted = FALSE; out = (BaseOutputPin*)capBox->pOut; @@ -894,9 +897,9 @@ capBox->bitDepth = 24; capBox->pOut = pOut; capBox->fps = 3; - capBox->stopped = 0; + capBox->stopped = FALSE; capBox->curframe = 0; - capBox->iscommitted = 0; + capBox->iscommitted = FALSE; TRACE("format: %d bits - %d x %d\n", capBox->bitDepth, capBox->width, capBox->height); diff -Nru wine1.7-1.7.13/dlls/qcap/yuv.c wine1.7-1.7.16/dlls/qcap/yuv.c --- wine1.7-1.7.13/dlls/qcap/yuv.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/qcap/yuv.c 2014-04-04 19:13:44.000000000 +0000 @@ -41,7 +41,7 @@ static int yuv_bu[256]; /* Blue U */ static int yuv_rv[256]; /* Red V */ static int yuv_gv[256]; /* Green V */ -static int initialised = 0; +static BOOL initialised = FALSE; static inline int ValidRange(int in) { if (in > 255) in = 255; @@ -67,7 +67,8 @@ float y, u, v; int y_, cb, cr; - if (initialised++) return; + if (initialised) return; + initialised = TRUE; for (y_ = 0; y_ <= 255; y_++) { diff -Nru wine1.7-1.7.13/dlls/qedit/samplegrabber.c wine1.7-1.7.16/dlls/qedit/samplegrabber.c --- wine1.7-1.7.13/dlls/qedit/samplegrabber.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/qedit/samplegrabber.c 2014-04-04 19:13:44.000000000 +0000 @@ -37,163 +37,8 @@ static const WCHAR pin_in_name[] = { 'I', 'n', 0 }; static const WCHAR pin_out_name[] = { 'O', 'u', 't', 0 }; -static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount); static IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype); -/* Fixed pins enumerator, holds filter referenced */ -typedef struct _PE_Impl { - IEnumPins pe; - IBaseFilter *filter; - LONG refCount; - ULONG numPins; - ULONG index; - IPin *pins[1]; -} PE_Impl; - - -/* IEnumPins interface implementation */ - -/* IUnknown */ -static ULONG WINAPI -Fixed_IEnumPins_AddRef(IEnumPins *iface) -{ - PE_Impl *This = (PE_Impl *)iface; - ULONG refCount = InterlockedIncrement(&This->refCount); - TRACE("(%p) new ref = %u\n", This, refCount); - return refCount; -} - -/* IUnknown */ -static ULONG WINAPI -Fixed_IEnumPins_Release(IEnumPins *iface) -{ - PE_Impl *This = (PE_Impl *)iface; - ULONG refCount = InterlockedDecrement(&This->refCount); - TRACE("(%p) new ref = %u\n", This, refCount); - if (refCount == 0) - { - IBaseFilter_Release(This->filter); - CoTaskMemFree(This); - return 0; - } - return refCount; -} - -/* IUnknown */ -static HRESULT WINAPI Fixed_IEnumPins_QueryInterface(IEnumPins *iface, REFIID riid, - void **ret_iface) -{ - TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ret_iface); - - if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IEnumPins)) { - IEnumPins_AddRef(iface); - *ret_iface = iface; - return S_OK; - } - *ret_iface = NULL; - WARN("(%p, %s, %p): not found\n", iface, debugstr_guid(riid), ret_iface); - return E_NOINTERFACE; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Next(IEnumPins *iface, ULONG nPins, IPin **pins, ULONG *fetched) -{ - PE_Impl *This = (PE_Impl *)iface; - ULONG count = 0; - TRACE("(%p)->(%u, %p, %p) index = %u\n", This, nPins, pins, fetched, This->index); - if (!nPins) - return E_INVALIDARG; - if (!pins || ((nPins != 1) && !fetched)) - return E_POINTER; - while ((count < nPins) && (This->index < This->numPins)) { - IPin *pin = This->pins[This->index++]; - IPin_AddRef(pin); - pins[count++] = pin; - } - if (fetched) - *fetched = count; - return (count == nPins) ? S_OK : S_FALSE; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Skip(IEnumPins *iface, ULONG nPins) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->(%u) index = %u\n", This, nPins, This->index); - nPins += This->index; - if (nPins >= This->numPins) { - This->index = This->numPins; - return S_FALSE; - } - This->index = nPins; - return S_OK; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Reset(IEnumPins *iface) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->() index = %u\n", This, This->index); - This->index = 0; - return S_OK; -} - -/* IEnumPins */ -static HRESULT WINAPI -Fixed_IEnumPins_Clone(IEnumPins *iface, IEnumPins **pins) -{ - PE_Impl *This = (PE_Impl *)iface; - TRACE("(%p)->(%p) index = %u\n", This, pins, This->index); - if (!pins) - return E_POINTER; - *pins = pinsenum_create(This->filter, This->pins, This->numPins); - if (!*pins) - return E_OUTOFMEMORY; - ((PE_Impl *)*pins)->index = This->index; - return S_OK; -} - - -/* Virtual tables and constructor */ - -static const IEnumPinsVtbl IEnumPins_VTable = -{ - Fixed_IEnumPins_QueryInterface, - Fixed_IEnumPins_AddRef, - Fixed_IEnumPins_Release, - Fixed_IEnumPins_Next, - Fixed_IEnumPins_Skip, - Fixed_IEnumPins_Reset, - Fixed_IEnumPins_Clone, -}; - -static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount) -{ - PE_Impl *obj; - ULONG len = offsetof(PE_Impl, pins[pinCount]); - ULONG i; - - obj = CoTaskMemAlloc(len); - if (!obj) - return NULL; - - ZeroMemory(obj, len); - obj->pe.lpVtbl = &IEnumPins_VTable; - obj->refCount = 1; - obj->filter = filter; - obj->numPins = pinCount; - obj->index = 0; - for (i = 0; i < pinCount; i++) - obj->pins[i] = pins[i]; - IBaseFilter_AddRef(filter); - - return &obj->pe; -} - - /* Single media type enumerator */ typedef struct _ME_Impl { IEnumMediaTypes me; @@ -398,6 +243,11 @@ return CONTAINING_RECORD(iface, SG_Impl, IUnknown_inner); } +static inline SG_Impl *impl_from_BaseFilter(BaseFilter *iface) +{ + return CONTAINING_RECORD(iface, SG_Impl, filter); +} + static inline SG_Impl *impl_from_IBaseFilter(IBaseFilter *iface) { return CONTAINING_RECORD(iface, SG_Impl, filter.IBaseFilter_iface); @@ -496,6 +346,32 @@ SampleGrabber_Release, }; +static IPin *WINAPI SampleGrabber_GetPin(BaseFilter *iface, int pos) +{ + SG_Impl *This = impl_from_BaseFilter(iface); + IPin *pin; + + if (pos == 0) + pin = &This->pin_in.IPin_iface; + else if (pos == 1) + pin = &This->pin_out.IPin_iface; + else + return NULL; + + IPin_AddRef(pin); + return pin; +} + +static LONG WINAPI SampleGrabber_GetPinCount(BaseFilter *iface) +{ + return 2; +} + +static const BaseFilterFuncTable basefunc_vtbl = { + SampleGrabber_GetPin, + SampleGrabber_GetPinCount +}; + /* Helper that buffers data and/or calls installed sample callbacks */ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample) { @@ -614,21 +490,6 @@ /* IBaseFilter */ static HRESULT WINAPI -SampleGrabber_IBaseFilter_EnumPins(IBaseFilter *iface, IEnumPins **pins) -{ - SG_Impl *This = impl_from_IBaseFilter(iface); - IPin *pin[2]; - TRACE("(%p)->(%p)\n", This, pins); - if (!pins) - return E_POINTER; - pin[0] = &This->pin_in.IPin_iface; - pin[1] = &This->pin_out.IPin_iface; - *pins = pinsenum_create(iface, pin, 2); - return *pins ? S_OK : E_OUTOFMEMORY; -} - -/* IBaseFilter */ -static HRESULT WINAPI SampleGrabber_IBaseFilter_FindPin(IBaseFilter *iface, LPCWSTR id, IPin **pin) { SG_Impl *This = impl_from_IBaseFilter(iface); @@ -1316,7 +1177,7 @@ BaseFilterImpl_GetState, BaseFilterImpl_SetSyncSource, BaseFilterImpl_GetSyncSource, - SampleGrabber_IBaseFilter_EnumPins, + BaseFilterImpl_EnumPins, SampleGrabber_IBaseFilter_FindPin, BaseFilterImpl_QueryFilterInfo, SampleGrabber_IBaseFilter_JoinFilterGraph, @@ -1410,7 +1271,7 @@ ZeroMemory(obj, sizeof(SG_Impl)); BaseFilter_Init(&obj->filter, &IBaseFilter_VTable, &CLSID_SampleGrabber, - (DWORD_PTR)(__FILE__ ": SG_Impl.csFilter"), NULL); + (DWORD_PTR)(__FILE__ ": SG_Impl.csFilter"), &basefunc_vtbl); obj->IUnknown_inner.lpVtbl = &samplegrabber_vtbl; obj->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable; obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable; diff -Nru wine1.7-1.7.13/dlls/riched20/caret.c wine1.7-1.7.16/dlls/riched20/caret.c --- wine1.7-1.7.13/dlls/riched20/caret.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/caret.c 2014-04-04 19:13:44.000000000 +0000 @@ -904,7 +904,7 @@ } static BOOL ME_FindRunInRow(ME_TextEditor *editor, ME_DisplayItem *pRow, - int x, ME_Cursor *cursor, int *pbCaretAtEnd) + int x, ME_Cursor *cursor, BOOL *pbCaretAtEnd) { ME_DisplayItem *pNext, *pLastRun; ME_Row *row = &pRow->member.row; @@ -964,7 +964,7 @@ y -= editor->rcFormat.top; if (is_eol) - *is_eol = 0; + *is_eol = FALSE; /* find paragraph */ for (; p != editor->pBuffer->pLast; p = p->member.para.next_para) @@ -1109,8 +1109,7 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum) { ME_Cursor tmp_cursor; - int is_selection = 0; - BOOL is_shift; + BOOL is_selection = FALSE, is_shift; editor->nUDArrowX = -1; @@ -1535,14 +1534,14 @@ ME_CheckCharOffsets(editor); switch(nVKey) { case VK_LEFT: - editor->bCaretAtEnd = 0; + editor->bCaretAtEnd = FALSE; if (ctrl) success = ME_MoveCursorWords(editor, &tmp_curs, -1); else success = ME_MoveCursorChars(editor, &tmp_curs, -1); break; case VK_RIGHT: - editor->bCaretAtEnd = 0; + editor->bCaretAtEnd = FALSE; if (ctrl) success = ME_MoveCursorWords(editor, &tmp_curs, +1); else @@ -1565,7 +1564,7 @@ ME_ArrowCtrlHome(editor, &tmp_curs); else ME_ArrowHome(editor, &tmp_curs); - editor->bCaretAtEnd = 0; + editor->bCaretAtEnd = FALSE; break; } case VK_END: diff -Nru wine1.7-1.7.13/dlls/riched20/editor.c wine1.7-1.7.16/dlls/riched20/editor.c --- wine1.7-1.7.13/dlls/riched20/editor.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/editor.c 2014-04-04 19:13:44.000000000 +0000 @@ -1633,7 +1633,7 @@ ME_Cursor linebreakCursor = *selEnd; ME_MoveCursorChars(editor, &linebreakCursor, -linebreakSize); - ME_GetTextW(editor, lastchar, 2, &linebreakCursor, linebreakSize, 0); + ME_GetTextW(editor, lastchar, 2, &linebreakCursor, linebreakSize, FALSE); if (lastchar[0] == '\r' && (lastchar[1] == '\n' || lastchar[1] == '\0')) { ME_InternalDeleteText(editor, &linebreakCursor, linebreakSize, FALSE); } @@ -2003,12 +2003,12 @@ { if (!strText) return 0; if (unicode) { - return ME_GetTextW(editor, strText, INT_MAX, start, nLen, 0); + return ME_GetTextW(editor, strText, INT_MAX, start, nLen, FALSE); } else { int nChars; WCHAR *p = ALLOC_N_OBJ(WCHAR, nLen+1); if (!p) return 0; - nChars = ME_GetTextW(editor, p, nLen, start, nLen, 0); + nChars = ME_GetTextW(editor, p, nLen, start, nLen, FALSE); WideCharToMultiByte(CP_ACP, 0, p, nChars+1, (char *)strText, nLen+1, NULL, NULL); FREE_OBJ(p); @@ -2858,6 +2858,8 @@ ed->horz_si.nPage = 0; ed->horz_si.nPos = 0; + ed->wheel_remain = 0; + OleInitialize(NULL); return ed; @@ -2925,6 +2927,23 @@ return TRUE; } +static inline int get_default_line_height( ME_TextEditor *editor ) +{ + int height = 0; + + if (editor->pBuffer && editor->pBuffer->pDefaultStyle) + height = editor->pBuffer->pDefaultStyle->tm.tmHeight; + if (height <= 0) height = 24; + + return height; +} + +static inline int calc_wheel_change( int *remain, int amount_per_click ) +{ + int change = amount_per_click * (float)*remain / WHEEL_DELTA; + *remain -= WHEEL_DELTA * change / amount_per_click; + return change; +} static const char * const edit_messages[] = { "EM_GETSEL", @@ -3142,11 +3161,14 @@ return ME_StreamOut(editor, wParam, (EDITSTREAM *)lParam); case WM_GETDLGCODE: { - UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS|DLGC_HASSETSEL; + UINT code = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS; + if (lParam) editor->bDialogMode = TRUE; if (editor->styleFlags & ES_MULTILINE) code |= DLGC_WANTMESSAGE; + if (!(editor->styleFlags & ES_SAVESEL)) + code |= DLGC_HASSETSEL; return code; } case EM_EMPTYUNDOBUFFER: @@ -3545,7 +3567,7 @@ { if (!(editor->styleFlags & ES_MULTILINE)) return FALSE; - ME_ScrollDown(editor, lParam * 8); /* FIXME follow the original */ + ME_ScrollDown( editor, lParam * get_default_line_height( editor ) ); return TRUE; } case WM_CLEAR: @@ -4132,6 +4154,7 @@ case WM_KILLFOCUS: ME_CommitUndo(editor); /* End coalesced undos for typed characters */ editor->bHaveFocus = FALSE; + editor->wheel_remain = 0; ME_HideCaret(editor); ME_SendOldNotify(editor, EN_KILLFOCUS); return 0; @@ -4218,14 +4241,9 @@ case WM_VSCROLL: { int origNPos; - int lineHeight; + int lineHeight = get_default_line_height( editor ); origNPos = editor->vert_si.nPos; - lineHeight = 24; - - if (editor->pBuffer && editor->pBuffer->pDefaultStyle) - lineHeight = editor->pBuffer->pDefaultStyle->tm.tmHeight; - if (lineHeight <= 0) lineHeight = 24; switch(LOWORD(wParam)) { @@ -4265,8 +4283,7 @@ } case WM_MOUSEWHEEL: { - int gcWheelDelta; - UINT pulScrollLines; + int delta; BOOL ctrl_is_down; if ((editor->nEventMask & ENM_MOUSEEVENTS) && @@ -4275,9 +4292,16 @@ ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000; - gcWheelDelta = GET_WHEEL_DELTA_WPARAM(wParam); + delta = GET_WHEEL_DELTA_WPARAM(wParam); - if (abs(gcWheelDelta) >= WHEEL_DELTA) + /* if scrolling changes direction, ignore left overs */ + if ((delta < 0 && editor->wheel_remain < 0) || + (delta > 0 && editor->wheel_remain > 0)) + editor->wheel_remain += delta; + else + editor->wheel_remain = delta; + + if (editor->wheel_remain) { if (ctrl_is_down) { int numerator; @@ -4287,14 +4311,18 @@ } else { numerator = editor->nZoomNumerator * 100 / editor->nZoomDenominator; } - numerator = numerator + (gcWheelDelta / WHEEL_DELTA) * 10; + numerator += calc_wheel_change( &editor->wheel_remain, 10 ); if (numerator >= 10 && numerator <= 500) ME_SetZoom(editor, numerator, 100); } else { - SystemParametersInfoW(SPI_GETWHEELSCROLLLINES,0, &pulScrollLines, 0); - /* FIXME follow the original */ - if (pulScrollLines) - ME_ScrollDown(editor,pulScrollLines * (-gcWheelDelta / WHEEL_DELTA) * 8); + UINT max_lines = 3; + int lines = 0; + + SystemParametersInfoW( SPI_GETWHEELSCROLLLINES, 0, &max_lines, 0 ); + if (max_lines) + lines = calc_wheel_change( &editor->wheel_remain, (int)max_lines ); + if (lines) + ME_ScrollDown( editor, -lines * get_default_line_height( editor ) ); } } break; @@ -4702,7 +4730,7 @@ int nLen; /* bCRLF flag is only honored in 2.0 and up. 1.0 must always return text verbatim */ - if (editor->bEmulateVersion10) bCRLF = 0; + if (editor->bEmulateVersion10) bCRLF = FALSE; pRun = start->pRun; assert(pRun); @@ -4987,7 +5015,7 @@ WCHAR bufferW[MAX_PREFIX_LEN + 1]; unsigned int i; - ME_GetTextW(editor, bufferW, MAX_PREFIX_LEN, start, nChars, 0); + ME_GetTextW(editor, bufferW, MAX_PREFIX_LEN, start, nChars, FALSE); for (i = 0; i < sizeof(prefixes) / sizeof(*prefixes); i++) { if (nChars < prefixes[i].length) continue; diff -Nru wine1.7-1.7.13/dlls/riched20/editstr.h wine1.7-1.7.16/dlls/riched20/editstr.h --- wine1.7-1.7.13/dlls/riched20/editstr.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/editstr.h 2014-04-04 19:13:44.000000000 +0000 @@ -443,6 +443,7 @@ SCROLLINFO vert_si, horz_si; BOOL bMouseCaptured; + int wheel_remain; } ME_TextEditor; typedef struct tagME_Context diff -Nru wine1.7-1.7.13/dlls/riched20/reader.c wine1.7-1.7.16/dlls/riched20/reader.c --- wine1.7-1.7.13/dlls/riched20/reader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/reader.c 2014-04-04 19:13:44.000000000 +0000 @@ -256,7 +256,7 @@ info->rtfLineNum = 0; info->rtfLinePos = 0; info->prevChar = EOF; - info->bumpLine = 0; + info->bumpLine = FALSE; info->dwCPOutputCount = 0; if (!info->cpOutputBuffer) @@ -722,7 +722,7 @@ static int GetChar(RTF_Info *info) { int c; - int oldBumpLine; + BOOL oldBumpLine; if ((c = _RTFGetChar(info)) != EOF) { @@ -730,16 +730,16 @@ info->rtfTextBuf[info->rtfTextLen] = '\0'; } if (info->prevChar == EOF) - info->bumpLine = 1; - oldBumpLine = info->bumpLine; /* non-zero if prev char was line ending */ - info->bumpLine = 0; + info->bumpLine = TRUE; + oldBumpLine = info->bumpLine; /* TRUE if prev char was line ending */ + info->bumpLine = FALSE; if (c == '\r') - info->bumpLine = 1; + info->bumpLine = TRUE; else if (c == '\n') { - info->bumpLine = 1; + info->bumpLine = TRUE; if (info->prevChar == '\r') /* oops, previous \r wasn't */ - oldBumpLine = 0; /* really a line ending */ + oldBumpLine = FALSE; /* really a line ending */ } ++info->rtfLinePos; if (oldBumpLine) /* were we supposed to increment the */ diff -Nru wine1.7-1.7.13/dlls/riched20/richole.c wine1.7-1.7.16/dlls/riched20/richole.c --- wine1.7-1.7.13/dlls/riched20/richole.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/richole.c 2014-04-04 19:13:44.000000000 +0000 @@ -515,6 +515,9 @@ { IRichEditOleImpl *This = impl_from_ITextDocument(me); TRACE("(%p)\n", me); + + if(!ppSel) + return E_INVALIDARG; *ppSel = &This->txtSel->ITextSelection_iface; ITextSelection_AddRef(*ppSel); return S_OK; @@ -1514,7 +1517,7 @@ return 0; } reo->clientSite = CreateOleClientSite(reo); - if (!reo->txtSel) + if (!reo->clientSite) { ITextSelection_Release(&reo->txtSel->ITextSelection_iface); heap_free(reo); diff -Nru wine1.7-1.7.13/dlls/riched20/rtf.h wine1.7-1.7.16/dlls/riched20/rtf.h --- wine1.7-1.7.13/dlls/riched20/rtf.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/rtf.h 2014-04-04 19:13:44.000000000 +0000 @@ -1139,7 +1139,7 @@ char *pushedTextBuf; int prevChar; - int bumpLine; + BOOL bumpLine; /* Document-wide attributes */ RTFFont *fontList; /* these lists MUST be */ diff -Nru wine1.7-1.7.13/dlls/riched20/tests/editor.c wine1.7-1.7.16/dlls/riched20/tests/editor.c --- wine1.7-1.7.13/dlls/riched20/tests/editor.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/tests/editor.c 2014-04-04 19:13:44.000000000 +0000 @@ -6729,6 +6729,16 @@ ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", res, expected); DestroyWindow(hwnd); + + hwnd = CreateWindowExA(0, RICHEDIT_CLASS20A, NULL, + WS_POPUP|ES_SAVESEL, + 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL); + ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS20A, (int) GetLastError()); + res = SendMessageA(hwnd, WM_GETDLGCODE, 0, 0); + expected = DLGC_WANTCHARS|DLGC_WANTTAB|DLGC_WANTARROWS; + ok(res == expected, "WM_GETDLGCODE returned %x but expected %x\n", + res, expected); + DestroyWindow(hwnd); } static void test_zoom(void) diff -Nru wine1.7-1.7.13/dlls/riched20/tests/richole.c wine1.7-1.7.16/dlls/riched20/tests/richole.c --- wine1.7-1.7.13/dlls/riched20/tests/richole.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/tests/richole.c 2014-04-04 19:13:44.000000000 +0000 @@ -117,6 +117,9 @@ ok(hres == S_OK, "IRichEditOle_QueryInterface\n"); ok(txtDoc != NULL, "IRichEditOle_QueryInterface\n"); + hres = ITextDocument_GetSelection(txtDoc, NULL); + ok(hres == E_INVALIDARG, "ITextDocument_GetSelection: 0x%x\n", hres); + ITextDocument_GetSelection(txtDoc, &txtSel); punk = NULL; @@ -190,7 +193,7 @@ int tomNumSingle = sizeof(tomConstantsSingle)/sizeof(tomConstantsSingle[0]); int tomNumMulti = sizeof(tomConstantsMulti)/sizeof(tomConstantsMulti[0]); int i; - VariantInit(&testfile); + V_VT(&testfile) = VT_BSTR; V_BSTR(&testfile) = SysAllocString(filename); @@ -378,6 +381,8 @@ todo_wine ok(result == 0, "ITextDocument_Open: Test UTF-16 set wrong text: Result: %s\n", wine_dbgstr_w(bufUnicode)); release_interfaces(&w, &reOle, &txtDoc, &txtSel); DeleteFileW(filename); + + VariantClear(&testfile); } START_TEST(richole) diff -Nru wine1.7-1.7.13/dlls/riched20/tests/txtsrv.c wine1.7-1.7.16/dlls/riched20/tests/txtsrv.c --- wine1.7-1.7.13/dlls/riched20/tests/txtsrv.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/tests/txtsrv.c 2014-04-04 19:13:44.000000000 +0000 @@ -65,7 +65,7 @@ #define ITextServices_OnTxUIDeactivate(This) TXTSERV_VTABLE(This)->OnTxUIDeactivate(This) #define ITextServices_TxGetText(This,a) TXTSERV_VTABLE(This)->TxGetText(This,a) #define ITextServices_TxSetText(This,a) TXTSERV_VTABLE(This)->TxSetText(This,a) -#define ITextServices_TxGetCurrentTargetX(This,a) TXTSERV_VTABLE(This)->TxGetCurrentTargetX(This,a) +#define ITextServices_TxGetCurTargetX(This,a) TXTSERV_VTABLE(This)->TxGetCurTargetX(This,a) #define ITextServices_TxGetBaseLinePos(This,a) TXTSERV_VTABLE(This)->TxGetBaseLinePos(This,a) #define ITextServices_TxGetNaturalSize(This,a,b,c,d,e,f,g,h) TXTSERV_VTABLE(This)->TxGetNaturalSize(This,a,b,c,d,e,f,g,h) #define ITextServices_TxGetDropTarget(This,a) TXTSERV_VTABLE(This)->TxGetDropTarget(This,a) diff -Nru wine1.7-1.7.13/dlls/riched20/txtsrv.c wine1.7-1.7.16/dlls/riched20/txtsrv.c --- wine1.7-1.7.13/dlls/riched20/txtsrv.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/riched20/txtsrv.c 2014-04-04 19:13:44.000000000 +0000 @@ -292,7 +292,7 @@ return S_OK; } -DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCurrentTargetX(ITextServices *iface, LONG *x) +DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetCurTargetX(ITextServices *iface, LONG *x) { ITextServicesImpl *This = impl_from_ITextServices(iface); @@ -354,7 +354,7 @@ DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxUIDeactivate,4) DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetText,8) DEFINE_THISCALL_WRAPPER(fnTextSrv_TxSetText,8) -DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurrentTargetX,8) +DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCurTargetX,8) DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetBaseLinePos,8) DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetNaturalSize,36) DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8) @@ -378,7 +378,7 @@ THISCALL(fnTextSrv_OnTxUIDeactivate), THISCALL(fnTextSrv_TxGetText), THISCALL(fnTextSrv_TxSetText), - THISCALL(fnTextSrv_TxGetCurrentTargetX), + THISCALL(fnTextSrv_TxGetCurTargetX), THISCALL(fnTextSrv_TxGetBaseLinePos), THISCALL(fnTextSrv_TxGetNaturalSize), THISCALL(fnTextSrv_TxGetDropTarget), diff -Nru wine1.7-1.7.13/dlls/rpcrt4/tests/server.c wine1.7-1.7.16/dlls/rpcrt4/tests/server.c --- wine1.7-1.7.13/dlls/rpcrt4/tests/server.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/rpcrt4/tests/server.c 2014-04-04 19:13:44.000000000 +0000 @@ -54,6 +54,9 @@ /* type check statements generated in header file */ fnprintf *p_printf = printf; +static const WCHAR helloW[] = { 'H','e','l','l','o',0 }; +static const WCHAR worldW[] = { 'W','o','r','l','d','!',0 }; + static void InitFunctionPointers(void) { HMODULE hrpcrt4 = GetModuleHandleA("rpcrt4.dll"); @@ -572,6 +575,34 @@ name->name[name->size - 1] = 0; } +void __cdecl s_get_names(int *n, str_array_t *names) +{ + str_array_t list; + + list = MIDL_user_allocate(2 * sizeof(list[0])); + list[0] = MIDL_user_allocate(6); + strcpy(list[0], "Hello"); + list[1] = MIDL_user_allocate(7); + strcpy(list[1], "World!"); + + *names = list; + *n = 2; +} + +void __cdecl s_get_namesw(int *n, wstr_array_t *names) +{ + wstr_array_t list; + + list = MIDL_user_allocate(2 * sizeof(list[0])); + list[0] = MIDL_user_allocate(sizeof(helloW)); + lstrcpyW(list[0], helloW); + list[1] = MIDL_user_allocate(sizeof(worldW)); + lstrcpyW(list[1], worldW); + + *names = list; + *n = 2; +} + int __cdecl s_sum_pcarr2(int n, int **pa) { return s_sum_conf_array(*pa, n); @@ -1191,12 +1222,36 @@ if (!old_windows_version) { + int n; + str_array_t names; + wstr_array_t namesw; + name.size = 10; name.name = buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, name.size); get_name(&name); ok(name.name == buffer, "[in,out] pointer should have stayed as %p but instead changed to %p\n", name.name, buffer); ok(!strcmp(name.name, "Jeremy Wh"), "name didn't unmarshall properly, expected \"Jeremy Wh\", but got \"%s\"\n", name.name); HeapFree(GetProcessHeap(), 0, name.name); + + n = -1; + names = NULL; + get_names(&n, &names); + ok(n == 2, "expected 2, got %d\n", n); + ok(!strcmp(names[0], "Hello"), "expected Hello, got %s\n", names[0]); + ok(!strcmp(names[1], "World!"), "expected World!, got %s\n", names[1]); + MIDL_user_free(names[0]); + MIDL_user_free(names[1]); + MIDL_user_free(names); + + n = -1; + namesw = NULL; + get_namesw(&n, &namesw); + ok(n == 2, "expected 2, got %d\n", n); + ok(!lstrcmpW(namesw[0], helloW), "expected Hello, got %s\n", wine_dbgstr_w(namesw[0])); + ok(!lstrcmpW(namesw[1], worldW), "expected World!, got %s\n", wine_dbgstr_w(namesw[1])); + MIDL_user_free(namesw[0]); + MIDL_user_free(namesw[1]); + MIDL_user_free(namesw); } pa2 = a; diff -Nru wine1.7-1.7.13/dlls/rpcrt4/tests/server.idl wine1.7-1.7.16/dlls/rpcrt4/tests/server.idl --- wine1.7-1.7.13/dlls/rpcrt4/tests/server.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/rpcrt4/tests/server.idl 2014-04-04 19:13:44.000000000 +0000 @@ -328,6 +328,11 @@ } name_t; void get_name([in,out] name_t *name); + typedef char **str_array_t; + void get_names([out] int *n, [out, string, size_is(,*n)] str_array_t *names); + typedef WCHAR **wstr_array_t; + void get_namesw([out] int *n, [out, string, size_is(,*n)] wstr_array_t *names); + int sum_pcarr2(int n, [size_is(, n)] int **pa); int sum_L1_norms(int n, [size_is(n)] vector_t *vs); diff -Nru wine1.7-1.7.13/dlls/schedsvc/Makefile.in wine1.7-1.7.16/dlls/schedsvc/Makefile.in --- wine1.7-1.7.13/dlls/schedsvc/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,8 @@ +MODULE = schedsvc.dll +IMPORTS = rpcrt4 advapi32 + +C_SRCS = \ + schedsvc.c \ + svc_main.c + +IDL_SRCS = schrpc.idl diff -Nru wine1.7-1.7.13/dlls/schedsvc/schedsvc.c wine1.7-1.7.16/dlls/schedsvc/schedsvc.c --- wine1.7-1.7.13/dlls/schedsvc/schedsvc.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/schedsvc.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,670 @@ +/* + * Task Scheduler Service + * + * Copyright 2014 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 + +#include "windef.h" +#include "schrpc.h" +#include "taskschd.h" +#include "wine/debug.h" + +#include "schedsvc_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(schedsvc); + +static const char bom_utf8[] = { 0xef,0xbb,0xbf }; + +HRESULT __cdecl SchRpcHighestVersion(DWORD *version) +{ + TRACE("%p\n", version); + + *version = MAKELONG(3, 1); + return S_OK; +} + +static WCHAR *get_full_name(const WCHAR *path, WCHAR **relative_path) +{ + static const WCHAR tasksW[] = { '\\','t','a','s','k','s','\\',0 }; + WCHAR *target; + int len; + + len = GetSystemDirectoryW(NULL, 0); + len += strlenW(tasksW) + strlenW(path); + + target = heap_alloc(len * sizeof(WCHAR)); + if (target) + { + GetSystemDirectoryW(target, len); + strcatW(target, tasksW); + if (relative_path) + *relative_path = target + strlenW(target) - 1; + while (*path == '\\') path++; + strcatW(target, path); + } + return target; +} + +/* + * Recursively create all directories in the path. + */ +static HRESULT create_directory(const WCHAR *path) +{ + HRESULT hr = S_OK; + WCHAR *new_path; + int len; + + new_path = heap_alloc((strlenW(path) + 1) * sizeof(WCHAR)); + if (!new_path) return E_OUTOFMEMORY; + + strcpyW(new_path, path); + + len = strlenW(new_path); + while (len && new_path[len - 1] == '\\') + { + new_path[len - 1] = 0; + len--; + } + + while (!CreateDirectoryW(new_path, NULL)) + { + WCHAR *slash; + DWORD last_error = GetLastError(); + + if (last_error == ERROR_ALREADY_EXISTS || last_error != ERROR_PATH_NOT_FOUND || + !(slash = strrchrW(new_path, '\\'))) + { + hr = HRESULT_FROM_WIN32(last_error); + break; + } + + len = slash - new_path; + new_path[len] = 0; + hr = create_directory(new_path); + if (hr != S_OK) break; + new_path[len] = '\\'; + } + + heap_free(new_path); + return hr; +} + +static HRESULT write_xml_utf8(const WCHAR *name, DWORD disposition, const WCHAR *xmlW) +{ + static const char comment[] = "\n"; + HANDLE hfile; + DWORD size; + char *xml; + HRESULT hr = S_OK; + + hfile = CreateFileW(name, GENERIC_WRITE, 0, NULL, disposition, 0, 0); + if (hfile == INVALID_HANDLE_VALUE) + { + if (GetLastError() == ERROR_FILE_EXISTS) + return HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS); + + return HRESULT_FROM_WIN32(GetLastError()); + } + + size = WideCharToMultiByte(CP_UTF8, 0, xmlW, -1, NULL, 0, NULL, NULL); + xml = heap_alloc(size); + if (!xml) + { + CloseHandle(hfile); + return E_OUTOFMEMORY; + } + WideCharToMultiByte(CP_UTF8, 0, xmlW, -1, xml, size, NULL, NULL); + + if (!WriteFile(hfile, bom_utf8, sizeof(bom_utf8), &size, NULL)) + { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto failed; + } + if (!WriteFile(hfile, comment, strlen(comment), &size, NULL)) + { + hr = HRESULT_FROM_WIN32(GetLastError()); + goto failed; + } + + /* skip XML declaration with UTF-16 specifier */ + if (!memcmp(xml, "'); + if (p++) while (isspace(*p)) p++; + else p = xml; + if (!WriteFile(hfile, p, strlen(p), &size, NULL)) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + else + { + if (!WriteFile(hfile, xml, strlen(xml), &size, NULL)) + hr = HRESULT_FROM_WIN32(GetLastError()); + } + +failed: + heap_free(xml); + CloseHandle(hfile); + return hr; +} + +HRESULT __cdecl SchRpcRegisterTask(const WCHAR *path, const WCHAR *xml, DWORD flags, const WCHAR *sddl, + DWORD task_logon_type, DWORD n_creds, const TASK_USER_CRED *creds, + WCHAR **actual_path, TASK_XML_ERROR_INFO **xml_error_info) +{ + WCHAR *full_name, *relative_path; + DWORD disposition; + HRESULT hr; + + TRACE("%s,%s,%#x,%s,%u,%u,%p,%p,%p\n", debugstr_w(path), debugstr_w(xml), flags, + debugstr_w(sddl), task_logon_type, n_creds, creds, actual_path, xml_error_info); + + *actual_path = NULL; + *xml_error_info = NULL; + + /* FIXME: assume that validation is performed on the client side */ + if (flags & TASK_VALIDATE_ONLY) return S_OK; + + full_name = get_full_name(path, &relative_path); + if (!full_name) return E_OUTOFMEMORY; + + if (strchrW(path, '\\') || strchrW(path, '/')) + { + WCHAR *p = strrchrW(full_name, '/'); + if (!p) p = strrchrW(full_name, '\\'); + *p = 0; + hr = create_directory(full_name); + *p = '\\'; + } + + switch (flags & (TASK_CREATE | TASK_UPDATE)) + { + default: + case TASK_CREATE: + disposition = CREATE_NEW; + break; + + case TASK_UPDATE: + disposition = OPEN_EXISTING; + break; + + case (TASK_CREATE | TASK_UPDATE): + disposition = OPEN_ALWAYS; + break; + } + + hr = write_xml_utf8(full_name, disposition, xml); + if (hr == S_OK) + { + *actual_path = heap_strdupW(relative_path); + schedsvc_auto_start(); + } + + heap_free(full_name); + return hr; +} + +static int detect_encoding(const void *buffer, DWORD size) +{ + if (size >= sizeof(bom_utf8) && !memcmp(buffer, bom_utf8, sizeof(bom_utf8))) + return CP_UTF8; + else + { + int flags = IS_TEXT_UNICODE_SIGNATURE | + IS_TEXT_UNICODE_REVERSE_SIGNATURE | + IS_TEXT_UNICODE_ODD_LENGTH; + IsTextUnicode(buffer, size, &flags); + if (flags & IS_TEXT_UNICODE_SIGNATURE) + return -1; + if (flags & IS_TEXT_UNICODE_REVERSE_SIGNATURE) + return -2; + return CP_ACP; + } +} + +static HRESULT read_xml(const WCHAR *name, WCHAR **xml) +{ + HANDLE hfile; + DWORD size; + char *src; + int cp; + + hfile = CreateFileW(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0); + if (hfile == INVALID_HANDLE_VALUE) + return HRESULT_FROM_WIN32(GetLastError()); + + size = GetFileSize(hfile, NULL); + src = heap_alloc(size + 2); + if (!src) + { + CloseHandle(hfile); + return E_OUTOFMEMORY; + } + + src[size] = 0; + src[size + 1] = 0; + + ReadFile(hfile, src, size, &size, NULL); + CloseHandle(hfile); + + cp = detect_encoding(src, size); + if (cp < 0) + { + *xml = (WCHAR *)src; + return S_OK; + } + + if (cp == CP_UTF8 && size >= sizeof(bom_utf8) && !memcmp(src, bom_utf8, sizeof(bom_utf8))) + src += sizeof(bom_utf8); + + size = MultiByteToWideChar(cp, 0, src, -1, NULL, 0); + *xml = heap_alloc(size * sizeof(WCHAR)); + if (!*xml) return E_OUTOFMEMORY; + MultiByteToWideChar(cp, 0, src, -1, *xml, size); + return S_OK; +} + +HRESULT __cdecl SchRpcRetrieveTask(const WCHAR *path, const WCHAR *languages, ULONG *n_languages, WCHAR **xml) +{ + WCHAR *full_name; + HRESULT hr; + + TRACE("%s,%s,%p,%p\n", debugstr_w(path), debugstr_w(languages), n_languages, xml); + + full_name = get_full_name(path, NULL); + if (!full_name) return E_OUTOFMEMORY; + + hr = read_xml(full_name, xml); + if (hr != S_OK) *xml = NULL; + + heap_free(full_name); + return hr; +} + +HRESULT __cdecl SchRpcCreateFolder(const WCHAR *path, const WCHAR *sddl, DWORD flags) +{ + WCHAR *full_name; + HRESULT hr; + + TRACE("%s,%s,%#x\n", debugstr_w(path), debugstr_w(sddl), flags); + + if (flags) return E_INVALIDARG; + + full_name = get_full_name(path, NULL); + if (!full_name) return E_OUTOFMEMORY; + + hr = create_directory(full_name); + + heap_free(full_name); + return hr; +} + +HRESULT __cdecl SchRpcSetSecurity(const WCHAR *path, const WCHAR *sddl, DWORD flags) +{ + FIXME("%s,%s,%#x: stub\n", debugstr_w(path), debugstr_w(sddl), flags); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcGetSecurity(const WCHAR *path, DWORD flags, WCHAR **sddl) +{ + FIXME("%s,%#x,%p: stub\n", debugstr_w(path), flags, sddl); + return E_NOTIMPL; +} + +static void free_list(TASK_NAMES list, LONG count) +{ + LONG i; + + for (i = 0; i < count; i++) + heap_free(list[i]); + + heap_free(list); +} + +static inline BOOL is_directory(const WIN32_FIND_DATAW *data) +{ + if (data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + if (data->cFileName[0] == '.') + { + if (!data->cFileName[1] || (data->cFileName[1] == '.' && !data->cFileName[2])) + return FALSE; + } + return TRUE; + } + return FALSE; +} + +static inline BOOL is_file(const WIN32_FIND_DATAW *data) +{ + return !(data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); +} + +HRESULT __cdecl SchRpcEnumFolders(const WCHAR *path, DWORD flags, DWORD *start_index, DWORD n_requested, + DWORD *n_names, TASK_NAMES *names) +{ + static const WCHAR allW[] = {'\\','*',0}; + HRESULT hr = S_OK; + WCHAR *full_name; + WCHAR pathW[MAX_PATH]; + WIN32_FIND_DATAW data; + HANDLE handle; + DWORD allocated, count, index; + TASK_NAMES list; + + TRACE("%s,%#x,%u,%u,%p,%p\n", debugstr_w(path), flags, *start_index, n_requested, n_names, names); + + *n_names = 0; + *names = NULL; + + if (flags & ~TASK_ENUM_HIDDEN) return E_INVALIDARG; + + if (!n_requested) n_requested = ~0u; + + full_name = get_full_name(path, NULL); + if (!full_name) return E_OUTOFMEMORY; + + if (strlenW(full_name) + 2 > MAX_PATH) + { + heap_free(full_name); + return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); + } + + strcpyW(pathW, full_name); + strcatW(pathW, allW); + + heap_free(full_name); + + allocated = 64; + list = heap_alloc(allocated * sizeof(list[0])); + if (!list) return E_OUTOFMEMORY; + + index = count = 0; + + handle = FindFirstFileW(pathW, &data); + if (handle == INVALID_HANDLE_VALUE) + { + heap_free(list); + if (GetLastError() == ERROR_PATH_NOT_FOUND) + return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + return HRESULT_FROM_WIN32(GetLastError()); + } + + do + { + if (is_directory(&data) && index++ >= *start_index) + { + if (count >= allocated) + { + TASK_NAMES new_list; + allocated *= 2; + new_list = heap_realloc(list, allocated * sizeof(list[0])); + if (!new_list) + { + hr = E_OUTOFMEMORY; + break; + } + list = new_list; + } + + TRACE("adding %s\n", debugstr_w(data.cFileName)); + + list[count] = heap_strdupW(data.cFileName); + if (!list[count]) + { + hr = E_OUTOFMEMORY; + break; + } + + count++; + + if (count >= n_requested) + { + hr = S_FALSE; + break; + } + } + } while (FindNextFileW(handle, &data)); + + FindClose(handle); + + if (FAILED(hr)) + { + free_list(list, count); + return hr; + } + + *n_names = count; + + if (count) + { + *names = list; + *start_index = index; + return hr; + } + + heap_free(list); + *names = NULL; + return *start_index ? S_FALSE : S_OK; +} + +HRESULT __cdecl SchRpcEnumTasks(const WCHAR *path, DWORD flags, DWORD *start_index, DWORD n_requested, + DWORD *n_names, TASK_NAMES *names) +{ + static const WCHAR allW[] = {'\\','*',0}; + HRESULT hr = S_OK; + WCHAR *full_name; + WCHAR pathW[MAX_PATH]; + WIN32_FIND_DATAW data; + HANDLE handle; + DWORD allocated, count, index; + TASK_NAMES list; + + TRACE("%s,%#x,%u,%u,%p,%p\n", debugstr_w(path), flags, *start_index, n_requested, n_names, names); + + *n_names = 0; + *names = NULL; + + if (flags & ~TASK_ENUM_HIDDEN) return E_INVALIDARG; + + if (!n_requested) n_requested = ~0u; + + full_name = get_full_name(path, NULL); + if (!full_name) return E_OUTOFMEMORY; + + if (strlenW(full_name) + 2 > MAX_PATH) + { + heap_free(full_name); + return HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); + } + + strcpyW(pathW, full_name); + strcatW(pathW, allW); + + heap_free(full_name); + + allocated = 64; + list = heap_alloc(allocated * sizeof(list[0])); + if (!list) return E_OUTOFMEMORY; + + index = count = 0; + + handle = FindFirstFileW(pathW, &data); + if (handle == INVALID_HANDLE_VALUE) + { + heap_free(list); + if (GetLastError() == ERROR_PATH_NOT_FOUND) + return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); + return HRESULT_FROM_WIN32(GetLastError()); + } + + do + { + if (is_file(&data) && index++ >= *start_index) + { + if (count >= allocated) + { + TASK_NAMES new_list; + allocated *= 2; + new_list = heap_realloc(list, allocated * sizeof(list[0])); + if (!new_list) + { + hr = E_OUTOFMEMORY; + break; + } + list = new_list; + } + + TRACE("adding %s\n", debugstr_w(data.cFileName)); + + list[count] = heap_strdupW(data.cFileName); + if (!list[count]) + { + hr = E_OUTOFMEMORY; + break; + } + + count++; + + if (count >= n_requested) + { + hr = S_FALSE; + break; + } + } + } while (FindNextFileW(handle, &data)); + + FindClose(handle); + + if (FAILED(hr)) + { + free_list(list, count); + return hr; + } + + *n_names = count; + + if (count) + { + *names = list; + *start_index = index; + return hr; + } + + heap_free(list); + *names = NULL; + return *start_index ? S_FALSE : S_OK; +} + +HRESULT __cdecl SchRpcEnumInstances(const WCHAR *path, DWORD flags, DWORD *n_guids, GUID **guids) +{ + FIXME("%s,%#x,%p,%p: stub\n", debugstr_w(path), flags, n_guids, guids); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcGetInstanceInfo(GUID guid, WCHAR **path, DWORD *task_state, WCHAR **action, + WCHAR **info, DWORD *n_instances, GUID **instances, DWORD *pid) +{ + FIXME("%s,%p,%p,%p,%p,%p,%p,%p: stub\n", wine_dbgstr_guid(&guid), path, task_state, action, + info, n_instances, instances, pid); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcStopInstance(GUID guid, DWORD flags) +{ + FIXME("%s,%#x: stub\n", wine_dbgstr_guid(&guid), flags); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcStop(const WCHAR *path, DWORD flags) +{ + FIXME("%s,%#x: stub\n", debugstr_w(path), flags); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcRun(const WCHAR *path, DWORD n_args, const WCHAR **args, DWORD flags, + DWORD session_id, const WCHAR *user, GUID *guid) +{ + FIXME("%s,%u,%p,%#x,%#x,%s,%p: stub\n", debugstr_w(path), n_args, args, flags, + session_id, debugstr_w(user), guid); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcDelete(const WCHAR *path, DWORD flags) +{ + WCHAR *full_name; + HRESULT hr = S_OK; + + TRACE("%s,%#x\n", debugstr_w(path), flags); + + if (flags) return E_INVALIDARG; + + while (*path == '\\' || *path == '/') path++; + if (!*path) return E_ACCESSDENIED; + + full_name = get_full_name(path, NULL); + if (!full_name) return E_OUTOFMEMORY; + + if (!RemoveDirectoryW(full_name)) + { + hr = HRESULT_FROM_WIN32(GetLastError()); + if (hr == HRESULT_FROM_WIN32(ERROR_DIRECTORY)) + hr = DeleteFileW(full_name) ? S_OK : HRESULT_FROM_WIN32(GetLastError()); + } + + heap_free(full_name); + return hr; +} + +HRESULT __cdecl SchRpcRename(const WCHAR *path, const WCHAR *name, DWORD flags) +{ + FIXME("%s,%s,%#x: stub\n", debugstr_w(path), debugstr_w(name), flags); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcScheduledRuntimes(const WCHAR *path, SYSTEMTIME *start, SYSTEMTIME *end, DWORD flags, + DWORD n_requested, DWORD *n_runtimes, SYSTEMTIME **runtimes) +{ + FIXME("%s,%p,%p,%#x,%u,%p,%p: stub\n", debugstr_w(path), start, end, flags, + n_requested, n_runtimes, runtimes); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcGetLastRunInfo(const WCHAR *path, SYSTEMTIME *last_runtime, DWORD *last_return_code) +{ + FIXME("%s,%p,%p: stub\n", debugstr_w(path), last_runtime, last_return_code); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcGetTaskInfo(const WCHAR *path, DWORD flags, DWORD *enabled, DWORD *task_state) +{ + FIXME("%s,%#x,%p,%p: stub\n", debugstr_w(path), flags, enabled, task_state); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcGetNumberOfMissedRuns(const WCHAR *path, DWORD *runs) +{ + FIXME("%s,%p: stub\n", debugstr_w(path), runs); + return E_NOTIMPL; +} + +HRESULT __cdecl SchRpcEnableTask(const WCHAR *path, DWORD enabled) +{ + FIXME("%s,%u: stub\n", debugstr_w(path), enabled); + return E_NOTIMPL; +} diff -Nru wine1.7-1.7.13/dlls/schedsvc/schedsvc_private.h wine1.7-1.7.16/dlls/schedsvc/schedsvc_private.h --- wine1.7-1.7.13/dlls/schedsvc/schedsvc_private.h 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/schedsvc_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * Copyright 2014 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 + */ + +#ifndef __WINE_SCHEDSVC_PRIVATE_H__ +#define __WINE_SCHEDSVC_PRIVATE_H__ + +#include "wine/unicode.h" + +void schedsvc_auto_start(void) DECLSPEC_HIDDEN; + +static void *heap_alloc_zero(SIZE_T size) __WINE_ALLOC_SIZE(1); +static inline void *heap_alloc_zero(SIZE_T size) +{ + void *ptr = MIDL_user_allocate(size); + if (ptr) memset(ptr, 0, size); + return ptr; +} + +static void *heap_alloc(SIZE_T size) __WINE_ALLOC_SIZE(1); +static inline void *heap_alloc(SIZE_T size) +{ + return MIDL_user_allocate(size); +} + +static void *heap_realloc(void *ptr, SIZE_T size) __WINE_ALLOC_SIZE(2); +static inline void *heap_realloc(void *ptr, SIZE_T size) +{ + return HeapReAlloc(GetProcessHeap(), 0, ptr, size); +} + +static inline void heap_free(void *ptr) +{ + MIDL_user_free(ptr); +} + +static inline WCHAR *heap_strdupW(const WCHAR *src) +{ + WCHAR *dst; + unsigned len; + if (!src) return NULL; + len = (strlenW(src) + 1) * sizeof(WCHAR); + if ((dst = heap_alloc(len))) memcpy(dst, src, len); + return dst; +} + +#endif /* __WINE_SCHEDSVC_PRIVATE_H__ */ diff -Nru wine1.7-1.7.13/dlls/schedsvc/schedsvc.spec wine1.7-1.7.16/dlls/schedsvc/schedsvc.spec --- wine1.7-1.7.13/dlls/schedsvc/schedsvc.spec 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/schedsvc.spec 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1 @@ +@ stdcall -private ServiceMain(long ptr) diff -Nru wine1.7-1.7.13/dlls/schedsvc/schrpc.idl wine1.7-1.7.16/dlls/schedsvc/schrpc.idl --- wine1.7-1.7.13/dlls/schedsvc/schrpc.idl 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/schrpc.idl 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,3 @@ +#pragma makedep server + +#include "wine/schrpc.idl" diff -Nru wine1.7-1.7.13/dlls/schedsvc/svc_main.c wine1.7-1.7.16/dlls/schedsvc/svc_main.c --- wine1.7-1.7.13/dlls/schedsvc/svc_main.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/svc_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,207 @@ +/* + * Task Scheduler Service + * + * Copyright 2014 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 + +#include "windef.h" +#include "winbase.h" +#include "winsvc.h" +#include "rpc.h" +#include "schrpc.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(schedsvc); + +static const WCHAR scheduleW[] = {'S','c','h','e','d','u','l','e',0}; +static SERVICE_STATUS_HANDLE schedsvc_handle; +static HANDLE done_event; + +void schedsvc_auto_start(void) +{ + static DWORD start_type; + SC_HANDLE scm, service; + QUERY_SERVICE_CONFIGW *cfg; + DWORD cfg_size; + + if (start_type == SERVICE_AUTO_START) return; + + TRACE("changing service start type to SERVICE_AUTO_START\n"); + + scm = OpenSCManagerW(NULL, NULL, 0); + if (!scm) + { + WARN("failed to open SCM (%u)\n", GetLastError()); + return; + } + + service = OpenServiceW(scm, scheduleW, SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG); + if (service) + { + if (!QueryServiceConfigW(service, NULL, 0, &cfg_size) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + cfg = HeapAlloc(GetProcessHeap(), 0, cfg_size); + if (cfg) + { + if (QueryServiceConfigW(service, cfg, cfg_size, &cfg_size)) + { + start_type = cfg->dwStartType; + if (start_type != SERVICE_AUTO_START) + { + if (ChangeServiceConfigW(service, SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE, + NULL, NULL, NULL, NULL, NULL, NULL, NULL)) + start_type = SERVICE_AUTO_START; + } + } + HeapFree(GetProcessHeap(), 0, cfg); + } + } + else + WARN("failed to query service config (%u)\n", GetLastError()); + + CloseServiceHandle(service); + } + else + WARN("failed to open service (%u)\n", GetLastError()); + + CloseServiceHandle(scm); +} + +static void schedsvc_update_status(DWORD state) +{ + SERVICE_STATUS status; + + status.dwServiceType = SERVICE_WIN32; + status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; + status.dwWin32ExitCode = 0; + status.dwServiceSpecificExitCode = 0; + status.dwCheckPoint = 0; + status.dwWaitHint = 0; + status.dwControlsAccepted = 0; + status.dwCurrentState = state; + + SetServiceStatus(schedsvc_handle, &status); +} + +static void WINAPI schedsvc_handler(DWORD control) +{ + TRACE("%#x\n", control); + + switch (control) + { + case SERVICE_CONTROL_STOP: + case SERVICE_CONTROL_SHUTDOWN: + schedsvc_update_status(SERVICE_STOP_PENDING); + SetEvent(done_event); + break; + + default: + schedsvc_update_status(SERVICE_RUNNING); + break; + } +} + +static RPC_BINDING_VECTOR *sched_bindings; + +static RPC_STATUS RPC_init(void) +{ + WCHAR transport[] = SCHEDSVC_TRANSPORT; + RPC_STATUS status; + + TRACE("using %s\n", debugstr_w(transport)); + + status = RpcServerUseProtseqEpW(transport, 0, NULL, NULL); + if (status != RPC_S_OK) + { + WINE_ERR("RpcServerUseProtseqEp error %#x\n", status); + return status; + } + + status = RpcServerRegisterIf(ITaskSchedulerService_v1_0_s_ifspec, 0, 0); + if (status != RPC_S_OK) + { + WINE_ERR("RpcServerRegisterIf error %#x\n", status); + return status; + } + + status = RpcServerInqBindings(&sched_bindings); + if (status != RPC_S_OK) + { + WINE_ERR("RpcServerInqBindings error %#x\n", status); + return status; + } + + status = RpcEpRegisterW(ITaskSchedulerService_v1_0_s_ifspec, sched_bindings, NULL, NULL); + if (status != RPC_S_OK) + { + WINE_ERR("RpcEpRegister error %#x\n", status); + return status; + } + + status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE); + if (status != RPC_S_OK) + { + WINE_ERR("RpcServerListen error %#x\n", status); + return status; + } + return RPC_S_OK; +} + +static void RPC_finish(void) +{ + RpcMgmtStopServerListening(NULL); + RpcEpUnregister(ITaskSchedulerService_v1_0_s_ifspec, sched_bindings, NULL); + RpcBindingVectorFree(&sched_bindings); + RpcServerUnregisterIf(NULL, NULL, FALSE); +} + +void WINAPI ServiceMain(DWORD argc, LPWSTR *argv) +{ + TRACE("starting Task Scheduler Service\n"); + + if (RPC_init() != RPC_S_OK) return; + + schedsvc_handle = RegisterServiceCtrlHandlerW(scheduleW, schedsvc_handler); + if (!schedsvc_handle) + { + WINE_ERR("RegisterServiceCtrlHandler error %d\n", GetLastError()); + return; + } + + done_event = CreateEventW(NULL, TRUE, FALSE, NULL); + + schedsvc_update_status(SERVICE_RUNNING); + + WaitForSingleObject(done_event, INFINITE); + + RPC_finish(); + schedsvc_update_status(SERVICE_STOPPED); + + TRACE("exiting Task Scheduler Service\n"); +} + +void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr) +{ + HeapFree(GetProcessHeap(), 0, ptr); +} diff -Nru wine1.7-1.7.13/dlls/schedsvc/tests/Makefile.in wine1.7-1.7.16/dlls/schedsvc/tests/Makefile.in --- wine1.7-1.7.13/dlls/schedsvc/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/tests/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,8 @@ +TESTDLL = schedsvc.dll +IMPORTS = rpcrt4 + +C_SRCS = \ + rpcapi.c + +IDL_SRCS = \ + schrpc.idl diff -Nru wine1.7-1.7.13/dlls/schedsvc/tests/rpcapi.c wine1.7-1.7.16/dlls/schedsvc/tests/rpcapi.c --- wine1.7-1.7.13/dlls/schedsvc/tests/rpcapi.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/tests/rpcapi.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,493 @@ +/* + * Copyright 2014 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 +#include +#include +#include +#include +#include "schrpc.h" + +#include "wine/test.h" + +extern handle_t rpc_handle; + +static LONG CALLBACK rpc_exception_filter(EXCEPTION_POINTERS *ptrs) +{ + skip("Can't connect to Scheduler service: %#x\n", ptrs->ExceptionRecord->ExceptionCode); + + if (winetest_debug) + { + fprintf(stdout, "rpcapi: 0 tests executed (0 marked as todo, 0 failures), 1 skipped.\n"); + fflush(stdout); + } + ExitProcess(0); +} + +START_TEST(rpcapi) +{ + static unsigned char ncalrpc[] = "ncalrpc"; + static const WCHAR empty[] = { 0 }; + static const WCHAR Wine[] = { '\\','W','i','n','e',0 }; + static const WCHAR Wine_Folder1[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1',0 }; + static const WCHAR Wine_Folder2[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','2',0 }; + static const WCHAR Folder1[] = { 'F','o','l','d','e','r','1',0 }; + static const WCHAR Folder2[] = { 'F','o','l','d','e','r','2',0 }; + static const WCHAR Wine_Task1[] = { '\\','W','i','n','e','\\','T','a','s','k','1',0 }; + static const WCHAR Wine_Task2[] = { '\\','W','i','n','e','\\','T','a','s','k','2',0 }; + static const WCHAR Wine_Task3[] = { '\\','W','i','n','e','\\','T','a','s','k','3',0 }; + static const WCHAR Wine_Folder1_Task1[] = { '\\','W','i','n','e','\\','F','o','l','d','e','r','1','\\','T','a','s','k','1',0 }; + static const WCHAR Task1[] = { 'T','a','s','k','1',0 }; + static const WCHAR Task2[] = { 'T','a','s','k','2',0 }; + static const WCHAR Task3[] = { 'T','a','s','k','3',0 }; + static const char xml1[] = + "\n" + "\n" + " \n" + " \"Task1\"\n" + " \n" + " \n" + " false\n" + " false\n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + "\n"; + static const struct + { + DWORD flags, hr; + } create_new_task[] = + { + { 0, S_OK }, + { TASK_CREATE, S_OK }, + { TASK_UPDATE, 0x80070002 /* HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) */ }, + { TASK_CREATE | TASK_UPDATE, S_OK } + }; + static const struct + { + DWORD flags, hr; + } open_existing_task[] = + { + { 0, 0x800700b7 /* HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) */ }, + { TASK_CREATE, 0x800700b7 /* HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) */ }, + { TASK_UPDATE, S_OK }, + { TASK_CREATE | TASK_UPDATE, S_OK } + }; + WCHAR xmlW[sizeof(xml1)], *xml; + HRESULT hr; + DWORD version, start_index, count, i, enumed; + WCHAR *path; + TASK_XML_ERROR_INFO *info; + TASK_NAMES names; + unsigned char *binding_str; + PTOP_LEVEL_EXCEPTION_FILTER old_exception_filter; + + hr = RpcStringBindingComposeA(NULL, ncalrpc, NULL, NULL, NULL, &binding_str); + ok(hr == RPC_S_OK, "RpcStringBindingCompose error %#x\n", hr); + hr = RpcBindingFromStringBindingA(binding_str, &rpc_handle); + ok(hr == RPC_S_OK, "RpcBindingFromStringBinding error %#x\n", hr); + hr = RpcStringFreeA(&binding_str); + ok(hr == RPC_S_OK, "RpcStringFree error %#x\n", hr); + + /* widl generated RpcTryExcept/RpcExcept can't catch raised exceptions */ + old_exception_filter = SetUnhandledExceptionFilter(rpc_exception_filter); + + version = 0; + hr = SchRpcHighestVersion(&version); + ok(version == 0x10002 /* vista */ || version == 0x10003 /* win7 */ || version == 0x10004 /* win8 */, + "wrong version %#x\n", version); + + SetUnhandledExceptionFilter(old_exception_filter); + + hr = SchRpcCreateFolder(Wine_Folder1, NULL, 1); + ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); + + hr = SchRpcCreateFolder(Wine_Folder1, NULL, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + hr = SchRpcCreateFolder(Wine_Folder1, NULL, 0); + ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr); + + hr = SchRpcCreateFolder(Wine_Folder2+1, empty, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + hr = SchRpcDelete(Wine+1, 0); + ok(hr == HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr); + + hr = SchRpcDelete(Wine_Folder1+1, 1); + ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); + + hr = SchRpcDelete(Wine_Folder1+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + hr = SchRpcDelete(Wine_Folder2, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + hr = SchRpcDelete(Wine, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + hr = SchRpcDelete(Wine, 0); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr); + + hr = SchRpcDelete(empty, 0); + ok(hr == E_ACCESSDENIED /* win7 */ || hr == E_INVALIDARG /* vista */, "expected E_ACCESSDENIED, got %#x\n", hr); + + hr = SchRpcCreateFolder(Wine, NULL, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml1, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine+1, xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!path, "expected NULL, path %p\n", path); + ok(!info, "expected NULL, info %p\n", info); + + for (i = 0; i < sizeof(create_new_task)/sizeof(create_new_task[0]); i++) + { + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Task1, xmlW, create_new_task[i].flags, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == create_new_task[i].hr, "%u: expected %#x, got %#x\n", i, create_new_task[i].hr, hr); + + if (hr == S_OK) + { + hr = SchRpcDelete(Wine_Task1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!info, "expected NULL, info %p\n", info); + MIDL_user_free(path); + } + } + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Task1, xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!path, "expected NULL, path %p\n", path); + ok(!info, "expected NULL, info %p\n", info); + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(NULL, xmlW, TASK_VALIDATE_ONLY, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!path, "expected NULL, path %p\n", path); + ok(!info, "expected NULL, info %p\n", info); + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Folder1_Task1+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!lstrcmpW(path, Wine_Folder1_Task1) /* win7 */ || !lstrcmpW(path, Wine_Folder1_Task1+1) /* vista */, + "expected \\Wine\\Folder1\\Task1, task actual path %s\n", wine_dbgstr_w(path)); + ok(!info, "expected NULL, info %p\n", info); + MIDL_user_free(path); + + for (i = 0; i < sizeof(open_existing_task)/sizeof(open_existing_task[0]); i++) + { + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Folder1_Task1+1, xmlW, open_existing_task[i].flags, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == open_existing_task[i].hr, "%u: expected %#x, got %#x\n", i, open_existing_task[i].hr, hr); + if (hr == S_OK) + { + ok(!lstrcmpW(path, Wine_Folder1_Task1) /* win7 */ || !lstrcmpW(path, Wine_Folder1_Task1+1) /* vista */, + "expected \\Wine\\Folder1\\Task1, task actual path %s\n", wine_dbgstr_w(path)); + MIDL_user_free(path); + } + else + ok(!path, "%u: expected NULL, path %p\n", i, path); + ok(!info, "%u: expected NULL, info %p\n", i, info); + } + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Folder1_Task1+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr); + ok(!path, "expected NULL, path %p\n", path); + ok(!info, "expected NULL, info %p\n", info); + + count = 0; + xml = NULL; + hr = SchRpcRetrieveTask(Wine_Folder1_Task1, empty, &count, &xml); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + if (hr == S_OK) trace("%s\n", wine_dbgstr_w(xml)); + MIDL_user_free(xml); + + hr = SchRpcDelete(Wine_Folder1_Task1+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcDelete(Wine_Folder1+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcDelete(Wine+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, TASK_ENUM_HIDDEN, &start_index, 0, &count, &names); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr); + ok(!count, "expected 0, got %u\n", count); + ok(!start_index, "expected 0, got %u\n", start_index); + ok(!names, "expected NULL, got %p\n", names); + + hr = SchRpcCreateFolder(Wine, NULL, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, 0, &start_index, 0, &count, &names); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!count, "expected 0, got %u\n", count); + ok(!start_index, "expected 0, got %u\n", start_index); + ok(!names, "expected NULL, got %p\n", names); + + hr = SchRpcCreateFolder(Wine_Folder1, NULL, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcCreateFolder(Wine_Folder2, NULL, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, 0, &start_index, 0, &count, &names); + ok(hr == S_OK, "expected S_FALSE, got %#x\n", hr); + ok(count == 2, "expected 2, got %u\n", count); + ok(start_index == 2, "expected 2, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + enumed = 0; + for (i = 0; i < count; i++) + { + if (!lstrcmpW(names[i], Folder1)) + enumed += 1; + else if (!lstrcmpW(names[i], Folder2)) + enumed += 2; + MIDL_user_free(names[i]); + } + MIDL_user_free(names); + ok(enumed == 3, "expected 3, got %u\n", enumed); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, 0, &start_index, 1, &count, &names); + ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); + ok(count == 1, "expected 1, got %u\n", count); + ok(start_index == 1, "expected 1, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + ok(!lstrcmpW(names[0], Folder1), "expected Folder1, got %s\n", wine_dbgstr_w(names[0])); + MIDL_user_free(names[0]); + MIDL_user_free(names); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, 0, &start_index, 2, &count, &names); + ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); + ok(count == 2, "expected 2, got %u\n", count); + ok(start_index == 2, "expected 2, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + enumed = 0; + for (i = 0; i < count; i++) + { + if (!lstrcmpW(names[i], Folder1)) + enumed += 1; + else if (!lstrcmpW(names[i], Folder2)) + enumed += 2; + MIDL_user_free(names[i]); + } + MIDL_user_free(names); + ok(enumed == 3, "expected 3, got %u\n", enumed); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, 0, &start_index, 10, &count, &names); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(count == 2, "expected 2, got %u\n", count); + ok(start_index == 2, "expected 2, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + enumed = 0; + for (i = 0; i < count; i++) + { + if (!lstrcmpW(names[i], Folder1)) + enumed += 1; + else if (!lstrcmpW(names[i], Folder2)) + enumed += 2; + MIDL_user_free(names[i]); + } + MIDL_user_free(names); + ok(enumed == 3, "expected 3, got %u\n", enumed); + + start_index = 10; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumFolders(Wine, 0, &start_index, 0, &count, &names); + ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); + ok(!count, "expected 0, got %u\n", count); + ok(start_index == 10, "expected 10, got %u\n", start_index); + ok(!names, "expected NULL, got %p\n", names); + + hr = SchRpcDelete(Wine_Folder1+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcDelete(Wine_Folder2, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumTasks(Wine_Folder1, TASK_ENUM_HIDDEN, &start_index, 0, &count, &names); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr); + ok(!count, "expected 0, got %u\n", count); + ok(!start_index, "expected 0, got %u\n", start_index); + ok(!names, "expected NULL, got %p\n", names); + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Task1+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!lstrcmpW(path, Wine_Task1) /* win7 */ || !lstrcmpW(path, Wine_Task1+1) /* vista */, + "expected \\Wine\\Task1, task actual path %s\n", wine_dbgstr_w(path)); + ok(!info, "expected NULL, info %p\n", info); + MIDL_user_free(path); + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Task2, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!lstrcmpW(path, Wine_Task2), "expected \\Wine\\Task2, task actual path %s\n", wine_dbgstr_w(path)); + ok(!info, "expected NULL, info %p\n", info); + MIDL_user_free(path); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumTasks(Wine, 0, &start_index, 0, &count, &names); + ok(hr == S_OK, "expected S_FALSE, got %#x\n", hr); + ok(count == 2, "expected 2, got %u\n", count); + ok(start_index == 2, "expected 2, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + enumed = 0; + for (i = 0; i < count; i++) + { + if (!lstrcmpW(names[i], Task1)) + enumed += 1; + else if (!lstrcmpW(names[i], Task2)) + enumed += 2; + MIDL_user_free(names[i]); + } + MIDL_user_free(names); + ok(enumed == 3, "expected 3, got %u\n", enumed); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumTasks(Wine, 0, &start_index, 1, &count, &names); + ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); + ok(count == 1, "expected 1, got %u\n", count); + ok(start_index == 1, "expected 1, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + ok(!lstrcmpW(names[0], Task1), "expected Task1, got %s\n", wine_dbgstr_w(names[0])); + MIDL_user_free(names[0]); + MIDL_user_free(names); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumTasks(Wine, 0, &start_index, 2, &count, &names); + ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr); + ok(count == 2, "expected 2, got %u\n", count); + ok(start_index == 2, "expected 2, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + enumed = 0; + for (i = 0; i < count; i++) + { + if (!lstrcmpW(names[i], Task1)) + enumed += 1; + else if (!lstrcmpW(names[i], Task2)) + enumed += 2; + MIDL_user_free(names[i]); + } + MIDL_user_free(names); + ok(enumed == 3, "expected 3, got %u\n", enumed); + + start_index = 0; + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumTasks(Wine, 0, &start_index, 10, &count, &names); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(count == 2, "expected 2, got %u\n", count); + ok(start_index == 2, "expected 2, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + enumed = 0; + for (i = 0; i < count; i++) + { + if (!lstrcmpW(names[i], Task1)) + enumed += 1; + else if (!lstrcmpW(names[i], Task2)) + enumed += 2; + MIDL_user_free(names[i]); + } + MIDL_user_free(names); + ok(enumed == 3, "expected 3, got %u\n", enumed); + + path = NULL; + info = NULL; + hr = SchRpcRegisterTask(Wine_Task3+1, xmlW, TASK_CREATE, NULL, TASK_LOGON_NONE, 0, NULL, &path, &info); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(!lstrcmpW(path, Wine_Task3) /* win7 */ || !lstrcmpW(path, Wine_Task3+1) /* vista */, + "expected \\Wine\\Task3, task actual path %s\n", wine_dbgstr_w(path)); + ok(!info, "expected NULL, info %p\n", info); + MIDL_user_free(path); + + count = 0xdeadbeef; + names = NULL; + hr = SchRpcEnumTasks(Wine+1, 0, &start_index, 10, &count, &names); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + ok(count == 1, "expected 1, got %u\n", count); + ok(start_index == 3, "expected 3, got %u\n", start_index); + ok(names != NULL, "names should not be NULL\n"); + ok(!lstrcmpW(names[0], Task3), "expected Task3, got %s\n", wine_dbgstr_w(names[0])); + MIDL_user_free(names[0]); + MIDL_user_free(names); + + hr = SchRpcDelete(Wine_Task1+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcDelete(Wine_Task2+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcDelete(Wine_Task3+1, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + hr = SchRpcDelete(Wine, 0); + ok(hr == S_OK, "expected S_OK, got %#x\n", hr); + + hr = RpcBindingFree(&rpc_handle); + ok(hr == RPC_S_OK, "RpcBindingFree error %#x\n", hr); +} + +void __RPC_FAR *__RPC_USER MIDL_user_allocate(SIZE_T n) +{ + return HeapAlloc(GetProcessHeap(), 0, n); +} + +void __RPC_USER MIDL_user_free(void __RPC_FAR *p) +{ + HeapFree(GetProcessHeap(), 0, p); +} diff -Nru wine1.7-1.7.13/dlls/schedsvc/tests/schrpc.idl wine1.7-1.7.16/dlls/schedsvc/tests/schrpc.idl --- wine1.7-1.7.13/dlls/schedsvc/tests/schrpc.idl 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/schedsvc/tests/schrpc.idl 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,3 @@ +#pragma makedep client + +#include "wine/schrpc.idl" diff -Nru wine1.7-1.7.13/dlls/scrrun/filesystem.c wine1.7-1.7.16/dlls/scrrun/filesystem.c --- wine1.7-1.7.13/dlls/scrrun/filesystem.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/scrrun/filesystem.c 2014-04-04 19:13:44.000000000 +0000 @@ -37,6 +37,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(scrrun); static const WCHAR bsW[] = {'\\',0}; +static const WCHAR utf16bom = 0xfeff; struct foldercollection { IFolderCollection IFolderCollection_iface; @@ -50,6 +51,13 @@ BSTR path; }; +struct drivecollection { + IDriveCollection IDriveCollection_iface; + LONG ref; + DWORD drives; + LONG count; +}; + struct enumdata { union { @@ -63,6 +71,11 @@ struct filecollection *coll; HANDLE find; } filecoll; + struct + { + struct drivecollection *coll; + INT cur; + } drivecoll; } u; }; @@ -73,6 +86,12 @@ struct enumdata data; }; +struct drive { + IDrive IDrive_iface; + LONG ref; + BSTR root; +}; + struct folder { IFolder IFolder_iface; LONG ref; @@ -91,6 +110,10 @@ LONG ref; IOMode mode; + BOOL unicode; + BOOL first_read; + LARGE_INTEGER size; + HANDLE file; }; enum iotype { @@ -98,6 +121,11 @@ IOWrite }; +static inline struct drive *impl_from_IDrive(IDrive *iface) +{ + return CONTAINING_RECORD(iface, struct drive, IDrive_iface); +} + static inline struct folder *impl_from_IFolder(IFolder *iface) { return CONTAINING_RECORD(iface, struct folder, IFolder_iface); @@ -123,6 +151,11 @@ return CONTAINING_RECORD(iface, struct filecollection, IFileCollection_iface); } +static inline struct drivecollection *impl_from_IDriveCollection(IDriveCollection *iface) +{ + return CONTAINING_RECORD(iface, struct drivecollection, IDriveCollection_iface); +} + static inline struct enumvariant *impl_from_IEnumVARIANT(IEnumVARIANT *iface) { return CONTAINING_RECORD(iface, struct enumvariant, IEnumVARIANT_iface); @@ -180,7 +213,7 @@ if (type == IORead) return This->mode == ForWriting || This->mode == ForAppending; else - return TRUE; + return This->mode == ForReading; } static HRESULT WINAPI textstream_QueryInterface(ITextStream *iface, REFIID riid, void **obj) @@ -217,7 +250,10 @@ TRACE("(%p)->(%d)\n", This, ref); if (!ref) + { + CloseHandle(This->file); heap_free(This); + } return ref; } @@ -298,8 +334,24 @@ static HRESULT WINAPI textstream_get_AtEndOfStream(ITextStream *iface, VARIANT_BOOL *eos) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, eos); - return E_NOTIMPL; + LARGE_INTEGER pos, dist; + + TRACE("(%p)->(%p)\n", This, eos); + + if (!eos) + return E_POINTER; + + if (textstream_check_iomode(This, IORead)) { + *eos = VARIANT_TRUE; + return CTL_E_BADFILEMODE; + } + + dist.QuadPart = 0; + if (!SetFilePointerEx(This->file, dist, &pos, FILE_CURRENT)) + return E_FAIL; + + *eos = This->size.QuadPart == pos.QuadPart ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; } static HRESULT WINAPI textstream_get_AtEndOfLine(ITextStream *iface, VARIANT_BOOL *eol) @@ -309,51 +361,252 @@ return E_NOTIMPL; } +/* + Reads 'toread' bytes from a file, converts if needed + BOM is skipped if 'bof' is set. + */ +static HRESULT textstream_read(struct textstream *stream, LONG toread, BOOL bof, BSTR *text) +{ + HRESULT hr = S_OK; + DWORD read; + char *buff; + BOOL ret; + + if (toread == 0) { + *text = SysAllocStringLen(NULL, 0); + return *text ? S_FALSE : E_OUTOFMEMORY; + } + + if (toread < sizeof(WCHAR)) + return CTL_E_ENDOFFILE; + + buff = heap_alloc(toread); + if (!buff) + return E_OUTOFMEMORY; + + ret = ReadFile(stream->file, buff, toread, &read, NULL); + if (!ret || toread != read) { + WARN("failed to read from file %d, %d, error %d\n", read, toread, GetLastError()); + heap_free(buff); + return E_FAIL; + } + + if (stream->unicode) { + int i = 0; + + /* skip BOM */ + if (bof && *(WCHAR*)buff == utf16bom) { + read -= sizeof(WCHAR); + i += sizeof(WCHAR); + } + + *text = SysAllocStringLen(read ? (WCHAR*)&buff[i] : NULL, read/sizeof(WCHAR)); + if (!*text) hr = E_OUTOFMEMORY; + } + else { + INT len = MultiByteToWideChar(CP_ACP, 0, buff, read, NULL, 0); + *text = SysAllocStringLen(NULL, len); + if (*text) + MultiByteToWideChar(CP_ACP, 0, buff, read, *text, len); + else + hr = E_OUTOFMEMORY; + } + heap_free(buff); + + return hr; +} + static HRESULT WINAPI textstream_Read(ITextStream *iface, LONG len, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, text); + LARGE_INTEGER start, end, dist; + DWORD toread; + HRESULT hr; + + TRACE("(%p)->(%d %p)\n", This, len, text); + + if (!text) + return E_POINTER; + + *text = NULL; + if (len <= 0) + return len == 0 ? S_OK : E_INVALIDARG; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; - return E_NOTIMPL; + if (!This->first_read) { + VARIANT_BOOL eos; + + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + } + + /* read everything from current position */ + dist.QuadPart = 0; + SetFilePointerEx(This->file, dist, &start, FILE_CURRENT); + SetFilePointerEx(This->file, dist, &end, FILE_END); + toread = end.QuadPart - start.QuadPart; + /* rewind back */ + dist.QuadPart = start.QuadPart; + SetFilePointerEx(This->file, dist, NULL, FILE_BEGIN); + + This->first_read = FALSE; + if (This->unicode) len *= sizeof(WCHAR); + + hr = textstream_read(This, min(toread, len), start.QuadPart == 0, text); + if (FAILED(hr)) + return hr; + else + return toread <= len ? S_FALSE : S_OK; } static HRESULT WINAPI textstream_ReadLine(ITextStream *iface, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); + VARIANT_BOOL eos; + HRESULT hr; + FIXME("(%p)->(%p): stub\n", This, text); + if (!text) + return E_POINTER; + + *text = NULL; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + return E_NOTIMPL; } static HRESULT WINAPI textstream_ReadAll(ITextStream *iface, BSTR *text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%p): stub\n", This, text); + LARGE_INTEGER start, end, dist; + DWORD toread; + HRESULT hr; + + TRACE("(%p)->(%p)\n", This, text); + + if (!text) + return E_POINTER; + *text = NULL; if (textstream_check_iomode(This, IORead)) return CTL_E_BADFILEMODE; - return E_NOTIMPL; + if (!This->first_read) { + VARIANT_BOOL eos; + + /* check for EOF */ + hr = ITextStream_get_AtEndOfStream(iface, &eos); + if (FAILED(hr)) + return hr; + + if (eos == VARIANT_TRUE) + return CTL_E_ENDOFFILE; + } + + /* read everything from current position */ + dist.QuadPart = 0; + SetFilePointerEx(This->file, dist, &start, FILE_CURRENT); + SetFilePointerEx(This->file, dist, &end, FILE_END); + toread = end.QuadPart - start.QuadPart; + /* rewind back */ + dist.QuadPart = start.QuadPart; + SetFilePointerEx(This->file, dist, NULL, FILE_BEGIN); + + This->first_read = FALSE; + + hr = textstream_read(This, toread, start.QuadPart == 0, text); + return FAILED(hr) ? hr : S_FALSE; +} + +static HRESULT textstream_writestr(struct textstream *stream, BSTR text) +{ + DWORD written = 0; + BOOL ret; + + if (stream->unicode) { + ret = WriteFile(stream->file, text, SysStringByteLen(text), &written, NULL); + return (ret && written == SysStringByteLen(text)) ? S_OK : create_error(GetLastError()); + } else { + DWORD len = WideCharToMultiByte(CP_ACP, 0, text, SysStringLen(text), NULL, 0, NULL, NULL); + char *buffA; + HRESULT hr; + + buffA = heap_alloc(len); + if (!buffA) + return E_OUTOFMEMORY; + + WideCharToMultiByte(CP_ACP, 0, text, SysStringLen(text), buffA, len, NULL, NULL); + ret = WriteFile(stream->file, buffA, len, &written, NULL); + hr = (ret && written == len) ? S_OK : create_error(GetLastError()); + heap_free(buffA); + return hr; + } } static HRESULT WINAPI textstream_Write(ITextStream *iface, BSTR text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(text)); - return E_NOTIMPL; + + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); + + if (textstream_check_iomode(This, IOWrite)) + return CTL_E_BADFILEMODE; + + return textstream_writestr(This, text); +} + +static HRESULT textstream_writecrlf(struct textstream *stream) +{ + static const WCHAR crlfW[] = {'\r','\n'}; + static const char crlfA[] = {'\r','\n'}; + DWORD written = 0, len; + const void *ptr; + BOOL ret; + + if (stream->unicode) { + ptr = crlfW; + len = sizeof(crlfW); + } + else { + ptr = crlfA; + len = sizeof(crlfA); + } + + ret = WriteFile(stream->file, ptr, len, &written, NULL); + return (ret && written == len) ? S_OK : create_error(GetLastError()); } static HRESULT WINAPI textstream_WriteLine(ITextStream *iface, BSTR text) { struct textstream *This = impl_from_ITextStream(iface); - FIXME("(%p)->(%s): stub\n", This, debugstr_w(text)); - return E_NOTIMPL; + HRESULT hr; + + TRACE("(%p)->(%s)\n", This, debugstr_w(text)); + + if (textstream_check_iomode(This, IOWrite)) + return CTL_E_BADFILEMODE; + + hr = textstream_writestr(This, text); + if (SUCCEEDED(hr)) + hr = textstream_writecrlf(This); + return hr; } static HRESULT WINAPI textstream_WriteBlankLines(ITextStream *iface, LONG lines) @@ -407,9 +660,26 @@ textstream_Close }; -static HRESULT create_textstream(IOMode mode, ITextStream **ret) +static HRESULT create_textstream(const WCHAR *filename, DWORD disposition, IOMode mode, BOOL unicode, ITextStream **ret) { struct textstream *stream; + DWORD access = 0; + + /* map access mode */ + switch (mode) + { + case ForReading: + access = GENERIC_READ; + break; + case ForWriting: + access = GENERIC_WRITE; + break; + case ForAppending: + access = FILE_APPEND_DATA; + break; + default: + return E_INVALIDARG; + } stream = heap_alloc(sizeof(struct textstream)); if (!stream) return E_OUTOFMEMORY; @@ -417,11 +687,351 @@ stream->ITextStream_iface.lpVtbl = &textstreamvtbl; stream->ref = 1; stream->mode = mode; + stream->unicode = unicode; + stream->first_read = TRUE; + + stream->file = CreateFileW(filename, access, 0, NULL, disposition, FILE_ATTRIBUTE_NORMAL, NULL); + if (stream->file == INVALID_HANDLE_VALUE) + { + HRESULT hr = create_error(GetLastError()); + heap_free(stream); + return hr; + } + + if (mode == ForReading) + GetFileSizeEx(stream->file, &stream->size); + else + stream->size.QuadPart = 0; + + /* Write Unicode BOM */ + if (unicode && mode == ForWriting && (disposition == CREATE_ALWAYS || disposition == CREATE_NEW)) { + DWORD written = 0; + BOOL ret = WriteFile(stream->file, &utf16bom, sizeof(utf16bom), &written, NULL); + if (!ret || written != sizeof(utf16bom)) { + ITextStream_Release(&stream->ITextStream_iface); + return create_error(GetLastError()); + } + } *ret = &stream->ITextStream_iface; return S_OK; } +static HRESULT WINAPI drive_QueryInterface(IDrive *iface, REFIID riid, void **obj) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IDrive ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown)) + { + *obj = iface; + IDrive_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI drive_AddRef(IDrive *iface) +{ + struct drive *This = impl_from_IDrive(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI drive_Release(IDrive *iface) +{ + struct drive *This = impl_from_IDrive(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + SysFreeString(This->root); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI drive_GetTypeInfoCount(IDrive *iface, UINT *pctinfo) +{ + struct drive *This = impl_from_IDrive(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI drive_GetTypeInfo(IDrive *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct drive *This = impl_from_IDrive(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IDrive_tid, ppTInfo); +} + +static HRESULT WINAPI drive_GetIDsOfNames(IDrive *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct drive *This = impl_from_IDrive(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IDrive_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drive_Invoke(IDrive *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct drive *This = impl_from_IDrive(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IDrive_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drive_get_Path(IDrive *iface, BSTR *path) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, path); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_DriveLetter(IDrive *iface, BSTR *letter) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%p)\n", This, letter); + + if (!letter) + return E_POINTER; + + *letter = SysAllocStringLen(This->root, 1); + if (!*letter) + return E_OUTOFMEMORY; + + return S_OK; +} + +static HRESULT WINAPI drive_get_ShareName(IDrive *iface, BSTR *share_name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, share_name); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_DriveType(IDrive *iface, DriveTypeConst *type) +{ + struct drive *This = impl_from_IDrive(iface); + + TRACE("(%p)->(%p)\n", This, type); + + switch (GetDriveTypeW(This->root)) + { + case DRIVE_REMOVABLE: + *type = Removable; + break; + case DRIVE_FIXED: + *type = Fixed; + break; + case DRIVE_REMOTE: + *type = Remote; + break; + case DRIVE_CDROM: + *type = CDRom; + break; + case DRIVE_RAMDISK: + *type = RamDisk; + break; + default: + *type = UnknownType; + break; + } + + return S_OK; +} + +static HRESULT WINAPI drive_get_RootFolder(IDrive *iface, IFolder **folder) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, folder); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_AvailableSpace(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER avail; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &avail, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(avail.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_FreeSpace(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER freespace; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(freespace.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_TotalSize(IDrive *iface, VARIANT *v) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER total; + + TRACE("(%p)->(%p)\n", This, v); + + if (!v) + return E_POINTER; + + if (!GetDiskFreeSpaceExW(This->root, NULL, &total, NULL)) + return E_FAIL; + + V_VT(v) = VT_R8; + return VarR8FromUI8(total.QuadPart, &V_R8(v)); +} + +static HRESULT WINAPI drive_get_VolumeName(IDrive *iface, BSTR *name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, name); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_put_VolumeName(IDrive *iface, BSTR name) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%s): stub\n", This, debugstr_w(name)); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_FileSystem(IDrive *iface, BSTR *fs) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, fs); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_SerialNumber(IDrive *iface, LONG *serial) +{ + struct drive *This = impl_from_IDrive(iface); + FIXME("(%p)->(%p): stub\n", This, serial); + return E_NOTIMPL; +} + +static HRESULT WINAPI drive_get_IsReady(IDrive *iface, VARIANT_BOOL *ready) +{ + struct drive *This = impl_from_IDrive(iface); + ULARGE_INTEGER freespace; + BOOL ret; + + TRACE("(%p)->(%p)\n", This, ready); + + if (!ready) + return E_POINTER; + + ret = GetDiskFreeSpaceExW(This->root, &freespace, NULL, NULL); + *ready = ret ? VARIANT_TRUE : VARIANT_FALSE; + return S_OK; +} + +static const IDriveVtbl drivevtbl = { + drive_QueryInterface, + drive_AddRef, + drive_Release, + drive_GetTypeInfoCount, + drive_GetTypeInfo, + drive_GetIDsOfNames, + drive_Invoke, + drive_get_Path, + drive_get_DriveLetter, + drive_get_ShareName, + drive_get_DriveType, + drive_get_RootFolder, + drive_get_AvailableSpace, + drive_get_FreeSpace, + drive_get_TotalSize, + drive_get_VolumeName, + drive_put_VolumeName, + drive_get_FileSystem, + drive_get_SerialNumber, + drive_get_IsReady +}; + +static HRESULT create_drive(WCHAR letter, IDrive **drive) +{ + struct drive *This; + + *drive = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IDrive_iface.lpVtbl = &drivevtbl; + This->ref = 1; + This->root = SysAllocStringLen(NULL, 3); + if (!This->root) + { + heap_free(This); + return E_OUTOFMEMORY; + } + This->root[0] = letter; + This->root[1] = ':'; + This->root[2] = '\\'; + This->root[3] = 0; + + *drive = &This->IDrive_iface; + return S_OK; +} + static HRESULT WINAPI enumvariant_QueryInterface(IEnumVARIANT *iface, REFIID riid, void **obj) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); @@ -467,7 +1077,7 @@ return ref; } -static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data) +static HANDLE start_enumeration(const WCHAR *path, WIN32_FIND_DATAW *data, BOOL file) { static const WCHAR allW[] = {'*',0}; WCHAR pathW[MAX_PATH]; @@ -482,10 +1092,10 @@ handle = FindFirstFileW(pathW, data); if (handle == INVALID_HANDLE_VALUE) return 0; - /* find first dir */ + /* find first dir/file */ while (1) { - if (is_dir_data(data)) + if (file ? is_file_data(data) : is_dir_data(data)) break; if (!FindNextFileW(handle, data)) @@ -513,7 +1123,7 @@ if (!handle) { - handle = start_enumeration(This->data.u.foldercoll.coll->path, &data); + handle = start_enumeration(This->data.u.foldercoll.coll->path, &data, FALSE); if (!handle) return S_FALSE; This->data.u.foldercoll.find = handle; @@ -563,58 +1173,200 @@ if (!handle) { - handle = start_enumeration(This->data.u.foldercoll.coll->path, &data); + handle = start_enumeration(This->data.u.foldercoll.coll->path, &data, FALSE); if (!handle) return S_FALSE; This->data.u.foldercoll.find = handle; } else { - if (!FindNextFileW(handle, &data)) - return S_FALSE; + if (!FindNextFileW(handle, &data)) + return S_FALSE; + } + + do + { + if (is_dir_data(&data)) + --celt; + + if (!celt) break; + } while (FindNextFileW(handle, &data)); + + return celt ? S_FALSE : S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Reset(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + + TRACE("(%p)\n", This); + + FindClose(This->data.u.foldercoll.find); + This->data.u.foldercoll.find = NULL; + + return S_OK; +} + +static HRESULT WINAPI foldercoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + TRACE("(%p)->(%p)\n", This, pclone); + return create_foldercoll_enum(This->data.u.foldercoll.coll, (IUnknown**)pclone); +} + +static const IEnumVARIANTVtbl foldercollenumvariantvtbl = { + enumvariant_QueryInterface, + enumvariant_AddRef, + foldercoll_enumvariant_Release, + foldercoll_enumvariant_Next, + foldercoll_enumvariant_Skip, + foldercoll_enumvariant_Reset, + foldercoll_enumvariant_Clone +}; + +static HRESULT create_foldercoll_enum(struct foldercollection *collection, IUnknown **newenum) +{ + struct enumvariant *This; + + *newenum = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IEnumVARIANT_iface.lpVtbl = &foldercollenumvariantvtbl; + This->ref = 1; + This->data.u.foldercoll.find = NULL; + This->data.u.foldercoll.coll = collection; + IFolderCollection_AddRef(&collection->IFolderCollection_iface); + + *newenum = (IUnknown*)&This->IEnumVARIANT_iface; + + return S_OK; +} + +static ULONG WINAPI filecoll_enumvariant_Release(IEnumVARIANT *iface) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + { + IFileCollection_Release(&This->data.u.filecoll.coll->IFileCollection_iface); + FindClose(This->data.u.filecoll.find); + heap_free(This); + } + + return ref; +} + +static HRESULT WINAPI filecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.filecoll.find; + WIN32_FIND_DATAW data; + ULONG count = 0; + + TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); + + if (fetched) + *fetched = 0; + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE); + if (!handle) return S_FALSE; + This->data.u.filecoll.find = handle; + } + else if (!FindNextFileW(handle, &data)) + return S_FALSE; + + do + { + if (is_file_data(&data)) + { + IFile *file; + HRESULT hr; + BSTR str; + + str = get_full_path(This->data.u.filecoll.coll->path, &data); + hr = create_file(str, &file); + SysFreeString(str); + if (FAILED(hr)) return hr; + + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)file; + if (++count >= celt) break; + } + } while (FindNextFileW(handle, &data)); + + if (fetched) + *fetched = count; + + return (count < celt) ? S_FALSE : S_OK; +} + +static HRESULT WINAPI filecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +{ + struct enumvariant *This = impl_from_IEnumVARIANT(iface); + HANDLE handle = This->data.u.filecoll.find; + WIN32_FIND_DATAW data; + + TRACE("(%p)->(%d)\n", This, celt); + + if (!celt) return S_OK; + + if (!handle) + { + handle = start_enumeration(This->data.u.filecoll.coll->path, &data, TRUE); + if (!handle) return S_FALSE; + This->data.u.filecoll.find = handle; } + else if (!FindNextFileW(handle, &data)) + return S_FALSE; do { - if (is_dir_data(&data)) + if (is_file_data(&data)) --celt; - - if (!celt) break; - } while (FindNextFileW(handle, &data)); + } while (celt && FindNextFileW(handle, &data)); return celt ? S_FALSE : S_OK; } -static HRESULT WINAPI foldercoll_enumvariant_Reset(IEnumVARIANT *iface) +static HRESULT WINAPI filecoll_enumvariant_Reset(IEnumVARIANT *iface) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); TRACE("(%p)\n", This); - FindClose(This->data.u.foldercoll.find); - This->data.u.foldercoll.find = NULL; + FindClose(This->data.u.filecoll.find); + This->data.u.filecoll.find = NULL; return S_OK; } -static HRESULT WINAPI foldercoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +static HRESULT WINAPI filecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); TRACE("(%p)->(%p)\n", This, pclone); - return create_foldercoll_enum(This->data.u.foldercoll.coll, (IUnknown**)pclone); + return create_filecoll_enum(This->data.u.filecoll.coll, (IUnknown**)pclone); } -static const IEnumVARIANTVtbl foldercollenumvariantvtbl = { +static const IEnumVARIANTVtbl filecollenumvariantvtbl = { enumvariant_QueryInterface, enumvariant_AddRef, - foldercoll_enumvariant_Release, - foldercoll_enumvariant_Next, - foldercoll_enumvariant_Skip, - foldercoll_enumvariant_Reset, - foldercoll_enumvariant_Clone + filecoll_enumvariant_Release, + filecoll_enumvariant_Next, + filecoll_enumvariant_Skip, + filecoll_enumvariant_Reset, + filecoll_enumvariant_Clone }; -static HRESULT create_foldercoll_enum(struct foldercollection *collection, IUnknown **newenum) +static HRESULT create_filecoll_enum(struct filecollection *collection, IUnknown **newenum) { struct enumvariant *This; @@ -623,18 +1375,18 @@ This = heap_alloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY; - This->IEnumVARIANT_iface.lpVtbl = &foldercollenumvariantvtbl; + This->IEnumVARIANT_iface.lpVtbl = &filecollenumvariantvtbl; This->ref = 1; - This->data.u.foldercoll.find = NULL; - This->data.u.foldercoll.coll = collection; - IFolderCollection_AddRef(&collection->IFolderCollection_iface); + This->data.u.filecoll.find = NULL; + This->data.u.filecoll.coll = collection; + IFileCollection_AddRef(&collection->IFileCollection_iface); *newenum = (IUnknown*)&This->IEnumVARIANT_iface; return S_OK; } -static ULONG WINAPI filecoll_enumvariant_Release(IEnumVARIANT *iface) +static ULONG WINAPI drivecoll_enumvariant_Release(IEnumVARIANT *iface) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -643,19 +1395,30 @@ if (!ref) { - IFileCollection_Release(&This->data.u.filecoll.coll->IFileCollection_iface); - FindClose(This->data.u.filecoll.find); + IDriveCollection_Release(&This->data.u.drivecoll.coll->IDriveCollection_iface); heap_free(This); } return ref; } -static HRESULT WINAPI filecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) +static HRESULT find_next_drive(struct enumvariant *penum) +{ + int i = penum->data.u.drivecoll.cur == -1 ? 0 : penum->data.u.drivecoll.cur + 1; + + for (; i < 32; i++) + if (penum->data.u.drivecoll.coll->drives & (1 << i)) + { + penum->data.u.drivecoll.cur = i; + return S_OK; + } + + return S_FALSE; +} + +static HRESULT WINAPI drivecoll_enumvariant_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *var, ULONG *fetched) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); - HANDLE handle = This->data.u.filecoll.find; - WIN32_FIND_DATAW data; ULONG count = 0; TRACE("(%p)->(%d %p %p)\n", This, celt, var, fetched); @@ -663,114 +1426,70 @@ if (fetched) *fetched = 0; - if (!handle) - { - static const WCHAR allW[] = {'*',0}; - WCHAR pathW[MAX_PATH]; - BSTR parent = This->data.u.filecoll.coll->path; - int len; - - strcpyW(pathW, parent); - len = SysStringLen(parent); - if (parent[len-1] != '\\') - strcatW(pathW, bsW); - strcatW(pathW, allW); - handle = FindFirstFileW(pathW, &data); - if (handle == INVALID_HANDLE_VALUE) - return S_FALSE; - - while (1) - { - if (is_file_data(&data)) - break; - else - if (!FindNextFileW(handle, &data)) - { - FindClose(handle); - return S_FALSE; - } - } - - This->data.u.filecoll.find = handle; - } - else if (celt) - FindNextFileW(handle, &data); + if (!celt) return S_OK; - do + while (find_next_drive(This) == S_OK) { - if (count >= celt) break; - - if (is_file_data(&data)) - { - IFile *file; - HRESULT hr; - BSTR str; + IDrive *drive; + HRESULT hr; - str = get_full_path(This->data.u.filecoll.coll->path, &data); - hr = create_file(str, &file); - SysFreeString(str); - if (FAILED(hr)) return hr; + hr = create_drive('A' + This->data.u.drivecoll.cur, &drive); + if (FAILED(hr)) return hr; - V_VT(&var[count]) = VT_DISPATCH; - V_DISPATCH(&var[count]) = (IDispatch*)file; - count++; - } - } while (FindNextFileW(handle, &data)); + V_VT(&var[count]) = VT_DISPATCH; + V_DISPATCH(&var[count]) = (IDispatch*)drive; - if (count < celt) - return S_FALSE; + if (++count >= celt) break; + } if (fetched) *fetched = count; - return S_OK; + return (count < celt) ? S_FALSE : S_OK; } -static HRESULT WINAPI filecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) +static HRESULT WINAPI drivecoll_enumvariant_Skip(IEnumVARIANT *iface, ULONG celt) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); - HANDLE handle = This->data.u.filecoll.find; - WIN32_FIND_DATAW data; TRACE("(%p)->(%d)\n", This, celt); - while (FindNextFileW(handle, &data) && celt) - if (is_file_data(&data)) - --celt; + if (!celt) return S_OK; + + while (celt && find_next_drive(This) == S_OK) + celt--; return celt ? S_FALSE : S_OK; } -static HRESULT WINAPI filecoll_enumvariant_Reset(IEnumVARIANT *iface) +static HRESULT WINAPI drivecoll_enumvariant_Reset(IEnumVARIANT *iface) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); TRACE("(%p)\n", This); - FindClose(This->data.u.filecoll.find); - This->data.u.filecoll.find = NULL; - + This->data.u.drivecoll.cur = -1; return S_OK; } -static HRESULT WINAPI filecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) +static HRESULT WINAPI drivecoll_enumvariant_Clone(IEnumVARIANT *iface, IEnumVARIANT **pclone) { struct enumvariant *This = impl_from_IEnumVARIANT(iface); - TRACE("(%p)->(%p)\n", This, pclone); - return create_filecoll_enum(This->data.u.filecoll.coll, (IUnknown**)pclone); + FIXME("(%p)->(%p): stub\n", This, pclone); + return E_NOTIMPL; } -static const IEnumVARIANTVtbl filecollenumvariantvtbl = { +static const IEnumVARIANTVtbl drivecollenumvariantvtbl = { enumvariant_QueryInterface, enumvariant_AddRef, - filecoll_enumvariant_Release, - filecoll_enumvariant_Next, - filecoll_enumvariant_Skip, - filecoll_enumvariant_Reset, - filecoll_enumvariant_Clone + drivecoll_enumvariant_Release, + drivecoll_enumvariant_Next, + drivecoll_enumvariant_Skip, + drivecoll_enumvariant_Reset, + drivecoll_enumvariant_Clone }; -static HRESULT create_filecoll_enum(struct filecollection *collection, IUnknown **newenum) +static HRESULT create_drivecoll_enum(struct drivecollection *collection, IUnknown **newenum) { struct enumvariant *This; @@ -779,10 +1498,11 @@ This = heap_alloc(sizeof(*This)); if (!This) return E_OUTOFMEMORY; - This->IEnumVARIANT_iface.lpVtbl = &filecollenumvariantvtbl; + This->IEnumVARIANT_iface.lpVtbl = &drivecollenumvariantvtbl; This->ref = 1; - This->data.u.filecoll.coll = collection; - IFileCollection_AddRef(&collection->IFileCollection_iface); + This->data.u.drivecoll.coll = collection; + This->data.u.drivecoll.cur = -1; + IDriveCollection_AddRef(&collection->IDriveCollection_iface); *newenum = (IUnknown*)&This->IEnumVARIANT_iface; @@ -1150,6 +1870,171 @@ return S_OK; } +static HRESULT WINAPI drivecoll_QueryInterface(IDriveCollection *iface, REFIID riid, void **obj) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), obj); + + *obj = NULL; + + if (IsEqualIID( riid, &IID_IDriveCollection ) || + IsEqualIID( riid, &IID_IDispatch ) || + IsEqualIID( riid, &IID_IUnknown )) + { + *obj = iface; + IDriveCollection_AddRef(iface); + } + else + return E_NOINTERFACE; + + return S_OK; +} + +static ULONG WINAPI drivecoll_AddRef(IDriveCollection *iface) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI drivecoll_Release(IDriveCollection *iface) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + + if (!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI drivecoll_GetTypeInfoCount(IDriveCollection *iface, UINT *pctinfo) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + TRACE("(%p)->(%p)\n", This, pctinfo); + *pctinfo = 1; + return S_OK; +} + +static HRESULT WINAPI drivecoll_GetTypeInfo(IDriveCollection *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); + return get_typeinfo(IDriveCollection_tid, ppTInfo); +} + +static HRESULT WINAPI drivecoll_GetIDsOfNames(IDriveCollection *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + + hr = get_typeinfo(IDriveCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drivecoll_Invoke(IDriveCollection *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, + DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + ITypeInfo *typeinfo; + HRESULT hr; + + TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), + lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + + hr = get_typeinfo(IDriveCollection_tid, &typeinfo); + if(SUCCEEDED(hr)) + { + hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, + pDispParams, pVarResult, pExcepInfo, puArgErr); + ITypeInfo_Release(typeinfo); + } + + return hr; +} + +static HRESULT WINAPI drivecoll_get_Item(IDriveCollection *iface, VARIANT key, IDrive **drive) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + FIXME("(%p)->(%p): stub\n", This, drive); + return E_NOTIMPL; +} + +static HRESULT WINAPI drivecoll_get__NewEnum(IDriveCollection *iface, IUnknown **ppenum) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%p)\n", This, ppenum); + + if(!ppenum) + return E_POINTER; + + return create_drivecoll_enum(This, ppenum); +} + +static HRESULT WINAPI drivecoll_get_Count(IDriveCollection *iface, LONG *count) +{ + struct drivecollection *This = impl_from_IDriveCollection(iface); + + TRACE("(%p)->(%p)\n", This, count); + + if (!count) return E_POINTER; + + *count = This->count; + return S_OK; +} + +static const IDriveCollectionVtbl drivecollectionvtbl = { + drivecoll_QueryInterface, + drivecoll_AddRef, + drivecoll_Release, + drivecoll_GetTypeInfoCount, + drivecoll_GetTypeInfo, + drivecoll_GetIDsOfNames, + drivecoll_Invoke, + drivecoll_get_Item, + drivecoll_get__NewEnum, + drivecoll_get_Count +}; + +static HRESULT create_drivecoll(IDriveCollection **drives) +{ + struct drivecollection *This; + DWORD mask; + + *drives = NULL; + + This = heap_alloc(sizeof(*This)); + if (!This) return E_OUTOFMEMORY; + + This->IDriveCollection_iface.lpVtbl = &drivecollectionvtbl; + This->ref = 1; + This->drives = mask = GetLogicalDrives(); + /* count set bits */ + for (This->count = 0; mask; This->count++) + mask &= mask - 1; + + *drives = &This->IDriveCollection_iface; + return S_OK; +} + static HRESULT WINAPI folder_QueryInterface(IFolder *iface, REFIID riid, void **obj) { struct folder *This = impl_from_IFolder(iface); @@ -1256,8 +2141,14 @@ static HRESULT WINAPI folder_get_Path(IFolder *iface, BSTR *path) { struct folder *This = impl_from_IFolder(iface); - FIXME("(%p)->(%p): stub\n", This, path); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, path); + + if(!path) + return E_POINTER; + + *path = SysAllocString(This->path); + return *path ? S_OK : E_OUTOFMEMORY; } static HRESULT WINAPI folder_get_Name(IFolder *iface, BSTR *name) @@ -1756,11 +2647,18 @@ return E_NOTIMPL; } -static HRESULT WINAPI file_OpenAsTextStream(IFile *iface, IOMode IOMode, Tristate Format, ITextStream **ppts) +static HRESULT WINAPI file_OpenAsTextStream(IFile *iface, IOMode mode, Tristate format, ITextStream **stream) { struct file *This = impl_from_IFile(iface); - FIXME("(%p)->(%x %x %p)\n", This, IOMode, Format, ppts); - return E_NOTIMPL; + + TRACE("(%p)->(%d %d %p)\n", This, mode, format, stream); + + if (format == TristateUseDefault) { + FIXME("default format not handled, defaulting to unicode\n"); + format = TristateTrue; + } + + return create_textstream(This->path, OPEN_EXISTING, mode, format == TristateTrue, stream); } static const IFileVtbl file_vtbl = { @@ -1944,9 +2842,8 @@ static HRESULT WINAPI filesys_get_Drives(IFileSystem3 *iface, IDriveCollection **ppdrives) { - FIXME("%p %p\n", iface, ppdrives); - - return E_NOTIMPL; + TRACE("%p %p\n", iface, ppdrives); + return create_drivecoll(ppdrives); } static HRESULT WINAPI filesys_BuildPath(IFileSystem3 *iface, BSTR Path, @@ -2483,8 +3380,10 @@ return CTL_E_FILENOTFOUND; src_len = get_parent_folder_name(source, source_len); - if(src_len+1 >= MAX_PATH) + if(src_len+1 >= MAX_PATH) { + FindClose(f); return E_FAIL; + } if(src_len) { memcpy(src_path, source, src_len*sizeof(WCHAR)); src_path[src_len++] = '\\'; @@ -2627,10 +3526,9 @@ FindClose(f); return CTL_E_FILEALREADYEXISTS; } - }else { - FindClose(f); - return create_error(GetLastError()); } + + FindClose(f); return create_error(GetLastError()); } copied = TRUE; @@ -2682,21 +3580,33 @@ return create_folder(path, folder); } -static HRESULT WINAPI filesys_CreateTextFile(IFileSystem3 *iface, BSTR FileName, - VARIANT_BOOL Overwrite, VARIANT_BOOL Unicode, - ITextStream **ppts) +static HRESULT WINAPI filesys_CreateTextFile(IFileSystem3 *iface, BSTR filename, + VARIANT_BOOL overwrite, VARIANT_BOOL unicode, + ITextStream **stream) { - FIXME("%p %s %d %d %p\n", iface, debugstr_w(FileName), Overwrite, Unicode, ppts); + DWORD disposition; - return E_NOTIMPL; + TRACE("%p %s %d %d %p\n", iface, debugstr_w(filename), overwrite, unicode, stream); + + disposition = overwrite == VARIANT_TRUE ? CREATE_ALWAYS : CREATE_NEW; + return create_textstream(filename, disposition, ForWriting, !!unicode, stream); } static HRESULT WINAPI filesys_OpenTextFile(IFileSystem3 *iface, BSTR filename, IOMode mode, VARIANT_BOOL create, Tristate format, ITextStream **stream) { - FIXME("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream); - return create_textstream(mode, stream); + DWORD disposition; + + TRACE("(%p)->(%s %d %d %d %p)\n", iface, debugstr_w(filename), mode, create, format, stream); + disposition = create == VARIANT_TRUE ? OPEN_ALWAYS : OPEN_EXISTING; + + if (format == TristateUseDefault) { + FIXME("default format not handled, defaulting to unicode\n"); + format = TristateTrue; + } + + return create_textstream(filename, disposition, mode, format == TristateTrue, stream); } static HRESULT WINAPI filesys_GetStandardStream(IFileSystem3 *iface, diff -Nru wine1.7-1.7.13/dlls/scrrun/scrrun.c wine1.7-1.7.16/dlls/scrrun/scrrun.c --- wine1.7-1.7.13/dlls/scrrun/scrrun.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/scrrun/scrrun.c 2014-04-04 19:13:44.000000000 +0000 @@ -103,12 +103,14 @@ static REFIID tid_ids[] = { &IID_NULL, &IID_IDictionary, + &IID_IDrive, + &IID_IDriveCollection, + &IID_IFile, + &IID_IFileCollection, &IID_IFileSystem3, &IID_IFolder, &IID_IFolderCollection, - &IID_ITextStream, - &IID_IFile, - &IID_IFileCollection + &IID_ITextStream }; static HRESULT load_typelib(void) diff -Nru wine1.7-1.7.13/dlls/scrrun/scrrun.idl wine1.7-1.7.16/dlls/scrrun/scrrun.idl --- wine1.7-1.7.13/dlls/scrrun/scrrun.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/scrrun/scrrun.idl 2014-04-04 19:13:44.000000000 +0000 @@ -27,6 +27,7 @@ cpp_quote("#undef DeleteFile") cpp_quote("#undef MoveFile") cpp_quote("#endif") +cpp_quote("#define CTL_E_ENDOFFILE STD_CTL_SCODE(62)") /* this is not defined in public headers */ [ uuid(420B2830-E718-11CF-893D-00A0C9054228), @@ -36,23 +37,13 @@ { importlib("stdole2.tlb"); - interface IDictionary; - interface IDrive; - interface IDriveCollection; - interface IFile; - interface IFileCollection; - interface IFileSystem; - interface IFileSystem3; interface IFolder; - interface IFolderCollection; - interface IScriptEncoder; - interface ITextStream; typedef enum CompareMethod { - BinaryCompare = 0, - TextCompare = 1, - DatabaseCompare = 2 + BinaryCompare, + TextCompare, + DatabaseCompare } CompareMethod; typedef enum IOMode @@ -64,10 +55,10 @@ typedef enum Tristate { - TristateTrue = 0xffffffff, - TristateFalse = 0, - TristateUseDefault = 0xfffffffe, - TristateMixed = 0xfffffffe + TristateTrue = -1, + TristateFalse = 0, + TristateUseDefault = -2, + TristateMixed = -2 } Tristate; typedef enum FileAttribute @@ -85,26 +76,26 @@ typedef enum SpecialFolderConst { - WindowsFolder = 0, - SystemFolder = 1, - TemporaryFolder = 2 + WindowsFolder, + SystemFolder, + TemporaryFolder } SpecialFolderConst; typedef enum DriveTypeConst { - UnknownType = 0, - Removable = 1, - Fixed = 2, - Remote = 3, - CDRom = 4, - RamDisk = 5 + UnknownType, + Removable, + Fixed, + Remote, + CDRom, + RamDisk } DriveTypeConst; typedef enum StandardStreamTypes { - StdIn = 0, - StdOut = 1, - StdErr = 2 + StdIn, + StdOut, + StdErr } StandardStreamTypes; [ @@ -164,94 +155,52 @@ [ odl, - uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), + uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFileSystem : IDispatch + interface IDrive : IDispatch { - [id(0x0000271a), propget] - HRESULT Drives([out, retval] IDriveCollection** ppdrives); - - [id(0x00002710)] - HRESULT BuildPath([in] BSTR Path, [in] BSTR Name, [out, retval] BSTR* pbstrResult); - - [id(0x00002714)] - HRESULT GetDriveName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002715)] - HRESULT GetParentFolderName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002716)] - HRESULT GetFileName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002717)] - HRESULT GetBaseName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002718)] - HRESULT GetExtensionName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002712)] - HRESULT GetAbsolutePathName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002713)] - HRESULT GetTempName([out, retval] BSTR* pbstrResult); - - [id(0x0000271f)] - HRESULT DriveExists([in] BSTR DriveSpec, [out, retval] VARIANT_BOOL* pfExists); - - [id(0x00002720)] - HRESULT FileExists([in] BSTR FileSpec, [out, retval] VARIANT_BOOL* pfExists); - - [id(0x00002721)] - HRESULT FolderExists([in] BSTR FolderSpec, [out, retval] VARIANT_BOOL* pfExists); - - [id(0x0000271b)] - HRESULT GetDrive([in] BSTR DriveSpec, [out, retval] IDrive** ppdrive); + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); - [id(0x0000271c)] - HRESULT GetFile([in] BSTR FilePath, [out, retval] IFile** ppfile); + [id(0x00002710), propget] + HRESULT DriveLetter([out, retval] BSTR* pbstrLetter); - [id(0x0000271d)] - HRESULT GetFolder([in] BSTR FolderPath, [out, retval] IFolder** ppfolder); + [id(0x00002711), propget] + HRESULT ShareName([out, retval] BSTR* pbstrShareName); - [id(0x0000271e)] - HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); + [id(0x00002712), propget] + HRESULT DriveType([out, retval] DriveTypeConst* pdt); - [id(0x000004b0)] - HRESULT DeleteFile([in] BSTR FileSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x00002713), propget] + HRESULT RootFolder([out, retval] IFolder** ppfolder); - [id(0x000004b1)] - HRESULT DeleteFolder([in] BSTR FolderSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x00002715), propget] + HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); - [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] - HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); + [id(0x00002714), propget] + HRESULT FreeSpace([out, retval] VARIANT* pvarFree); - [id(0x000004b5)] - HRESULT MoveFolder([in] BSTR Source, [in] BSTR Destination); + [id(0x00002716), propget] + HRESULT TotalSize([out, retval] VARIANT* pvarTotal); - [id(0x000004b2)] - HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x00002717), propget] + HRESULT VolumeName([out, retval] BSTR* pbstrName); - [id(0x000004b3)] - HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x00002717), propput] + HRESULT VolumeName([in] BSTR pbstrName); - [id(0x00000460)] - HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); + [id(0x00002718), propget] + HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); - [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [id(0x00002719), propget] + HRESULT SerialNumber([out, retval] long* pulSerialNumber); - [id(0x0000044c)] - HRESULT OpenTextFile([in] BSTR FileName, [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] VARIANT_BOOL Create, - [in, optional, defaultvalue(0)] Tristate Format, - [out, retval] ITextStream** ppts); + [id(0x0000271a), propget] + HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); } [ @@ -263,7 +212,7 @@ oleautomation ] interface IDriveCollection : IDispatch { - [id(DISPID_VALUE)] + [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); [id(DISPID_NEWENUM), propget, restricted, hidden] @@ -275,63 +224,63 @@ [ odl, - uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), hidden, dual, nonextensible, oleautomation ] - interface IDrive : IDispatch + interface ITextStream : IDispatch { - [id(DISPID_VALUE), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - [id(0x00002710), propget] - HRESULT DriveLetter([out, retval] BSTR* pbstrLetter) -; - [id(0x00002711), propget] - HRESULT ShareName([out, retval] BSTR* pbstrShareName); + HRESULT Line([out, retval] long* Line); + + [id(0xfffffdef), propget] + HRESULT Column([out, retval] long* Column); [id(0x00002712), propget] - HRESULT DriveType([out, retval] DriveTypeConst* pdt); + HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); [id(0x00002713), propget] - HRESULT RootFolder([out, retval] IFolder** ppfolder); + HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - [id(0x00002715), propget] - HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); + [id(0x00002714)] + HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - [id(0x00002714), propget] - HRESULT FreeSpace([out, retval] VARIANT* pvarFree); + [id(0x00002715)] + HRESULT ReadLine([out, retval] BSTR* Text); - [id(0x00002716), propget] - HRESULT TotalSize([out, retval] VARIANT* pvarTotal); + [id(0x00002716)] + HRESULT ReadAll([out, retval] BSTR* Text); - [id(0x00002717), propget] - HRESULT VolumeName([out, retval] BSTR* pbstrName); + [id(0x00002717)] + HRESULT Write([in] BSTR Text); - [id(0x00002717), propput] - HRESULT VolumeName([in] BSTR pbstrName); + [id(0x00002718)] + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); - [id(0x00002718), propget] - HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); + [id(0x00002719)] + HRESULT WriteBlankLines([in] long Lines); - [id(0x00002719), propget] - HRESULT SerialNumber([out, retval] long* pulSerialNumber); + [id(0x0000271a)] + HRESULT Skip([in] long Characters); - [id(0x0000271a), propget] - HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + [id(0x0000271b)] + HRESULT SkipLine(); + + [id(0x0000271c)] + HRESULT Close(); } [ odl, - uuid(C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFolder : IDispatch + interface IFile : IDispatch { [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); @@ -369,50 +318,130 @@ [id(0x000003f0), propget] HRESULT DateLastAccessed([out, retval] DATE* pdate); + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); + [id(0x000003f2), propget] HRESULT Type([out, retval] BSTR* pbstrType); - [id(0x000004b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x000004b0)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); - [id(0x000004b3)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x000004b2)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - [id(0x000004b5)] + [id(0x000004b4)] HRESULT Move([in] BSTR Destination); - [id(0x00002710), propget] - HRESULT IsRootFolder([out, retval] VARIANT_BOOL* pfRootFolder); + [id(0x0000044c)] + HRESULT OpenAsTextStream([in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); + } - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); + [ + odl, + uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFileSystem : IDispatch + { + [id(0x0000271a), propget] + HRESULT Drives([out, retval] IDriveCollection** ppdrives); - [id(0x00002711), propget] - HRESULT SubFolders([out, retval] IFolderCollection** ppfolders); + [id(0x00002710)] + HRESULT BuildPath([in] BSTR Path, [in] BSTR Name, [out, retval] BSTR* pbstrResult); - [id(0x00002712), propget] - HRESULT Files([out, retval] IFileCollection** ppfiles); + [id(0x00002714)] + HRESULT GetDriveName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002715)] + HRESULT GetParentFolderName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002716)] + HRESULT GetFileName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002717)] + HRESULT GetBaseName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002718)] + HRESULT GetExtensionName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002712)] + HRESULT GetAbsolutePathName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002713)] + HRESULT GetTempName([out, retval] BSTR* pbstrResult); + + [id(0x0000271f)] + HRESULT DriveExists([in] BSTR DriveSpec, [out, retval] VARIANT_BOOL* pfExists); + + [id(0x00002720)] + HRESULT FileExists([in] BSTR FileSpec, [out, retval] VARIANT_BOOL* pfExists); + + [id(0x00002721)] + HRESULT FolderExists([in] BSTR FolderSpec, [out, retval] VARIANT_BOOL* pfExists); + + [id(0x0000271b)] + HRESULT GetDrive([in] BSTR DriveSpec, [out, retval] IDrive** ppdrive); + + [id(0x0000271c)] + HRESULT GetFile([in] BSTR FilePath, [out, retval] IFile** ppfile); + + [id(0x0000271d)] + HRESULT GetFolder([in] BSTR FolderPath, [out, retval] IFolder** ppfolder); + + [id(0x0000271e)] + HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); + + [id(0x000004b0)] + HRESULT DeleteFile([in] BSTR FileSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b1)] + HRESULT DeleteFolder([in] BSTR FolderSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] + HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); + + [id(0x000004b5)] + HRESULT MoveFolder([in] BSTR Source, [in] BSTR Destination); + + [id(0x000004b2)] + HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x000004b3)] + HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x00000460)] + HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + + [id(0x0000044c)] + HRESULT OpenTextFile([in] BSTR FileName, [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] VARIANT_BOOL Create, + [in, defaultvalue(0)] Tristate Format, + [out, retval] ITextStream** ppts); } [ odl, - uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFolderCollection : IDispatch + interface IFileCollection : IDispatch { - [id(0x00000002)] - HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); - [id(DISPID_VALUE), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); + HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -423,16 +452,19 @@ [ odl, - uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFileCollection : IDispatch + interface IFolderCollection : IDispatch { + [id(0x00000002)] + HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); + [id(DISPID_VALUE), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); + HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -443,13 +475,13 @@ [ odl, - uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFile : IDispatch + interface IFolder : IDispatch { [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); @@ -487,74 +519,33 @@ [id(0x000003f0), propget] HRESULT DateLastAccessed([out, retval] DATE* pdate); - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); - [id(0x000003f2), propget] HRESULT Type([out, retval] BSTR* pbstrType); - [id(0x000004b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x000004b1)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); - [id(0x000004b2)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x000004b3)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - [id(0x000004b4)] + [id(0x000004b5)] HRESULT Move([in] BSTR Destination); - [id(0x0000044c)] - HRESULT OpenAsTextStream([in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), - hidden, - dual, - nonextensible, - oleautomation - ] - interface ITextStream : IDispatch - { [id(0x00002710), propget] - HRESULT Line([out, retval] long* Line); - - [id(0xfffffdef), propget] - HRESULT Column([out, retval] long* Column); - - [id(0x00002712), propget] - HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); - - [id(0x00002713), propget] - HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - - [id(0x00002714)] - HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - - [id(0x00002715)] - HRESULT ReadLine([out, retval] BSTR* Text); - - [id(0x00002716)] - HRESULT ReadAll([out, retval] BSTR* Text); - - [id(0x00002717)] - HRESULT Write([in] BSTR Text); - - [id(0x00002718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); + HRESULT IsRootFolder([out, retval] VARIANT_BOOL* pfRootFolder); - [id(0x00002719)] - HRESULT WriteBlankLines([in] long Lines); + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); - [id(0x0000271a)] - HRESULT Skip([in] long Characters); + [id(0x00002711), propget] + HRESULT SubFolders([out, retval] IFolderCollection** ppfolders); - [id(0x0000271b)] - HRESULT SkipLine(); + [id(0x00002712), propget] + HRESULT Files([out, retval] IFileCollection** ppfiles); - [id(0x0000271c)] - HRESULT Close(); + [id(0x0000044d)] + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); } [ @@ -568,7 +559,7 @@ { [id(0x00004e20)] HRESULT GetStandardStream([in] StandardStreamTypes StandardStreamType, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x00004e2a)] HRESULT GetFileVersion([in] BSTR FileName, [out, retval] BSTR* FileVersion); diff -Nru wine1.7-1.7.13/dlls/scrrun/scrrun_private.h wine1.7-1.7.16/dlls/scrrun/scrrun_private.h --- wine1.7-1.7.13/dlls/scrrun/scrrun_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/scrrun/scrrun_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -25,12 +25,14 @@ { NULL_tid, IDictionary_tid, + IDrive_tid, + IDriveCollection_tid, + IFile_tid, + IFileCollection_tid, IFileSystem3_tid, IFolder_tid, IFolderCollection_tid, ITextStream_tid, - IFile_tid, - IFileCollection_tid, LAST_tid } tid_t; diff -Nru wine1.7-1.7.13/dlls/scrrun/tests/filesystem.c wine1.7-1.7.16/dlls/scrrun/tests/filesystem.c --- wine1.7-1.7.13/dlls/scrrun/tests/filesystem.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/scrrun/tests/filesystem.c 2014-04-04 19:13:44.000000000 +0000 @@ -40,6 +40,8 @@ return IUnknown_Release(iface); } +static const WCHAR crlfW[] = {'\r','\n',0}; + #define GET_REFCOUNT(iface) \ get_refcount((IUnknown*)iface) @@ -127,19 +129,26 @@ static void test_createfolder(void) { + WCHAR pathW[MAX_PATH], buffW[MAX_PATH]; HRESULT hr; - WCHAR pathW[MAX_PATH]; BSTR path; IFolder *folder; + BOOL ret; + + GetTempPathW(MAX_PATH, pathW); + GetTempFileNameW(pathW, NULL, 0, buffW); + DeleteFileW(buffW); + ret = CreateDirectoryW(buffW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); /* create existing directory */ - GetCurrentDirectoryW(sizeof(pathW)/sizeof(WCHAR), pathW); - path = SysAllocString(pathW); + path = SysAllocString(buffW); folder = (void*)0xdeabeef; hr = IFileSystem3_CreateFolder(fs3, path, &folder); ok(hr == CTL_E_FILEALREADYEXISTS, "got 0x%08x\n", hr); ok(folder == NULL, "got %p\n", folder); SysFreeString(path); + RemoveDirectoryW(buffW); } static void test_textstream(void) @@ -147,9 +156,11 @@ static const WCHAR testfileW[] = {'t','e','s','t','f','i','l','e','.','t','x','t',0}; ITextStream *stream; VARIANT_BOOL b; + DWORD written; HANDLE file; HRESULT hr; BSTR name, data; + BOOL ret; file = CreateFileW(testfileW, GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); CloseHandle(file); @@ -160,15 +171,46 @@ ok(hr == S_OK, "got 0x%08x, expected 0x%08x\n", hr, S_OK); ok(b == VARIANT_TRUE, "got %x\n", b); + /* different mode combinations */ + hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting | ForAppending, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForReading | ForAppending, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting | ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForAppending, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextStream_Read(stream, 1, &data); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextStream_Read(stream, 1, &data); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ITextStream_Release(stream); + hr = IFileSystem3_OpenTextFile(fs3, name, ForReading, VARIANT_FALSE, TristateFalse, &stream); ok(hr == S_OK, "got 0x%08x\n", hr); + /* try to write when open for reading */ + hr = ITextStream_WriteLine(stream, name); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + + hr = ITextStream_Write(stream, name); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + + hr = ITextStream_get_AtEndOfStream(stream, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + b = 10; hr = ITextStream_get_AtEndOfStream(stream, &b); -todo_wine { - ok(hr == S_FALSE || broken(hr == S_OK), "got 0x%08x\n", hr); + ok(hr == S_OK || broken(hr == S_FALSE), "got 0x%08x\n", hr); ok(b == VARIANT_TRUE, "got 0x%x\n", b); -} + ITextStream_Release(stream); hr = IFileSystem3_OpenTextFile(fs3, name, ForWriting, VARIANT_FALSE, TristateFalse, &stream); @@ -176,10 +218,9 @@ b = 10; hr = ITextStream_get_AtEndOfStream(stream, &b); -todo_wine { ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); ok(b == VARIANT_TRUE || broken(b == 10), "got 0x%x\n", b); -} + b = 10; hr = ITextStream_get_AtEndOfLine(stream, &b); todo_wine { @@ -199,14 +240,12 @@ hr = IFileSystem3_OpenTextFile(fs3, name, ForAppending, VARIANT_FALSE, TristateFalse, &stream); ok(hr == S_OK, "got 0x%08x\n", hr); - SysFreeString(name); b = 10; hr = ITextStream_get_AtEndOfStream(stream, &b); -todo_wine { ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); ok(b == VARIANT_TRUE || broken(b == 10), "got 0x%x\n", b); -} + b = 10; hr = ITextStream_get_AtEndOfLine(stream, &b); todo_wine { @@ -224,6 +263,21 @@ ITextStream_Release(stream); + /* now with non-empty file */ + file = CreateFileW(testfileW, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ret = WriteFile(file, testfileW, sizeof(testfileW), &written, NULL); + ok(ret && written == sizeof(testfileW), "got %d\n", ret); + CloseHandle(file); + + hr = IFileSystem3_OpenTextFile(fs3, name, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + b = 10; + hr = ITextStream_get_AtEndOfStream(stream, &b); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(b == VARIANT_FALSE, "got 0x%x\n", b); + ITextStream_Release(stream); + + SysFreeString(name); DeleteFileW(testfileW); } @@ -788,7 +842,7 @@ /* Please keep the tests for IFolderCollection and IFileCollection in sync */ static void test_FolderCollection(void) { - static const WCHAR fooW[] = {'\\','f','o','o',0}; + static const WCHAR fooW[] = {'f','o','o',0}; static const WCHAR aW[] = {'\\','a',0}; static const WCHAR bW[] = {'\\','b',0}; static const WCHAR cW[] = {'\\','c',0}; @@ -817,6 +871,14 @@ hr = IFolder_get_SubFolders(folder, NULL); ok(hr == E_POINTER, "got 0x%08x\n", hr); + hr = IFolder_get_Path(folder, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IFolder_get_Path(folder, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(!lstrcmpW(buffW, str), "got %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buffW)); + SysFreeString(str); + lstrcpyW(pathW, buffW); lstrcatW(pathW, aW); CreateDirectoryW(pathW, NULL); @@ -1089,12 +1151,10 @@ ok(0, "unexpected file %s was found\n", wine_dbgstr_w(str)); SysFreeString(str); - /* FIXME: uncomment once Wine is fixed - IFile_Release(file); */ + IFile_Release(file); VariantClear(&var); } -todo_wine ok(found_a == 1 && found_b == 1 && found_c == 1, "each file should be found 1 time instead of %d/%d/%d\n", found_a, found_b, found_c); @@ -1102,15 +1162,12 @@ VariantInit(&var); fetched = -1; hr = IEnumVARIANT_Next(enumvar, 1, &var, &fetched); -todo_wine ok(hr == S_FALSE, "got 0x%08x\n", hr); -todo_wine ok(fetched == 0, "got %d\n", fetched); hr = IEnumVARIANT_Reset(enumvar); ok(hr == S_OK, "got 0x%08x\n", hr); hr = IEnumVARIANT_Skip(enumvar, 2); -todo_wine ok(hr == S_OK, "got 0x%08x\n", hr); hr = IEnumVARIANT_Skip(enumvar, 0); ok(hr == S_OK, "got 0x%08x\n", hr); @@ -1123,9 +1180,7 @@ ok(fetched == 0, "got %d\n", fetched); fetched = -1; hr = IEnumVARIANT_Next(enumvar, 2, var2, &fetched); -todo_wine ok(hr == S_FALSE, "got 0x%08x\n", hr); -todo_wine ok(fetched == 1, "got %d\n", fetched); ok(V_VT(&var2[0]) == VT_DISPATCH, "got type %d\n", V_VT(&var2[0])); VariantClear(&var2[0]); @@ -1142,6 +1197,527 @@ IFileCollection_Release(files); } +static void test_DriveCollection(void) +{ + IDriveCollection *drives; + IEnumVARIANT *enumvar; + ULONG fetched; + VARIANT var; + HRESULT hr; + LONG count; + + hr = IFileSystem3_get_Drives(fs3, &drives); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDriveCollection_get__NewEnum(drives, (IUnknown**)&enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDriveCollection_get_Count(drives, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + count = 0; + hr = IDriveCollection_get_Count(drives, &count); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(count > 0, "got %d\n", count); + + V_VT(&var) = VT_EMPTY; + fetched = -1; + hr = IEnumVARIANT_Next(enumvar, 0, &var, &fetched); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(fetched == 0, "got %d\n", fetched); + + hr = IEnumVARIANT_Skip(enumvar, 0); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IEnumVARIANT_Skip(enumvar, count); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IEnumVARIANT_Skip(enumvar, 1); + ok(hr == S_FALSE, "got 0x%08x\n", hr); + + /* reset and iterate again */ + hr = IEnumVARIANT_Reset(enumvar); + ok(hr == S_OK, "got 0x%08x\n", hr); + + while (IEnumVARIANT_Next(enumvar, 1, &var, &fetched) == S_OK) { + IDrive *drive = (IDrive*)V_DISPATCH(&var); + DriveTypeConst type; + BSTR str; + + hr = IDrive_get_DriveType(drive, &type); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = IDrive_get_DriveLetter(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_DriveLetter(drive, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(SysStringLen(str) == 1, "got string %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + hr = IDrive_get_IsReady(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_TotalSize(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_AvailableSpace(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = IDrive_get_FreeSpace(drive, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + if (type == Fixed) { + VARIANT_BOOL ready = VARIANT_FALSE; + VARIANT size; + + hr = IDrive_get_IsReady(drive, &ready); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(ready == VARIANT_TRUE, "got %x\n", ready); + + V_VT(&size) = VT_EMPTY; + hr = IDrive_get_TotalSize(drive, &size); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(V_VT(&size) == VT_R8, "got %d\n", V_VT(&size)); + ok(V_R8(&size) > 0, "got %f\n", V_R8(&size)); + + V_VT(&size) = VT_EMPTY; + hr = IDrive_get_AvailableSpace(drive, &size); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(V_VT(&size) == VT_R8, "got %d\n", V_VT(&size)); + ok(V_R8(&size) > 0, "got %f\n", V_R8(&size)); + + V_VT(&size) = VT_EMPTY; + hr = IDrive_get_FreeSpace(drive, &size); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(V_VT(&size) == VT_R8, "got %d\n", V_VT(&size)); + ok(V_R8(&size) > 0, "got %f\n", V_R8(&size)); + } + VariantClear(&var); + } + + IEnumVARIANT_Release(enumvar); + IDriveCollection_Release(drives); +} + +static void test_CreateTextFile(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + static const WCHAR bomAW[] = {0xff,0xfe,0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH]; + ITextStream *stream; + BSTR nameW, str; + HANDLE file; + HRESULT hr; + BOOL ret; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + /* dir doesn't exist */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == CTL_E_PATHNOTFOUND, "got 0x%08x\n", hr); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, 1, &str); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + + ITextStream_Release(stream); + + /* check it's created */ + file = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "got %p\n", file); + CloseHandle(file); + + /* try to create again with no-overwrite mode */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == CTL_E_FILEALREADYEXISTS, "got 0x%08x\n", hr); + + /* now overwrite */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + /* overwrite in Unicode mode, check for BOM */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(!lstrcmpW(str, bomAW), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + ITextStream_Release(stream); + + DeleteFileW(nameW); + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + +static void test_WriteLine(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH]; + WCHAR buffW[MAX_PATH], buff2W[MAX_PATH]; + char buffA[MAX_PATH]; + ITextStream *stream; + DWORD r, len; + HANDLE file; + BSTR nameW; + HRESULT hr; + BOOL ret; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + /* create as ASCII file first */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + /* check contents */ + file = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "got %p\n", file); + r = 0; + ret = ReadFile(file, buffA, sizeof(buffA), &r, NULL); + ok(ret && r, "read %d, got %d, %d\n", r, ret, GetLastError()); + + len = MultiByteToWideChar(CP_ACP, 0, buffA, r, buffW, sizeof(buffW)/sizeof(WCHAR)); + buffW[len] = 0; + lstrcpyW(buff2W, nameW); + lstrcatW(buff2W, crlfW); + ok(!lstrcmpW(buff2W, buffW), "got %s, expected %s\n", wine_dbgstr_w(buffW), wine_dbgstr_w(buff2W)); + CloseHandle(file); + DeleteFileW(nameW); + + /* same for unicode file */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + ITextStream_Release(stream); + + /* check contents */ + file = CreateFileW(pathW, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + ok(file != INVALID_HANDLE_VALUE, "got %p\n", file); + r = 0; + ret = ReadFile(file, buffW, sizeof(buffW), &r, NULL); + ok(ret && r, "read %d, got %d, %d\n", r, ret, GetLastError()); + buffW[r/sizeof(WCHAR)] = 0; + + buff2W[0] = 0xfeff; + buff2W[1] = 0; + lstrcatW(buff2W, nameW); + lstrcatW(buff2W, crlfW); + ok(!lstrcmpW(buff2W, buffW), "got %s, expected %s\n", wine_dbgstr_w(buffW), wine_dbgstr_w(buff2W)); + CloseHandle(file); + DeleteFileW(nameW); + + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + +static void test_ReadAll(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + static const WCHAR secondlineW[] = {'s','e','c','o','n','d',0}; + static const WCHAR aW[] = {'A',0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH], buffW[500]; + ITextStream *stream; + BSTR nameW; + HRESULT hr; + BOOL ret; + BSTR str; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + /* Unicode file -> read with ascii stream */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = SysAllocString(secondlineW); + hr = ITextStream_WriteLine(stream, str); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + + hr = ITextStream_ReadAll(stream, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_ReadAll(stream, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + /* Buffer content is not interpreted - BOM is kept, all data is converted to WCHARs */ + str = NULL; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(str[0] == 0x00ff && str[1] == 0x00fe, "got %s, %d\n", wine_dbgstr_w(str), SysStringLen(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* Unicode file -> read with unicode stream */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + lstrcpyW(buffW, nameW); + lstrcatW(buffW, crlfW); + lstrcatW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + /* ReadAll one more time */ + str = (void*)0xdeadbeef; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + + /* ReadLine fails the same way */ + str = (void*)0xdeadbeef; + hr = ITextStream_ReadLine(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + ITextStream_Release(stream); + + /* Open again and skip first line before ReadAll */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = NULL; + hr = ITextStream_ReadLine(stream, &str); +todo_wine { + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str != NULL, "got %p\n", str); +} + SysFreeString(str); + + lstrcpyW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); +todo_wine + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* ASCII file, read with Unicode stream */ + /* 1. one byte content, not enough for Unicode read */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + str = SysAllocString(aW); + hr = ITextStream_Write(stream, str); + SysFreeString(str); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_ReadAll(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef) /* win2k */, "got %p\n", str); + + ITextStream_Release(stream); + + DeleteFileW(nameW); + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + +static void test_Read(void) +{ + static const WCHAR scrrunW[] = {'s','c','r','r','u','n','\\',0}; + static const WCHAR testfileW[] = {'t','e','s','t','.','t','x','t',0}; + static const WCHAR secondlineW[] = {'s','e','c','o','n','d',0}; + static const WCHAR aW[] = {'A',0}; + WCHAR pathW[MAX_PATH], dirW[MAX_PATH], buffW[500]; + ITextStream *stream; + BSTR nameW; + HRESULT hr; + BOOL ret; + BSTR str; + + GetTempPathW(sizeof(pathW)/sizeof(WCHAR), pathW); + lstrcatW(pathW, scrrunW); + lstrcpyW(dirW, pathW); + lstrcatW(pathW, testfileW); + + ret = CreateDirectoryW(dirW, NULL); + ok(ret, "got %d, %d\n", ret, GetLastError()); + + /* Unicode file -> read with ascii stream */ + nameW = SysAllocString(pathW); + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_FALSE, VARIANT_TRUE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_WriteLine(stream, nameW); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = SysAllocString(secondlineW); + hr = ITextStream_WriteLine(stream, str); + ok(hr == S_OK, "got 0x%08x\n", hr); + SysFreeString(str); + + hr = ITextStream_Read(stream, 0, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, 1, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, -1, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 1, &str); + ok(hr == CTL_E_BADFILEMODE, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateFalse, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + hr = ITextStream_Read(stream, 1, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, -1, &str); + ok(hr == E_INVALIDARG, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 0, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + /* Buffer content is not interpreted - BOM is kept, all data is converted to WCHARs */ + str = NULL; + hr = ITextStream_Read(stream, 2, &str); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str[0] == 0x00ff && str[1] == 0x00fe, "got %s, %d\n", wine_dbgstr_w(str), SysStringLen(str)); + ok(SysStringLen(str) == 2, "got %d\n", SysStringLen(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* Unicode file -> read with unicode stream */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + lstrcpyW(buffW, nameW); + lstrcatW(buffW, crlfW); + lstrcatW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_Read(stream, 500, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + + /* ReadAll one more time */ + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 10, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + /* ReadLine fails the same way */ + str = (void*)0xdeadbeef; + hr = ITextStream_ReadLine(stream, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL || broken(str == (void*)0xdeadbeef), "got %p\n", str); + ITextStream_Release(stream); + + /* Open again and skip first line before ReadAll */ + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = NULL; + hr = ITextStream_ReadLine(stream, &str); +todo_wine { + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(str != NULL, "got %p\n", str); +} + SysFreeString(str); + + lstrcpyW(buffW, secondlineW); + lstrcatW(buffW, crlfW); + str = NULL; + hr = ITextStream_Read(stream, 100, &str); + ok(hr == S_FALSE || broken(hr == S_OK) /* win2k */, "got 0x%08x\n", hr); +todo_wine + ok(!lstrcmpW(buffW, str), "got %s\n", wine_dbgstr_w(str)); + SysFreeString(str); + ITextStream_Release(stream); + + /* ASCII file, read with Unicode stream */ + /* 1. one byte content, not enough for Unicode read */ + hr = IFileSystem3_CreateTextFile(fs3, nameW, VARIANT_TRUE, VARIANT_FALSE, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + str = SysAllocString(aW); + hr = ITextStream_Write(stream, str); + SysFreeString(str); + ITextStream_Release(stream); + + hr = IFileSystem3_OpenTextFile(fs3, nameW, ForReading, VARIANT_FALSE, TristateTrue, &stream); + ok(hr == S_OK, "got 0x%08x\n", hr); + + str = (void*)0xdeadbeef; + hr = ITextStream_Read(stream, 500, &str); + ok(hr == CTL_E_ENDOFFILE, "got 0x%08x\n", hr); + ok(str == NULL, "got %p\n", str); + + ITextStream_Release(stream); + + DeleteFileW(nameW); + RemoveDirectoryW(dirW); + SysFreeString(nameW); +} + START_TEST(filesystem) { HRESULT hr; @@ -1169,6 +1745,11 @@ test_GetFolder(); test_FolderCollection(); test_FileCollection(); + test_DriveCollection(); + test_CreateTextFile(); + test_WriteLine(); + test_ReadAll(); + test_Read(); IFileSystem3_Release(fs3); diff -Nru wine1.7-1.7.13/dlls/scrrun/tests/scrrun.idl wine1.7-1.7.16/dlls/scrrun/tests/scrrun.idl --- wine1.7-1.7.13/dlls/scrrun/tests/scrrun.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/scrrun/tests/scrrun.idl 2014-04-04 19:13:44.000000000 +0000 @@ -24,6 +24,7 @@ cpp_quote("#undef DeleteFile") cpp_quote("#undef MoveFile") cpp_quote("#endif") +cpp_quote("#define CTL_E_ENDOFFILE STD_CTL_SCODE(62)") /* this is not defined in public headers */ [ uuid(420B2830-E718-11CF-893D-00A0C9054228), @@ -33,23 +34,13 @@ { importlib("stdole2.tlb"); - interface IDictionary; - interface IDrive; - interface IDriveCollection; - interface IFile; - interface IFileCollection; - interface IFileSystem; - interface IFileSystem3; interface IFolder; - interface IFolderCollection; - interface IScriptEncoder; - interface ITextStream; typedef enum CompareMethod { - BinaryCompare = 0, - TextCompare = 1, - DatabaseCompare = 2 + BinaryCompare, + TextCompare, + DatabaseCompare } CompareMethod; typedef enum IOMode @@ -61,10 +52,10 @@ typedef enum Tristate { - TristateTrue = 0xffffffff, - TristateFalse = 0, - TristateUseDefault = 0xfffffffe, - TristateMixed = 0xfffffffe + TristateTrue = -1, + TristateFalse = 0, + TristateUseDefault = -2, + TristateMixed = -2 } Tristate; typedef enum FileAttribute @@ -82,26 +73,26 @@ typedef enum SpecialFolderConst { - WindowsFolder = 0, - SystemFolder = 1, - TemporaryFolder = 2 + WindowsFolder, + SystemFolder, + TemporaryFolder } SpecialFolderConst; typedef enum DriveTypeConst { - UnknownType = 0, - Removable = 1, - Fixed = 2, - Remote = 3, - CDRom = 4, - RamDisk = 5 + UnknownType, + Removable, + Fixed, + Remote, + CDRom, + RamDisk } DriveTypeConst; typedef enum StandardStreamTypes { - StdIn = 0, - StdOut = 1, - StdErr = 2 + StdIn, + StdOut, + StdErr } StandardStreamTypes; [ @@ -113,13 +104,13 @@ ] interface IDictionary : IDispatch { - [id(00000000), propputref] + [id(DISPID_VALUE), propputref] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propput] + [id(DISPID_VALUE), propput] HRESULT Item([in] VARIANT* Key, [in] VARIANT* pRetItem); - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT* Key, [out, retval] VARIANT* pRetItem); [id(0x00000001)] @@ -161,94 +152,52 @@ [ odl, - uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), + uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFileSystem : IDispatch + interface IDrive : IDispatch { - [id(0x0000271a), propget] - HRESULT Drives([out, retval] IDriveCollection** ppdrives); - - [id(0x00002710)] - HRESULT BuildPath([in] BSTR Path, [in] BSTR Name, [out, retval] BSTR* pbstrResult); - - [id(0x00002714)] - HRESULT GetDriveName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002715)] - HRESULT GetParentFolderName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002716)] - HRESULT GetFileName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002717)] - HRESULT GetBaseName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002718)] - HRESULT GetExtensionName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002712)] - HRESULT GetAbsolutePathName([in] BSTR Path, [out, retval] BSTR* pbstrResult); - - [id(0x00002713)] - HRESULT GetTempName([out, retval] BSTR* pbstrResult); - - [id(0x0000271f)] - HRESULT DriveExists([in] BSTR DriveSpec, [out, retval] VARIANT_BOOL* pfExists); - - [id(0x00002720)] - HRESULT FileExists([in] BSTR FileSpec, [out, retval] VARIANT_BOOL* pfExists); - - [id(0x00002721)] - HRESULT FolderExists([in] BSTR FolderSpec, [out, retval] VARIANT_BOOL* pfExists); - - [id(0x0000271b)] - HRESULT GetDrive([in] BSTR DriveSpec, [out, retval] IDrive** ppdrive); + [id(DISPID_VALUE), propget] + HRESULT Path([out, retval] BSTR* pbstrPath); - [id(0x0000271c)] - HRESULT GetFile([in] BSTR FilePath, [out, retval] IFile** ppfile); + [id(0x00002710), propget] + HRESULT DriveLetter([out, retval] BSTR* pbstrLetter); - [id(0x0000271d)] - HRESULT GetFolder([in] BSTR FolderPath, [out, retval] IFolder** ppfolder); + [id(0x00002711), propget] + HRESULT ShareName([out, retval] BSTR* pbstrShareName); - [id(0x0000271e)] - HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); + [id(0x00002712), propget] + HRESULT DriveType([out, retval] DriveTypeConst* pdt); - [id(0x000004b0)] - HRESULT DeleteFile([in] BSTR FileSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x00002713), propget] + HRESULT RootFolder([out, retval] IFolder** ppfolder); - [id(0x000004b1)] - HRESULT DeleteFolder([in] BSTR FolderSpec, [in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x00002715), propget] + HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); - [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] - HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); + [id(0x00002714), propget] + HRESULT FreeSpace([out, retval] VARIANT* pvarFree); - [id(0x000004b5)] - HRESULT MoveFolder([in] BSTR Source, [in] BSTR Destination); + [id(0x00002716), propget] + HRESULT TotalSize([out, retval] VARIANT* pvarTotal); - [id(0x000004b2)] - HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x00002717), propget] + HRESULT VolumeName([out, retval] BSTR* pbstrName); - [id(0x000004b3)] - HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x00002717), propput] + HRESULT VolumeName([in] BSTR pbstrName); - [id(0x00000460)] - HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); + [id(0x00002718), propget] + HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); - [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [id(0x00002719), propget] + HRESULT SerialNumber([out, retval] long* pulSerialNumber); - [id(0x0000044c)] - HRESULT OpenTextFile([in] BSTR FileName, [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] VARIANT_BOOL Create, - [in, optional, defaultvalue(0)] Tristate Format, - [out, retval] ITextStream** ppts); + [id(0x0000271a), propget] + HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); } [ @@ -260,7 +209,7 @@ oleautomation ] interface IDriveCollection : IDispatch { - [id(00000000)] + [id(DISPID_VALUE), propget] HRESULT Item([in] VARIANT Key, [out, retval] IDrive** ppdrive); [id(DISPID_NEWENUM), propget, restricted, hidden] @@ -272,65 +221,65 @@ [ odl, - uuid(C7C3F5A0-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), hidden, dual, nonextensible, oleautomation ] - interface IDrive : IDispatch + interface ITextStream : IDispatch { - [id(00000000), propget] - HRESULT Path([out, retval] BSTR* pbstrPath); - [id(0x00002710), propget] - HRESULT DriveLetter([out, retval] BSTR* pbstrLetter) -; - [id(0x00002711), propget] - HRESULT ShareName([out, retval] BSTR* pbstrShareName); + HRESULT Line([out, retval] long* Line); + + [id(0xfffffdef), propget] + HRESULT Column([out, retval] long* Column); [id(0x00002712), propget] - HRESULT DriveType([out, retval] DriveTypeConst* pdt); + HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); [id(0x00002713), propget] - HRESULT RootFolder([out, retval] IFolder** ppfolder); + HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - [id(0x00002715), propget] - HRESULT AvailableSpace([out, retval] VARIANT* pvarAvail); + [id(0x00002714)] + HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - [id(0x00002714), propget] - HRESULT FreeSpace([out, retval] VARIANT* pvarFree); + [id(0x00002715)] + HRESULT ReadLine([out, retval] BSTR* Text); - [id(0x00002716), propget] - HRESULT TotalSize([out, retval] VARIANT* pvarTotal); + [id(0x00002716)] + HRESULT ReadAll([out, retval] BSTR* Text); - [id(0x00002717), propget] - HRESULT VolumeName([out, retval] BSTR* pbstrName); + [id(0x00002717)] + HRESULT Write([in] BSTR Text); - [id(0x00002717), propput] - HRESULT VolumeName([in] BSTR pbstrName); + [id(0x00002718)] + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); - [id(0x00002718), propget] - HRESULT FileSystem([out, retval] BSTR* pbstrFileSystem); + [id(0x00002719)] + HRESULT WriteBlankLines([in] long Lines); - [id(0x00002719), propget] - HRESULT SerialNumber([out, retval] long* pulSerialNumber); + [id(0x0000271a)] + HRESULT Skip([in] long Characters); - [id(0x0000271a), propget] - HRESULT IsReady([out, retval] VARIANT_BOOL* pfReady); + [id(0x0000271b)] + HRESULT SkipLine(); + + [id(0x0000271c)] + HRESULT Close(); } [ odl, - uuid(C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFolder : IDispatch + interface IFile : IDispatch { - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); [id(0x000003e8), propget] @@ -366,50 +315,130 @@ [id(0x000003f0), propget] HRESULT DateLastAccessed([out, retval] DATE* pdate); + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); + [id(0x000003f2), propget] HRESULT Type([out, retval] BSTR* pbstrType); - [id(0x000004b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x000004b0)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); - [id(0x000004b3)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x000004b2)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - [id(0x000004b5)] + [id(0x000004b4)] HRESULT Move([in] BSTR Destination); - [id(0x00002710), propget] - HRESULT IsRootFolder([out, retval] VARIANT_BOOL* pfRootFolder); + [id(0x0000044c)] + HRESULT OpenAsTextStream([in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); + } - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); + [ + odl, + uuid(0AB5A3D0-E5B6-11D0-ABF5-00A0C90FFFC0), + hidden, + dual, + nonextensible, + oleautomation + ] + interface IFileSystem : IDispatch + { + [id(0x0000271a), propget] + HRESULT Drives([out, retval] IDriveCollection** ppdrives); - [id(0x00002711), propget] - HRESULT SubFolders([out, retval] IFolderCollection** ppfolders); + [id(0x00002710)] + HRESULT BuildPath([in] BSTR Path, [in] BSTR Name, [out, retval] BSTR* pbstrResult); - [id(0x00002712), propget] - HRESULT Files([out, retval] IFileCollection** ppfiles); + [id(0x00002714)] + HRESULT GetDriveName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002715)] + HRESULT GetParentFolderName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002716)] + HRESULT GetFileName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002717)] + HRESULT GetBaseName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002718)] + HRESULT GetExtensionName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002712)] + HRESULT GetAbsolutePathName([in] BSTR Path, [out, retval] BSTR* pbstrResult); + + [id(0x00002713)] + HRESULT GetTempName([out, retval] BSTR* pbstrResult); + + [id(0x0000271f)] + HRESULT DriveExists([in] BSTR DriveSpec, [out, retval] VARIANT_BOOL* pfExists); + + [id(0x00002720)] + HRESULT FileExists([in] BSTR FileSpec, [out, retval] VARIANT_BOOL* pfExists); + + [id(0x00002721)] + HRESULT FolderExists([in] BSTR FolderSpec, [out, retval] VARIANT_BOOL* pfExists); + + [id(0x0000271b)] + HRESULT GetDrive([in] BSTR DriveSpec, [out, retval] IDrive** ppdrive); + + [id(0x0000271c)] + HRESULT GetFile([in] BSTR FilePath, [out, retval] IFile** ppfile); + + [id(0x0000271d)] + HRESULT GetFolder([in] BSTR FolderPath, [out, retval] IFolder** ppfolder); + + [id(0x0000271e)] + HRESULT GetSpecialFolder([in] SpecialFolderConst SpecialFolder, [out, retval] IFolder** ppfolder); + + [id(0x000004b0)] + HRESULT DeleteFile([in] BSTR FileSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b1)] + HRESULT DeleteFolder([in] BSTR FolderSpec, [in, defaultvalue(0)] VARIANT_BOOL Force); + + [id(0x000004b4), helpstring("Move a file"), helpcontext(0x00214bab)] + HRESULT MoveFile([in] BSTR Source, [in] BSTR Destination); + + [id(0x000004b5)] + HRESULT MoveFolder([in] BSTR Source, [in] BSTR Destination); + + [id(0x000004b2)] + HRESULT CopyFile([in] BSTR Source, [in] BSTR Destination, + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x000004b3)] + HRESULT CopyFolder([in] BSTR Source, [in] BSTR Destination, + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + + [id(0x00000460)] + HRESULT CreateFolder([in] BSTR Path, [out, retval] IFolder** ppfolder); [id(0x0000044d)] - HRESULT CreateTextFile([in] BSTR FileName, [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + + [id(0x0000044c)] + HRESULT OpenTextFile([in] BSTR FileName, [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] VARIANT_BOOL Create, + [in, defaultvalue(0)] Tristate Format, + [out, retval] ITextStream** ppts); } [ odl, - uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFolderCollection : IDispatch + interface IFileCollection : IDispatch { - [id(0x00000002)] - HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); - - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -420,16 +449,19 @@ [ odl, - uuid(C7C3F5A5-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A3-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFileCollection : IDispatch + interface IFolderCollection : IDispatch { - [id(00000000), propget] - HRESULT Item([in] VARIANT Key, [out, retval] IFile** ppfile); + [id(0x00000002)] + HRESULT Add([in] BSTR Name, [out, retval] IFolder** ppfolder); + + [id(DISPID_VALUE), propget] + HRESULT Item([in] VARIANT Key, [out, retval] IFolder** ppfolder); [id(DISPID_NEWENUM), propget, restricted, hidden] HRESULT _NewEnum([out, retval] IUnknown** ppenum); @@ -440,15 +472,15 @@ [ odl, - uuid(C7C3F5A4-88A3-11D0-ABCB-00A0C90FFFC0), + uuid(C7C3F5A2-88A3-11D0-ABCB-00A0C90FFFC0), hidden, dual, nonextensible, oleautomation ] - interface IFile : IDispatch + interface IFolder : IDispatch { - [id(00000000), propget] + [id(DISPID_VALUE), propget] HRESULT Path([out, retval] BSTR* pbstrPath); [id(0x000003e8), propget] @@ -484,74 +516,33 @@ [id(0x000003f0), propget] HRESULT DateLastAccessed([out, retval] DATE* pdate); - [id(0x000003f1), propget] - HRESULT Size([out, retval] VARIANT* pvarSize); - [id(0x000003f2), propget] HRESULT Type([out, retval] BSTR* pbstrType); - [id(0x000004b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + [id(0x000004b1)] + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); - [id(0x000004b2)] - HRESULT Copy([in] BSTR Destination, [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [id(0x000004b3)] + HRESULT Copy([in] BSTR Destination, [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); - [id(0x000004b4)] + [id(0x000004b5)] HRESULT Move([in] BSTR Destination); - [id(0x0000044c)] - HRESULT OpenAsTextStream([in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); - } - - [ - odl, - uuid(53BAD8C1-E718-11CF-893D-00A0C9054228), - hidden, - dual, - nonextensible, - oleautomation - ] - interface ITextStream : IDispatch - { [id(0x00002710), propget] - HRESULT Line([out, retval] long* Line); - - [id(0xfffffdef), propget] - HRESULT Column([out, retval] long* Column); - - [id(0x00002712), propget] - HRESULT AtEndOfStream([out, retval] VARIANT_BOOL* EOS); - - [id(0x00002713), propget] - HRESULT AtEndOfLine([out, retval] VARIANT_BOOL* EOL); - - [id(0x00002714)] - HRESULT Read([in] long Characters, [out, retval] BSTR* Text); - - [id(0x00002715)] - HRESULT ReadLine([out, retval] BSTR* Text); - - [id(0x00002716)] - HRESULT ReadAll([out, retval] BSTR* Text); - - [id(0x00002717)] - HRESULT Write([in] BSTR Text); - - [id(0x00002718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); + HRESULT IsRootFolder([out, retval] VARIANT_BOOL* pfRootFolder); - [id(0x00002719)] - HRESULT WriteBlankLines([in] long Lines); + [id(0x000003f1), propget] + HRESULT Size([out, retval] VARIANT* pvarSize); - [id(0x0000271a)] - HRESULT Skip([in] long Characters); + [id(0x00002711), propget] + HRESULT SubFolders([out, retval] IFolderCollection** ppfolders); - [id(0x0000271b)] - HRESULT SkipLine(); + [id(0x00002712), propget] + HRESULT Files([out, retval] IFileCollection** ppfiles); - [id(0x0000271c)] - HRESULT Close(); + [id(0x0000044d)] + HRESULT CreateTextFile([in] BSTR FileName, [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); } [ @@ -565,7 +556,7 @@ { [id(0x00004e20)] HRESULT GetStandardStream([in] StandardStreamTypes StandardStreamType, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); [id(0x00004e2a)] HRESULT GetFileVersion([in] BSTR FileName, [out, retval] BSTR* FileVersion); @@ -579,7 +570,7 @@ ] interface IScriptEncoder : IDispatch { - [id(00000000)] + [id(DISPID_VALUE)] HRESULT EncodeScriptFile([in] BSTR szExt, [in] BSTR bstrStreamIn, [in] long cFlags, [in] BSTR bstrDefaultLang, [out, retval] BSTR* pbstrStreamOut); } diff -Nru wine1.7-1.7.13/dlls/secur32/schannel_macosx.c wine1.7-1.7.16/dlls/secur32/schannel_macosx.c --- wine1.7-1.7.13/dlls/secur32/schannel_macosx.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/secur32/schannel_macosx.c 2014-04-04 19:13:44.000000000 +0000 @@ -977,7 +977,7 @@ TRACE("(%p/%p, %p, %p/%lu)\n", s, s->context, buffer, length, *length); status = SSLRead(s->context, buffer, *length, length); - if (status == noErr) + if (status == noErr || status == errSSLClosedGraceful) TRACE("Read %lu bytes\n", *length); else if (status == errSSLWouldBlock) { diff -Nru wine1.7-1.7.13/dlls/secur32/tests/schannel.c wine1.7-1.7.16/dlls/secur32/tests/schannel.c --- wine1.7-1.7.13/dlls/secur32/tests/schannel.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/secur32/tests/schannel.c 2014-04-04 19:13:44.000000000 +0000 @@ -518,7 +518,7 @@ cert_cnt++; } - ok(cert_cnt == 3, "cert_cnt = %u\n", cert_cnt); + ok(cert_cnt == 2, "cert_cnt = %u\n", cert_cnt); ok(incl_remote, "context does not contain cert itself\n"); } diff -Nru wine1.7-1.7.13/dlls/setupapi/devinst.c wine1.7-1.7.16/dlls/setupapi/devinst.c --- wine1.7-1.7.13/dlls/setupapi/devinst.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/setupapi/devinst.c 2014-04-04 19:13:44.000000000 +0000 @@ -2795,8 +2795,11 @@ SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } + /* In case application fails to check return value, clear output */ memset(DeviceInterfaceData, 0, sizeof(*DeviceInterfaceData)); + DeviceInterfaceData->cbSize = sizeof(SP_DEVICE_INTERFACE_DATA); + if (DeviceInfoData) { struct DeviceInfo *devInfo = diff -Nru wine1.7-1.7.13/dlls/setupapi/fakedll.c wine1.7-1.7.16/dlls/setupapi/fakedll.c --- wine1.7-1.7.13/dlls/setupapi/fakedll.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/setupapi/fakedll.c 2014-04-04 19:13:44.000000000 +0000 @@ -275,8 +275,14 @@ nt = info.nt = (IMAGE_NT_HEADERS *)(buffer + lfanew); /* some fields are copied from the source dll */ -#ifdef _WIN64 +#if defined __x86_64__ nt->FileHeader.Machine = IMAGE_FILE_MACHINE_AMD64; +#elif defined __aarch64__ + nt->FileHeader.Machine = IMAGE_FILE_MACHINE_ARM64; +#elif defined __arm__ + nt->FileHeader.Machine = IMAGE_FILE_MACHINE_ARMNT; +#elif defined __powerpc__ + nt->FileHeader.Machine = IMAGE_FILE_MACHINE_POWERPC; #else nt->FileHeader.Machine = IMAGE_FILE_MACHINE_I386; #endif diff -Nru wine1.7-1.7.13/dlls/setupapi/misc.c wine1.7-1.7.16/dlls/setupapi/misc.c --- wine1.7-1.7.13/dlls/setupapi/misc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/setupapi/misc.c 2014-04-04 19:13:44.000000000 +0000 @@ -1412,7 +1412,8 @@ return ERROR_INVALID_PARAMETER; ret = SetupGetFileCompressionInfoExW( source, NULL, 0, &required, NULL, NULL, NULL ); - if (!(actual_name = MyMalloc( required ))) return ERROR_NOT_ENOUGH_MEMORY; + if (!(actual_name = MyMalloc( required * sizeof(WCHAR) ))) + return ERROR_NOT_ENOUGH_MEMORY; ret = SetupGetFileCompressionInfoExW( source, actual_name, required, &required, source_size, target_size, type ); diff -Nru wine1.7-1.7.13/dlls/setupx.dll16/infparse.c wine1.7-1.7.16/dlls/setupx.dll16/infparse.c --- wine1.7-1.7.13/dlls/setupx.dll16/infparse.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/setupx.dll16/infparse.c 2014-04-04 19:13:44.000000000 +0000 @@ -136,7 +136,7 @@ { const char *start, *subst, *p; unsigned int len, total = 0; - int inside = 0; + BOOL inside = FALSE; unsigned int size = MAX_INF_STRING_LENGTH; char tmp[MAX_INF_STRING_LENGTH]; diff -Nru wine1.7-1.7.13/dlls/shell32/shell32.spec wine1.7-1.7.16/dlls/shell32/shell32.spec --- wine1.7-1.7.13/dlls/shell32/shell32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/shell32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -347,7 +347,7 @@ @ stdcall SHCreateShellItemArrayFromShellItem(ptr ptr ptr) @ stdcall SHEmptyRecycleBinA(long str long) @ stdcall SHEmptyRecycleBinW(long wstr long) -@ stub SHExtractIconsW +@ stdcall SHExtractIconsW(wstr long long long ptr ptr long long) user32.PrivateExtractIconsW @ stdcall SHFileOperation(ptr) SHFileOperationA @ stdcall SHFileOperationA(ptr) @ stdcall SHFileOperationW(ptr) diff -Nru wine1.7-1.7.13/dlls/shell32/shellpath.c wine1.7-1.7.16/dlls/shell32/shellpath.c --- wine1.7-1.7.13/dlls/shell32/shellpath.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/shellpath.c 2014-04-04 19:13:44.000000000 +0000 @@ -2265,8 +2265,8 @@ if (FAILED(hr)) goto end; if(pszSubPath) { - /* make sure the new path does not exceed th bufferlength - * rememebr to backslash and the termination */ + /* make sure the new path does not exceed the buffer length + * and remember to backslash and terminate it */ if(MAX_PATH < (lstrlenW(szBuildPath) + lstrlenW(pszSubPath) + 2)) { hr = HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE); goto end; @@ -2441,7 +2441,8 @@ CSIDL_COOKIES, CSIDL_HISTORY, CSIDL_MYPICTURES, - CSIDL_FONTS + CSIDL_FONTS, + CSIDL_ADMINTOOLS }; WCHAR userShellFolderPath[MAX_PATH], shellFolderPath[MAX_PATH]; LPCWSTR pUserShellFolderPath, pShellFolderPath; diff -Nru wine1.7-1.7.13/dlls/shell32/shfldr_unixfs.c wine1.7-1.7.16/dlls/shell32/shfldr_unixfs.c --- wine1.7-1.7.13/dlls/shell32/shfldr_unixfs.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/shfldr_unixfs.c 2014-04-04 19:13:44.000000000 +0000 @@ -170,9 +170,6 @@ #if !defined(__MINGW32__) && !defined(_MSC_VER) -#define ADJUST_THIS(c,m,p) ((c*)(((long)p)-(long)&(((c*)0)->lp##m##Vtbl))) -#define STATIC_CAST(i,p) ((i*)&p->lp##i##Vtbl) - #define LEN_SHITEMID_FIXED_PART ((USHORT) \ ( sizeof(USHORT) /* SHITEMID's cb field. */ \ + sizeof(PIDLTYPE) /* PIDLDATA's type field. */ \ @@ -971,14 +968,12 @@ return result; } -static IUnknown *UnixSubFolderIterator_Constructor(UnixFolder *pUnixFolder, SHCONTF fFilter); +static IEnumIDList *UnixSubFolderIterator_Constructor(UnixFolder *pUnixFolder, SHCONTF fFilter); static HRESULT WINAPI ShellFolder2_EnumObjects(IShellFolder2* iface, HWND hwndOwner, SHCONTF grfFlags, IEnumIDList** ppEnumIDList) { UnixFolder *This = impl_from_IShellFolder2(iface); - IUnknown *newIterator; - HRESULT hr; TRACE("(%p)->(%p 0x%08x %p)\n", This, hwndOwner, grfFlags, ppEnumIDList); @@ -987,11 +982,8 @@ return E_UNEXPECTED; } - newIterator = UnixSubFolderIterator_Constructor(This, grfFlags); - hr = IUnknown_QueryInterface(newIterator, &IID_IEnumIDList, (void**)ppEnumIDList); - IUnknown_Release(newIterator); - - return hr; + *ppEnumIDList = UnixSubFolderIterator_Constructor(This, grfFlags); + return S_OK; } static HRESULT CreateUnixFolder(IUnknown *pUnkOuter, REFIID riid, LPVOID *ppv, const CLSID *pCLSID); @@ -2373,13 +2365,18 @@ /* UnixSubFolderIterator object layout and typedef. */ typedef struct _UnixSubFolderIterator { - const IEnumIDListVtbl *lpIEnumIDListVtbl; - LONG m_cRef; + IEnumIDList IEnumIDList_iface; + LONG ref; SHCONTF m_fFilter; DIR *m_dirFolder; char m_szFolder[FILENAME_MAX]; } UnixSubFolderIterator; +static inline UnixSubFolderIterator *impl_from_IEnumIDList(IEnumIDList *iface) +{ + return CONTAINING_RECORD(iface, UnixSubFolderIterator, IEnumIDList_iface); +} + static void UnixSubFolderIterator_Destroy(UnixSubFolderIterator *iterator) { TRACE("(iterator=%p)\n", iterator); @@ -2405,35 +2402,34 @@ IEnumIDList_AddRef(iface); return S_OK; } - + static ULONG WINAPI UnixSubFolderIterator_IEnumIDList_AddRef(IEnumIDList* iface) { - UnixSubFolderIterator *This = ADJUST_THIS(UnixSubFolderIterator, IEnumIDList, iface); + UnixSubFolderIterator *This = impl_from_IEnumIDList(iface); + ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(iface=%p)\n", iface); - - return InterlockedIncrement(&This->m_cRef); + TRACE("(%p) ref=%d\n", This, ref); + + return ref; } static ULONG WINAPI UnixSubFolderIterator_IEnumIDList_Release(IEnumIDList* iface) { - UnixSubFolderIterator *This = ADJUST_THIS(UnixSubFolderIterator, IEnumIDList, iface); - ULONG cRef; - - TRACE("(iface=%p)\n", iface); + UnixSubFolderIterator *This = impl_from_IEnumIDList(iface); + ULONG ref = InterlockedDecrement(&This->ref); - cRef = InterlockedDecrement(&This->m_cRef); - - if (!cRef) + TRACE("(%p) ref=%d\n", This, ref); + + if (!ref) UnixSubFolderIterator_Destroy(This); - return cRef; + return ref; } static HRESULT WINAPI UnixSubFolderIterator_IEnumIDList_Next(IEnumIDList* iface, ULONG celt, LPITEMIDLIST* rgelt, ULONG* pceltFetched) { - UnixSubFolderIterator *This = ADJUST_THIS(UnixSubFolderIterator, IEnumIDList, iface); + UnixSubFolderIterator *This = impl_from_IEnumIDList(iface); ULONG i = 0; /* This->m_dirFolder will be NULL if the user doesn't have access rights for the dir. */ @@ -2492,8 +2488,8 @@ static HRESULT WINAPI UnixSubFolderIterator_IEnumIDList_Reset(IEnumIDList* iface) { - UnixSubFolderIterator *This = ADJUST_THIS(UnixSubFolderIterator, IEnumIDList, iface); - + UnixSubFolderIterator *This = impl_from_IEnumIDList(iface); + TRACE("(iface=%p)\n", iface); if (This->m_dirFolder) @@ -2521,21 +2517,20 @@ UnixSubFolderIterator_IEnumIDList_Clone }; -static IUnknown *UnixSubFolderIterator_Constructor(UnixFolder *pUnixFolder, SHCONTF fFilter) { +static IEnumIDList *UnixSubFolderIterator_Constructor(UnixFolder *pUnixFolder, SHCONTF fFilter) +{ UnixSubFolderIterator *iterator; TRACE("(pUnixFolder=%p)\n", pUnixFolder); - - iterator = SHAlloc((ULONG)sizeof(UnixSubFolderIterator)); - iterator->lpIEnumIDListVtbl = &UnixSubFolderIterator_IEnumIDList_Vtbl; - iterator->m_cRef = 0; + + iterator = SHAlloc(sizeof(*iterator)); + iterator->IEnumIDList_iface.lpVtbl = &UnixSubFolderIterator_IEnumIDList_Vtbl; + iterator->ref = 1; iterator->m_fFilter = fFilter; iterator->m_dirFolder = opendir(pUnixFolder->m_pszPath); lstrcpyA(iterator->m_szFolder, pUnixFolder->m_pszPath); - UnixSubFolderIterator_IEnumIDList_AddRef((IEnumIDList*)iterator); - - return (IUnknown*)iterator; + return &iterator->IEnumIDList_iface; } #else /* __MINGW32__ || _MSC_VER */ diff -Nru wine1.7-1.7.13/dlls/shell32/shlfileop.c wine1.7-1.7.16/dlls/shell32/shlfileop.c --- wine1.7-1.7.13/dlls/shell32/shlfileop.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/shlfileop.c 2014-04-04 19:13:44.000000000 +0000 @@ -53,6 +53,9 @@ #define FO_MASK 0xF +#define DE_SAMEFILE 0x71 +#define DE_DESTSAMETREE 0x7D + static const WCHAR wWildcardFile[] = {'*',0}; static const WCHAR wWildcardChars[] = {'*','?',0}; @@ -1428,11 +1431,15 @@ static DWORD move_files(LPSHFILEOPSTRUCTW lpFileOp, const FILE_LIST *flFrom, const FILE_LIST *flTo) { DWORD i; + INT mismatched = 0; const FILE_ENTRY *entryToMove; const FILE_ENTRY *fileDest; - if (!flFrom->dwNumFiles || !flTo->dwNumFiles) - return ERROR_CANCELLED; + if (!flFrom->dwNumFiles) + return ERROR_SUCCESS; + + if (!flTo->dwNumFiles) + return ERROR_FILE_NOT_FOUND; if (!(lpFileOp->fFlags & FOF_MULTIDESTFILES) && flTo->dwNumFiles > 1 && flFrom->dwNumFiles > 1) @@ -1450,29 +1457,44 @@ if (!PathFileExistsW(flTo->feFiles[0].szDirectory)) return ERROR_CANCELLED; - if ((lpFileOp->fFlags & FOF_MULTIDESTFILES) && - flFrom->dwNumFiles != flTo->dwNumFiles) - { - return ERROR_CANCELLED; - } + if (lpFileOp->fFlags & FOF_MULTIDESTFILES) + mismatched = flFrom->dwNumFiles - flTo->dwNumFiles; fileDest = &flTo->feFiles[0]; for (i = 0; i < flFrom->dwNumFiles; i++) { entryToMove = &flFrom->feFiles[i]; - if (lpFileOp->fFlags & FOF_MULTIDESTFILES) - fileDest = &flTo->feFiles[i]; - if (!PathFileExistsW(fileDest->szDirectory)) return ERROR_CANCELLED; + if (lpFileOp->fFlags & FOF_MULTIDESTFILES) + { + if (i >= flTo->dwNumFiles) + break; + fileDest = &flTo->feFiles[i]; + if (mismatched && !fileDest->bExists) + { + create_dest_dirs(flTo->feFiles[i].szFullPath); + flTo->feFiles[i].bExists = TRUE; + flTo->feFiles[i].attributes = FILE_ATTRIBUTE_DIRECTORY; + } + } + if (fileDest->bExists && IsAttribDir(fileDest->attributes)) move_to_dir(lpFileOp, entryToMove, fileDest); else SHNotifyMoveFileW(entryToMove->szFullPath, fileDest->szFullPath); } + if (mismatched > 0) + { + if (flFrom->bAnyDirectories) + return DE_DESTSAMETREE; + else + return DE_SAMEFILE; + } + return ERROR_SUCCESS; } diff -Nru wine1.7-1.7.13/dlls/shell32/shlview_cmenu.c wine1.7-1.7.16/dlls/shell32/shlview_cmenu.c --- wine1.7-1.7.13/dlls/shell32/shlview_cmenu.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/shlview_cmenu.c 2014-04-04 19:13:44.000000000 +0000 @@ -285,9 +285,10 @@ return TRUE; } +#define MAX_PROP_PAGES 99 + static void DoOpenProperties(ContextMenu *This, HWND hwnd) { - static const UINT MAX_PROP_PAGES = 99; static const WCHAR wszFolder[] = {'F','o','l','d','e','r', 0}; static const WCHAR wszFiletypeAll[] = {'*',0}; LPSHELLFOLDER lpDesktopSF; diff -Nru wine1.7-1.7.13/dlls/shell32/tests/ebrowser.c wine1.7-1.7.16/dlls/shell32/tests/ebrowser.c --- wine1.7-1.7.13/dlls/shell32/tests/ebrowser.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/tests/ebrowser.c 2014-04-04 19:13:44.000000000 +0000 @@ -67,8 +67,10 @@ DEFINE_GUID(IID_UnknownInterface14, 0x16770868, 0x239c, 0x445b, 0xa0,0x1d, 0xf2,0x6c,0x7f,0xbb,0xf2,0x6c); DEFINE_GUID(IID_UnknownInterface15, 0x05a89298, 0x6246, 0x4c63, 0xbb,0x0d, 0x9b,0xda,0xf1,0x40,0xbf,0x3b); DEFINE_GUID(IID_UnknownInterface16, 0x35094a87, 0x8bb1, 0x4237, 0x96,0xc6, 0xc4,0x17,0xee,0xbd,0xb0,0x78); -DEFINE_GUID(IID_UnknownInterface17, 0xa36a3ace, 0x8332, 0x45ce, 0xaa,0x29, 0x50,0x3c,0xb7,0x6b,0x25,0x87); -DEFINE_GUID(IID_UnknownInterface18, 0x3d5d8c60, 0x21e4, 0x4b03, 0x83,0xb8, 0xc7,0x3f,0x8c,0x94,0x00,0x78); +DEFINE_GUID(IID_UnknownInterface17, 0x3d5d8c60, 0x21e4, 0x4b03, 0x83,0xb8, 0xc7,0x3f,0x8c,0x94,0x00,0x78); +DEFINE_GUID(IID_UnknownInterface18, 0x1fc45c07, 0x9e35, 0x4276, 0xad,0x7f, 0x08,0x60,0x3a,0xa0,0xf6,0x0f); +DEFINE_GUID(IID_UnknownInterface19, 0xacd9b67a, 0xceab, 0x4c6c, 0x90,0xa1, 0xe8,0x57,0xc6,0x59,0xe3,0x9d); +DEFINE_GUID(IID_UnknownInterface20, 0xd0fe6f62, 0xdea4, 0x46c9, 0x9d,0xae, 0x36,0xcb,0x13,0x99,0x78,0xfa); static HWND hwnd; @@ -926,12 +928,15 @@ /* Win 8 */ { &IID_ICommDlgBrowser, &IID_UnknownInterface11, 0, NULL }, { &IID_ICommDlgBrowser, &IID_UnknownInterface12, 0, NULL }, + { &IID_ICommDlgBrowser, &IID_UnknownInterface20, 0, NULL }, { &IID_UnknownInterface13, &IID_IUnknown, 0, NULL }, + { &IID_UnknownInterface13, &IID_UnknownInterface13, 0, NULL }, + { &IID_UnknownInterface13, &IID_UnknownInterface18, 0, NULL }, { &IID_UnknownInterface14, &IID_UnknownInterface14, 0, NULL }, { &IID_UnknownInterface15, &IID_UnknownInterface15, 0, NULL }, { &IID_UnknownInterface16, &IID_UnknownInterface16, 0, NULL }, { &IID_UnknownInterface17, &IID_UnknownInterface17, 0, NULL }, - { &IID_UnknownInterface18, &IID_UnknownInterface18, 0, NULL }, + { &IID_UnknownInterface17, &IID_UnknownInterface19, 0, NULL }, /* Other services requested in Vista, Windows 2008 but not in Windows 7 */ { &IID_IBrowserSettings_Vista, &IID_IBrowserSettings_Vista, 0, NULL }, diff -Nru wine1.7-1.7.13/dlls/shell32/tests/shelllink.c wine1.7-1.7.16/dlls/shell32/tests/shelllink.c --- wine1.7-1.7.13/dlls/shell32/tests/shelllink.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/tests/shelllink.c 2014-04-04 19:13:44.000000000 +0000 @@ -42,6 +42,7 @@ static HRESULT (WINAPI *pSHGetStockIconInfo)(SHSTOCKICONID, UINT, SHSTOCKICONINFO *); static DWORD (WINAPI *pGetLongPathNameA)(LPCSTR, LPSTR, DWORD); static DWORD (WINAPI *pGetShortPathNameA)(LPCSTR, LPSTR, DWORD); +static UINT (WINAPI *pSHExtractIconsW)(LPCWSTR, int, int, int, HICON *, UINT *, UINT, UINT); static const GUID _IID_IShellLinkDataList = { 0x45e2b4ae, 0xb1c3, 0x11d0, @@ -1095,6 +1096,63 @@ ok(hr == E_INVALIDARG, "NULL: got 0x%x\n", hr); } +static void test_SHExtractIcons(void) +{ + static const WCHAR notepadW[] = {'n','o','t','e','p','a','d','.','e','x','e',0}; + static const WCHAR shell32W[] = {'s','h','e','l','l','3','2','.','d','l','l',0}; + static const WCHAR emptyW[] = {0}; + UINT ret, ret2; + HICON icons[256]; + UINT ids[256], i; + + if (!pSHExtractIconsW) + { + win_skip("SHExtractIconsW not available\n"); + return; + } + + ret = pSHExtractIconsW(emptyW, 0, 16, 16, icons, ids, 1, 0); + ok(ret == ~0u, "got %u\n", ret); + + ret = pSHExtractIconsW(notepadW, 0, 16, 16, NULL, NULL, 1, 0); + ok(ret == 1 || broken(ret == 2) /* win2k */, "got %u\n", ret); + + icons[0] = (HICON)0xdeadbeef; + ret = pSHExtractIconsW(notepadW, 0, 16, 16, icons, NULL, 1, 0); + ok(ret == 1, "got %u\n", ret); + ok(icons[0] != (HICON)0xdeadbeef, "icon not set\n"); + DestroyIcon(icons[0]); + + icons[0] = (HICON)0xdeadbeef; + ids[0] = 0xdeadbeef; + ret = pSHExtractIconsW(notepadW, 0, 16, 16, icons, ids, 1, 0); + ok(ret == 1, "got %u\n", ret); + ok(icons[0] != (HICON)0xdeadbeef, "icon not set\n"); + ok(ids[0] != 0xdeadbeef, "id not set\n"); + DestroyIcon(icons[0]); + + ret = pSHExtractIconsW(shell32W, 0, 16, 16, NULL, NULL, 0, 0); + ret2 = pSHExtractIconsW(shell32W, 4, MAKELONG(32,16), MAKELONG(32,16), NULL, NULL, 256, 0); + ok(ret && ret == ret2, + "icon count should be independent of requested icon sizes and base icon index\n"); + + ret = pSHExtractIconsW(shell32W, 0, 16, 16, icons, ids, 0, 0); + ok(ret == ~0u || !ret /* < vista */, "got %u\n", ret); + + ret = pSHExtractIconsW(shell32W, 0, 16, 16, icons, ids, 3, 0); + ok(ret == 3, "got %u\n", ret); + for (i = 0; i < ret; i++) DestroyIcon(icons[i]); + + /* count must be a multiple of two when getting two sizes */ + ret = pSHExtractIconsW(shell32W, 0, MAKELONG(16,32), MAKELONG(16,32), icons, ids, 3, 0); + ok(!ret /* vista */ || ret == 4, "got %u\n", ret); + for (i = 0; i < ret; i++) DestroyIcon(icons[i]); + + ret = pSHExtractIconsW(shell32W, 0, MAKELONG(16,32), MAKELONG(16,32), icons, ids, 4, 0); + ok(ret == 4, "got %u\n", ret); + for (i = 0; i < ret; i++) DestroyIcon(icons[i]); +} + START_TEST(shelllink) { HRESULT r; @@ -1108,6 +1166,7 @@ pSHGetStockIconInfo = (void *)GetProcAddress(hmod, "SHGetStockIconInfo"); pGetLongPathNameA = (void *)GetProcAddress(hkernel32, "GetLongPathNameA"); pGetShortPathNameA = (void *)GetProcAddress(hkernel32, "GetShortPathNameA"); + pSHExtractIconsW = (void *)GetProcAddress(hmod, "SHExtractIconsW"); r = CoInitialize(NULL); ok(r == S_OK, "CoInitialize failed (0x%08x)\n", r); @@ -1120,6 +1179,7 @@ test_shdefextracticon(); test_GetIconLocation(); test_SHGetStockIconInfo(); + test_SHExtractIcons(); CoUninitialize(); } diff -Nru wine1.7-1.7.13/dlls/shell32/tests/shlexec.c wine1.7-1.7.16/dlls/shell32/tests/shlexec.c --- wine1.7-1.7.13/dlls/shell32/tests/shlexec.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/tests/shlexec.c 2014-04-04 19:13:44.000000000 +0000 @@ -747,10 +747,19 @@ "%s expected %d, but got %d\n", key, expected, result); } +static void _okChildIntBroken(const char* file, int line, const char* key, int expected) +{ + INT result; + result=GetPrivateProfileIntA("Arguments", key, expected, child_file); + ok_(file, line)(result == expected || broken(result != expected), + "%s expected %d, but got %d\n", key, expected, result); +} + #define okChildString(key, expected) _okChildString(__FILE__, __LINE__, (key), (expected), (expected)) #define okChildStringBroken(key, expected, broken) _okChildString(__FILE__, __LINE__, (key), (expected), (broken)) #define okChildPath(key, expected) _okChildPath(__FILE__, __LINE__, (key), (expected)) -#define okChildInt(key, expected) _okChildInt(__FILE__, __LINE__, (key), (expected)) +#define okChildInt(key, expected) _okChildInt(__FILE__, __LINE__, (key), (expected)) +#define okChildIntBroken(key, expected) _okChildIntBroken(__FILE__, __LINE__, (key), (expected)) /*** * @@ -2118,35 +2127,35 @@ const char* ifexec; int expectedArgs; const char* expectedDdeExec; - int todo; + BOOL broken; } dde_tests_t; static dde_tests_t dde_tests[] = { /* Test passing and not passing command-line * argument, no DDE */ - {"", NULL, NULL, NULL, NULL, FALSE, "", 0x0}, - {"\"%1\"", NULL, NULL, NULL, NULL, TRUE, "", 0x0}, + {"", NULL, NULL, NULL, NULL, FALSE, ""}, + {"\"%1\"", NULL, NULL, NULL, NULL, TRUE, ""}, /* Test passing and not passing command-line * argument, with DDE */ - {"", "[open(\"%1\")]", "shlexec", "dde", NULL, FALSE, "[open(\"%s\")]", 0x0}, - {"\"%1\"", "[open(\"%1\")]", "shlexec", "dde", NULL, TRUE, "[open(\"%s\")]", 0x0}, + {"", "[open(\"%1\")]", "shlexec", "dde", NULL, FALSE, "[open(\"%s\")]"}, + {"\"%1\"", "[open(\"%1\")]", "shlexec", "dde", NULL, TRUE, "[open(\"%s\")]"}, /* Test unquoted %1 in command and ddeexec * (test filename has space) */ - {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", 0x0}, + {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", TRUE /* before vista */}, /* Test ifexec precedence over ddeexec */ - {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]", 0x0}, + {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]"}, /* Test default DDE topic */ - {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0}, + {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]"}, /* Test default DDE application */ - {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0}, + {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]"}, - {NULL, NULL, NULL, NULL, NULL, 0, 0x0} + {NULL} }; static DWORD WINAPI hooked_WaitForInputIdle(HANDLE process, DWORD timeout) @@ -2266,47 +2275,19 @@ dde_ready_event = CreateEventA(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready"); rc = shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL, NULL); CloseHandle(dde_ready_event); - if ((test->todo & 0x1)==0) - { - ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call, - rc, GetLastError()); - } - else todo_wine - { - ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call, - rc, GetLastError()); - } + ok(32 < rc, "%s failed: rc=%lu err=%u\n", shell_call, rc, GetLastError()); + if (32 < rc) { - if ((test->todo & 0x2)==0) - { - okChildInt("argcA", test->expectedArgs + 3); - } - else todo_wine - { + if (test->broken) + okChildIntBroken("argcA", test->expectedArgs + 3); + else okChildInt("argcA", test->expectedArgs + 3); - } - if (test->expectedArgs == 1) - { - if ((test->todo & 0x4) == 0) - { - okChildPath("argvA3", filename); - } - else todo_wine - { - okChildPath("argvA3", filename); - } - } - if ((test->todo & 0x8) == 0) - { - sprintf(params, test->expectedDdeExec, filename); - okChildPath("ddeExec", params); - } - else todo_wine - { - sprintf(params, test->expectedDdeExec, filename); - okChildPath("ddeExec", params); - } + + if (test->expectedArgs == 1) okChildPath("argvA3", filename); + + sprintf(params, test->expectedDdeExec, filename); + okChildPath("ddeExec", params); } delete_test_association(".sde"); diff -Nru wine1.7-1.7.13/dlls/shell32/tests/shlfileop.c wine1.7-1.7.16/dlls/shell32/tests/shlfileop.c --- wine1.7-1.7.13/dlls/shell32/tests/shlfileop.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shell32/tests/shlfileop.c 2014-04-04 19:13:44.000000000 +0000 @@ -1871,7 +1871,8 @@ init_shfo_tests(); - /* number of sources do not correspond to number of targets */ + /* number of sources do not correspond to number of targets, + include directories */ set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0"); set_curr_dir_path(to, "test6.txt\0test7.txt\0"); retval = SHFileOperationA(&shfo2); @@ -1903,6 +1904,108 @@ } init_shfo_tests(); + /* number of sources do not correspond to number of targets, + files only, + from exceeds to */ + set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0"); + set_curr_dir_path(to, "test6.txt\0test7.txt\0"); + retval = SHFileOperationA(&shfo2); + if (dir_exists("test6.txt")) + { + if (retval == ERROR_SUCCESS) + { + /* Old shell32 */ + DeleteFileA("test6.txt\\test1.txt"); + DeleteFileA("test6.txt\\test2.txt"); + RemoveDirectoryA("test6.txt\\test4.txt"); + RemoveDirectoryA("test6.txt"); + } + else + { + /* Vista and W2K8 (broken or new behavior ?) */ + ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval); + ok(DeleteFileA("test6.txt\\test1.txt"), "The file is not moved\n"); + RemoveDirectoryA("test6.txt"); + ok(DeleteFileA("test7.txt\\test2.txt"), "The file is not moved\n"); + RemoveDirectoryA("test7.txt"); + ok(file_exists("test3.txt"), "File should not be moved\n"); + } + } + else + { + expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* Win9x, NT4 */); + ok(!file_exists("test6.txt"), "The file is not moved - many files are " + "specified as a target\n"); + } + + init_shfo_tests(); + /* number of sources do not correspond to number of targets, + files only, + too exceeds from */ + set_curr_dir_path(from, "test1.txt\0test2.txt\0"); + set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0"); + retval = SHFileOperationA(&shfo2); + if (dir_exists("test6.txt")) + { + ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); + ok(DeleteFileA("test6.txt\\test1.txt"),"The file is not moved\n"); + ok(DeleteFileA("test7.txt\\test2.txt"),"The file is not moved\n"); + ok(!dir_exists("test8.txt") && !file_exists("test8.txt"), + "Directory should not be created\n"); + RemoveDirectoryA("test6.txt"); + RemoveDirectoryA("test7.txt"); + } + else + { + expect_retval(ERROR_CANCELLED, DE_OPCANCELLED /* WinXp, Win2k */); + ok(!file_exists("test6.txt"), "The file is not moved - many files are " + "specified as a target\n"); + } + + init_shfo_tests(); + /* number of sources do not correspond to number of targets, + target directories */ + set_curr_dir_path(from, "test1.txt\0test2.txt\0test3.txt\0"); + set_curr_dir_path(to, "test4.txt\0test5.txt\0"); + retval = SHFileOperationA(&shfo2); + if (dir_exists("test5.txt")) + { + ok(retval == DE_SAMEFILE, "Expected DE_SAMEFILE, got %d\n", retval); + ok(DeleteFileA("test4.txt\\test1.txt"),"The file is not moved\n"); + ok(DeleteFileA("test5.txt\\test2.txt"),"The file is not moved\n"); + ok(file_exists("test3.txt"), "The file is not moved\n"); + RemoveDirectoryA("test4.txt"); + RemoveDirectoryA("test5.txt"); + } + else + { + ok(retval == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", retval); + ok(DeleteFileA("test4.txt\\test1.txt"),"The file is not moved\n"); + ok(DeleteFileA("test4.txt\\test2.txt"),"The file is not moved\n"); + ok(DeleteFileA("test4.txt\\test3.txt"),"The file is not moved\n"); + } + + + init_shfo_tests(); + /* 0 incomming files */ + set_curr_dir_path(from, "\0\0"); + set_curr_dir_path(to, "test6.txt\0\0"); + retval = SHFileOperationA(&shfo2); + ok(retval == ERROR_SUCCESS || retval == ERROR_ACCESS_DENIED + , "Expected ERROR_SUCCESS || ERROR_ACCESS_DENIED, got %d\n", retval); + ok(!file_exists("test6.txt"), "The file should not exist\n"); + + init_shfo_tests(); + /* 0 outgoing files */ + set_curr_dir_path(from, "test1\0\0"); + set_curr_dir_path(to, "\0\0"); + retval = SHFileOperationA(&shfo2); + ok(retval == ERROR_FILE_NOT_FOUND || + broken(retval == 1026) + , "Expected ERROR_FILE_NOT_FOUND, got %d\n", retval); + ok(!file_exists("test6.txt"), "The file should not exist\n"); + + init_shfo_tests(); set_curr_dir_path(from, "test3.txt\0"); set_curr_dir_path(to, "test4.txt\\test1.txt\0"); diff -Nru wine1.7-1.7.13/dlls/shlwapi/ordinal.c wine1.7-1.7.16/dlls/shlwapi/ordinal.c --- wine1.7-1.7.13/dlls/shlwapi/ordinal.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shlwapi/ordinal.c 2014-04-04 19:13:44.000000000 +0000 @@ -60,7 +60,7 @@ extern DWORD SHLWAPI_ThreadRef_index; HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); -HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,BOOL); +HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD); BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD); /* @@ -2933,7 +2933,7 @@ HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl) { TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl); - return SHInvokeCommand(hWnd, lpFolder, lpApidl, FALSE); + return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0); } /************************************************************************* @@ -3481,19 +3481,19 @@ * hWnd [I] Window displaying the shell folder * lpFolder [I] IShellFolder interface * lpApidl [I] Id for the particular folder desired - * bInvokeDefault [I] Whether to invoke the default menu item + * dwCommandId [I] The command ID to invoke (0=invoke default) * * RETURNS * Success: S_OK. If bInvokeDefault is TRUE, the default menu action was * executed. * Failure: An HRESULT error code indicating the error. */ -HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, BOOL bInvokeDefault) +HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, DWORD dwCommandId) { IContextMenu *iContext; HRESULT hRet; - TRACE("(%p, %p, %p, %d)\n", hWnd, lpFolder, lpApidl, bInvokeDefault); + TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId); if (!lpFolder) return E_FAIL; @@ -3507,16 +3507,16 @@ if ((hMenu = CreatePopupMenu())) { HRESULT hQuery; - DWORD dwDefaultId = 0; /* Add the context menu entries to the popup */ hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF, - bInvokeDefault ? CMF_NORMAL : CMF_DEFAULTONLY); + dwCommandId ? CMF_NORMAL : CMF_DEFAULTONLY); if (SUCCEEDED(hQuery)) { - if (bInvokeDefault && - (dwDefaultId = GetMenuDefaultItem(hMenu, 0, 0)) != (UINT)-1) + if (!dwCommandId) + dwCommandId = GetMenuDefaultItem(hMenu, 0, 0); + if (dwCommandId != (UINT)-1) { CMINVOKECOMMANDINFO cmIci; /* Invoke the default item */ @@ -3524,8 +3524,8 @@ cmIci.cbSize = sizeof(cmIci); cmIci.fMask = CMIC_MASK_ASYNCOK; cmIci.hwnd = hWnd; - cmIci.lpVerb = MAKEINTRESOURCEA(dwDefaultId); - cmIci.nShow = SW_SCROLLCHILDREN; + cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId); + cmIci.nShow = SW_SHOWNORMAL; hRet = IContextMenu_InvokeCommand(iContext, &cmIci); } diff -Nru wine1.7-1.7.13/dlls/shlwapi/tests/assoc.c wine1.7-1.7.16/dlls/shlwapi/tests/assoc.c --- wine1.7-1.7.13/dlls/shlwapi/tests/assoc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shlwapi/tests/assoc.c 2014-04-04 19:13:44.000000000 +0000 @@ -39,6 +39,8 @@ static void test_getstring_bad(void) { + static const WCHAR openwith[] = {'O','p','e','n','W','i','t','h','.','e','x','e',0}; + WCHAR buf[MAX_PATH]; HRESULT hr; DWORD len; @@ -48,47 +50,71 @@ return; } + len = 0xdeadbeef; hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, NULL, open, NULL, &len); expect_hr(E_INVALIDARG, hr); + ok(len == 0xdeadbeef, "got %u\n", len); + + len = 0xdeadbeef; hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, badBad, open, NULL, &len); ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ "Unexpected result : %08x\n", hr); - hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, NULL, &len); + ok(len == 0xdeadbeef, "got %u\n", len); + + len = sizeof(buf)/sizeof(buf[0]); + hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotBad, open, buf, &len); ok(hr == E_FAIL || - hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ + hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ || + hr == S_OK /* Win8 */, "Unexpected result : %08x\n", hr); - hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL, - &len); + if (hr == S_OK) + { + ok(len < sizeof(buf)/sizeof(buf[0]), "got %u\n", len); + ok(!lstrcmpiW(buf + len - sizeof(openwith)/sizeof(openwith[0]), openwith), "wrong data\n"); + } + + len = 0xdeadbeef; + hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, invalid, NULL, &len); ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ "Unexpected result : %08x\n", hr); + ok(len == 0xdeadbeef, "got %u\n", len); + hr = pAssocQueryStringW(0, ASSOCSTR_EXECUTABLE, dotHtml, open, NULL, NULL); ok(hr == E_UNEXPECTED || hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ "Unexpected result : %08x\n", hr); + len = 0xdeadbeef; hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, NULL, open, NULL, &len); expect_hr(E_INVALIDARG, hr); - hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL, - &len); + ok(len == 0xdeadbeef, "got %u\n", len); + + len = 0xdeadbeef; + hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, badBad, open, NULL, &len); ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION), /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ "Unexpected result : %08x\n", hr); - hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL, - &len); + ok(len == 0xdeadbeef, "got %u\n", len); + + len = 0xdeadbeef; + hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotBad, open, NULL, &len); ok(hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ || hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), /* Win8 */ "Unexpected result : %08x\n", hr); - hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL, - &len); + ok(len == 0xdeadbeef, "got %u\n", len); + + len = 0xdeadbeef; + hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, invalid, NULL, &len); ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) || hr == HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) || /* W2K/Vista/W2K8 */ hr == E_FAIL, /* Win9x/WinMe/NT4 */ "Unexpected result : %08x\n", hr); - hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL, - NULL); + ok(len == 0xdeadbeef, "got %u\n", len); + + hr = pAssocQueryStringW(0, ASSOCSTR_FRIENDLYAPPNAME, dotHtml, open, NULL, NULL); ok(hr == E_UNEXPECTED || hr == E_INVALIDARG, /* Win9x/WinMe/NT4/W2K/Vista/W2K8 */ "Unexpected result : %08x\n", hr); diff -Nru wine1.7-1.7.13/dlls/shlwapi/tests/clsid.c wine1.7-1.7.16/dlls/shlwapi/tests/clsid.c --- wine1.7-1.7.13/dlls/shlwapi/tests/clsid.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/shlwapi/tests/clsid.c 2014-04-04 19:13:44.000000000 +0000 @@ -107,7 +107,7 @@ DWORD dwLen; BOOL bRet; int i = 0; - int is_vista = 0; + BOOL is_vista = FALSE; if (!pSHLWAPI_269 || !pSHLWAPI_23) return; @@ -115,7 +115,7 @@ while (*guids) { dwLen = pSHLWAPI_23(*guids, szBuff, 256); - if (!i && dwLen == S_OK) is_vista = 1; /* seems to return an HRESULT on vista */ + if (!i && dwLen == S_OK) is_vista = TRUE; /* seems to return an HRESULT on vista */ ok(dwLen == (is_vista ? S_OK : 39), "wrong size %u for id %d\n", dwLen, i); bRet = pSHLWAPI_269(szBuff, &guid); diff -Nru wine1.7-1.7.13/dlls/tapi32/line.c wine1.7-1.7.16/dlls/tapi32/line.c --- wine1.7-1.7.13/dlls/tapi32/line.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/tapi32/line.c 2014-04-04 19:13:44.000000000 +0000 @@ -1268,6 +1268,15 @@ } /*********************************************************************** + * lineOpenW (TAPI32.@) + */ +DWORD WINAPI lineOpenW(HLINEAPP hLineApp, DWORD dwDeviceID, LPHLINE lphLine, DWORD dwAPIVersion, DWORD dwExtVersion, DWORD dwCallbackInstance, DWORD dwPrivileges, DWORD dwMediaModes, LPLINECALLPARAMS lpCallParams) +{ + FIXME("stub.\n"); + return 0; +} + +/*********************************************************************** * lineOpen (TAPI32.@) */ DWORD WINAPI lineOpenA(HLINEAPP hLineApp, DWORD dwDeviceID, LPHLINE lphLine, DWORD dwAPIVersion, DWORD dwExtVersion, DWORD dwCallbackInstance, DWORD dwPrivileges, DWORD dwMediaModes, LPLINECALLPARAMS lpCallParams) diff -Nru wine1.7-1.7.13/dlls/tapi32/tapi32.spec wine1.7-1.7.16/dlls/tapi32/tapi32.spec --- wine1.7-1.7.13/dlls/tapi32/tapi32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/tapi32/tapi32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -83,6 +83,7 @@ @ stdcall lineNegotiateExtVersion(long long long long long ptr) @ stdcall lineOpen(long long ptr long long long long long ptr) lineOpenA @ stdcall lineOpenA(long long ptr long long long long long ptr) +@ stdcall lineOpenW(long long ptr long long long long long ptr) @ stdcall linePark(long long str ptr) lineParkA @ stdcall lineParkA(long long str ptr) @ stdcall linePickup(long long ptr str str) linePickupA diff -Nru wine1.7-1.7.13/dlls/taskschd/folder.c wine1.7-1.7.16/dlls/taskschd/folder.c --- wine1.7-1.7.13/dlls/taskschd/folder.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/taskschd/folder.c 2014-04-04 19:13:44.000000000 +0000 @@ -325,6 +325,8 @@ TRACE("%p,%s,%s,%x,%s,%s,%d,%s,%p\n", iface, debugstr_w(name), debugstr_w(xml), flags, debugstr_variant(&user), debugstr_variant(&password), logon, debugstr_variant(&sddl), task); + if (!xml) return HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER); + hr = TaskDefinition_create(&taskdef); if (hr != S_OK) return hr; diff -Nru wine1.7-1.7.13/dlls/taskschd/Makefile.in wine1.7-1.7.16/dlls/taskschd/Makefile.in --- wine1.7-1.7.13/dlls/taskschd/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/taskschd/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -1,5 +1,5 @@ MODULE = taskschd.dll -IMPORTS = oleaut32 ole32 advapi32 xmllite +IMPORTS = oleaut32 ole32 advapi32 xmllite rpcrt4 C_SRCS = \ folder.c \ @@ -8,4 +8,6 @@ task.c \ taskschd.c -IDL_SRCS = taskschd_tlb.idl +IDL_SRCS = \ + schrpc.idl \ + taskschd_tlb.idl diff -Nru wine1.7-1.7.13/dlls/taskschd/schrpc.idl wine1.7-1.7.16/dlls/taskschd/schrpc.idl --- wine1.7-1.7.13/dlls/taskschd/schrpc.idl 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/taskschd/schrpc.idl 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,3 @@ +#pragma makedep client + +#include "wine/schrpc.idl" diff -Nru wine1.7-1.7.13/dlls/taskschd/task.c wine1.7-1.7.16/dlls/taskschd/task.c --- wine1.7-1.7.13/dlls/taskschd/task.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/taskschd/task.c 2014-04-04 19:13:44.000000000 +0000 @@ -26,6 +26,8 @@ #include "objbase.h" #include "xmllite.h" #include "taskschd.h" +#include "winsvc.h" +#include "schrpc.h" #include "taskschd_private.h" #include "wine/unicode.h" @@ -529,7 +531,7 @@ static HRESULT WINAPI TaskSettings_put_XmlText(ITaskSettings *iface, BSTR xml) { - TRACE("%p,%s\n", iface, debugstr_w(xml)); + FIXME("%p,%s: stub\n", iface, debugstr_w(xml)); return E_NOTIMPL; } @@ -832,9 +834,12 @@ typedef struct { ITaskDefinition ITaskDefinition_iface; + LONG ref; IRegistrationInfo *reginfo; ITaskSettings *taskset; - LONG ref; + ITriggerCollection *triggers; + IPrincipal *principal; + IActionCollection *actions; } TaskDefinition; static inline TaskDefinition *impl_from_ITaskDefinition(ITaskDefinition *iface) @@ -856,10 +861,18 @@ if (!ref) { TRACE("destroying %p\n", iface); + if (taskdef->reginfo) IRegistrationInfo_Release(taskdef->reginfo); if (taskdef->taskset) ITaskSettings_Release(taskdef->taskset); + if (taskdef->triggers) + ITriggerCollection_Release(taskdef->triggers); + if (taskdef->principal) + IPrincipal_Release(taskdef->principal); + if (taskdef->actions) + IActionCollection_Release(taskdef->actions); + heap_free(taskdef); } @@ -1037,12 +1050,6 @@ return E_NOTIMPL; } -static HRESULT WINAPI TaskDefinition_get_XmlText(ITaskDefinition *iface, BSTR *xml) -{ - FIXME("%p,%p: stub\n", iface, xml); - return E_NOTIMPL; -} - static const WCHAR Task[] = {'T','a','s','k',0}; static const WCHAR version[] = {'v','e','r','s','i','o','n',0}; static const WCHAR v1_0[] = {'1','.','0',0}; @@ -1052,15 +1059,39 @@ static const WCHAR xmlns[] = {'x','m','l','n','s',0}; static const WCHAR task_ns[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','w','i','n','d','o','w','s','/','2','0','0','4','/','0','2','/','m','i','t','/','t','a','s','k',0}; static const WCHAR RegistrationInfo[] = {'R','e','g','i','s','t','r','a','t','i','o','n','I','n','f','o',0}; +static const WCHAR Author[] = {'A','u','t','h','o','r',0}; +static const WCHAR Description[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; +static const WCHAR Source[] = {'S','o','u','r','c','e',0}; +static const WCHAR Date[] = {'D','a','t','e',0}; +static const WCHAR Version[] = {'V','e','r','s','i','o','n',0}; +static const WCHAR Documentation[] = {'D','o','c','u','m','e','n','t','a','t','i','o','n',0}; +static const WCHAR URI[] = {'U','R','I',0}; +static const WCHAR SecurityDescriptor[] = {'S','e','c','u','r','i','t','y','D','e','s','c','r','i','p','t','o','r',0}; static const WCHAR Settings[] = {'S','e','t','t','i','n','g','s',0}; static const WCHAR Triggers[] = {'T','r','i','g','g','e','r','s',0}; static const WCHAR Principals[] = {'P','r','i','n','c','i','p','a','l','s',0}; +static const WCHAR Principal[] = {'P','r','i','n','c','i','p','a','l',0}; +static const WCHAR id[] = {'i','d',0}; +static const WCHAR UserId[] = {'U','s','e','r','I','d',0}; +static const WCHAR LogonType[] = {'L','o','g','o','n','T','y','p','e',0}; +static const WCHAR GroupId[] = {'G','r','o','u','p','I','d',0}; +static const WCHAR DisplayName[] = {'D','i','s','p','l','a','y','N','a','m','e',0}; +static const WCHAR HighestAvailable[] = {'H','i','g','h','e','s','t','A','v','a','i','l','a','b','l','e',0}; +static const WCHAR Password[] = {'P','a','s','s','w','o','r','d',0}; +static const WCHAR S4U[] = {'S','4','U',0}; +static const WCHAR InteractiveToken[] = {'I','n','t','e','r','a','c','t','i','v','e','T','o','k','e','n',0}; +static const WCHAR RunLevel[] = {'R','u','n','L','e','v','e','l',0}; +static const WCHAR LeastPrivilege[] = {'L','e','a','s','t','P','r','i','v','i','l','e','g','e',0}; static const WCHAR Actions[] = {'A','c','t','i','o','n','s',0}; +static const WCHAR Exec[] = {'E','x','e','c',0}; static const WCHAR MultipleInstancesPolicy[] = {'M','u','l','t','i','p','l','e','I','n','s','t','a','n','c','e','s','P','o','l','i','c','y',0}; static const WCHAR IgnoreNew[] = {'I','g','n','o','r','e','N','e','w',0}; static const WCHAR DisallowStartIfOnBatteries[] = {'D','i','s','a','l','l','o','w','S','t','a','r','t','I','f','O','n','B','a','t','t','e','r','i','e','s',0}; static const WCHAR AllowStartOnDemand[] = {'A','l','l','o','w','S','t','a','r','t','O','n','D','e','m','a','n','d',0}; static const WCHAR StopIfGoingOnBatteries[] = {'S','t','o','p','I','f','G','o','i','n','g','O','n','B','a','t','t','e','r','i','e','s',0}; +static const WCHAR AllowHardTerminate[] = {'A','l','l','o','w','H','a','r','d','T','e','r','m','i','n','a','t','e',0}; +static const WCHAR StartWhenAvailable[] = {'S','t','a','r','t','W','h','e','n','A','v','a','i','l','a','b','l','e',0}; +static const WCHAR RunOnlyIfNetworkAvailable[] = {'R','u','n','O','n','l','y','I','f','N','e','t','w','o','r','k','A','v','a','i','l','a','b','l','e',0}; static const WCHAR Enabled[] = {'E','n','a','b','l','e','d',0}; static const WCHAR Hidden[] = {'H','i','d','d','e','n',0}; static const WCHAR RunOnlyIfIdle[] = {'R','u','n','O','n','l','y','I','f','I','d','l','e',0}; @@ -1069,6 +1100,417 @@ static const WCHAR Priority[] = {'P','r','i','o','r','i','t','y',0}; static const WCHAR IdleSettings[] = {'I','d','l','e','S','e','t','t','i','n','g','s',0}; +static int xml_indent; + +static inline void push_indent(void) +{ + xml_indent += 2; +} + +static inline void pop_indent(void) +{ + xml_indent -= 2; +} + +static inline HRESULT write_stringW(IStream *stream, const WCHAR *str) +{ + return IStream_Write(stream, str, lstrlenW(str) * sizeof(WCHAR), NULL); +} + +static void write_indent(IStream *stream) +{ + static const WCHAR spacesW[] = {' ',' ',0}; + int i; + for (i = 0; i < xml_indent; i += 2) + write_stringW(stream, spacesW); +} + +static const WCHAR start_element[] = {'<',0}; +static const WCHAR start_end_element[] = {'<','/',0}; +static const WCHAR close_element[] = {'>',0}; +static const WCHAR end_empty_element[] = {'/','>',0}; +static const WCHAR eol[] = {'\n',0}; +static const WCHAR spaceW[] = {' ',0}; +static const WCHAR equalW[] = {'=',0}; +static const WCHAR quoteW[] = {'"',0}; + +static inline HRESULT write_empty_element(IStream *stream, const WCHAR *name) +{ + write_indent(stream); + write_stringW(stream, start_element); + write_stringW(stream, name); + write_stringW(stream, end_empty_element); + return write_stringW(stream, eol); +} + +static inline HRESULT write_element(IStream *stream, const WCHAR *name) +{ + write_indent(stream); + write_stringW(stream, start_element); + write_stringW(stream, name); + write_stringW(stream, close_element); + return write_stringW(stream, eol); +} + +static inline HRESULT write_element_end(IStream *stream, const WCHAR *name) +{ + write_indent(stream); + write_stringW(stream, start_end_element); + write_stringW(stream, name); + write_stringW(stream, close_element); + return write_stringW(stream, eol); +} + +static inline HRESULT write_text_value(IStream *stream, const WCHAR *name, const WCHAR *value) +{ + write_indent(stream); + write_stringW(stream, start_element); + write_stringW(stream, name); + write_stringW(stream, close_element); + write_stringW(stream, value); + write_stringW(stream, start_end_element); + write_stringW(stream, name); + write_stringW(stream, close_element); + return write_stringW(stream, eol); +} + +static HRESULT write_task_attributes(IStream *stream, ITaskDefinition *taskdef) +{ + HRESULT hr; + ITaskSettings *taskset; + TASK_COMPATIBILITY level; + const WCHAR *compatibility; + + hr = ITaskDefinition_get_Settings(taskdef, &taskset); + if (hr != S_OK) return hr; + + hr = ITaskSettings_get_Compatibility(taskset, &level); + if (hr != S_OK) level = TASK_COMPATIBILITY_V2_1; + + ITaskSettings_Release(taskset); + + switch (level) + { + case TASK_COMPATIBILITY_AT: + compatibility = v1_0; + break; + case TASK_COMPATIBILITY_V1: + compatibility = v1_1; + break; + case TASK_COMPATIBILITY_V2: + compatibility = v1_2; + break; + default: + compatibility = v1_3; + break; + } + + write_stringW(stream, start_element); + write_stringW(stream, Task); + write_stringW(stream, spaceW); + write_stringW(stream, version); + write_stringW(stream, equalW); + write_stringW(stream, quoteW); + write_stringW(stream, compatibility); + write_stringW(stream, quoteW); + write_stringW(stream, spaceW); + write_stringW(stream, xmlns); + write_stringW(stream, equalW); + write_stringW(stream, quoteW); + write_stringW(stream, task_ns); + write_stringW(stream, quoteW); + write_stringW(stream, close_element); + return write_stringW(stream, eol); +} + +static HRESULT write_registration_info(IStream *stream, IRegistrationInfo *reginfo) +{ + HRESULT hr; + BSTR bstr; + VARIANT var; + + if (!reginfo) + return write_empty_element(stream, RegistrationInfo); + + hr = write_element(stream, RegistrationInfo); + if (hr != S_OK) return hr; + + push_indent(); + + hr = IRegistrationInfo_get_Source(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, Source, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_Date(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, Date, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_Author(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, Author, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_Version(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, Version, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_Description(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, Description, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_Documentation(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, Documentation, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_URI(reginfo, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, URI, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IRegistrationInfo_get_SecurityDescriptor(reginfo, &var); + if (hr == S_OK) + { + if (V_VT(&var) == VT_BSTR) + { + hr = write_text_value(stream, SecurityDescriptor, V_BSTR(&var)); + VariantClear(&var); + if (hr != S_OK) return hr; + } + else + FIXME("SecurityInfo variant type %d is not supported\n", V_VT(&var)); + } + + pop_indent(); + + return write_element_end(stream, RegistrationInfo); +} + +static HRESULT write_principal(IStream *stream, IPrincipal *principal) +{ + HRESULT hr; + BSTR bstr; + TASK_LOGON_TYPE logon; + TASK_RUNLEVEL_TYPE level; + + if (!principal) + return write_empty_element(stream, Principals); + + hr = write_element(stream, Principals); + if (hr != S_OK) return hr; + + push_indent(); + + hr = IPrincipal_get_Id(principal, &bstr); + if (hr == S_OK) + { + write_indent(stream); + write_stringW(stream, start_element); + write_stringW(stream, Principal); + write_stringW(stream, spaceW); + write_stringW(stream, id); + write_stringW(stream, equalW); + write_stringW(stream, quoteW); + write_stringW(stream, bstr); + write_stringW(stream, quoteW); + write_stringW(stream, close_element); + write_stringW(stream, eol); + SysFreeString(bstr); + } + else + write_element(stream, Principal); + + push_indent(); + + hr = IPrincipal_get_GroupId(principal, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, GroupId, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IPrincipal_get_DisplayName(principal, &bstr); + if (hr == S_OK) + { + hr = write_text_value(stream, DisplayName, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IPrincipal_get_UserId(principal, &bstr); + if (hr == S_OK && lstrlenW(bstr)) + { + hr = write_text_value(stream, UserId, bstr); + SysFreeString(bstr); + if (hr != S_OK) return hr; + } + hr = IPrincipal_get_RunLevel(principal, &level); + if (hr == S_OK) + { + const WCHAR *level_str = NULL; + + switch (level) + { + case TASK_RUNLEVEL_HIGHEST: + level_str = HighestAvailable; + break; + case TASK_RUNLEVEL_LUA: + level_str = LeastPrivilege; + break; + default: + FIXME("Principal run level %d\n", level); + break; + } + + if (level_str) + { + hr = write_text_value(stream, RunLevel, level_str); + if (hr != S_OK) return hr; + } + } + hr = IPrincipal_get_LogonType(principal, &logon); + if (hr == S_OK) + { + const WCHAR *logon_str = NULL; + + switch (logon) + { + case TASK_LOGON_PASSWORD: + logon_str = Password; + break; + case TASK_LOGON_S4U: + logon_str = S4U; + break; + case TASK_LOGON_INTERACTIVE_TOKEN: + logon_str = InteractiveToken; + break; + default: + FIXME("Principal logon type %d\n", logon); + break; + } + + if (logon_str) + { + hr = write_text_value(stream, LogonType, logon_str); + if (hr != S_OK) return hr; + } + } + + pop_indent(); + write_element_end(stream, Principal); + + pop_indent(); + return write_element_end(stream, Principals); +} + +static HRESULT write_settings(IStream *stream, ITaskSettings *settings) +{ + if (!settings) + return write_empty_element(stream, Settings); + + FIXME("stub\n"); + return S_OK; +} + +static HRESULT write_triggers(IStream *stream, ITriggerCollection *triggers) +{ + if (!triggers) + return write_empty_element(stream, Triggers); + + FIXME("stub\n"); + return S_OK; +} + +static HRESULT write_actions(IStream *stream, IActionCollection *actions) +{ + if (!actions) + { + write_element(stream, Actions); + push_indent(); + write_empty_element(stream, Exec); + pop_indent(); + return write_element_end(stream, Actions); + } + + FIXME("stub\n"); + return S_OK; +} + +static HRESULT WINAPI TaskDefinition_get_XmlText(ITaskDefinition *iface, BSTR *xml) +{ + TaskDefinition *taskdef = impl_from_ITaskDefinition(iface); + HRESULT hr; + IStream *stream; + HGLOBAL hmem; + void *p; + + TRACE("%p,%p\n", iface, xml); + + hmem = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD, 16); + if (!hmem) return E_OUTOFMEMORY; + + hr = CreateStreamOnHGlobal(hmem, TRUE, &stream); + if (hr != S_OK) + { + GlobalFree(hmem); + return hr; + } + + hr = write_task_attributes(stream, &taskdef->ITaskDefinition_iface); + if (hr != S_OK) goto failed; + + push_indent(); + + hr = write_registration_info(stream, taskdef->reginfo); + if (hr != S_OK) goto failed; + + hr = write_triggers(stream, taskdef->triggers); + if (hr != S_OK) goto failed; + + hr = write_principal(stream, taskdef->principal); + if (hr != S_OK) goto failed; + + hr = write_settings(stream, taskdef->taskset); + if (hr != S_OK) goto failed; + + hr = write_actions(stream, taskdef->actions); + if (hr != S_OK) goto failed; + + pop_indent(); + + write_element_end(stream, Task); + IStream_Write(stream, "\0\0", 2, NULL); + + p = GlobalLock(hmem); + *xml = SysAllocString(p); + GlobalUnlock(hmem); + + IStream_Release(stream); + + return *xml ? S_OK : E_OUTOFMEMORY; + +failed: + IStream_Release(stream); + return hr; +} + static HRESULT read_text_value(IXmlReader *reader, WCHAR **value) { HRESULT hr; @@ -1113,8 +1555,8 @@ *vbool = VARIANT_FALSE; else { - FIXME("unexpected bool value %s\n", debugstr_w(value)); - return E_FAIL; + WARN("unexpected bool value %s\n", debugstr_w(value)); + return SCHED_E_INVALIDVALUE; } return S_OK; @@ -1139,12 +1581,187 @@ return S_OK; } -static HRESULT read_principals(IXmlReader *reader, ITaskDefinition *taskdef) +static HRESULT read_principal_attributes(IXmlReader *reader, IPrincipal *principal) { - FIXME("stub\n"); + HRESULT hr; + const WCHAR *name; + const WCHAR *value; + + hr = IXmlReader_MoveToFirstAttribute(reader); + + while (hr == S_OK) + { + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) break; + + hr = IXmlReader_GetValue(reader, &value, NULL); + if (hr != S_OK) break; + + TRACE("%s=%s\n", debugstr_w(name), debugstr_w(value)); + + if (!lstrcmpW(name, id)) + IPrincipal_put_Id(principal, (BSTR)value); + else + FIXME("unhandled Principal attribute %s\n", debugstr_w(name)); + + hr = IXmlReader_MoveToNextAttribute(reader); + } + return S_OK; } +static HRESULT read_principal(IXmlReader *reader, IPrincipal *principal) +{ + HRESULT hr; + XmlNodeType type; + const WCHAR *name; + WCHAR *value; + + if (IXmlReader_IsEmptyElement(reader)) + { + TRACE("Principal is empty\n"); + return S_OK; + } + + read_principal_attributes(reader, principal); + + while (IXmlReader_Read(reader, &type) == S_OK) + { + switch (type) + { + case XmlNodeType_EndElement: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("/%s\n", debugstr_w(name)); + + if (!lstrcmpW(name, Principal)) + return S_OK; + + break; + + case XmlNodeType_Element: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("Element: %s\n", debugstr_w(name)); + + if (!lstrcmpW(name, UserId)) + { + hr = read_text_value(reader, &value); + if (hr == S_OK) + IPrincipal_put_UserId(principal, value); + } + else if (!lstrcmpW(name, LogonType)) + { + hr = read_text_value(reader, &value); + if (hr == S_OK) + { + TASK_LOGON_TYPE logon = TASK_LOGON_NONE; + + if (!lstrcmpW(value, InteractiveToken)) + logon = TASK_LOGON_INTERACTIVE_TOKEN; + else + FIXME("unhandled LogonType %s\n", debugstr_w(value)); + + IPrincipal_put_LogonType(principal, logon); + } + } + else if (!lstrcmpW(name, RunLevel)) + { + hr = read_text_value(reader, &value); + if (hr == S_OK) + { + TASK_RUNLEVEL_TYPE level = TASK_RUNLEVEL_LUA; + + if (!lstrcmpW(value, LeastPrivilege)) + level = TASK_RUNLEVEL_LUA; + else + FIXME("unhandled RunLevel %s\n", debugstr_w(value)); + + IPrincipal_put_RunLevel(principal, level); + } + } + else + FIXME("unhandled Principal element %s\n", debugstr_w(name)); + + break; + + case XmlNodeType_Whitespace: + case XmlNodeType_Comment: + break; + + default: + FIXME("unhandled Principal node type %d\n", type); + break; + } + } + + WARN("Principal was not terminated\n"); + return E_FAIL; +} + +static HRESULT read_principals(IXmlReader *reader, ITaskDefinition *taskdef) +{ + HRESULT hr; + XmlNodeType type; + const WCHAR *name; + + if (IXmlReader_IsEmptyElement(reader)) + { + TRACE("Principals is empty\n"); + return S_OK; + } + + while (IXmlReader_Read(reader, &type) == S_OK) + { + switch (type) + { + case XmlNodeType_EndElement: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("/%s\n", debugstr_w(name)); + + if (!lstrcmpW(name, Principals)) + return S_OK; + + break; + + case XmlNodeType_Element: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("Element: %s\n", debugstr_w(name)); + + if (!lstrcmpW(name, Principal)) + { + IPrincipal *principal; + + hr = ITaskDefinition_get_Principal(taskdef, &principal); + if (hr != S_OK) return hr; + hr = read_principal(reader, principal); + IPrincipal_Release(principal); + } + else + FIXME("unhandled Principals element %s\n", debugstr_w(name)); + + break; + + case XmlNodeType_Whitespace: + case XmlNodeType_Comment: + break; + + default: + FIXME("unhandled Principals node type %d\n", type); + break; + } + } + + WARN("Principals was not terminated\n"); + return E_FAIL; +} + static HRESULT read_actions(IXmlReader *reader, ITaskDefinition *taskdef) { FIXME("stub\n"); @@ -1211,44 +1828,62 @@ else if (!lstrcmpW(name, DisallowStartIfOnBatteries)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_DisallowStartIfOnBatteries(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_DisallowStartIfOnBatteries(taskset, bool_val); } else if (!lstrcmpW(name, AllowStartOnDemand)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_AllowDemandStart(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_AllowDemandStart(taskset, bool_val); } else if (!lstrcmpW(name, StopIfGoingOnBatteries)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_StopIfGoingOnBatteries(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_StopIfGoingOnBatteries(taskset, bool_val); + } + else if (!lstrcmpW(name, AllowHardTerminate)) + { + hr = read_variantbool_value(reader, &bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_AllowHardTerminate(taskset, bool_val); + } + else if (!lstrcmpW(name, StartWhenAvailable)) + { + hr = read_variantbool_value(reader, &bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_StartWhenAvailable(taskset, bool_val); + } + else if (!lstrcmpW(name, RunOnlyIfNetworkAvailable)) + { + hr = read_variantbool_value(reader, &bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_RunOnlyIfNetworkAvailable(taskset, bool_val); } else if (!lstrcmpW(name, Enabled)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_Enabled(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_Enabled(taskset, bool_val); } else if (!lstrcmpW(name, Hidden)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_Hidden(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_Hidden(taskset, bool_val); } else if (!lstrcmpW(name, RunOnlyIfIdle)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_RunOnlyIfIdle(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_RunOnlyIfIdle(taskset, bool_val); } else if (!lstrcmpW(name, WakeToRun)) { hr = read_variantbool_value(reader, &bool_val); - if (hr == S_OK) - ITaskSettings_put_WakeToRun(taskset, bool_val); + if (hr != S_OK) return hr; + ITaskSettings_put_WakeToRun(taskset, bool_val); } else if (!lstrcmpW(name, ExecutionTimeLimit)) { @@ -1283,13 +1918,72 @@ } WARN("Settings was not terminated\n"); - return E_FAIL; + return SCHED_E_MALFORMEDXML; } -static HRESULT read_registration_info(IXmlReader *reader, ITaskDefinition *taskdef) +static HRESULT read_registration_info(IXmlReader *reader, IRegistrationInfo *info) { - FIXME("stub\n"); - return S_OK; + HRESULT hr; + XmlNodeType type; + const WCHAR *name; + WCHAR *value; + + if (IXmlReader_IsEmptyElement(reader)) + { + TRACE("RegistrationInfo is empty\n"); + return S_OK; + } + + while (IXmlReader_Read(reader, &type) == S_OK) + { + switch (type) + { + case XmlNodeType_EndElement: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("/%s\n", debugstr_w(name)); + + if (!lstrcmpW(name, RegistrationInfo)) + return S_OK; + + break; + + case XmlNodeType_Element: + hr = IXmlReader_GetLocalName(reader, &name, NULL); + if (hr != S_OK) return hr; + + TRACE("Element: %s\n", debugstr_w(name)); + + if (!lstrcmpW(name, Author)) + { + hr = read_text_value(reader, &value); + if (hr == S_OK) + IRegistrationInfo_put_Author(info, value); + } + else if (!lstrcmpW(name, Description)) + { + hr = read_text_value(reader, &value); + if (hr == S_OK) + IRegistrationInfo_put_Description(info, value); + } + else + FIXME("unhandled RegistrationInfo element %s\n", debugstr_w(name)); + + break; + + case XmlNodeType_Whitespace: + case XmlNodeType_Comment: + break; + + default: + FIXME("unhandled RegistrationInfo node type %d\n", type); + break; + } + } + + WARN("RegistrationInfo was not terminated\n"); + return SCHED_E_MALFORMEDXML; } static HRESULT read_task_attributes(IXmlReader *reader, ITaskDefinition *taskdef) @@ -1298,6 +1992,7 @@ ITaskSettings *taskset; const WCHAR *name; const WCHAR *value; + BOOL xmlns_ok = FALSE; TRACE("\n"); @@ -1336,7 +2031,11 @@ else if (!lstrcmpW(name, xmlns)) { if (lstrcmpW(value, task_ns)) + { FIXME("unknown namespace %s\n", debugstr_w(value)); + break; + } + xmlns_ok = TRUE; } else FIXME("unhandled Task attribute %s\n", debugstr_w(name)); @@ -1345,7 +2044,7 @@ } ITaskSettings_Release(taskset); - return S_OK; + return xmlns_ok ? S_OK : SCHED_E_NAMESPACE; } static HRESULT read_task(IXmlReader *reader, ITaskDefinition *taskdef) @@ -1382,7 +2081,14 @@ TRACE("Element: %s\n", debugstr_w(name)); if (!lstrcmpW(name, RegistrationInfo)) - hr = read_registration_info(reader, taskdef); + { + IRegistrationInfo *info; + + hr = ITaskDefinition_get_RegistrationInfo(taskdef, &info); + if (hr != S_OK) return hr; + hr = read_registration_info(reader, info); + IRegistrationInfo_Release(info); + } else if (!lstrcmpW(name, Settings)) { ITaskSettings *taskset; @@ -1415,7 +2121,7 @@ } WARN("Task was not terminated\n"); - return E_FAIL; + return SCHED_E_MALFORMEDXML; } static HRESULT read_xml(IXmlReader *reader, ITaskDefinition *taskdef) @@ -1461,7 +2167,7 @@ } WARN("Task definition was not found\n"); - return E_FAIL; + return SCHED_E_MALFORMEDXML; } static HRESULT WINAPI TaskDefinition_put_XmlText(ITaskDefinition *iface, BSTR xml) @@ -1474,6 +2180,8 @@ TRACE("%p,%s\n", iface, debugstr_w(xml)); + if (!xml) return E_INVALIDARG; + hmem = GlobalAlloc(0, lstrlenW(xml) * sizeof(WCHAR)); if (!hmem) return E_OUTOFMEMORY; @@ -1551,6 +2259,7 @@ ITaskService ITaskService_iface; LONG ref; BOOL connected; + DWORD version; WCHAR comp_name[MAX_COMPUTERNAME_LENGTH + 1]; } TaskService; @@ -1648,15 +2357,10 @@ static HRESULT WINAPI TaskService_NewTask(ITaskService *iface, DWORD flags, ITaskDefinition **definition) { - TaskService *task_svc = impl_from_ITaskService(iface); - TRACE("%p,%x,%p\n", iface, flags, definition); if (!definition) return E_POINTER; - if (!task_svc->connected) - return HRESULT_FROM_WIN32(ERROR_ONLY_IF_CONNECTED); - if (flags) FIXME("unsupported flags %x\n", flags); @@ -1669,11 +2373,70 @@ (V_VT(var) == VT_BSTR && (V_BSTR(var) == NULL || !*V_BSTR(var))); } +static HRESULT start_schedsvc(void) +{ + static const WCHAR scheduleW[] = { 'S','c','h','e','d','u','l','e',0 }; + SC_HANDLE scm, service; + SERVICE_STATUS_PROCESS status; + ULONGLONG start_time; + HRESULT hr = SCHED_E_SERVICE_NOT_RUNNING; + + TRACE("Trying to start %s service\n", debugstr_w(scheduleW)); + + scm = OpenSCManagerW(NULL, NULL, 0); + if (!scm) return SCHED_E_SERVICE_NOT_INSTALLED; + + service = OpenServiceW(scm, scheduleW, SERVICE_START | SERVICE_QUERY_STATUS); + if (service) + { + if (StartServiceW(service, 0, NULL) || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) + { + start_time = GetTickCount64(); + do + { + DWORD dummy; + + if (!QueryServiceStatusEx(service, SC_STATUS_PROCESS_INFO, (BYTE *)&status, sizeof(status), &dummy)) + { + WARN("failed to query scheduler status (%u)\n", GetLastError()); + break; + } + + if (status.dwCurrentState == SERVICE_RUNNING) + { + hr = S_OK; + break; + } + + if (GetTickCount64() - start_time > 30000) break; + Sleep(1000); + + } while (status.dwCurrentState == SERVICE_START_PENDING); + + if (status.dwCurrentState != SERVICE_RUNNING) + WARN("scheduler failed to start %u\n", status.dwCurrentState); + } + else + WARN("failed to start scheduler service (%u)\n", GetLastError()); + + CloseServiceHandle(service); + } + else + WARN("failed to open scheduler service (%u)\n", GetLastError()); + + CloseServiceHandle(scm); + return hr; +} + static HRESULT WINAPI TaskService_Connect(ITaskService *iface, VARIANT server, VARIANT user, VARIANT domain, VARIANT password) { + static WCHAR ncalrpc[] = { 'n','c','a','l','r','p','c',0 }; TaskService *task_svc = impl_from_ITaskService(iface); WCHAR comp_name[MAX_COMPUTERNAME_LENGTH + 1]; DWORD len; + HRESULT hr; + RPC_WSTR binding_str; + extern handle_t rpc_handle; TRACE("%p,%s,%s,%s,%s\n", iface, debugstr_variant(&server), debugstr_variant(&user), debugstr_variant(&domain), debugstr_variant(&password)); @@ -1707,6 +2470,21 @@ } } + hr = start_schedsvc(); + if (hr != S_OK) return hr; + + hr = RpcStringBindingComposeW(NULL, ncalrpc, NULL, NULL, NULL, &binding_str); + if (hr != RPC_S_OK) return hr; + hr = RpcBindingFromStringBindingW(binding_str, &rpc_handle); + if (hr != RPC_S_OK) return hr; + RpcStringFreeW(&binding_str); + + /* Make sure that the connection works */ + hr = SchRpcHighestVersion(&task_svc->version); + if (hr != S_OK) return hr; + + TRACE("server version %#x\n", task_svc->version); + strcpyW(task_svc->comp_name, comp_name); task_svc->connected = TRUE; @@ -1757,8 +2535,18 @@ static HRESULT WINAPI TaskService_get_HighestVersion(ITaskService *iface, DWORD *version) { - FIXME("%p,%p: stub\n", iface, version); - return E_NOTIMPL; + TaskService *task_svc = impl_from_ITaskService(iface); + + TRACE("%p,%p\n", iface, version); + + if (!version) return E_POINTER; + + if (!task_svc->connected) + return HRESULT_FROM_WIN32(ERROR_ONLY_IF_CONNECTED); + + *version = task_svc->version; + + return S_OK; } static const ITaskServiceVtbl TaskService_vtbl = @@ -1797,3 +2585,13 @@ return S_OK; } + +void __RPC_FAR *__RPC_USER MIDL_user_allocate(SIZE_T n) +{ + return HeapAlloc(GetProcessHeap(), 0, n); +} + +void __RPC_USER MIDL_user_free(void __RPC_FAR *p) +{ + HeapFree(GetProcessHeap(), 0, p); +} diff -Nru wine1.7-1.7.13/dlls/taskschd/tests/scheduler.c wine1.7-1.7.16/dlls/taskschd/tests/scheduler.c --- wine1.7-1.7.13/dlls/taskschd/tests/scheduler.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/taskschd/tests/scheduler.c 2014-04-04 19:13:44.000000000 +0000 @@ -81,8 +81,8 @@ V_BSTR(&v_comp) = SysAllocString(deadbeefW); hr = ITaskService_Connect(service, v_comp, v_null, v_null, v_null); -todo_wine - ok(hr == HRESULT_FROM_WIN32(RPC_S_INVALID_NET_ADDR), "expected RPC_S_INVALID_NET_ADDR, got %#x\n", hr); + ok(hr == HRESULT_FROM_WIN32(RPC_S_INVALID_NET_ADDR) || hr == HRESULT_FROM_WIN32(ERROR_BAD_NETPATH) /* VM */, + "expected RPC_S_INVALID_NET_ADDR, got %#x\n", hr); SysFreeString(V_BSTR(&v_comp)); vbool = 0xdead; @@ -340,6 +340,10 @@ ITaskFolder_Release(subfolder); + hr = ITaskFolder_DeleteFolder(folder, Wine, 0); +todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr); + hr = ITaskFolder_DeleteFolder(folder, Wine_Folder1_Folder2, 0); ok(hr == S_OK, "DeleteFolder error %#x\n", hr); ITaskFolder_DeleteFolder(folder, Wine_Folder1+1, 0); @@ -698,6 +702,26 @@ " \n" " \n" "\n"; + static const struct + { + DWORD flags, hr; + } create_new_task[] = + { + { 0, S_OK }, + { TASK_CREATE, S_OK }, + { TASK_UPDATE, 0x80070002 /* HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) */ }, + { TASK_CREATE | TASK_UPDATE, S_OK } + }; + static const struct + { + DWORD flags, hr; + } open_existing_task[] = + { + { 0, 0x800700b7 /* HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) */ }, + { TASK_CREATE, 0x800700b7 /* HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS) */ }, + { TASK_UPDATE, S_OK }, + { TASK_CREATE | TASK_UPDATE, S_OK } + }; WCHAR xmlW[sizeof(xml1)]; HRESULT hr; BSTR bstr; @@ -707,6 +731,8 @@ ITaskService *service; ITaskFolder *root, *folder; IRegisteredTask *task1, *task2; + IID iid; + int i; hr = CoCreateInstance(&CLSID_TaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskService, (void **)&service); if (hr != S_OK) @@ -728,11 +754,48 @@ ITaskFolder_DeleteTask(root, Wine_Task2, 0); ITaskFolder_DeleteFolder(root, Wine, 0); + if (0) /* FIXME: Uncomment once implemented */ + { + hr = ITaskFolder_GetTask(root, Wine_Task1, &task1); + ok(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "expected ERROR_PATH_NOT_FOUND, got %#x\n", hr); + } hr = ITaskFolder_CreateFolder(root, Wine, v_null, &folder); ok(hr == S_OK, "CreateFolder error %#x\n", hr); + if (0) /* FIXME: Uncomment once implemented */ + { + hr = ITaskFolder_GetTask(root, Wine, &task1); + ok(hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND), "expected ERROR_PATH_NOT_FOUND, got %#x\n", hr); + } + MultiByteToWideChar(CP_ACP, 0, xml1, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + for (i = 0; i < sizeof(create_new_task)/sizeof(create_new_task[0]); i++) + { + hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, create_new_task[i].flags, v_null, v_null, TASK_LOGON_NONE, v_null, &task1); +/* FIXME: Remove once Wine is fixed */ +if (create_new_task[i].hr != S_OK) todo_wine + ok(hr == create_new_task[i].hr, "%d: expected %#x, got %#x\n", i, create_new_task[i].hr, hr); +else + ok(hr == create_new_task[i].hr, "%d: expected %#x, got %#x\n", i, create_new_task[i].hr, hr); + if (hr == S_OK) + { + hr = ITaskFolder_DeleteTask(root, Wine_Task1, 0); +todo_wine + ok(hr == S_OK, "DeleteTask error %#x\n", hr); + } + } + + hr = ITaskFolder_RegisterTask(root, Wine_Task1, NULL, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, NULL); + ok(hr == HRESULT_FROM_WIN32(RPC_X_NULL_REF_POINTER), "expected RPC_X_NULL_REF_POINTER, got %#x\n", hr); + + hr = ITaskFolder_RegisterTask(root, Wine, xmlW, TASK_VALIDATE_ONLY, v_null, v_null, TASK_LOGON_NONE, v_null, NULL); + ok(hr == S_OK, "RegisterTask error %#x\n", hr); + + hr = ITaskFolder_RegisterTask(root, Wine, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, NULL); +todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_ACCESS_DENIED) || broken(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS)) /* Vista */, "expected ERROR_ACCESS_DENIED, got %#x\n", hr); + hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, NULL); ok(hr == S_OK, "RegisterTask error %#x\n", hr); @@ -740,9 +803,23 @@ todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr); + hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, 0, v_null, v_null, TASK_LOGON_NONE, v_null, NULL); +todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS), "expected ERROR_ALREADY_EXISTS, got %#x\n", hr); + hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, TASK_CREATE_OR_UPDATE, v_null, v_null, TASK_LOGON_NONE, v_null, &task1); ok(hr == S_OK, "RegisterTask error %#x\n", hr); + for (i = 0; i < sizeof(open_existing_task)/sizeof(open_existing_task[0]); i++) + { + hr = ITaskFolder_RegisterTask(root, Wine_Task1, xmlW, open_existing_task[i].flags, v_null, v_null, TASK_LOGON_NONE, v_null, &task1); +/* FIXME: Remove once Wine is fixed */ +if (open_existing_task[i].hr != S_OK) todo_wine + ok(hr == open_existing_task[i].hr, "%d: expected %#x, got %#x\n", i, open_existing_task[i].hr, hr); +else + ok(hr == open_existing_task[i].hr, "%d: expected %#x, got %#x\n", i, open_existing_task[i].hr, hr); + } + hr = IRegisteredTask_get_Name(task1, NULL); todo_wine ok(hr == E_POINTER, "expected E_POINTER, got %#x\n", hr); @@ -816,6 +893,15 @@ ok(hr == S_OK, "get_Enabled error %#x\n", hr); ok(vbool == VARIANT_FALSE, "expected VARIANT_FALSE, got %d\n", vbool); + hr = IRegisteredTask_put_Enabled(task1, VARIANT_TRUE); + ok(hr == S_OK, "put_Enabled error %#x\n", hr); + hr = IRegisteredTask_get_State(task1, &state); + ok(hr == S_OK, "get_State error %#x\n", hr); + ok(state == TASK_STATE_READY, "expected TASK_STATE_READY, got %d\n", state); + hr = IRegisteredTask_get_Enabled(task1, &vbool); + ok(hr == S_OK, "get_Enabled error %#x\n", hr); + ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool); + IRegisteredTask_Release(task1); hr = ITaskFolder_GetTask(folder, Task2, &task2); @@ -838,11 +924,30 @@ IRegisteredTask_Release(task2); + hr = ITaskFolder_DeleteTask(folder, NULL, 0); + ok(hr == HRESULT_FROM_WIN32(ERROR_DIR_NOT_EMPTY), "expected ERROR_DIR_NOT_EMPTY, got %#x\n", hr); + hr = ITaskFolder_DeleteTask(root, Wine_Task1, 0); ok(hr == S_OK, "DeleteTask error %#x\n", hr); hr = ITaskFolder_DeleteTask(folder, Task2, 0); ok(hr == S_OK, "DeleteTask error %#x\n", hr); + hr = ITaskFolder_DeleteTask(folder, Task2, 0); + ok(hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), "expected ERROR_FILE_NOT_FOUND, got %#x\n", hr); + + hr = ITaskFolder_RegisterTask(root, NULL, xmlW, TASK_CREATE, v_null, v_null, TASK_LOGON_NONE, v_null, &task1); + ok(hr == S_OK, "RegisterTask error %#x\n", hr); + + hr = IRegisteredTask_get_Name(task1, &bstr); + ok(hr == S_OK, "get_Name error %#x\n", hr); + hr = IIDFromString(bstr, &iid); + ok(hr == S_OK, "IIDFromString error %#x\n", hr); + + IRegisteredTask_Release(task1); + + hr = ITaskFolder_DeleteTask(root, bstr, 0); + ok(hr == S_OK, "DeleteTask error %#x\n", hr); + failed: ITaskFolder_Release(folder); @@ -1076,6 +1181,89 @@ static void test_TaskDefinition(void) { + static const char xml1[] = + "\n" + " \n" + " \"Task1\"\n" + " \n" + " \n" + " false\n" + " false\n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + "\n"; + static const char xml2[] = + "\n" + " \n" + " \"Task1\"\n" + " \n" + " \n" + " false\n" + " false\n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + "\n"; + static const char xml3[] = + "\n" + " \n" + " \"Task1\"\n" + " \n" + " \n" + " false\n" + " false\n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + "\n"; + static const char xml4[] = + "\n" + " \n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + "\n"; + static const char xml5[] = + "\n" + " \n" + " \n" + " \n" + "\n"; + static const char xml6[] = + "\n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + " \n" + "\n"; + static const char xml7[] = + "\n" + " \n" + " \n" + " FALSE\n" + " \n" + " \n" + " \n" + " \"task1.exe\"\n" + " \n" + " \n" + "\n"; static struct settings def_settings = { { 0 }, { 'P','T','7','2','H',0 }, { 0 }, 0, 7, TASK_INSTANCES_IGNORE_NEW, TASK_COMPATIBILITY_V2, VARIANT_TRUE, VARIANT_TRUE, VARIANT_TRUE, VARIANT_TRUE, VARIANT_FALSE, VARIANT_FALSE, VARIANT_TRUE, VARIANT_FALSE, @@ -1085,10 +1273,10 @@ VARIANT_FALSE, VARIANT_FALSE, VARIANT_TRUE, VARIANT_TRUE, VARIANT_FALSE, VARIANT_TRUE, VARIANT_TRUE, VARIANT_TRUE }; HRESULT hr; - VARIANT v_null; ITaskService *service; ITaskDefinition *taskdef; BSTR xml; + WCHAR xmlW[sizeof(xml1)]; hr = CoCreateInstance(&CLSID_TaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskService, (void **)&service); if (hr != S_OK) @@ -1097,11 +1285,6 @@ return; } - V_VT(&v_null) = VT_NULL; - - hr = ITaskService_Connect(service, v_null, v_null, v_null, v_null); - ok(hr == S_OK, "Connect error %#x\n", hr); - hr = ITaskService_NewTask(service, 0, &taskdef); ok(hr == S_OK, "NewTask error %#x\n", hr); @@ -1112,7 +1295,6 @@ create_action(taskdef); hr = ITaskDefinition_get_XmlText(taskdef, &xml); -todo_wine ok(hr == S_OK, "get_XmlText error %#x\n", hr); ITaskDefinition_Release(taskdef); @@ -1121,7 +1303,6 @@ ok(hr == S_OK, "NewTask error %#x\n", hr); hr = ITaskDefinition_put_XmlText(taskdef, xml); -todo_wine ok(hr == S_OK, "put_XmlText error %#x\n", hr); SysFreeString(xml); @@ -1129,6 +1310,43 @@ test_settings_v1(taskdef, &new_settings, &def_settings); */ + hr = ITaskDefinition_put_XmlText(taskdef, NULL); + ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml1, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); + ok(hr == S_OK, "put_XmlText error %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml2, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); + ok(hr == SCHED_E_NAMESPACE, "expected SCHED_E_NAMESPACE, got %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml3, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); +todo_wine + ok(hr == SCHED_E_UNEXPECTEDNODE, "expected SCHED_E_UNEXPECTEDNODE, got %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml4, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); + ok(hr == S_OK, "put_XmlText error %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml5, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); +todo_wine + ok(hr == SCHED_E_MISSINGNODE, "expected SCHED_E_MISSINGNODE, got %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml6, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); + ok(hr == SCHED_E_MALFORMEDXML, "expected SCHED_E_MALFORMEDXML, got %#x\n", hr); + + MultiByteToWideChar(CP_ACP, 0, xml7, -1, xmlW, sizeof(xmlW)/sizeof(xmlW[0])); + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); + ok(hr == SCHED_E_INVALIDVALUE, "expected SCHED_E_INVALIDVALUE, got %#x\n", hr); + + xmlW[0] = 0; + hr = ITaskDefinition_put_XmlText(taskdef, xmlW); + ok(hr == SCHED_E_MALFORMEDXML, "expected SCHED_E_MALFORMEDXML, got %#x\n", hr); + ITaskDefinition_Release(taskdef); ITaskService_Release(service); } diff -Nru wine1.7-1.7.13/dlls/urlmon/http.c wine1.7-1.7.16/dlls/urlmon/http.c --- wine1.7-1.7.13/dlls/urlmon/http.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/urlmon/http.c 2014-04-04 19:13:44.000000000 +0000 @@ -282,7 +282,7 @@ HINTERNET internet_session, IInternetBindInfo *bind_info) { HttpProtocol *This = impl_from_Protocol(prot); - LPWSTR addl_header = NULL, post_cookie = NULL; + WCHAR *addl_header = NULL, *post_cookie = NULL, *rootdoc_url = NULL; IServiceProvider *service_provider = NULL; IHttpNegotiate2 *http_negotiate2 = NULL; BSTR url, host, user, pass, path; @@ -326,6 +326,13 @@ return INET_E_CANNOT_CONNECT; } + num = 0; + hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ROOTDOC_URL, &rootdoc_url, 1, &num); + if(hres == S_OK && num) { + FIXME("Use root doc URL %s\n", debugstr_w(rootdoc_url)); + CoTaskMemFree(rootdoc_url); + } + num = sizeof(accept_mimes)/sizeof(accept_mimes[0])-1; hres = IInternetBindInfo_GetBindString(bind_info, BINDSTRING_ACCEPT_MIMES, accept_mimes, num, &num); if(hres == INET_E_USE_DEFAULT_SETTING) { diff -Nru wine1.7-1.7.13/dlls/urlmon/tests/misc.c wine1.7-1.7.16/dlls/urlmon/tests/misc.c --- wine1.7-1.7.13/dlls/urlmon/tests/misc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/urlmon/tests/misc.c 2014-04-04 19:13:44.000000000 +0000 @@ -1740,7 +1740,8 @@ char *name; HKEY feature_control; HKEY feature; - DWORD value, skip_zone; + DWORD value; + BOOL skip_zone; BOOL delete_feature_key = TRUE; static const char* szFeatureBehaviorsKey = "FEATURE_BEHAVIORS"; @@ -1805,11 +1806,11 @@ if (res == ERROR_ACCESS_DENIED) { skip("Not allowed to modify zone elevation\n"); - skip_zone = 1; + skip_zone = TRUE; } else { - skip_zone = 0; + skip_zone = FALSE; ok(res == ERROR_SUCCESS, "RegSetValueEx failed: %d\n", res); hres = pCoInternetIsFeatureEnabled(FEATURE_ZONE_ELEVATION, GET_FEATURE_FROM_PROCESS); diff -Nru wine1.7-1.7.13/dlls/urlmon/tests/protocol.c wine1.7-1.7.16/dlls/urlmon/tests/protocol.c --- wine1.7-1.7.13/dlls/urlmon/tests/protocol.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/urlmon/tests/protocol.c 2014-04-04 19:13:44.000000000 +0000 @@ -90,6 +90,7 @@ DEFINE_EXPECT(GetBindString_USER_AGENT); DEFINE_EXPECT(GetBindString_POST_COOKIE); DEFINE_EXPECT(GetBindString_URL); +DEFINE_EXPECT(GetBindString_ROOTDOC_URL); DEFINE_EXPECT(QueryService_HttpNegotiate); DEFINE_EXPECT(QueryService_InternetProtocol); DEFINE_EXPECT(QueryService_HttpSecurity); @@ -430,7 +431,12 @@ static HRESULT WINAPI Stream_QueryInterface(IStream *iface, REFIID riid, void **ppv) { - ok(0, "unexpected call\n"); + static const IID IID_strm_unknown = {0x2f68429a,0x199a,0x4043,{0x93,0x11,0xf2,0xfe,0x7c,0x13,0xcc,0xb9}}; + + if(!IsEqualGUID(&IID_strm_unknown, riid)) /* IE11 */ + ok(0, "unexpected call %s\n", wine_dbgstr_guid(riid)); + + *ppv = NULL; return E_NOINTERFACE; } @@ -1384,8 +1390,12 @@ memcpy(*ppwzStr, binding_urls[tested_protocol], size); return S_OK; } + case BINDSTRING_ROOTDOC_URL: + CHECK_EXPECT(GetBindString_ROOTDOC_URL); + ok(cEl == 1, "cEl=%d, expected 1\n", cEl); + return E_NOTIMPL; default: - ok(0, "unexpected call\n"); + ok(0, "unexpected ulStringType %d\n", ulStringType); } return E_NOTIMPL; @@ -2843,6 +2853,7 @@ SET_EXPECT(ReportProgress_DIRECTBIND); if(!got_user_agent) SET_EXPECT(GetBindString_USER_AGENT); + SET_EXPECT(GetBindString_ROOTDOC_URL); SET_EXPECT(GetBindString_ACCEPT_MIMES); SET_EXPECT(QueryService_HttpNegotiate); SET_EXPECT(BeginningTransaction); @@ -2884,6 +2895,7 @@ CHECK_CALLED(GetBindString_USER_AGENT); got_user_agent = TRUE; } + CLEAR_CALLED(GetBindString_ROOTDOC_URL); /* New in IE11 */ CHECK_CALLED(GetBindString_ACCEPT_MIMES); CHECK_CALLED(QueryService_HttpNegotiate); CHECK_CALLED(BeginningTransaction); @@ -3638,7 +3650,7 @@ CHECK_CALLED(QueryService_InternetProtocol); CHECK_CALLED(CreateInstance); CHECK_CALLED(ReportProgress_PROTOCOLCLASSID); - CHECK_CALLED(SetPriority); + CLEAR_CALLED(SetPriority); /* IE11 does not call it. */ if(impl_protex) CHECK_CALLED(StartEx); else diff -Nru wine1.7-1.7.13/dlls/urlmon/tests/sec_mgr.c wine1.7-1.7.16/dlls/urlmon/tests/sec_mgr.c --- wine1.7-1.7.13/dlls/urlmon/tests/sec_mgr.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/urlmon/tests/sec_mgr.c 2014-04-04 19:13:44.000000000 +0000 @@ -65,6 +65,11 @@ expect_ ## func = called_ ## func = FALSE; \ }while(0) +#define SET_CALLED(func) \ + do { \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + DEFINE_EXPECT(ParseUrl_SECURITY_URL_input); DEFINE_EXPECT(ParseUrl_SECURITY_URL_input2); DEFINE_EXPECT(ParseUrl_SECURITY_URL_expected); @@ -509,15 +514,26 @@ */ res = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey); - if(res != ERROR_SUCCESS) { - ok(0, "Could not open zone key\n"); + ok(res == ERROR_SUCCESS, "Could not open zone key\n"); + if(res != ERROR_SUCCESS) return; - } wsprintfA(buf, "%X", action); size = sizeof(DWORD); res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)®_policy, &size); RegCloseKey(hkey); + + /* Try settings from HKEY_LOCAL_MACHINE. */ + if(res != ERROR_SUCCESS || size != sizeof(DWORD)) { + res = RegOpenKeyA(HKEY_LOCAL_MACHINE, + "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey); + ok(res == ERROR_SUCCESS, "Could not open zone key\n"); + + size = sizeof(DWORD); + res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)®_policy, &size); + RegCloseKey(hkey); + } + if(res != ERROR_SUCCESS || size != sizeof(DWORD)) { policy = 0xdeadbeef; hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy, @@ -1213,10 +1229,10 @@ ok((pZA->cbSize == 0xffffffff) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)), "got cbSize = 0x%x (expected 0xffffffff)\n", pZA->cbSize); - /* IE8 no longer fail on invalid zones */ + /* IE8 up to IE10 don't fail on invalid zones */ memset(buffer, -1, sizeof(buffer)); hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0xdeadbeef, pZA); - ok(hr == S_OK || (hr == E_FAIL), + ok(hr == S_OK || hr == E_FAIL || hr == E_POINTER, "got 0x%x (expected S_OK or E_FAIL)\n", hr); hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, NULL); @@ -1958,6 +1974,16 @@ testcases[i].policy_flags = URLPOLICY_ALLOW; } + /* IE10 does not seem to use passed ISecurityManager */ + SET_EXPECT(ProcessUrlAction); + pCoInternetIsFeatureZoneElevationEnabled(url1, url1, &security_manager, 0); + i = called_ProcessUrlAction; + SET_CALLED(ProcessUrlAction); + if(!i) { + skip("CoInternetIsFeatureZoneElevationEnabled does not use passed ISecurityManager\n"); + return; + } + for(i=0; ihwndOwner = hwndOwner; + + if (flags & TPM_LAYOUTRTL) + ex_style = WS_EX_LAYOUTRTL; + + /* NOTE: In Windows, top menu popup is not owned. */ + menu->hWnd = CreateWindowExW( ex_style, (LPCWSTR)POPUPMENU_CLASS_ATOM, NULL, + WS_POPUP, 0, 0, 0, 0, + hwndOwner, 0, (HINSTANCE)GetWindowLongPtrW(hwndOwner, GWLP_HINSTANCE), + (LPVOID)hmenu ); + if( !menu->hWnd ) return FALSE; + return TRUE; +} + + +/*********************************************************************** * MENU_ShowPopup * * Display a popup menu. @@ -1829,7 +1864,6 @@ POINT pt; HMONITOR monitor; MONITORINFO info; - DWORD ex_style = 0; TRACE("owner=%p hmenu=%p id=0x%04x x=0x%04x y=0x%04x xa=0x%04x ya=0x%04x\n", hwndOwner, hmenu, id, x, y, xanchor, yanchor); @@ -1841,14 +1875,6 @@ menu->FocusedItem = NO_SELECTED_ITEM; } - /* store the owner for DrawItem */ - if (!IsWindow( hwndOwner )) - { - SetLastError( ERROR_INVALID_WINDOW_HANDLE ); - return FALSE; - } - menu->hwndOwner = hwndOwner; - menu->nScrollPos = 0; MENU_PopupMenuCalcSize( menu ); @@ -1865,10 +1891,7 @@ GetMonitorInfoW( monitor, &info ); if (flags & TPM_LAYOUTRTL) - { - ex_style = WS_EX_LAYOUTRTL; flags ^= TPM_RIGHTALIGN; - } if( flags & TPM_RIGHTALIGN ) x -= width; if( flags & TPM_CENTERALIGN ) x -= width / 2; @@ -1896,20 +1919,14 @@ } if( y < info.rcWork.top ) y = info.rcWork.top; - /* NOTE: In Windows, top menu popup is not owned. */ - menu->hWnd = CreateWindowExW( ex_style, (LPCWSTR)POPUPMENU_CLASS_ATOM, NULL, - WS_POPUP, x, y, width, height, - hwndOwner, 0, (HINSTANCE)GetWindowLongPtrW(hwndOwner, GWLP_HINSTANCE), - (LPVOID)hmenu ); - if( !menu->hWnd ) return FALSE; if (!top_popup) { top_popup = menu->hWnd; top_popup_hmenu = hmenu; } /* Display the window */ - SetWindowPos( menu->hWnd, HWND_TOPMOST, 0, 0, 0, 0, - SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ); + SetWindowPos( menu->hWnd, HWND_TOPMOST, x, y, width, height, + SWP_SHOWWINDOW | SWP_NOACTIVATE ); UpdateWindow( menu->hWnd ); return TRUE; } @@ -2386,6 +2403,8 @@ /* use default alignment for submenus */ wFlags &= ~(TPM_CENTERALIGN | TPM_RIGHTALIGN | TPM_VCENTERALIGN | TPM_BOTTOMALIGN); + MENU_InitPopup( hwndOwner, item->hSubMenu, wFlags ); + MENU_ShowPopup( hwndOwner, item->hSubMenu, menu->FocusedItem, wFlags, rect.left, rect.top, rect.right, rect.bottom ); if (selectFirst) @@ -3291,7 +3310,7 @@ * It also enables menus to be displayed in more than one window, * but there are some bugs left that need to be fixed in this case. */ - if ((menu = MENU_GetMenu( hMenu ))) menu->hWnd = hWnd; + if (!bPopup && (menu = MENU_GetMenu( hMenu ))) menu->hWnd = hWnd; if (!top_popup) top_popup_hmenu = hMenu; /* Send WM_ENTERMENULOOP and WM_INITMENU message only if TPM_NONOTIFY flag is not specified */ @@ -3442,16 +3461,29 @@ return FALSE; } - MENU_InitTracking(hWnd, hMenu, TRUE, wFlags); + if (MENU_InitPopup( hWnd, hMenu, wFlags )) + { + MENU_InitTracking(hWnd, hMenu, TRUE, wFlags); - /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ - if (!(wFlags & TPM_NONOTIFY)) - SendMessageW( hWnd, WM_INITMENUPOPUP, (WPARAM)hMenu, 0); + /* Send WM_INITMENUPOPUP message only if TPM_NONOTIFY flag is not specified */ + if (!(wFlags & TPM_NONOTIFY)) + SendMessageW( hWnd, WM_INITMENUPOPUP, (WPARAM)hMenu, 0); - if (MENU_ShowPopup( hWnd, hMenu, 0, wFlags, x, y, 0, 0 )) - ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, - lpTpm ? &lpTpm->rcExclude : NULL ); - MENU_ExitTracking(hWnd, TRUE); + if (MENU_ShowPopup( hWnd, hMenu, 0, wFlags, x, y, 0, 0 )) + ret = MENU_TrackMenu( hMenu, wFlags | TPM_POPUPMENU, 0, 0, hWnd, + lpTpm ? &lpTpm->rcExclude : NULL ); + MENU_ExitTracking(hWnd, TRUE); + + if (menu->hWnd) + { + DestroyWindow( menu->hWnd ); + menu->hWnd = 0; + + if (!(wFlags & TPM_NONOTIFY)) + SendMessageW( hWnd, WM_UNINITMENUPOPUP, (WPARAM)hMenu, + MAKELPARAM(0, IS_SYSTEM_MENU(menu)) ); + } + } return ret; } @@ -3687,7 +3719,7 @@ return 0; } if (!item->text) return 0; - if (!str || !nMaxSiz) return strlenW(item->text); + if (!str || !nMaxSiz) return WideCharToMultiByte( CP_ACP, 0, item->text, -1, NULL, 0, NULL, NULL ); if (!WideCharToMultiByte( CP_ACP, 0, item->text, -1, str, nMaxSiz, NULL, NULL )) str[nMaxSiz-1] = 0; TRACE("returning %s\n", debugstr_a(str)); diff -Nru wine1.7-1.7.13/dlls/user32/message.c wine1.7-1.7.16/dlls/user32/message.c --- wine1.7-1.7.13/dlls/user32/message.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/message.c 2014-04-04 19:13:44.000000000 +0000 @@ -4093,6 +4093,8 @@ return WAIT_FAILED; } + flush_window_surfaces( TRUE ); + /* set the queue mask */ SERVER_START_REQ( set_queue_mask ) { @@ -4107,7 +4109,6 @@ for (i = 0; i < count; i++) handles[i] = pHandles[i]; handles[count] = get_server_queue_handle(); - flush_window_surfaces( TRUE ); return wow_handlers.wait_message( count+1, handles, timeout, mask, flags ); } @@ -4577,3 +4578,12 @@ FIXME( "%x %08x\n", message, flag ); return TRUE; } + +/****************************************************************** + * ChangeWindowMessageFilterEx (USER32.@) + */ +BOOL WINAPI ChangeWindowMessageFilterEx( HWND hwnd, UINT message, DWORD action, CHANGEFILTERSTRUCT *changefilter ) +{ + FIXME( "%p %x %d %p\n", hwnd, message, action, changefilter ); + return TRUE; +} diff -Nru wine1.7-1.7.13/dlls/user32/nonclient.c wine1.7-1.7.16/dlls/user32/nonclient.c --- wine1.7-1.7.13/dlls/user32/nonclient.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/nonclient.c 2014-04-04 19:13:44.000000000 +0000 @@ -1396,7 +1396,15 @@ { case HTCAPTION: { - HWND top = GetAncestor( hwnd, GA_ROOT ); + HWND top = hwnd, parent; + while(1) + { + if ((GetWindowLongW( top, GWL_STYLE ) & (WS_POPUP|WS_CHILD)) != WS_CHILD) + break; + parent = GetAncestor( top, GA_PARENT ); + if (!parent || parent == GetDesktopWindow()) break; + top = parent; + } if (FOCUS_MouseActivate( top ) || (GetActiveWindow() == top)) SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, lParam ); diff -Nru wine1.7-1.7.13/dlls/user32/tests/clipboard.c wine1.7-1.7.16/dlls/user32/tests/clipboard.c --- wine1.7-1.7.13/dlls/user32/tests/clipboard.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/clipboard.c 2014-04-04 19:13:44.000000000 +0000 @@ -270,6 +270,7 @@ } static CRITICAL_SECTION clipboard_cs; +static HWND next_wnd; static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp) { switch(msg) { @@ -277,7 +278,14 @@ EnterCriticalSection(&clipboard_cs); LeaveCriticalSection(&clipboard_cs); break; + case WM_CHANGECBCHAIN: + if (next_wnd == (HWND)wp) + next_wnd = (HWND)lp; + else if (next_wnd) + SendMessageA(next_wnd, msg, wp, lp); + break; case WM_USER: + ChangeClipboardChain(hwnd, next_wnd); PostQuitMessage(0); break; } @@ -292,7 +300,7 @@ EnterCriticalSection(&clipboard_cs); SetLastError(0xdeadbeef); - SetClipboardViewer(win); + next_wnd = SetClipboardViewer(win); ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError()); LeaveCriticalSection(&clipboard_cs); diff -Nru wine1.7-1.7.13/dlls/user32/tests/menu.c wine1.7-1.7.16/dlls/user32/tests/menu.c --- wine1.7-1.7.13/dlls/user32/tests/menu.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/menu.c 2014-04-04 19:13:44.000000000 +0000 @@ -147,7 +147,10 @@ static BOOL MOD_GotDrawItemMsg = FALSE; static int gflag_initmenupopup, gflag_entermenuloop, - gflag_initmenu; + gflag_initmenu, + gflag_enteridle; +static WPARAM selectitem_wp; +static LPARAM selectitem_lp; /* wndproc used by test_menu_ownerdraw() */ static LRESULT WINAPI menu_ownerdraw_wnd_proc(HWND hwnd, UINT msg, @@ -236,6 +239,7 @@ } case WM_ENTERIDLE: { + gflag_enteridle++; ok( lparam || broken(!lparam), /* win9x, nt4 */ "Menu window handle is NULL!\n"); if( lparam) { @@ -246,7 +250,10 @@ PostMessageA(hwnd, WM_CANCELMODE, 0, 0); return TRUE; } - + case WM_MENUSELECT: + selectitem_wp = wparam; + selectitem_lp = lparam; + break; } return DefWindowProcA(hwnd, msg, wparam, lparam); } @@ -3244,8 +3251,13 @@ g_hmenu = CreatePopupMenu(); ok(g_hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError()); + ret = AppendMenuA(g_hmenu, MF_STRING , 100, "item 1"); + ok(ret, "AppendMenu failed.\n"); + ret = AppendMenuA(g_hmenu, MF_STRING , 101, "item 2"); + ok(ret, "AppendMenu failed.\n"); + ret = TrackPopupMenu( g_hmenu, 0, 100, 100, 0, hwnd, NULL); - todo_wine ok(ret == FALSE, "got %d\n", ret); + ok(ret == TRUE, "got %d\n", ret); DestroyMenu(g_hmenu); DestroyWindow(hwnd); @@ -3517,6 +3529,106 @@ DestroyWindow( hwnd); } +static LRESULT WINAPI menu_fill_in_init(HWND hwnd, UINT msg, + WPARAM wparam, LPARAM lparam) +{ + HMENU hmenupopup; + BOOL ret; + switch (msg) + { + case WM_INITMENUPOPUP: + gflag_initmenupopup++; + hmenupopup = (HMENU) wparam; + ret = AppendMenuA(hmenupopup, MF_STRING , 100, "item 1"); + ok(ret, "AppendMenu failed.\n"); + ret = AppendMenuA(hmenupopup, MF_STRING , 101, "item 2"); + ok(ret, "AppendMenu failed.\n"); + break; + case WM_ENTERMENULOOP: + gflag_entermenuloop++; + break; + case WM_INITMENU: + gflag_initmenu++; + break; + case WM_ENTERIDLE: + gflag_enteridle++; + PostMessageA(hwnd, WM_CANCELMODE, 0, 0); + return TRUE; + case WM_MENUSELECT: + selectitem_wp = wparam; + selectitem_lp = lparam; + break; + } + return DefWindowProcA(hwnd, msg, wparam, lparam); +} + +static void test_emptypopup(void) +{ + BOOL ret; + HMENU hmenu; + + HWND hwnd = CreateWindowExA(0, (LPCSTR)MAKEINTATOM(atomMenuCheckClass), NULL, + WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, + NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError()); + SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_ownerdraw_wnd_proc); + + hmenu = CreatePopupMenu(); + ok(hmenu != NULL, "CreateMenu failed with error %d\n", GetLastError()); + + gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0; + selectitem_wp = 0xdeadbeef; + selectitem_lp = 0xdeadbeef; + + ret = TrackPopupMenu( hmenu, TPM_RETURNCMD, 100,100, 0, hwnd, NULL); + ok(ret == 0, "got %i\n", ret); + + ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup); + ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop); + ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu); + todo_wine ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu); + + todo_wine ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp); + todo_wine ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp); + + gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0; + selectitem_wp = 0xdeadbeef; + selectitem_lp = 0xdeadbeef; + + ret = TrackPopupMenu( hmenu, 0, 100,100, 0, hwnd, NULL); + todo_wine ok(ret == 0, "got %i\n", ret); + + ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup); + ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop); + ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu); + todo_wine ok(gflag_enteridle == 0, "got %i\n", gflag_initmenu); + + todo_wine ok(selectitem_wp == 0xdeadbeef, "got %lx\n", selectitem_wp); + todo_wine ok(selectitem_lp == 0xdeadbeef, "got %lx\n", selectitem_lp); + + SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)menu_fill_in_init); + + gflag_initmenupopup = gflag_entermenuloop = gflag_initmenu = gflag_enteridle = 0; + selectitem_wp = 0xdeadbeef; + selectitem_lp = 0xdeadbeef; + + ret = TrackPopupMenu( hmenu, 0, 100,100, 0, hwnd, NULL); + ok(ret == 1, "got %i\n", ret); + + ok(gflag_initmenupopup == 1, "got %i\n", gflag_initmenupopup); + ok(gflag_entermenuloop == 1, "got %i\n", gflag_entermenuloop); + ok(gflag_initmenu == 1, "got %i\n", gflag_initmenu); + ok(gflag_enteridle == 1, "got %i\n", gflag_initmenu); + + ok(selectitem_wp == 0xffff0000, "got %lx\n", selectitem_wp); + ok(selectitem_lp == 0, "got %lx\n", selectitem_lp); + + DestroyWindow(hwnd); + + ret = DestroyMenu(hmenu); + ok(ret, "DestroyMenu failed with error %d\n", GetLastError()); +} + START_TEST(menu) { init_function_pointers(); @@ -3553,4 +3665,5 @@ test_menu_cancelmode(); test_menu_maxdepth(); test_menu_circref(); + test_emptypopup(); } diff -Nru wine1.7-1.7.13/dlls/user32/tests/msg.c wine1.7-1.7.16/dlls/user32/tests/msg.c --- wine1.7-1.7.13/dlls/user32/tests/msg.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/msg.c 2014-04-04 19:13:44.000000000 +0000 @@ -444,20 +444,20 @@ { WM_NCPAINT, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, { WM_ERASEBKGND, sent|optional }, - { HCBT_ACTIVATE, hook }, + { HCBT_ACTIVATE, hook|optional }, { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 }, { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, { WM_NCPAINT, sent|wparam|optional, 1 }, - { WM_ACTIVATEAPP, sent|wparam, 1 }, - { WM_NCACTIVATE, sent|wparam, 1 }, + { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, + { WM_NCACTIVATE, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ACTIVATE, sent|wparam, 1 }, - { HCBT_SETFOCUS, hook }, + { WM_ACTIVATE, sent|wparam|optional, 1 }, + { HCBT_SETFOCUS, hook|optional }, { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, - { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, + { WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 }, { WM_GETTEXT, sent|optional }, { WM_NCPAINT, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, @@ -488,19 +488,19 @@ { WM_GETMINMAXINFO, sent|defwinproc }, { WM_NCCALCSIZE, sent|wparam, TRUE }, { EVENT_OBJECT_SHOW, winevent_hook|wparam|lparam, 0, 0 }, - { HCBT_ACTIVATE, hook }, + { HCBT_ACTIVATE, hook|optional }, { EVENT_SYSTEM_FOREGROUND, winevent_hook|wparam|lparam, 0, 0 }, { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, - { WM_ACTIVATEAPP, sent|wparam, 1 }, - { WM_NCACTIVATE, sent|wparam, 1 }, + { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, + { WM_NCACTIVATE, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ACTIVATE, sent|wparam, 1 }, - { HCBT_SETFOCUS, hook }, + { WM_ACTIVATE, sent|wparam|optional, 1 }, + { HCBT_SETFOCUS, hook|optional }, { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, - { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, + { WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 }, { WM_GETTEXT, sent|optional }, { WM_NCPAINT, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, @@ -549,20 +549,27 @@ { HCBT_MINMAX, hook|lparam, 0, SW_RESTORE }, { WM_QUERYOPEN, sent|optional }, { WM_GETTEXT, sent|optional }, - { WM_WINDOWPOSCHANGING, sent|wparam, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS }, - { WM_GETMINMAXINFO, sent|defwinproc }, - { WM_NCCALCSIZE, sent|wparam, TRUE }, - { HCBT_ACTIVATE, hook }, + { WM_NCACTIVATE, sent|wparam|optional, 1 }, + { WM_WINDOWPOSCHANGING, sent|optional }, /* SWP_NOSIZE|SWP_NOMOVE */ + { WM_WINDOWPOSCHANGED, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE|SWP_NOCLIENTSIZE|SWP_NOCLIENTMOVE }, + { WM_NCCALCSIZE, sent|wparam|optional, TRUE }, + { WM_MOVE, sent|optional }, + { WM_SIZE, sent|wparam|optional, SIZE_RESTORED }, + { WM_GETTEXT, sent|optional }, + { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_FRAMECHANGED|SWP_STATECHANGED|SWP_NOCOPYBITS }, + { WM_GETMINMAXINFO, sent|defwinproc|optional }, + { WM_NCCALCSIZE, sent|wparam|optional, TRUE }, + { HCBT_ACTIVATE, hook|optional }, { WM_QUERYNEWPALETTE, sent|wparam|lparam|optional, 0, 0 }, { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, - { WM_ACTIVATEAPP, sent|wparam, 1 }, - { WM_NCACTIVATE, sent|wparam, 1 }, + { WM_ACTIVATEAPP, sent|wparam|optional, 1 }, + { WM_NCACTIVATE, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ACTIVATE, sent|wparam, 1 }, - { HCBT_SETFOCUS, hook }, + { WM_ACTIVATE, sent|wparam|optional, 1 }, + { HCBT_SETFOCUS, hook|optional }, { WM_IME_SETCONTEXT, sent|wparam|defwinproc|optional, 1 }, { WM_IME_NOTIFY, sent|wparam|defwinproc|optional, 2 }, - { WM_SETFOCUS, sent|wparam|defwinproc, 0 }, + { WM_SETFOCUS, sent|wparam|defwinproc|optional, 0 }, { WM_GETTEXT, sent|optional }, { WM_NCPAINT, sent|wparam|optional, 1 }, { WM_GETTEXT, sent|defwinproc|optional }, @@ -570,9 +577,13 @@ { WM_WINDOWPOSCHANGED, sent|wparam, SWP_STATECHANGED|SWP_FRAMECHANGED|SWP_NOCOPYBITS }, { WM_MOVE, sent|defwinproc }, { WM_SIZE, sent|defwinproc|wparam, SIZE_RESTORED }, + { HCBT_SETFOCUS, hook|optional }, + { WM_SETFOCUS, sent|wparam|optional, 0 }, { WM_NCCALCSIZE, sent|wparam|optional, TRUE }, { WM_NCPAINT, sent|wparam|optional, 1 }, { WM_ERASEBKGND, sent|optional }, + { HCBT_SETFOCUS, hook|optional }, + { WM_SETFOCUS, sent|wparam|optional, 0 }, { WM_ACTIVATE, sent|wparam, 1 }, { WM_GETTEXT, sent|optional }, { WM_PAINT, sent|optional }, @@ -584,9 +595,9 @@ /* ShowWindow(SW_SHOWMINIMIZED) for a not visible overlapped window */ static const struct message WmShowMinOverlappedSeq[] = { { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE }, - { HCBT_SETFOCUS, hook }, + { HCBT_SETFOCUS, hook|optional }, { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, - { WM_KILLFOCUS, sent }, + { WM_KILLFOCUS, sent|optional }, { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 }, { WM_GETTEXT, sent|optional }, @@ -603,10 +614,10 @@ { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, { EVENT_OBJECT_LOCATIONCHANGE, winevent_hook|wparam|lparam, 0, 0 }, { EVENT_SYSTEM_MINIMIZESTART, winevent_hook|wparam|lparam, 0, 0 }, - { WM_NCACTIVATE, sent|wparam, 0 }, + { WM_NCACTIVATE, sent|wparam|optional, 0 }, { WM_GETTEXT, sent|defwinproc|optional }, - { WM_ACTIVATE, sent }, - { WM_ACTIVATEAPP, sent|wparam, 0 }, + { WM_ACTIVATE, sent|optional }, + { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, /* Vista sometimes restores the window right away... */ { WM_SYSCOMMAND, sent|optional|wparam, SC_RESTORE }, @@ -652,7 +663,7 @@ { WM_ACTIVATE, sent|wparam|optional, 0 }, { WM_ACTIVATEAPP, sent|wparam|optional, 0 }, { HCBT_SETFOCUS, hook|optional }, - { WM_KILLFOCUS, sent|wparam, 0 }, + { WM_KILLFOCUS, sent|wparam|optional, 0 }, { WM_IME_SETCONTEXT, sent|wparam|optional, 0 }, { WM_IME_NOTIFY, sent|wparam|optional|defwinproc, 1 }, { 0 } @@ -1719,6 +1730,38 @@ { 0 } }; +static const struct message WmTrackPopupMenu[] = { + { HCBT_CREATEWND, hook }, + { WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 }, + { WM_INITMENU, sent|lparam, 0, 0 }, + { WM_INITMENUPOPUP, sent|lparam, 0, 0 }, + { 0x0093, sent|optional }, + { 0x0094, sent|optional }, + { 0x0094, sent|optional }, + { WM_ENTERIDLE, sent|wparam, 2 }, + { WM_CAPTURECHANGED, sent }, + { HCBT_DESTROYWND, hook }, + { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, + { WM_MENUSELECT, sent|wparam|lparam, 0xffff0000, 0 }, + { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 }, + { 0 } +}; + +static const struct message WmTrackPopupMenuEmpty[] = { + { HCBT_CREATEWND, hook }, + { WM_ENTERMENULOOP, sent|wparam|lparam, TRUE, 0 }, + { WM_INITMENU, sent|lparam, 0, 0 }, + { WM_INITMENUPOPUP, sent|lparam, 0, 0 }, + { 0x0093, sent|optional }, + { 0x0094, sent|optional }, + { 0x0094, sent|optional }, + { WM_CAPTURECHANGED, sent }, + { WM_EXITMENULOOP, sent|wparam|lparam, 1, 0 }, + { HCBT_DESTROYWND, hook }, + { WM_UNINITMENUPOPUP, sent|lparam, 0, 0 }, + { 0 } +}; + static BOOL after_end_dialog, test_def_id, paint_loop_done; static int sequence_cnt, sequence_size; static struct recvd_message* sequence; @@ -10816,8 +10859,11 @@ }; static const struct message WmShowNoActivate_2[] = { { HCBT_MINMAX, hook|lparam, 0, SW_SHOWNOACTIVATE }, - { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, - { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, + { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE }, + { HCBT_ACTIVATE, hook|optional }, + { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, + { HCBT_SETFOCUS, hook|optional }, + { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE }, { WM_MOVE, sent|defwinproc }, { WM_SIZE, sent|wparam|defwinproc, SIZE_RESTORED }, { HCBT_SETFOCUS, hook|optional }, @@ -10937,16 +10983,18 @@ static const struct message WmMinimize_2[] = { { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE }, { HCBT_SETFOCUS, hook|optional }, - { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, - { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, + { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE }, + { WM_WINDOWPOSCHANGED, sent|wparam, SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE }, { WM_MOVE, sent|defwinproc }, { WM_SIZE, sent|wparam|lparam|defwinproc, SIZE_MINIMIZED, 0 }, { 0 } }; static const struct message WmMinimize_3[] = { { HCBT_MINMAX, hook|lparam, 0, SW_MINIMIZE }, - { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, - { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED }, + { WM_WINDOWPOSCHANGING, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE }, + { HCBT_ACTIVATE, hook|optional }, + { WM_WINDOWPOSCHANGING, sent|wparam|optional, SWP_NOSIZE|SWP_NOMOVE }, + { WM_WINDOWPOSCHANGED, sent|wparam, SWP_SHOWWINDOW|SWP_NOACTIVATE|SWP_FRAMECHANGED|SWP_NOCOPYBITS|SWP_STATECHANGED, 0, SWP_NOACTIVATE }, { WM_MOVE, sent|defwinproc }, { WM_SIZE, sent|wparam|lparam|defwinproc, SIZE_MINIMIZED, 0 }, { 0 } @@ -11284,12 +11332,9 @@ win_rc.left, win_rc.top, win_rc.right, win_rc.bottom, wp.rcNormalPosition.left, wp.rcNormalPosition.top, wp.rcNormalPosition.right, wp.rcNormalPosition.bottom); - - flush_events(); - flush_sequence(); } - DestroyWindow(hwnd); + flush_events(); } static INT_PTR WINAPI test_dlg_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -12084,7 +12129,11 @@ PostMessageW( hwnd, WM_CHAR, 0x3b1, 0 ); - ok( GetMessageW( &msg, hwnd, 0, 0 ), "no message\n" ); + while (GetMessageW( &msg, hwnd, 0, 0 )) + { + if (!ignore_message( msg.message )) break; + } + ok( msg.hwnd == hwnd, "unexpected hwnd %p\n", msg.hwnd ); ok( msg.message == WM_CHAR, "unexpected message %x\n", msg.message ); ok( msg.wParam == 0x3b1, "bad wparam %lx\n", msg.wParam ); @@ -14260,6 +14309,80 @@ DeleteObject( bmp ); } +static HMENU hpopupmenu; + +static LRESULT WINAPI cancel_popup_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + if (ignore_message( message )) return 0; + + switch (message) { + case WM_ENTERIDLE: + todo_wine ok(GetCapture() == hwnd, "expected %p, got %p\n", hwnd, GetCapture()); + EndMenu(); + break; + case WM_INITMENU: + case WM_INITMENUPOPUP: + case WM_UNINITMENUPOPUP: + ok((HMENU)wParam == hpopupmenu, "expected %p, got %lx\n", hpopupmenu, wParam); + break; + } + + return MsgCheckProc (FALSE, hwnd, message, wParam, lParam); +} + +static void test_TrackPopupMenu(void) +{ + HWND hwnd; + BOOL ret; + + hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0, + 0, 0, 1, 1, 0, + NULL, NULL, 0); + ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError()); + + SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc); + + hpopupmenu = CreatePopupMenu(); + ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError()); + + AppendMenuA(hpopupmenu, MF_STRING, 100, "item 1"); + AppendMenuA(hpopupmenu, MF_STRING, 100, "item 2"); + + flush_events(); + flush_sequence(); + ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL); + ok_sequence(WmTrackPopupMenu, "TrackPopupMenu", TRUE); + ok(ret == 1, "TrackPopupMenu failed with error %i\n", GetLastError()); + + DestroyMenu(hpopupmenu); + DestroyWindow(hwnd); +} + +static void test_TrackPopupMenuEmpty(void) +{ + HWND hwnd; + BOOL ret; + + hwnd = CreateWindowExA(0, "TestWindowClass", NULL, 0, + 0, 0, 1, 1, 0, + NULL, NULL, 0); + ok(hwnd != NULL, "CreateWindowEx failed with error %d\n", GetLastError()); + + SetWindowLongPtrA( hwnd, GWLP_WNDPROC, (LONG_PTR)cancel_popup_proc); + + hpopupmenu = CreatePopupMenu(); + ok(hpopupmenu != NULL, "CreateMenu failed with error %d\n", GetLastError()); + + flush_events(); + flush_sequence(); + ret = TrackPopupMenu(hpopupmenu, 0, 100,100, 0, hwnd, NULL); + ok_sequence(WmTrackPopupMenuEmpty, "TrackPopupMenuEmpty", TRUE); + todo_wine ok(ret == 0, "TrackPopupMenu succeeded\n"); + + DestroyMenu(hpopupmenu); + DestroyWindow(hwnd); +} + static void init_funcs(void) { HMODULE hKernel32 = GetModuleHandleA("kernel32.dll"); @@ -14337,7 +14460,6 @@ pUnhookWinEvent = 0; } hEvent_hook = 0; - test_SetFocus(); test_SetParent(); test_PostMessage(); @@ -14389,6 +14511,8 @@ test_keyflags(); test_hotkey(); test_layered_window(); + test_TrackPopupMenu(); + test_TrackPopupMenuEmpty(); /* keep it the last test, under Windows it tends to break the tests * which rely on active/foreground windows being correct. */ diff -Nru wine1.7-1.7.13/dlls/user32/tests/resource.c wine1.7-1.7.16/dlls/user32/tests/resource.c --- wine1.7-1.7.13/dlls/user32/tests/resource.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/resource.c 2014-04-04 19:13:44.000000000 +0000 @@ -333,11 +333,30 @@ static void test_PrivateExtractIcons(void) { const CHAR szShell32Dll[] = "shell32.dll"; HICON ahIcon[256]; - UINT aIconId[256]; - UINT cIcons, cIcons2; + UINT i, aIconId[256], cIcons, cIcons2; if (!pPrivateExtractIconsA) return; - + + cIcons = pPrivateExtractIconsA("", 0, 16, 16, ahIcon, aIconId, 1, 0); + ok(cIcons == ~0u, "got %u\n", cIcons); + + cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, NULL, NULL, 1, 0); + ok(cIcons == 1 || broken(cIcons == 2) /* win2k */, "got %u\n", cIcons); + + ahIcon[0] = (HICON)0xdeadbeef; + cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, NULL, 1, 0); + ok(cIcons == 1, "got %u\n", cIcons); + ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n"); + DestroyIcon(ahIcon[0]); + + ahIcon[0] = (HICON)0xdeadbeef; + aIconId[0] = 0xdeadbeef; + cIcons = pPrivateExtractIconsA("notepad.exe", 0, 16, 16, ahIcon, aIconId, 1, 0); + ok(cIcons == 1, "got %u\n", cIcons); + ok(ahIcon[0] != (HICON)0xdeadbeef, "icon not set\n"); + ok(aIconId[0] != 0xdeadbeef, "id not set\n"); + DestroyIcon(ahIcon[0]); + cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, NULL, NULL, 0, 0); cIcons2 = pPrivateExtractIconsA(szShell32Dll, 4, MAKELONG(32,16), MAKELONG(32,16), NULL, NULL, 256, 0); @@ -350,14 +369,18 @@ cIcons = pPrivateExtractIconsA(szShell32Dll, 0, 16, 16, ahIcon, aIconId, 3, 0); ok(cIcons == 3, "Three icons requested got cIcons=%d\n", cIcons); + for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]); /* count must be a multiple of two when getting two sizes */ cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32), ahIcon, aIconId, 3, 0); ok(cIcons == 0 /* vista */ || cIcons == 4, "Three icons requested got cIcons=%d\n", cIcons); + for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]); + cIcons = pPrivateExtractIconsA(szShell32Dll, 0, MAKELONG(16,32), MAKELONG(16,32), ahIcon, aIconId, 4, 0); ok(cIcons == 4, "Four icons requested got cIcons=%d\n", cIcons); + for (i = 0; i < cIcons; i++) DestroyIcon(ahIcon[i]); } static void test_LoadImage(void) diff -Nru wine1.7-1.7.13/dlls/user32/tests/text.c wine1.7-1.7.16/dlls/user32/tests/text.c --- wine1.7-1.7.13/dlls/user32/tests/text.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/text.c 2014-04-04 19:13:44.000000000 +0000 @@ -42,6 +42,8 @@ 's','t','r','i','n','g','\0'}; static CHAR emptystring[] = ""; static WCHAR emptystringW[] = { 0 }; + static CHAR wordbreak_text[] = "line1 line2"; + static WCHAR wordbreak_textW[] = {'l','i','n','e','1',' ','l','i','n','e','2',0}; INT textlen, textheight, heightcheck; RECT rect = { 0, 0, 100, 0 }; BOOL ret; @@ -556,6 +558,20 @@ ok(rect.bottom, "rect.bottom should not be 0\n"); } + SetRect(&rect, 0, 0, 1, 1); + heightcheck = DrawTextA(hdc, wordbreak_text, -1, &rect, DT_CALCRECT); + SetRect(&rect, 0, 0, 1, 1); + textheight = DrawTextA(hdc, wordbreak_text, -1, &rect, DT_CALCRECT | DT_WORDBREAK); + ok(textheight == heightcheck * 2, "Got unexpected textheight %d, expected %d.\n", + textheight, heightcheck * 2); + + SetRect(&rect, 0, 0, 1, 1); + heightcheck = DrawTextW(hdc, wordbreak_textW, -1, &rect, DT_CALCRECT); + SetRect(&rect, 0, 0, 1, 1); + textheight = DrawTextW(hdc, wordbreak_textW, -1, &rect, DT_CALCRECT | DT_WORDBREAK); + ok(textheight == heightcheck * 2, "Got unexpected textheight %d, expected %d.\n", + textheight, heightcheck * 2); + SelectObject(hdc, hOldFont); ret = DeleteObject(hFont); ok( ret, "DeleteObject error %u\n", GetLastError()); diff -Nru wine1.7-1.7.13/dlls/user32/tests/uitools.c wine1.7-1.7.16/dlls/user32/tests/uitools.c --- wine1.7-1.7.13/dlls/user32/tests/uitools.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/uitools.c 2014-04-04 19:13:44.000000000 +0000 @@ -63,7 +63,57 @@ ReleaseDC(0, hdc); } +static void test_SubtractRect(void) +{ + RECT rect1; + RECT rect2; + RECT rectr; + BOOL result; + + /* source rectangles don't intersect */ + SetRect(&rect1, 50, 50, 150, 100); + SetRect(&rect2, 250, 200, 1500, 1000); + result = SubtractRect(&rectr, &rect1, &rect2); + ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); + ok(result && rectr.left == 50 && rectr.top == 50 && rectr.right ==150 + && rectr.bottom == 100, "wrong rect subtraction of SubtractRect " + "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + + /* source rect 2 partially overlaps rect 1 */ + SetRect(&rect1, 2431, 626, 3427, 1608); + SetRect(&rect2, 2499, 626, 3427, 1608); + result = SubtractRect(&rectr, &rect1, &rect2); + ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); + ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499 + && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect " + "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + + /* source rect 2 partially overlaps rect 1 - dest is src rect 2 */ + SetRect(&rect1, 2431, 626, 3427, 1608); + SetRect(&rect2, 2499, 626, 3427, 1608); + result = SubtractRect(&rect2, &rect1, &rect2); + ok(result, "SubtractRect returned FALSE but subtraction should not be empty\n"); + ok(result && rectr.left == 2431 && rectr.top == 626 && rectr.right == 2499 + && rectr.bottom == 1608, "wrong rect subtraction of SubtractRect " + "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + + /* source rect 2 completely overlaps rect 1 */ + SetRect(&rect1, 250, 250, 400, 500); + SetRect(&rect2, 50, 50, 1500, 1000); + result = SubtractRect(&rectr, &rect1, &rect2); + ok(!result, "SubtractRect returned TRUE but subtraction should be empty " + "(dest rect={%d, %d, %d, %d})\n", rectr.left, rectr.top, rectr.right, rectr.bottom); + + /* source rect 2 completely overlaps rect 1 - dest is src rect 2 */ + SetRect(&rect1, 250, 250, 400, 500); + SetRect(&rect2, 50, 50, 1500, 1000); + result = SubtractRect(&rect2, &rect1, &rect2); + ok(!result, "SubtractRect returned TRUE but subtraction should be empty " + "(dest rect={%d, %d, %d, %d})\n", rect2.left, rect2.top, rect2.right, rect2.bottom); +} + START_TEST(uitools) { test_FillRect(); + test_SubtractRect(); } diff -Nru wine1.7-1.7.13/dlls/user32/tests/win.c wine1.7-1.7.16/dlls/user32/tests/win.c --- wine1.7-1.7.13/dlls/user32/tests/win.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/win.c 2014-04-04 19:13:44.000000000 +0000 @@ -2794,6 +2794,7 @@ BOOL ret; HWND hwnd2; MSG msg; + LONG style; flush_events( TRUE ); ShowWindow(hwnd, SW_HIDE); @@ -2889,6 +2890,19 @@ todo_wine ok(GetActiveWindow() == hwnd2, "Expected active window %p, got %p.\n", hwnd2, GetActiveWindow()); todo_wine ok(GetFocus() == hwnd2, "Expected focus window %p, got %p.\n", hwnd2, GetFocus()); + SetForegroundWindow(hwnd); + check_wnd_state(hwnd, hwnd, hwnd, 0); + style = GetWindowLongA(hwnd2, GWL_STYLE) | WS_CHILD; + ok(SetWindowLongA(hwnd2, GWL_STYLE, style), "SetWindowLong failed\n"); + ok(SetForegroundWindow(hwnd2), "SetForegroundWindow failed\n"); + check_wnd_state(hwnd2, hwnd2, hwnd2, 0); + + SetForegroundWindow(hwnd); + check_wnd_state(hwnd, hwnd, hwnd, 0); + ok(SetWindowLongA(hwnd2, GWL_STYLE, style & (~WS_POPUP)), "SetWindowLong failed\n"); + ok(!SetForegroundWindow(hwnd2), "SetForegroundWindow failed\n"); + check_wnd_state(hwnd, hwnd, hwnd, 0); + SetEvent(thread_params.test_finished); WaitForSingleObject(thread, INFINITE); CloseHandle(thread_params.test_finished); @@ -3675,6 +3689,19 @@ ok(SetParent(sibling, parent) != 0, "SetParent should not fail\n"); ok(GetMenu(sibling) == hMenu, "SetParent should not remove menu\n"); + ok(SetParent(parent, desktop) != 0, "SetParent should not fail\n"); + ok(SetParent(child4, child3) != 0, "SetParent should not fail\n"); + ok(SetParent(child3, child2) != 0, "SetParent should not fail\n"); + ok(SetParent(child2, child1) != 0, "SetParent should not fail\n"); + ok(!IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4); + SetWindowLongW(child4, GWL_STYLE, WS_CHILD); + ok(IsChild(child3, child4), "wrong parent/child %p/%p\n", child3, child4); + ok(IsChild(child2, child4), "wrong parent/child %p/%p\n", child2, child4); + ok(!IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4); + SetWindowLongW(child2, GWL_STYLE, WS_CHILD); + ok(IsChild(child1, child4), "wrong parent/child %p/%p\n", child1, child4); + ok(IsChild(parent, child4), "wrong parent/child %p/%p\n", parent, child4); + ok(DestroyWindow(parent), "DestroyWindow() failed\n"); ok(!IsWindow(parent), "parent still exists\n"); @@ -3707,21 +3734,34 @@ ret = SetParent(popup, child1); ok(ret == desktop, "expected %p, got %p\n", desktop, ret); check_parents(popup, child1, child1, 0, 0, parent, popup); -todo_wine check_active_state(popup, 0, popup); SetActiveWindow(parent); + SetFocus(popup); + check_active_state(popup, 0, popup); + + EnableWindow(child1, FALSE); + check_active_state(popup, 0, popup); + SetFocus(parent); + check_active_state(parent, 0, parent); + SetFocus(popup); + check_active_state(popup, 0, popup); + EnableWindow(child1, TRUE); + + ShowWindow(child1, SW_MINIMIZE); + SetFocus(parent); + check_active_state(parent, 0, parent); + SetFocus(popup); + check_active_state(popup, 0, popup); + ShowWindow(child1, SW_HIDE); + + SetActiveWindow(parent); SetFocus(parent); check_active_state(parent, 0, parent); bret = SetForegroundWindow(popup); -todo_wine { - ok(bret || broken(!bret), "SetForegroundWindow() failed\n"); - if (!bret) - check_active_state(popup, 0, popup); - else - check_active_state(popup, popup, popup); - } + ok(bret, "SetForegroundWindow() failed\n"); + check_active_state(popup, popup, popup); ok(DestroyWindow(parent), "DestroyWindow() failed\n"); @@ -5886,7 +5926,7 @@ ShowWindow(hwnd, SW_SHOW); UpdateWindow(hwnd); flush_events( FALSE ); - while(PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE) != 0) + while (PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE)) { if (msg.message == WM_PAINT) loopcount++; if (loopcount >= 100) break; @@ -7050,7 +7090,7 @@ struct window_attributes { char class_name[128]; - int is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent; + BOOL is_visible, is_enabled, is_groupbox, is_httransparent, is_extransparent; }; static void get_window_attributes(HWND hwnd, struct window_attributes *attrs) @@ -7470,6 +7510,26 @@ DestroyWindow(parent); } +static void test_window_without_child_style(void) +{ + HWND hwnd; + + hwnd = CreateWindowExA(0, "edit", NULL, WS_VISIBLE|WS_CHILD, + 0, 0, 50, 50, hwndMain, NULL, 0, NULL); + ok(hwnd != NULL, "CreateWindow failed\n"); + + ok(SetWindowLongA(hwnd, GWL_STYLE, GetWindowLongA(hwnd, GWL_STYLE) & (~WS_CHILD)), + "can't remove WS_CHILD style\n"); + + SetActiveWindow(hwndMain); + PostMessageW(hwnd, WM_LBUTTONUP, 0, 0); + SendMessageW(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, 0); + check_active_state(hwnd, hwnd, hwnd); + flush_events(TRUE); + + DestroyWindow(hwnd); +} + START_TEST(win) { HMODULE user32 = GetModuleHandleA( "user32.dll" ); @@ -7494,6 +7554,32 @@ if (!RegisterWindowClasses()) assert(0); + hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", + WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | + WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE, + 100, 100, 200, 200, + 0, 0, GetModuleHandleA(NULL), NULL); + assert( hwndMain ); + + if(!SetForegroundWindow(hwndMain)) { + /* workaround for foreground lock timeout */ + INPUT input[2]; + UINT events_no; + + memset(input, 0, sizeof(input)); + input[0].type = INPUT_MOUSE; + U(input[0]).mi.dx = 101; + U(input[0]).mi.dy = 101; + U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTDOWN; + input[0].type = INPUT_MOUSE; + U(input[0]).mi.dx = 101; + U(input[0]).mi.dy = 101; + U(input[0]).mi.dwFlags = MOUSEEVENTF_LEFTUP; + events_no = SendInput(2, input, sizeof(input[0])); + ok(events_no == 2, "SendInput returned %d\n", events_no); + ok(SetForegroundWindow(hwndMain), "SetForegroundWindow failed\n"); + } + SetLastError(0xdeafbeef); GetWindowLongPtrW(GetDesktopWindow(), GWLP_WNDPROC); is_win9x = (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED); @@ -7505,17 +7591,11 @@ test_FindWindowEx(); test_SetParent(); - hwndMain = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window", - WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | - WS_MAXIMIZEBOX | WS_POPUP, - 100, 100, 200, 200, - 0, 0, GetModuleHandleA(NULL), NULL); hwndMain2 = CreateWindowExA(/*WS_EX_TOOLWINDOW*/ 0, "MainWindowClass", "Main window 2", WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP, 100, 100, 200, 200, 0, 0, GetModuleHandleA(NULL), NULL); - assert( hwndMain ); assert( hwndMain2 ); our_pid = GetWindowThreadProcessId(hwndMain, NULL); @@ -7580,6 +7660,7 @@ test_winregion(); test_map_points(); test_update_region(); + test_window_without_child_style(); /* add the tests above this line */ if (hhook) UnhookWindowsHookEx(hhook); diff -Nru wine1.7-1.7.13/dlls/user32/tests/winstation.c wine1.7-1.7.16/dlls/user32/tests/winstation.c --- wine1.7-1.7.13/dlls/user32/tests/winstation.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/tests/winstation.c 2014-04-04 19:13:44.000000000 +0000 @@ -297,7 +297,8 @@ static void test_enumstations(void) { - BOOL ret; + DWORD ret; + HWINSTA hwinsta; if (0) /* Crashes instead */ { @@ -307,6 +308,15 @@ ok(GetLastError() == ERROR_INVALID_PARAMETER, "LastError is set to %08x\n", GetLastError()); } + hwinsta = CreateWindowStationA("winsta_test", 0, WINSTA_ALL_ACCESS, NULL); + ret = GetLastError(); + ok(hwinsta != NULL || ret == ERROR_ACCESS_DENIED, "CreateWindowStation failed (%u)\n", ret); + if (!hwinsta) + { + win_skip("Not enough privileges for CreateWindowStation\n"); + return; + } + SetLastError(0xdeadbeef); ret = EnumWindowStationsA(open_window_station_callbackA, 0x12345); ok(ret == 0x12345, "EnumWindowStationsA returned %x\n", ret); diff -Nru wine1.7-1.7.13/dlls/user32/text.c wine1.7-1.7.16/dlls/user32/text.c --- wine1.7-1.7.13/dlls/user32/text.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/text.c 2014-04-04 19:13:44.000000000 +0000 @@ -379,7 +379,7 @@ i = chars_fit; word_fits = TRUE; if (!chars_fit) - ; /* we pretend that it fits anyway */ + word_fits = FALSE; else if (sla[i].fSoftBreak) /* chars_fit < *len_str so this is valid */ { /* the word just fitted */ @@ -392,7 +392,7 @@ word_fits = (i != 0 || sla[i+1].fSoftBreak ); } - /* If there was one or the first character didn't fit then */ + /* If there was one. */ if (word_fits) { BOOL next_is_space; diff -Nru wine1.7-1.7.13/dlls/user32/uitools.c wine1.7-1.7.16/dlls/user32/uitools.c --- wine1.7-1.7.13/dlls/user32/uitools.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/uitools.c 2014-04-04 19:13:44.000000000 +0000 @@ -1421,14 +1421,14 @@ SetRectEmpty( dest ); return FALSE; } - *dest = *src1; if (IntersectRect( &tmp, src1, src2 )) { - if (EqualRect( &tmp, dest )) + if (EqualRect( &tmp, src1 )) { SetRectEmpty( dest ); return FALSE; } + *dest = *src1; if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom)) { if (tmp.left == dest->left) dest->left = tmp.right; @@ -1440,6 +1440,10 @@ else if (tmp.bottom == dest->bottom) dest->bottom = tmp.top; } } + else + { + *dest = *src1; + } return TRUE; } diff -Nru wine1.7-1.7.13/dlls/user32/user32.spec wine1.7-1.7.16/dlls/user32/user32.spec --- wine1.7-1.7.13/dlls/user32/user32.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/user32.spec 2014-04-04 19:13:44.000000000 +0000 @@ -1,4 +1,5 @@ @ stdcall ActivateKeyboardLayout(long long) +@ stdcall AddClipboardFormatListener(long) @ stdcall AdjustWindowRect(ptr long long) @ stdcall AdjustWindowRectEx(ptr long long long) @ stdcall AlignRects(ptr long long long) @@ -38,6 +39,7 @@ @ stdcall ChangeMenuA(long long ptr long long) @ stdcall ChangeMenuW(long long ptr long long) @ stdcall ChangeWindowMessageFilter(long long) +@ stdcall ChangeWindowMessageFilterEx(long long long ptr) @ stdcall CharLowerA(str) @ stdcall CharLowerBuffA(str long) @ stdcall CharLowerBuffW(wstr long) @@ -575,6 +577,7 @@ @ stdcall RegisterWindowMessageW(wstr) @ stdcall ReleaseCapture() @ stdcall ReleaseDC(long long) +@ stdcall RemoveClipboardFormatListener(long) @ stdcall RemoveMenu(long long long) @ stdcall RemovePropA(long str) @ stdcall RemovePropW(long wstr) diff -Nru wine1.7-1.7.13/dlls/user32/win.c wine1.7-1.7.16/dlls/user32/win.c --- wine1.7-1.7.13/dlls/user32/win.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/user32/win.c 2014-04-04 19:13:44.000000000 +0000 @@ -2739,7 +2739,7 @@ * SetWindowTextA (USER32.@) * SetWindowText (USER32.@) */ -BOOL WINAPI SetWindowTextA( HWND hwnd, LPCSTR lpString ) +BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextA( HWND hwnd, LPCSTR lpString ) { if (is_broadcast(hwnd)) { @@ -2756,7 +2756,7 @@ /******************************************************************* * SetWindowTextW (USER32.@) */ -BOOL WINAPI SetWindowTextW( HWND hwnd, LPCWSTR lpString ) +BOOL WINAPI DECLSPEC_HOTPATCH SetWindowTextW( HWND hwnd, LPCWSTR lpString ) { if (is_broadcast(hwnd)) { @@ -3043,14 +3043,22 @@ */ BOOL WINAPI IsChild( HWND parent, HWND child ) { - HWND *list = list_window_parents( child ); + HWND *list; int i; - BOOL ret; + BOOL ret = FALSE; - if (!list) return FALSE; + if (!(GetWindowLongW( child, GWL_STYLE ) & WS_CHILD)) return FALSE; + if (!(list = list_window_parents( child ))) return FALSE; parent = WIN_GetFullHandle( parent ); - for (i = 0; list[i]; i++) if (list[i] == parent) break; - ret = list[i] && list[i+1]; + for (i = 0; list[i]; i++) + { + if (list[i] == parent) + { + ret = list[i] && list[i+1]; + break; + } + if (!(GetWindowLongW( list[i], GWL_STYLE ) & WS_CHILD)) break; + } HeapFree( GetProcessHeap(), 0, list ); return ret; } diff -Nru wine1.7-1.7.13/dlls/usp10/bidi.c wine1.7-1.7.16/dlls/usp10/bidi.c --- wine1.7-1.7.13/dlls/usp10/bidi.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/usp10/bidi.c 2014-04-04 19:13:44.000000000 +0000 @@ -827,10 +827,13 @@ static void computeIsolatingRunsSet(unsigned baselevel, WORD *pcls, WORD *pLevel, int uCount, struct list *set) { int run_start, run_end, i; - Run runs[uCount]; int run_count = 0; + Run *runs; IsolatedRun *current_isolated; + runs = HeapAlloc(GetProcessHeap(), 0, uCount * sizeof(Run)); + if (!runs) return; + list_init(set); /* Build Runs */ @@ -857,6 +860,7 @@ int type_fence, real_end; int j; current_isolated = HeapAlloc(GetProcessHeap(), 0, sizeof(IsolatedRun) + sizeof(WORD*)*uCount); + if (!current_isolated) break; run_start = runs[k].start; current_isolated->e = runs[k].e; @@ -944,6 +948,8 @@ } i++; } + + HeapFree(GetProcessHeap(), 0, runs); } /************************************************************* diff -Nru wine1.7-1.7.13/dlls/uuid/uuid.c wine1.7-1.7.16/dlls/uuid/uuid.c --- wine1.7-1.7.13/dlls/uuid/uuid.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/uuid/uuid.c 2014-04-04 19:13:44.000000000 +0000 @@ -86,6 +86,7 @@ #include "commdlg.h" #include "tlogstg.h" #include "msdasc.h" +#include "netcfgx.h" /* FIXME: cguids declares GUIDs but does not define their values */ diff -Nru wine1.7-1.7.13/dlls/vbscript/compile.c wine1.7-1.7.16/dlls/vbscript/compile.c --- wine1.7-1.7.13/dlls/vbscript/compile.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/compile.c 2014-04-04 19:13:44.000000000 +0000 @@ -346,6 +346,35 @@ ctx->labels[label & ~LABEL_FLAG] = ctx->instr_cnt; } +static inline unsigned stack_offset(compile_ctx_t *ctx) +{ + statement_ctx_t *iter; + unsigned ret = 0; + + for(iter = ctx->stat_ctx; iter; iter = iter->next) + ret += iter->stack_use; + + return ret; +} + +static BOOL emit_catch_jmp(compile_ctx_t *ctx, unsigned stack_off, unsigned code_off) +{ + unsigned code; + + code = push_instr(ctx, OP_catch); + if(!code) + return FALSE; + + instr_ptr(ctx, code)->arg1.uint = code_off; + instr_ptr(ctx, code)->arg2.uint = stack_off + stack_offset(ctx); + return TRUE; +} + +static inline BOOL emit_catch(compile_ctx_t *ctx, unsigned off) +{ + return emit_catch_jmp(ctx, off, ctx->instr_cnt); +} + static expression_t *lookup_const_decls(compile_ctx_t *ctx, const WCHAR *name, BOOL lookup_global) { const_decl_t *decl; @@ -533,6 +562,9 @@ if(!cnd_jmp) return E_OUTOFMEMORY; + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + hres = compile_statement(ctx, NULL, stat->if_stat); if(FAILED(hres)) return hres; @@ -558,6 +590,9 @@ if(!cnd_jmp) return E_OUTOFMEMORY; + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + hres = compile_statement(ctx, NULL, elseif_decl->stat); if(FAILED(hres)) return hres; @@ -597,6 +632,9 @@ if(!jmp_end) return E_OUTOFMEMORY; + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + if(stat->stat.type == STAT_WHILE) { loop_ctx = NULL; }else { @@ -652,6 +690,10 @@ return hres; label_set_addr(ctx, loop_ctx.while_end_label); + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + return S_OK; } @@ -661,6 +703,10 @@ unsigned loop_start; HRESULT hres; + /* Preserve a place on the stack in case we throw before having proper enum collection. */ + if(!push_instr(ctx, OP_empty)) + return E_OUTOFMEMORY; + hres = compile_expression(ctx, stat->group_expr); if(FAILED(hres)) return hres; @@ -668,7 +714,6 @@ if(!push_instr(ctx, OP_newenum)) return E_OUTOFMEMORY; - loop_start = ctx->instr_cnt; if(!(loop_ctx.for_end_label = alloc_label(ctx))) return E_OUTOFMEMORY; @@ -676,10 +721,19 @@ if(FAILED(hres)) return hres; + if(!emit_catch(ctx, 1)) + return E_OUTOFMEMORY; + + loop_start = ctx->instr_cnt; hres = compile_statement(ctx, &loop_ctx, stat->body); if(FAILED(hres)) return hres; + /* We need a separated enumnext here, because we need to jump out of the loop on exception. */ + hres = push_instr_uint_bstr(ctx, OP_enumnext, loop_ctx.for_end_label, stat->identifier); + if(FAILED(hres)) + return hres; + hres = push_instr_addr(ctx, OP_jmp, loop_start); if(FAILED(hres)) return hres; @@ -703,6 +757,7 @@ if(FAILED(hres)) return hres; + /* FIXME: Assign should happen after both expressions evaluation. */ instr = push_instr(ctx, OP_assign_ident); if(!instr) return E_OUTOFMEMORY; @@ -739,10 +794,14 @@ instr_ptr(ctx, step_instr)->arg2.bstr = identifier; instr_ptr(ctx, step_instr)->arg1.uint = loop_ctx.for_end_label; + if(!emit_catch(ctx, 2)) + return E_OUTOFMEMORY; + hres = compile_statement(ctx, &loop_ctx, stat->body); if(FAILED(hres)) return hres; + /* FIXME: Error handling can't be done compatible with native using OP_incc here. */ instr = push_instr(ctx, OP_incc); if(!instr) return E_OUTOFMEMORY; @@ -757,6 +816,11 @@ return hres; label_set_addr(ctx, loop_ctx.for_end_label); + + /* FIXME: reconsider after OP_incc fixup. */ + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + return S_OK; } @@ -778,6 +842,9 @@ if(!end_label) return E_OUTOFMEMORY; + if(!emit_catch_jmp(ctx, 0, end_label)) + return E_OUTOFMEMORY; + for(case_iter = stat->case_clausules; case_iter; case_iter = case_iter->next) case_cnt++; @@ -805,6 +872,11 @@ hres = push_instr_addr(ctx, OP_case, case_labels[i]); if(FAILED(hres)) break; + + if(!emit_catch_jmp(ctx, 0, case_labels[i])) { + hres = E_OUTOFMEMORY; + break; + } } } @@ -871,7 +943,14 @@ if(FAILED(hres)) return hres; - return push_instr_bstr_uint(ctx, op, member_expr->identifier, args_cnt); + hres = push_instr_bstr_uint(ctx, op, member_expr->identifier, args_cnt); + if(FAILED(hres)) + return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + + return S_OK; } static HRESULT compile_assign_statement(compile_ctx_t *ctx, assign_statement_t *stat, BOOL is_set) @@ -881,6 +960,8 @@ static HRESULT compile_call_statement(compile_ctx_t *ctx, call_statement_t *stat) { + HRESULT hres; + /* It's challenging for parser to distinguish parameterized assignment with one argument from call * with equality expression argument, so we do it in compiler. */ if(!stat->is_strict && stat->expr->args && !stat->expr->args->next && stat->expr->args->type == EXPR_EQUAL) { @@ -896,7 +977,14 @@ } } - return compile_member_expression(ctx, stat->expr, FALSE); + hres = compile_member_expression(ctx, stat->expr, FALSE); + if(FAILED(hres)) + return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; + + return S_OK; } static BOOL lookup_dim_decls(compile_ctx_t *ctx, const WCHAR *name) @@ -940,6 +1028,9 @@ HRESULT hres = push_instr_bstr_uint(ctx, OP_dim, dim_decl->name, ctx->func->array_cnt++); if(FAILED(hres)) return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; } if(!dim_decl->next) @@ -978,6 +1069,9 @@ hres = push_instr_bstr(ctx, OP_const, decl->name); if(FAILED(hres)) return hres; + + if(!emit_catch(ctx, 0)) + return E_OUTOFMEMORY; } next_decl = decl->next; @@ -1054,11 +1148,7 @@ static HRESULT exit_label(compile_ctx_t *ctx, unsigned jmp_label) { - statement_ctx_t *iter; - unsigned pop_cnt = 0; - - for(iter = ctx->stat_ctx; iter; iter = iter->next) - pop_cnt += iter->stack_use; + unsigned pop_cnt = stack_offset(ctx); if(pop_cnt) { HRESULT hres; @@ -1210,6 +1300,28 @@ ctx->labels_cnt = 0; } +static HRESULT fill_array_desc(compile_ctx_t *ctx, dim_decl_t *dim_decl, array_desc_t *array_desc) +{ + unsigned dim_cnt = 0, i; + dim_list_t *iter; + + for(iter = dim_decl->dims; iter; iter = iter->next) + dim_cnt++; + + array_desc->bounds = compiler_alloc(ctx->code, dim_cnt * sizeof(SAFEARRAYBOUND)); + if(!array_desc->bounds) + return E_OUTOFMEMORY; + + array_desc->dim_cnt = dim_cnt; + + for(iter = dim_decl->dims, i=0; iter; iter = iter->next, i++) { + array_desc->bounds[i].cElements = iter->val+1; + array_desc->bounds[i].lLbound = 0; + } + + return S_OK; +} + static HRESULT compile_func(compile_ctx_t *ctx, statement_t *stat, function_t *func) { HRESULT hres; @@ -1304,35 +1416,19 @@ } if(func->array_cnt) { - unsigned dim_cnt, array_id = 0; + unsigned array_id = 0; dim_decl_t *dim_decl; - dim_list_t *iter; func->array_descs = compiler_alloc(ctx->code, func->array_cnt * sizeof(array_desc_t)); if(!func->array_descs) return E_OUTOFMEMORY; for(dim_decl = ctx->dim_decls; dim_decl; dim_decl = dim_decl->next) { - if(!dim_decl->is_array) - continue; - - dim_cnt = 0; - for(iter = dim_decl->dims; iter; iter = iter->next) - dim_cnt++; - - func->array_descs[array_id].bounds = compiler_alloc(ctx->code, dim_cnt * sizeof(SAFEARRAYBOUND)); - if(!func->array_descs[array_id].bounds) - return E_OUTOFMEMORY; - - func->array_descs[array_id].dim_cnt = dim_cnt; - - dim_cnt = 0; - for(iter = dim_decl->dims; iter; iter = iter->next) { - func->array_descs[array_id].bounds[dim_cnt].cElements = iter->val+1; - func->array_descs[array_id].bounds[dim_cnt++].lLbound = 0; + if(dim_decl->is_array) { + hres = fill_array_desc(ctx, dim_decl, func->array_descs + array_id++); + if(FAILED(hres)) + return hres; } - - array_id++; } assert(array_id == func->array_cnt); @@ -1475,8 +1571,8 @@ static HRESULT compile_class(compile_ctx_t *ctx, class_decl_t *class_decl) { function_decl_t *func_decl, *func_prop_decl; - class_prop_decl_t *prop_decl; class_desc_t *class_desc; + dim_decl_t *prop_decl; unsigned i; HRESULT hres; @@ -1560,6 +1656,25 @@ return E_OUTOFMEMORY; class_desc->props[i].is_public = prop_decl->is_public; + + if(prop_decl->is_array) { + class_desc->props[i].is_array = TRUE; + class_desc->array_cnt++; + } + } + + if(class_desc->array_cnt) { + class_desc->array_descs = compiler_alloc(ctx->code, class_desc->array_cnt*sizeof(*class_desc->array_descs)); + if(!class_desc->array_descs) + return E_OUTOFMEMORY; + + for(prop_decl = class_decl->props, i=0; prop_decl; prop_decl = prop_decl->next) { + if(prop_decl->is_array) { + hres = fill_array_desc(ctx, prop_decl, class_desc->array_descs + i++); + if(FAILED(hres)) + return hres; + } + } } class_desc->next = ctx->classes; diff -Nru wine1.7-1.7.13/dlls/vbscript/error.c wine1.7-1.7.16/dlls/vbscript/error.c --- wine1.7-1.7.13/dlls/vbscript/error.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/error.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright 2011 Jacek Caban 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 - */ - -#include "vbscript.h" -#include "vbscript_defs.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(vbscript); - -static HRESULT Err_Description(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_HelpContext(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_HelpFile(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Source(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static HRESULT Err_Raise(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) -{ - FIXME("\n"); - return E_NOTIMPL; -} - -static const builtin_prop_t err_props[] = { - {DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT}, - {DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT}, - {DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT}, - {DISPID_ERR_NUMBER, Err_Number, BP_GETPUT}, - {DISPID_ERR_SOURCE, Err_Source, BP_GETPUT}, - {DISPID_ERR_CLEAR, Err_Clear}, - {DISPID_ERR_RAISE, Err_Raise, 0, 5}, -}; - -HRESULT init_err(script_ctx_t *ctx) -{ - HRESULT hres; - - ctx->err_desc.ctx = ctx; - ctx->err_desc.builtin_prop_cnt = sizeof(err_props)/sizeof(*err_props); - ctx->err_desc.builtin_props = err_props; - - hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo); - if(FAILED(hres)) - return hres; - - return create_vbdisp(&ctx->err_desc, &ctx->err_obj); -} diff -Nru wine1.7-1.7.13/dlls/vbscript/global.c wine1.7-1.7.16/dlls/vbscript/global.c --- wine1.7-1.7.13/dlls/vbscript/global.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/global.c 2014-04-04 19:13:44.000000000 +0000 @@ -1866,6 +1866,75 @@ {DISPID_GLOBAL_VBMSGBOXRTLREADING, NULL, BP_GET, VT_I4, MB_RTLREADING} }; +static HRESULT Err_Description(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_HelpContext(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_HelpFile(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_Number(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + HRESULT hres; + + TRACE("\n"); + + if(!This->desc) + return E_UNEXPECTED; + + if(args_cnt) { + FIXME("setter not implemented\n"); + return E_NOTIMPL; + } + + hres = This->desc->ctx->err_number; + return return_int(res, HRESULT_FACILITY(hres) == FACILITY_VBS ? HRESULT_CODE(hres) : hres); +} + +static HRESULT Err_Source(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT Err_Clear(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + TRACE("\n"); + + if(!This->desc) + return E_UNEXPECTED; + + This->desc->ctx->err_number = S_OK; + return S_OK; +} + +static HRESULT Err_Raise(vbdisp_t *This, VARIANT *args, unsigned args_cnt, VARIANT *res) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static const builtin_prop_t err_props[] = { + {DISPID_ERR_DESCRIPTION, Err_Description, BP_GETPUT}, + {DISPID_ERR_HELPCONTEXT, Err_HelpContext, BP_GETPUT}, + {DISPID_ERR_HELPFILE, Err_HelpFile, BP_GETPUT}, + {DISPID_ERR_NUMBER, Err_Number, BP_GETPUT}, + {DISPID_ERR_SOURCE, Err_Source, BP_GETPUT}, + {DISPID_ERR_CLEAR, Err_Clear}, + {DISPID_ERR_RAISE, Err_Raise, 0, 5}, +}; + HRESULT init_global(script_ctx_t *ctx) { HRESULT hres; @@ -1886,5 +1955,13 @@ if(FAILED(hres)) return hres; - return init_err(ctx); + ctx->err_desc.ctx = ctx; + ctx->err_desc.builtin_prop_cnt = sizeof(err_props)/sizeof(*err_props); + ctx->err_desc.builtin_props = err_props; + + hres = get_typeinfo(ErrObj_tid, &ctx->err_desc.typeinfo); + if(FAILED(hres)) + return hres; + + return create_vbdisp(&ctx->err_desc, &ctx->err_obj); } diff -Nru wine1.7-1.7.13/dlls/vbscript/interp.c wine1.7-1.7.16/dlls/vbscript/interp.c --- wine1.7-1.7.13/dlls/vbscript/interp.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/interp.c 2014-04-04 19:13:44.000000000 +0000 @@ -32,6 +32,7 @@ script_ctx_t *script; function_t *func; IDispatch *this_obj; + vbdisp_t *vbthis; VARIANT *args; VARIANT *vars; @@ -132,6 +133,17 @@ return S_OK; if(ctx->func->type != FUNC_GLOBAL) { + if(ctx->vbthis) { + /* FIXME: Bind such identifier while generating bytecode. */ + for(i=0; i < ctx->vbthis->desc->prop_cnt; i++) { + if(!strcmpiW(ctx->vbthis->desc->props[i].name, name)) { + ref->type = REF_VAR; + ref->u.v = ctx->vbthis->props+i; + return S_OK; + } + } + } + hres = disp_get_id(ctx->this_obj, name, invoke_type, TRUE, &id); if(SUCCEEDED(hres)) { ref->type = REF_DISP; @@ -297,33 +309,42 @@ VariantClear(stack_pop(ctx)); } -static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *v) +static void stack_pop_deref(exec_ctx_t *ctx, variant_val_t *r) { - VARIANT *var; - - var = stack_pop(ctx); + VARIANT *v; - if(V_VT(var) == (VT_BYREF|VT_VARIANT)) { - v->owned = FALSE; - var = V_VARIANTREF(var); + v = stack_pop(ctx); + if(V_VT(v) == (VT_BYREF|VT_VARIANT)) { + r->owned = FALSE; + r->v = V_VARIANTREF(v); }else { - v->owned = TRUE; + r->owned = TRUE; + r->v = v; } +} + +static inline void release_val(variant_val_t *v) +{ + if(v->owned) + VariantClear(v->v); +} + +static HRESULT stack_pop_val(exec_ctx_t *ctx, variant_val_t *r) +{ + stack_pop_deref(ctx, r); - if(V_VT(var) == VT_DISPATCH) { + if(V_VT(r->v) == VT_DISPATCH) { DISPPARAMS dp = {0}; HRESULT hres; - hres = disp_call(ctx->script, V_DISPATCH(var), DISPID_VALUE, &dp, &v->store); - if(v->owned) - IDispatch_Release(V_DISPATCH(var)); + hres = disp_call(ctx->script, V_DISPATCH(r->v), DISPID_VALUE, &dp, &r->store); + if(r->owned) + IDispatch_Release(V_DISPATCH(r->v)); if(FAILED(hres)) return hres; - v->owned = TRUE; - v->v = &v->store; - }else { - v->v = var; + r->owned = TRUE; + r->v = &r->store; } return S_OK; @@ -358,12 +379,6 @@ return S_OK; } -static inline void release_val(variant_val_t *v) -{ - if(v->owned) - VariantClear(v->v); -} - static int stack_pop_bool(exec_ctx_t *ctx, BOOL *b) { variant_val_t val; @@ -960,8 +975,19 @@ VARIANT v; HRESULT hres; + static const WCHAR regexpW[] = {'r','e','g','e','x','p',0}; + TRACE("%s\n", debugstr_w(arg)); + if(!strcmpiW(arg, regexpW)) { + V_VT(&v) = VT_DISPATCH; + hres = create_regexp(&V_DISPATCH(&v)); + if(FAILED(hres)) + return hres; + + return stack_push(ctx, &v); + } + for(class_desc = ctx->script->classes; class_desc; class_desc = class_desc->next) { if(!strcmpiW(class_desc->name, arg)) break; @@ -1067,21 +1093,25 @@ static HRESULT interp_newenum(exec_ctx_t *ctx) { - VARIANT *v, r; + variant_val_t v; + VARIANT *r; HRESULT hres; TRACE("\n"); - v = stack_pop(ctx); - switch(V_VT(v)) { + stack_pop_deref(ctx, &v); + assert(V_VT(stack_top(ctx, 0)) == VT_EMPTY); + r = stack_top(ctx, 0); + + switch(V_VT(v.v)) { case VT_DISPATCH|VT_BYREF: case VT_DISPATCH: { IEnumVARIANT *iter; DISPPARAMS dp = {0}; VARIANT iterv; - hres = disp_call(ctx->script, V_ISBYREF(v) ? *V_DISPATCHREF(v) : V_DISPATCH(v), DISPID_NEWENUM, &dp, &iterv); - VariantClear(v); + hres = disp_call(ctx->script, V_ISBYREF(v.v) ? *V_DISPATCHREF(v.v) : V_DISPATCH(v.v), DISPID_NEWENUM, &dp, &iterv); + release_val(&v); if(FAILED(hres)) return hres; @@ -1098,17 +1128,17 @@ return hres; } - V_VT(&r) = VT_UNKNOWN; - V_UNKNOWN(&r) = (IUnknown*)iter; + V_VT(r) = VT_UNKNOWN; + V_UNKNOWN(r) = (IUnknown*)iter; break; } default: - FIXME("Unsupported for %s\n", debugstr_variant(v)); - VariantClear(v); + FIXME("Unsupported for %s\n", debugstr_variant(v.v)); + release_val(&v); return E_NOTIMPL; } - return stack_push(ctx, &r); + return S_OK; } static HRESULT interp_enumnext(exec_ctx_t *ctx) @@ -1123,6 +1153,11 @@ TRACE("\n"); + if(V_VT(stack_top(ctx, 0)) == VT_EMPTY) { + FIXME("uninitialized\n"); + return E_FAIL; + } + assert(V_VT(stack_top(ctx, 0)) == VT_UNKNOWN); iter = (IEnumVARIANT*)V_UNKNOWN(stack_top(ctx, 0)); @@ -1932,6 +1967,12 @@ return S_OK; } +static HRESULT interp_catch(exec_ctx_t *ctx) +{ + /* Nothing to do here, the OP is for unwinding only. */ + return S_OK; +} + static const instr_func_t op_funcs[] = { #define X(x,n,a,b) interp_ ## x, OP_LIST @@ -1986,7 +2027,7 @@ heap_free(ctx->stack); } -HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DISPPARAMS *dp, VARIANT *res) +HRESULT exec_script(script_ctx_t *ctx, function_t *func, vbdisp_t *vbthis, DISPPARAMS *dp, VARIANT *res) { exec_ctx_t exec = {func->code_ctx}; vbsop_t op; @@ -2017,9 +2058,9 @@ if(func->args[i].by_ref) exec.args[i] = *v; else - hres = VariantCopy(exec.args+i, V_VARIANTREF(v)); + hres = VariantCopyInd(exec.args+i, V_VARIANTREF(v)); }else { - hres = VariantCopy(exec.args+i, v); + hres = VariantCopyInd(exec.args+i, v); } if(FAILED(hres)) { release_exec(&exec); @@ -2048,12 +2089,14 @@ return E_OUTOFMEMORY; } - if(this_obj) - exec.this_obj = this_obj; - else if (ctx->host_global) + if(vbthis) { + exec.this_obj = (IDispatch*)&vbthis->IDispatchEx_iface; + exec.vbthis = vbthis; + }else if (ctx->host_global) { exec.this_obj = ctx->host_global; - else + }else { exec.this_obj = (IDispatch*)&ctx->script_obj->IDispatchEx_iface; + } IDispatch_AddRef(exec.this_obj); exec.instr = exec.code->instrs + func->code_off; @@ -2064,12 +2107,45 @@ op = exec.instr->op; hres = op_funcs[op](&exec); if(FAILED(hres)) { - if(exec.resume_next) - FIXME("Failed %08x in resume next mode\n", hres); - else + ctx->err_number = hres = map_hres(hres); + + if(exec.resume_next) { + unsigned stack_off; + + WARN("Failed %08x in resume next mode\n", hres); + + /* + * Unwinding here is simple. We need to find the next OP_catch, which contains + * information about expected stack size and jump offset on error. Generated + * bytecode needs to guarantee, that simple jump and stack adjustment will + * guarantee proper execution continuation. + */ + while((++exec.instr)->op != OP_catch); + + TRACE("unwind jmp %d stack_off %d\n", exec.instr->arg1.uint, exec.instr->arg2.uint); + + stack_off = exec.instr->arg2.uint; + instr_jmp(&exec, exec.instr->arg1.uint); + + if(exec.top > stack_off) { + stack_popn(&exec, exec.top-stack_off); + }else if(exec.top < stack_off) { + VARIANT v; + + V_VT(&v) = VT_EMPTY; + while(exec.top < stack_off) { + hres = stack_push(&exec, &v); + if(FAILED(hres)) + break; + } + } + + continue; + }else { WARN("Failed %08x\n", hres); - stack_popn(&exec, exec.top); - break; + stack_popn(&exec, exec.top); + break; + } } exec.instr += op_move[op]; diff -Nru wine1.7-1.7.13/dlls/vbscript/Makefile.in wine1.7-1.7.16/dlls/vbscript/Makefile.in --- wine1.7-1.7.13/dlls/vbscript/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -3,7 +3,6 @@ C_SRCS = \ compile.c \ - error.c \ global.c \ interp.c \ lex.c \ diff -Nru wine1.7-1.7.13/dlls/vbscript/parse.h wine1.7-1.7.16/dlls/vbscript/parse.h --- wine1.7-1.7.13/dlls/vbscript/parse.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/parse.h 2014-04-04 19:13:44.000000000 +0000 @@ -146,6 +146,7 @@ typedef struct _dim_decl_t { const WCHAR *name; BOOL is_array; + BOOL is_public; /* Used only for class members. */ dim_list_t *dims; struct _dim_decl_t *next; } dim_decl_t; @@ -176,16 +177,10 @@ function_decl_t *func_decl; } function_statement_t; -typedef struct _class_prop_decl_t { - BOOL is_public; - const WCHAR *name; - struct _class_prop_decl_t *next; -} class_prop_decl_t; - typedef struct _class_decl_t { const WCHAR *name; function_decl_t *funcs; - class_prop_decl_t *props; + dim_decl_t *props; struct _class_decl_t *next; } class_decl_t; diff -Nru wine1.7-1.7.13/dlls/vbscript/parser.y wine1.7-1.7.16/dlls/vbscript/parser.y --- wine1.7-1.7.13/dlls/vbscript/parser.y 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/parser.y 2014-04-04 19:13:44.000000000 +0000 @@ -67,7 +67,7 @@ static class_decl_t *new_class_decl(parser_ctx_t*); static class_decl_t *add_class_function(parser_ctx_t*,class_decl_t*,function_decl_t*); -static class_decl_t *add_variant_prop(parser_ctx_t*,class_decl_t*,const WCHAR*,unsigned); +static class_decl_t *add_dim_prop(parser_ctx_t*,class_decl_t*,dim_decl_t*,unsigned); static statement_t *link_statements(statement_t*,statement_t*); @@ -205,7 +205,7 @@ { $$ = new_forto_statement(ctx, $2, $4, $6, $7, $9); CHECK_ERROR; } | tFOR tEACH Identifier tIN Expression tNL StatementsNl_opt tNEXT { $$ = new_foreach_statement(ctx, $3, $5, $7); } - | tSELECT tCASE Expression tNL CaseClausules tEND tSELECT + | tSELECT tCASE Expression StSep CaseClausules tEND tSELECT { $$ = new_select_statement(ctx, $3, $5); } MemberExpression @@ -273,8 +273,8 @@ CaseClausules : /* empty */ { $$ = NULL; } - | tCASE tELSE tNL StatementsNl { $$ = new_case_clausule(ctx, NULL, $4, NULL); } - | tCASE ExpressionList tNL StatementsNl_opt CaseClausules + | tCASE tELSE StSep StatementsNl { $$ = new_case_clausule(ctx, NULL, $4, NULL); } + | tCASE ExpressionList StSep StatementsNl_opt CaseClausules { $$ = new_case_clausule(ctx, $2, $4, $5); } Arguments_opt @@ -396,7 +396,10 @@ ClassBody : /* empty */ { $$ = new_class_decl(ctx); } | FunctionDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } - | Storage tIdentifier tNL ClassBody { $$ = add_variant_prop(ctx, $4, $2, $1); CHECK_ERROR; } + /* FIXME: We should use DimDecl here to support arrays, but that conflicts with PropertyDecl. */ + | Storage tIdentifier tNL ClassBody { dim_decl_t *dim_decl = new_dim_decl(ctx, $2, FALSE, NULL); CHECK_ERROR; + $$ = add_dim_prop(ctx, $4, dim_decl, $1); CHECK_ERROR; } + | tDIM DimDecl tNL ClassBody { $$ = add_dim_prop(ctx, $4, $2, 0); CHECK_ERROR; } | PropertyDecl tNL ClassBody { $$ = add_class_function(ctx, $3, $1); CHECK_ERROR; } PropertyDecl @@ -431,14 +434,20 @@ | ArgumentDecl ',' ArgumentDeclList { $1->next = $3; $$ = $1; } ArgumentDecl - : Identifier { $$ = new_argument_decl(ctx, $1, TRUE); } - | tBYREF Identifier { $$ = new_argument_decl(ctx, $2, TRUE); } - | tBYVAL Identifier { $$ = new_argument_decl(ctx, $2, FALSE); } + : Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $1, TRUE); } + | tBYREF Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $2, TRUE); } + | tBYVAL Identifier EmptyBrackets_opt { $$ = new_argument_decl(ctx, $2, FALSE); } /* 'property' may be both keyword and identifier, depending on context */ Identifier : tIdentifier { $$ = $1; } | tPROPERTY { $$ = propertyW; } + +/* Some statements accept both new line and ':' as a separator */ +StSep + : tNL + | ':' + %% static int parser_error(parser_ctx_t *ctx, const char *str) @@ -891,24 +900,17 @@ return class_decl; } -static class_decl_t *add_variant_prop(parser_ctx_t *ctx, class_decl_t *class_decl, const WCHAR *identifier, unsigned storage_flags) +static class_decl_t *add_dim_prop(parser_ctx_t *ctx, class_decl_t *class_decl, dim_decl_t *dim_decl, unsigned storage_flags) { - class_prop_decl_t *prop; - if(storage_flags & STORAGE_IS_DEFAULT) { FIXME("variant prop van't be default value\n"); ctx->hres = E_FAIL; return NULL; } - prop = parser_alloc(ctx, sizeof(*prop)); - if(!prop) - return NULL; - - prop->name = identifier; - prop->is_public = !(storage_flags & STORAGE_IS_PRIVATE); - prop->next = class_decl->props; - class_decl->props = prop; + dim_decl->is_public = !(storage_flags & STORAGE_IS_PRIVATE); + dim_decl->next = class_decl->props; + class_decl->props = dim_decl; return class_decl; } diff -Nru wine1.7-1.7.13/dlls/vbscript/tests/error.vbs wine1.7-1.7.16/dlls/vbscript/tests/error.vbs --- wine1.7-1.7.13/dlls/vbscript/tests/error.vbs 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/tests/error.vbs 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,374 @@ +' +' Copyright 2014 Jacek Caban 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 +' + +Option Explicit + +const E_TESTERROR = &h80080008& + +const VB_E_FORLOOPNOTINITIALIZED = 92 +const VB_E_OBJNOTCOLLECTION = 451 + +const E_NOTIMPL = &h80004001& +const E_NOINTERFACE = &h80004002& +const DISP_E_UNKNOWNINTERFACE = &h80020001& +const DISP_E_MEMBERNOTFOUND = &h80020003& +const DISP_E_PARAMNOTFOUND = &h80020004& +const DISP_E_TYPEMISMATCH = &h80020005& +const DISP_E_UNKNOWNNAME = &h80020006& +const DISP_E_NONAMEDARGS = &h80020007& +const DISP_E_BADVARTYPE = &h80020008& +const DISP_E_OVERFLOW = &h8002000A& +const DISP_E_BADINDEX = &h8002000B& +const DISP_E_UNKNOWNLCID = &h8002000C& +const DISP_E_ARRAYISLOCKED = &h8002000D& +const DISP_E_BADPARAMCOUNT = &h8002000E& +const DISP_E_PARAMNOTOPTIONAL = &h8002000F& +const DISP_E_NOTACOLLECTION = &h80020011& +const TYPE_E_DLLFUNCTIONNOTFOUND = &h8002802F& +const TYPE_E_TYPEMISMATCH = &h80028CA0& +const TYPE_E_OUTOFBOUNDS = &h80028CA1& +const TYPE_E_IOERROR = &h80028CA2& +const TYPE_E_CANTCREATETMPFILE = &h80028CA3& +const STG_E_FILENOTFOUND = &h80030002& +const STG_E_PATHNOTFOUND = &h80030003& +const STG_E_TOOMANYOPENFILES = &h80030004& +const STG_E_ACCESSDENIED = &h80030005& +const STG_E_INSUFFICIENTMEMORY = &h80030008& +const STG_E_NOMOREFILES = &h80030012& +const STG_E_DISKISWRITEPROTECTED = &h80030013& +const STG_E_WRITEFAULT = &h8003001D& +const STG_E_READFAULT = &h8003001E& +const STG_E_SHAREVIOLATION = &h80030020& +const STG_E_LOCKVIOLATION = &h80030021& +const STG_E_FILEALREADYEXISTS = &h80030050& +const STG_E_MEDIUMFULL = &h80030070& +const STG_E_INVALIDNAME = &h800300FC& +const STG_E_INUSE = &h80030100& +const STG_E_NOTCURRENT = &h80030101& +const STG_E_CANTSAVE = &h80030103& +const REGDB_E_CLASSNOTREG = &h80040154& +const MK_E_UNAVAILABLE = &h800401E3& +const MK_E_INVALIDEXTENSION = &h800401E6& +const MK_E_CANTOPENFILE = &h800401EA& +const CO_E_CLASSSTRING = &h800401F3& +const CO_E_APPNOTFOUND = &h800401F5& +const O_E_APPDIDNTREG = &h800401FE& +const E_ACCESSDENIED = &h80070005& +const E_OUTOFMEMORY = &h8007000E& +const E_INVALIDARG = &h80070057& +const RPC_S_SERVER_UNAVAILABLE = &h800706BA& +const CO_E_SERVER_EXEC_FAILURE = &h80080005& + +call ok(Err.Number = 0, "Err.Number = " & Err.Number) + +dim calledFunc + +sub returnTrue + calledFunc = true + returnTrue = true +end sub + +sub testThrow + on error resume next + + dim x, y + + call throwInt(1000) + call ok(Err.Number = 0, "Err.Number = " & Err.Number) + + call throwInt(E_TESTERROR) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + call throwInt(1000) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + call Err.clear() + call ok(Err.Number = 0, "Err.Number = " & Err.Number) + + x = 6 + calledFunc = false + x = throwInt(E_TESTERROR) and returnTrue() + call ok(x = 6, "x = " & x) + call ok(not calledFunc, "calledFunc = " & calledFunc) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = false + call Err.clear() + if false and throwInt(E_TESTERROR) then + x = true + else + call ok(false, "unexpected if else branch on throw") + end if + call ok(x, "if branch not taken") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = false + call Err.clear() + if throwInt(E_TESTERROR) then x = true + call ok(x, "if branch not taken") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = false + call Err.clear() + if false then + call ok(false, "unexpected if else branch on throw") + elseif throwInt(E_TESTERROR) then + x = true + else + call ok(false, "unexpected if else branch on throw") + end if + call ok(x, "elseif branch not taken") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + call Err.clear() + if true then + call throwInt(E_TESTERROR) + else + call ok(false, "unexpected if else branch on throw") + end if + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = false + call Err.clear() + do while throwInt(E_TESTERROR) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + x = true + exit do + loop + call ok(x, "if branch not taken") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = 0 + call Err.clear() + do + x = x+1 + call ok(Err.Number = 0, "Err.Number = " & Err.Number) + loop while throwInt(E_TESTERROR) + call ok(x = 1, "if branch not taken") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = 0 + call Err.clear() + do + x = x+1 + call ok(Err.Number = 0, "Err.Number = " & Err.Number) + loop until throwInt(E_TESTERROR) + call ok(x = 1, "if branch not taken") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + call Err.clear() + x = 0 + while x < 2 + x = x+1 + call throwInt(E_TESTERROR) + wend + call ok(x = 2, "x = " & x) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + call Err.clear() + x = 2 + y = 0 + for each x in throwInt(E_TESTERROR) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + y = y+1 + next + call ok(x = 2, "x = " & x) + call ok(y = 1, "y = " & y) + 'todo_wine call ok(Err.Number = VB_E_OBJNOTCOLLECTION, "Err.Number = " & Err.Number) + + Err.clear() + y = 0 + x = 6 + for x = throwInt(E_TESTERROR) to 100 + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + call ok(x = 6, "x = " & x) + y = y+1 + next + call ok(y = 1, "y = " & y) + call ok(x = 6, "x = " & x) + 'todo_wine call ok(Err.Number = VB_E_FORLOOPNOTINITIALIZED, "Err.Number = " & Err.Number) + + Err.clear() + y = 0 + x = 6 + for x = 100 to throwInt(E_TESTERROR) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + 'todo_wine call ok(x = 6, "x = " & x) + y = y+1 + next + call ok(y = 1, "y = " & y) + 'todo_wine call ok(x = 6, "x = " & x) + 'todo_wine call ok(Err.Number = VB_E_FORLOOPNOTINITIALIZED, "Err.Number = " & Err.Number) + + select case throwInt(E_TESTERROR) + case true + call ok(false, "unexpected case true") + case false + call ok(false, "unexpected case false") + case empty + call ok(false, "unexpected case empty") + case else + call ok(false, "unexpected case else") + end select + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + x = false + select case false + case true + call ok(false, "unexpected case true") + case throwInt(E_TESTERROR) + x = true + case else + call ok(false, "unexpected case else") + end select + call ok(x, "case not executed") + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) + + 'Exception in non-trivial stack context + for x = 1 to 1 + for each y in collectionObj + select case 3 + case 1 + call ok(false, "unexpected case") + case throwInt(E_TESTERROR) + exit for + case 2 + call ok(false, "unexpected case") + end select + next + next +end sub + +call testThrow + +dim x + +sub testOnError(resumeNext) + if resumeNext then + on error resume next + else + on error goto 0 + end if + x = 1 + throwInt(E_TESTERROR) + x = 2 + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) +end sub + +sub callTestOnError(resumeNext) + on error resume next + call testOnError(resumeNext) + call ok(Err.Number = E_TESTERROR, "Err.Number = " & Err.Number) +end sub + +x = 0 +call callTestOnError(true) +call ok(x = 2, "x = " & x) + +x = 0 +call callTestOnError(false) +call ok(x = 1, "x = " & x) + +sub testForEachError() + on error resume next + + dim x, y + y = false + for each x in empty + y = true + next + call ok(y, "for each not executed") + 'todo_wine call ok(Err.Number = VB_E_OBJNOTCOLLECTION, "Err.Number = " & Err.Number) +end sub + +call testForEachError() + +sub testHresMap(hres, code) + on error resume next + + call Err.Clear() + call throwInt(hres) + call ok(Err.Number = code, "throw(" & hex(hres) & ") Err.Number = " & Err.Number) +end sub + +testHresMap E_NOTIMPL, 445 +testHresMap E_NOINTERFACE, 430 +testHresMap DISP_E_UNKNOWNINTERFACE, 438 +testHresMap DISP_E_MEMBERNOTFOUND, 438 +testHresMap DISP_E_PARAMNOTFOUND, 448 +testHresMap DISP_E_TYPEMISMATCH, 13 +testHresMap DISP_E_UNKNOWNNAME, 438 +testHresMap DISP_E_NONAMEDARGS, 446 +testHresMap DISP_E_BADVARTYPE, 458 +testHresMap DISP_E_OVERFLOW, 6 +testHresMap DISP_E_BADINDEX, 9 +testHresMap DISP_E_UNKNOWNLCID, 447 +testHresMap DISP_E_ARRAYISLOCKED, 10 +testHresMap DISP_E_BADPARAMCOUNT, 450 +testHresMap DISP_E_PARAMNOTOPTIONAL, 449 +testHresMap DISP_E_NOTACOLLECTION, 451 +testHresMap TYPE_E_DLLFUNCTIONNOTFOUND, 453 +testHresMap TYPE_E_TYPEMISMATCH, 13 +testHresMap TYPE_E_OUTOFBOUNDS, 9 +testHresMap TYPE_E_IOERROR, 57 +testHresMap TYPE_E_CANTCREATETMPFILE, 322 +testHresMap STG_E_FILENOTFOUND, 432 +testHresMap STG_E_PATHNOTFOUND, 76 +testHresMap STG_E_TOOMANYOPENFILES, 67 +testHresMap STG_E_ACCESSDENIED, 70 +testHresMap STG_E_INSUFFICIENTMEMORY, 7 +testHresMap STG_E_NOMOREFILES, 67 +testHresMap STG_E_DISKISWRITEPROTECTED, 70 +testHresMap STG_E_WRITEFAULT, 57 +testHresMap STG_E_READFAULT, 57 +testHresMap STG_E_SHAREVIOLATION, 75 +testHresMap STG_E_LOCKVIOLATION, 70 +testHresMap STG_E_FILEALREADYEXISTS, 58 +testHresMap STG_E_MEDIUMFULL, 61 +testHresMap STG_E_INVALIDNAME, 53 +testHresMap STG_E_INUSE, 70 +testHresMap STG_E_NOTCURRENT, 70 +testHresMap STG_E_CANTSAVE, 57 +testHresMap REGDB_E_CLASSNOTREG, 429 +testHresMap MK_E_UNAVAILABLE, 429 +testHresMap MK_E_INVALIDEXTENSION, 432 +testHresMap MK_E_CANTOPENFILE, 432 +testHresMap CO_E_CLASSSTRING, 429 +testHresMap CO_E_APPNOTFOUND, 429 +testHresMap O_E_APPDIDNTREG, 429 +testHresMap E_ACCESSDENIED, 70 +testHresMap E_OUTOFMEMORY, 7 +testHresMap E_INVALIDARG, 5 +testHresMap RPC_S_SERVER_UNAVAILABLE, 462 +testHresMap CO_E_SERVER_EXEC_FAILURE, 429 + +sub testVBErrorCodes() + on error resume next + + Err.clear() + throwInt(&h800a00aa&) + call ok(Err.number = 170, "Err.number = " & Err.number) + + Err.clear() + throwInt(&h800a10aa&) + call ok(Err.number = 4266, "Err.number = " & Err.number) +end sub + +call testVBErrorCodes + +call reportSuccess() diff -Nru wine1.7-1.7.13/dlls/vbscript/tests/lang.vbs wine1.7-1.7.16/dlls/vbscript/tests/lang.vbs --- wine1.7-1.7.13/dlls/vbscript/tests/lang.vbs 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/tests/lang.vbs 2014-04-04 19:13:44.000000000 +0000 @@ -19,6 +19,7 @@ Option Explicit dim x, y, z +Dim obj call ok(true, "true is not true?") ok true, "true is not true?" @@ -224,6 +225,10 @@ if false then x=1 else x=2 end if +x = false +if false then x = true : x = true +Call ok(x = false, "x <> false") + if false then ok false, "if false called" end if @@ -482,6 +487,17 @@ Call ok(y = 1, "y = " & y) Call ok(x = 2, "x = " & x) +Set obj = collectionObj +Call obj.reset() +y = 0 +x = 10 +for each x in obj + y = y+1 + Call ok(x = y, "x <> y") +next +Call ok(y = 3, "y = " & y) +Call ok(getVT(x) = "VT_EMPTY*", "getVT(x) = " & getVT(x)) + x = false select case 3 case 2 @@ -538,6 +554,22 @@ select case 0 end select +x = false +select case 2 + case 3,1,2,4: x = true + case 5,6,7 + Call ok(false, "unexpected case") +end select +Call ok(x, "wrong case") + +x = false +select case 2: case 5,6,7: Call ok(false, "unexpected case") + case 2,1,2,4 + x = true + case else: Call ok(false, "unexpected case else") +end select +Call ok(x, "wrong case") + if false then Sub testsub x = true @@ -747,7 +779,6 @@ set x = testObj Call ok(getVT(x) = "VT_DISPATCH*", "getVT(x=testObj) = " & getVT(x)) -Dim obj Set obj = New EmptyClass Call ok(getVT(obj) = "VT_DISPATCH*", "getVT(obj) = " & getVT(obj)) @@ -814,6 +845,9 @@ Public Sub Class_Initialize publicProp2 = 2 privateProp = true + Call ok(getVT(privateProp) = "VT_BOOL*", "getVT(privateProp) = " & getVT(privateProp)) + Call ok(getVT(publicProp2) = "VT_I2*", "getVT(publicProp2) = " & getVT(publicProp2)) + Call ok(getVT(Me.publicProp2) = "VT_I2", "getVT(Me.publicProp2) = " & getVT(Me.publicProp2)) End Sub End Class @@ -830,6 +864,7 @@ Call ok(getVT(obj.publicProp) = "VT_EMPTY", "getVT(obj.publicProp) = " & getVT(obj.publicProp)) obj.publicProp = 3 +Call ok(getVT(obj.publicProp) = "VT_I2", "getVT(obj.publicProp) = " & getVT(obj.publicProp)) Call ok(obj.publicProp = 3, "obj.publicProp = " & obj.publicProp) obj.publicProp() = 3 @@ -1044,4 +1079,69 @@ x=1 Call ok(forarr(x) = 2, "forarr(x) = " & forarr(x)) +Class ArrClass + Dim classarr(3) + Dim classnoarr() + Dim var + + Private Sub Class_Initialize + Call ok(getVT(classarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(classarr) = " & getVT(classarr)) + Call testArray(-1, classnoarr) + classarr(0) = 1 + classarr(1) = 2 + classarr(2) = 3 + classarr(3) = 4 + End Sub + + Public Sub testVarVT + Call ok(getVT(var) = "VT_ARRAY|VT_VARIANT*", "getVT(var) = " & getVT(var)) + End Sub +End Class + +Set obj = new ArrClass +Call ok(getVT(obj.classarr) = "VT_ARRAY|VT_VARIANT", "getVT(obj.classarr) = " & getVT(obj.classarr)) +'todo_wine Call ok(obj.classarr(1) = 2, "obj.classarr(1) = " & obj.classarr(1)) + +obj.var = arr +Call ok(getVT(obj.var) = "VT_ARRAY|VT_VARIANT", "getVT(obj.var) = " & getVT(obj.var)) +Call obj.testVarVT + +Sub arrarg(byref refarr, byval valarr, byref refarr2, byval valarr2) + Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr)) + Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr)) + Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2)) + Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2)) +End Sub + +Call arrarg(arr, arr, obj.classarr, obj.classarr) + +Sub arrarg2(byref refarr(), byval valarr(), byref refarr2(), byval valarr2()) + Call ok(getVT(refarr) = "VT_ARRAY|VT_BYREF|VT_VARIANT*", "getVT(refarr) = " & getVT(refarr)) + Call ok(getVT(valarr) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr) = " & getVT(valarr)) + Call ok(getVT(refarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(refarr2) = " & getVT(refarr2)) + Call ok(getVT(valarr2) = "VT_ARRAY|VT_VARIANT*", "getVT(valarr2) = " & getVT(valarr2)) +End Sub + +Call arrarg2(arr, arr, obj.classarr, obj.classarr) + +Sub testarrarg(arg(), vt) + Call ok(getVT(arg) = vt, "getVT() = " & getVT(arg) & " expected " & vt) +End Sub + +Call testarrarg(1, "VT_I2*") +Call testarrarg(false, "VT_BOOL*") +Call testarrarg(Empty, "VT_EMPTY*") + +' It's allowed to declare non-builtin RegExp class... +class RegExp + public property get Global() + Call ok(false, "Global called") + Global = "fail" + end property +end class + +' ...but there is no way to use it because builtin instance is always created +set x = new RegExp +Call ok(x.Global = false, "x.Global = " & x.Global) + reportSuccess() diff -Nru wine1.7-1.7.13/dlls/vbscript/tests/regexp.vbs wine1.7-1.7.16/dlls/vbscript/tests/regexp.vbs --- wine1.7-1.7.13/dlls/vbscript/tests/regexp.vbs 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/tests/regexp.vbs 2014-04-04 19:13:44.000000000 +0000 @@ -168,4 +168,10 @@ Call ok(submatch.Item(0) = "a", "submatch.Item(0) = " & submatch.Item(0)) Call ok(submatch.Item(1) = "b", "submatch.Item(0) = " & submatch.Item(1)) +Set x = new regexp +Call ok(x.Pattern = "", "RegExp.Pattern = " & x.Pattern) +Call ok(x.IgnoreCase = false, "RegExp.IgnoreCase = " & x.IgnoreCase) +Call ok(x.Global = false, "RegExp.Global = " & x.Global) +Call ok(x.Multiline = false, "RegExp.Multiline = " & x.Multiline) + Call reportSuccess() diff -Nru wine1.7-1.7.13/dlls/vbscript/tests/rsrc.rc wine1.7-1.7.16/dlls/vbscript/tests/rsrc.rc --- wine1.7-1.7.13/dlls/vbscript/tests/rsrc.rc 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/tests/rsrc.rc 2014-04-04 19:13:44.000000000 +0000 @@ -19,6 +19,9 @@ /* @makedep: api.vbs */ api.vbs 40 "api.vbs" +/* @makedep: error.vbs */ +error.vbs 40 "error.vbs" + /* @makedep: lang.vbs */ lang.vbs 40 "lang.vbs" diff -Nru wine1.7-1.7.13/dlls/vbscript/tests/run.c wine1.7-1.7.16/dlls/vbscript/tests/run.c --- wine1.7-1.7.13/dlls/vbscript/tests/run.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/tests/run.c 2014-04-04 19:13:44.000000000 +0000 @@ -113,12 +113,16 @@ #define DISPID_GLOBAL_COLLOBJ 1013 #define DISPID_GLOBAL_DOUBLEASSTRING 1014 #define DISPID_GLOBAL_TESTARRAY 1015 +#define DISPID_GLOBAL_THROWINT 1016 #define DISPID_TESTOBJ_PROPGET 2000 #define DISPID_TESTOBJ_PROPPUT 2001 #define DISPID_COLLOBJ_RESET 3000 +#define FACILITY_VBS 0xa +#define MAKE_VBSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code) + static const WCHAR testW[] = {'t','e','s','t',0}; static const WCHAR emptyW[] = {0}; @@ -922,6 +926,11 @@ *pid = DISPID_GLOBAL_TESTARRAY; return S_OK; } + if(!strcmp_wa(bstrName, "throwInt")) { + test_grfdex(grfdex, fdexNameCaseInsensitive); + *pid = DISPID_GLOBAL_THROWINT; + return S_OK; + } if(strict_dispid_check && strcmp_wa(bstrName, "x")) ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex); @@ -1200,6 +1209,41 @@ else test_safearray(*V_ARRAYREF(V_VARIANTREF(pdp->rgvarg)), V_I2(pdp->rgvarg+1)); return S_OK; + + case DISPID_GLOBAL_THROWINT: { + VARIANT *v = pdp->rgvarg; + HRESULT hres; + + ok((wFlags & ~INVOKE_PROPERTYGET) == INVOKE_FUNC, "wFlags = %x\n", wFlags); + ok(pdp != NULL, "pdp == NULL\n"); + ok(pdp->rgvarg != NULL, "rgvarg == NULL\n"); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(pei != NULL, "pei == NULL\n"); + if(pvarRes) { + ok(V_VT(pvarRes) == VT_EMPTY, "V_VT(pvarRes) = %d\n", V_VT(pvarRes)); + V_VT(pvarRes) = VT_BOOL; + V_BOOL(pvarRes) = VARIANT_FALSE; + } + + if(V_VT(v) == (VT_VARIANT|VT_BYREF)) + v = V_VARIANTREF(v); + + switch(V_VT(v)) { + case VT_I2: + hres = V_I2(v); + break; + case VT_I4: + hres = V_I4(v); + break; + default: + ok(0, "unexpected vt %d\n", V_VT(v)); + return E_INVALIDARG; + } + + return hres; + } } ok(0, "unexpected call %d\n", id); @@ -1941,6 +1985,20 @@ test_global_vars_ref(TRUE); test_global_vars_ref(FALSE); + hres = parse_script_ar("throwInt(&h80080008&)"); + ok(hres == 0x80080008, "hres = %08x\n", hres); + + /* DISP_E_BADINDEX */ + hres = parse_script_ar("throwInt(&h8002000b&)"); + ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres); + + hres = parse_script_ar("throwInt(&h800a0009&)"); + ok(hres == MAKE_VBSERROR(9), "hres = %08x\n", hres); + + /* E_NOTIMPL */ + hres = parse_script_ar("throwInt(&h80004001&)"); + ok(hres == MAKE_VBSERROR(445), "hres = %08x\n", hres); + strict_dispid_check = FALSE; parse_script_a("Sub testsub\n" @@ -1960,6 +2018,7 @@ run_from_res("lang.vbs"); run_from_res("api.vbs"); run_from_res("regexp.vbs"); + run_from_res("error.vbs"); test_procedures(); test_gc(); diff -Nru wine1.7-1.7.13/dlls/vbscript/vbdisp.c wine1.7-1.7.16/dlls/vbscript/vbdisp.c --- wine1.7-1.7.13/dlls/vbscript/vbdisp.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/vbdisp.c 2014-04-04 19:13:44.000000000 +0000 @@ -109,7 +109,7 @@ return DISP_E_MEMBERNOTFOUND; /* That's what tests show */ } - hres = VariantCopy(res, v); + hres = VariantCopyInd(res, v); break; case DISPATCH_PROPERTYPUT: { @@ -121,10 +121,15 @@ return DISP_E_PARAMNOTOPTIONAL; } + if(arg_cnt(dp)) { + FIXME("Arguments not supported\n"); + return E_NOTIMPL; + } + if(res) V_VT(res) = VT_EMPTY; - hres = VariantCopy(v, put_val); + hres = VariantCopyInd(v, put_val); break; } @@ -228,7 +233,7 @@ This->ref++; exec_script(This->desc->ctx, This->desc->funcs[This->desc->class_terminate_id].entries[VBDISP_CALLGET], - (IDispatch*)&This->IDispatchEx_iface, &dp, NULL); + This, &dp, NULL); return !--This->ref; } @@ -239,6 +244,13 @@ if(!This->desc) return; + for(i=0; i < This->desc->array_cnt; i++) { + if(This->arrays[i]) { + SafeArrayDestroy(This->arrays[i]); + This->arrays[i] = NULL; + } + } + for(i=0; i < This->desc->prop_cnt; i++) VariantClear(This->props+i); } @@ -291,6 +303,7 @@ if(!ref && run_terminator(This)) { clean_props(This); list_remove(&This->entry); + heap_free(This->arrays); heap_free(This); } @@ -384,7 +397,7 @@ return DISP_E_MEMBERNOTFOUND; } - return exec_script(This->desc->ctx, func, (IDispatch*)&This->IDispatchEx_iface, pdp, pvarRes); + return exec_script(This->desc->ctx, func, This, pdp, pvarRes); case DISPATCH_PROPERTYPUT: { VARIANT *put_val; DISPPARAMS dp = {NULL, NULL, 1, 0}; @@ -407,7 +420,7 @@ return DISP_E_MEMBERNOTFOUND; } - return exec_script(This->desc->ctx, func, (IDispatch*)&This->IDispatchEx_iface, &dp, NULL); + return exec_script(This->desc->ctx, func, This, &dp, NULL); } default: FIXME("flags %x\n", wFlags); @@ -505,6 +518,7 @@ HRESULT create_vbdisp(const class_desc_t *desc, vbdisp_t **ret) { vbdisp_t *vbdisp; + HRESULT hres = S_OK; vbdisp = heap_alloc_zero( FIELD_OFFSET( vbdisp_t, props[desc->prop_cnt] )); if(!vbdisp) @@ -516,18 +530,46 @@ list_add_tail(&desc->ctx->objects, &vbdisp->entry); - if(desc->class_initialize_id) { - DISPPARAMS dp = {0}; - HRESULT hres; + if(desc->array_cnt) { + vbdisp->arrays = heap_alloc_zero(desc->array_cnt * sizeof(*vbdisp->arrays)); + if(vbdisp->arrays) { + unsigned i, j; + + for(i=0; i < desc->array_cnt; i++) { + if(!desc->array_descs[i].dim_cnt) + continue; + + vbdisp->arrays[i] = SafeArrayCreate(VT_VARIANT, desc->array_descs[i].dim_cnt, desc->array_descs[i].bounds); + if(!vbdisp->arrays[i]) { + hres = E_OUTOFMEMORY; + break; + } + } - hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET], - (IDispatch*)&vbdisp->IDispatchEx_iface, &dp, NULL); - if(FAILED(hres)) { - IDispatchEx_Release(&vbdisp->IDispatchEx_iface); - return hres; + if(SUCCEEDED(hres)) { + for(i=0, j=0; i < desc->prop_cnt; i++) { + if(desc->props[i].is_array) { + V_VT(vbdisp->props+i) = VT_ARRAY|VT_BYREF|VT_VARIANT; + V_ARRAYREF(vbdisp->props+i) = vbdisp->arrays + j++; + } + } + } + }else { + hres = E_OUTOFMEMORY; } } + if(SUCCEEDED(hres) && desc->class_initialize_id) { + DISPPARAMS dp = {0}; + hres = exec_script(desc->ctx, desc->funcs[desc->class_initialize_id].entries[VBDISP_CALLGET], + vbdisp, &dp, NULL); + } + + if(FAILED(hres)) { + IDispatchEx_Release(&vbdisp->IDispatchEx_iface); + return hres; + } + *ret = vbdisp; return S_OK; } @@ -926,6 +968,69 @@ return hres; } +#define RPC_E_SERVER_UNAVAILABLE 0x800706ba + +HRESULT map_hres(HRESULT hres) +{ + if(SUCCEEDED(hres) || HRESULT_FACILITY(hres) == FACILITY_VBS) + return hres; + + switch(hres) { + case E_NOTIMPL: return MAKE_VBSERROR(VBSE_ACTION_NOT_SUPPORTED); + case E_NOINTERFACE: return MAKE_VBSERROR(VBSE_OLE_NOT_SUPPORTED); + case DISP_E_UNKNOWNINTERFACE: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD); + case DISP_E_MEMBERNOTFOUND: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD); + case DISP_E_PARAMNOTFOUND: return MAKE_VBSERROR(VBSE_NAMED_PARAM_NOT_FOUND); + case DISP_E_TYPEMISMATCH: return MAKE_VBSERROR(VBSE_TYPE_MISMATCH); + case DISP_E_UNKNOWNNAME: return MAKE_VBSERROR(VBSE_OLE_NO_PROP_OR_METHOD); + case DISP_E_NONAMEDARGS: return MAKE_VBSERROR(VBSE_NAMED_ARGS_NOT_SUPPORTED); + case DISP_E_BADVARTYPE: return MAKE_VBSERROR(VBSE_INVALID_TYPELIB_VARIABLE); + case DISP_E_OVERFLOW: return MAKE_VBSERROR(VBSE_OVERFLOW); + case DISP_E_BADINDEX: return MAKE_VBSERROR(VBSE_OUT_OF_BOUNDS); + case DISP_E_UNKNOWNLCID: return MAKE_VBSERROR(VBSE_LOCALE_SETTING_NOT_SUPPORTED); + case DISP_E_ARRAYISLOCKED: return MAKE_VBSERROR(VBSE_ARRAY_LOCKED); + case DISP_E_BADPARAMCOUNT: return MAKE_VBSERROR(VBSE_FUNC_ARITY_MISMATCH); + case DISP_E_PARAMNOTOPTIONAL: return MAKE_VBSERROR(VBSE_PARAMETER_NOT_OPTIONAL); + case DISP_E_NOTACOLLECTION: return MAKE_VBSERROR(VBSE_NOT_ENUM); + case TYPE_E_DLLFUNCTIONNOTFOUND: return MAKE_VBSERROR(VBSE_INVALID_DLL_FUNCTION_NAME); + case TYPE_E_TYPEMISMATCH: return MAKE_VBSERROR(VBSE_TYPE_MISMATCH); + case TYPE_E_OUTOFBOUNDS: return MAKE_VBSERROR(VBSE_OUT_OF_BOUNDS); + case TYPE_E_IOERROR: return MAKE_VBSERROR(VBSE_IO_ERROR); + case TYPE_E_CANTCREATETMPFILE: return MAKE_VBSERROR(VBSE_CANT_CREATE_TMP_FILE); + case STG_E_FILENOTFOUND: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND); + case STG_E_PATHNOTFOUND: return MAKE_VBSERROR(VBSE_PATH_NOT_FOUND); + case STG_E_TOOMANYOPENFILES: return MAKE_VBSERROR(VBSE_TOO_MANY_FILES); + case STG_E_ACCESSDENIED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_INSUFFICIENTMEMORY: return MAKE_VBSERROR(VBSE_OUT_OF_MEMORY); + case STG_E_NOMOREFILES: return MAKE_VBSERROR(VBSE_TOO_MANY_FILES); + case STG_E_DISKISWRITEPROTECTED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_WRITEFAULT: return MAKE_VBSERROR(VBSE_IO_ERROR); + case STG_E_READFAULT: return MAKE_VBSERROR(VBSE_IO_ERROR); + case STG_E_SHAREVIOLATION: return MAKE_VBSERROR(VBSE_PATH_FILE_ACCESS); + case STG_E_LOCKVIOLATION: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_FILEALREADYEXISTS: return MAKE_VBSERROR(VBSE_FILE_ALREADY_EXISTS); + case STG_E_MEDIUMFULL: return MAKE_VBSERROR(VBSE_DISK_FULL); + case STG_E_INVALIDNAME: return MAKE_VBSERROR(VBSE_FILE_NOT_FOUND); + case STG_E_INUSE: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_NOTCURRENT: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case STG_E_CANTSAVE: return MAKE_VBSERROR(VBSE_IO_ERROR); + case REGDB_E_CLASSNOTREG: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case MK_E_UNAVAILABLE: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case MK_E_INVALIDEXTENSION: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND); + case MK_E_CANTOPENFILE: return MAKE_VBSERROR(VBSE_OLE_FILE_NOT_FOUND); + case CO_E_CLASSSTRING: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case CO_E_APPNOTFOUND: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case CO_E_APPDIDNTREG: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + case E_ACCESSDENIED: return MAKE_VBSERROR(VBSE_PERMISSION_DENIED); + case E_OUTOFMEMORY: return MAKE_VBSERROR(VBSE_OUT_OF_MEMORY); + case E_INVALIDARG: return MAKE_VBSERROR(VBSE_ILLEGAL_FUNC_CALL); + case RPC_E_SERVER_UNAVAILABLE: return MAKE_VBSERROR(VBSE_SERVER_NOT_FOUND); + case CO_E_SERVER_EXEC_FAILURE: return MAKE_VBSERROR(VBSE_CANT_CREATE_OBJECT); + } + + return hres; +} + HRESULT disp_call(script_ctx_t *ctx, IDispatch *disp, DISPID id, DISPPARAMS *dp, VARIANT *retv) { const WORD flags = DISPATCH_METHOD|(retv ? DISPATCH_PROPERTYGET : 0); diff -Nru wine1.7-1.7.13/dlls/vbscript/vbregexp.c wine1.7-1.7.16/dlls/vbscript/vbregexp.c --- wine1.7-1.7.13/dlls/vbscript/vbregexp.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/vbregexp.c 2014-04-04 19:13:44.000000000 +0000 @@ -1599,29 +1599,41 @@ RegExp_Replace }; -HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv) +HRESULT create_regexp(IDispatch **ret) { - RegExp2 *ret; + RegExp2 *regexp; HRESULT hres; - TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv); - hres = init_regexp_typeinfo(RegExp2_tid); if(FAILED(hres)) return hres; - ret = heap_alloc_zero(sizeof(*ret)); - if(!ret) + regexp = heap_alloc_zero(sizeof(*regexp)); + if(!regexp) return E_OUTOFMEMORY; - ret->IRegExp2_iface.lpVtbl = &RegExp2Vtbl; - ret->IRegExp_iface.lpVtbl = &RegExpVtbl; + regexp->IRegExp2_iface.lpVtbl = &RegExp2Vtbl; + regexp->IRegExp_iface.lpVtbl = &RegExpVtbl; + regexp->ref = 1; + heap_pool_init(®exp->pool); - ret->ref = 1; - heap_pool_init(&ret->pool); + *ret = (IDispatch*)®exp->IRegExp2_iface; + return S_OK; +} + +HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppv) +{ + IDispatch *regexp; + HRESULT hres; + + TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppv); + + hres = create_regexp(®exp); + if(FAILED(hres)) + return hres; - hres = IRegExp2_QueryInterface(&ret->IRegExp2_iface, riid, ppv); - IRegExp2_Release(&ret->IRegExp2_iface); + hres = IDispatch_QueryInterface(regexp, riid, ppv); + IDispatch_Release(regexp); return hres; } diff -Nru wine1.7-1.7.13/dlls/vbscript/vbscript.h wine1.7-1.7.16/dlls/vbscript/vbscript.h --- wine1.7-1.7.13/dlls/vbscript/vbscript.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/vbscript/vbscript.h 2014-04-04 19:13:44.000000000 +0000 @@ -68,13 +68,20 @@ } vbdisp_invoke_type_t; typedef struct { + unsigned dim_cnt; + SAFEARRAYBOUND *bounds; +} array_desc_t; + +typedef struct { BOOL is_public; + BOOL is_array; const WCHAR *name; } vbdisp_prop_desc_t; typedef struct { const WCHAR *name; BOOL is_public; + BOOL is_array; function_t *entries[VBDISP_ANY]; } vbdisp_funcprop_desc_t; @@ -101,6 +108,9 @@ unsigned prop_cnt; vbdisp_prop_desc_t *props; + unsigned array_cnt; + array_desc_t *array_descs; + unsigned builtin_prop_cnt; const builtin_prop_t *builtin_props; ITypeInfo *typeinfo; @@ -117,6 +127,7 @@ struct list entry; const class_desc_t *desc; + SAFEARRAY **arrays; VARIANT props[1]; }; @@ -178,6 +189,8 @@ class_desc_t err_desc; vbdisp_t *err_obj; + HRESULT err_number; + dynamic_var_t *global_vars; function_t *global_funcs; class_desc_t *classes; @@ -211,6 +224,7 @@ X(assign_ident, 1, ARG_BSTR, ARG_UINT) \ X(assign_member, 1, ARG_BSTR, ARG_UINT) \ X(bool, 1, ARG_INT, 0) \ + X(catch, 1, ARG_ADDR, ARG_UINT) \ X(case, 0, ARG_ADDR, 0) \ X(concat, 1, 0, 0) \ X(const, 1, ARG_BSTR, 0) \ @@ -302,11 +316,6 @@ const WCHAR *name; } var_desc_t; -typedef struct { - unsigned dim_cnt; - SAFEARRAYBOUND *bounds; -} array_desc_t; - struct _function_t { function_type_t type; const WCHAR *name; @@ -341,7 +350,7 @@ void release_vbscode(vbscode_t*) DECLSPEC_HIDDEN; HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,vbscode_t**) DECLSPEC_HIDDEN; -HRESULT exec_script(script_ctx_t*,function_t*,IDispatch*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; +HRESULT exec_script(script_ctx_t*,function_t*,vbdisp_t*,DISPPARAMS*,VARIANT*) DECLSPEC_HIDDEN; void release_dynamic_vars(dynamic_var_t*) DECLSPEC_HIDDEN; typedef struct { @@ -376,6 +385,43 @@ return INT32_MIN <= d && d <= INT32_MAX && (double)(int)d == d; } +HRESULT create_regexp(IDispatch**) DECLSPEC_HIDDEN; + +HRESULT map_hres(HRESULT) DECLSPEC_HIDDEN; + +#define FACILITY_VBS 0xa +#define MAKE_VBSERROR(code) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_VBS, code) + +#define VBSE_ILLEGAL_FUNC_CALL 5 +#define VBSE_OVERFLOW 6 +#define VBSE_OUT_OF_MEMORY 7 +#define VBSE_OUT_OF_BOUNDS 9 +#define VBSE_ARRAY_LOCKED 10 +#define VBSE_TYPE_MISMATCH 13 +#define VBSE_FILE_NOT_FOUND 53 +#define VBSE_IO_ERROR 57 +#define VBSE_FILE_ALREADY_EXISTS 58 +#define VBSE_DISK_FULL 61 +#define VBSE_TOO_MANY_FILES 67 +#define VBSE_PERMISSION_DENIED 70 +#define VBSE_PATH_FILE_ACCESS 75 +#define VBSE_PATH_NOT_FOUND 76 +#define VBSE_OLE_NOT_SUPPORTED 430 +#define VBSE_OLE_NO_PROP_OR_METHOD 438 +#define VBSE_ACTION_NOT_SUPPORTED 445 +#define VBSE_NAMED_ARGS_NOT_SUPPORTED 446 +#define VBSE_LOCALE_SETTING_NOT_SUPPORTED 447 +#define VBSE_NAMED_PARAM_NOT_FOUND 448 +#define VBSE_INVALID_TYPELIB_VARIABLE 458 +#define VBSE_FUNC_ARITY_MISMATCH 450 +#define VBSE_PARAMETER_NOT_OPTIONAL 449 +#define VBSE_NOT_ENUM 451 +#define VBSE_INVALID_DLL_FUNCTION_NAME 453 +#define VBSE_CANT_CREATE_TMP_FILE 322 +#define VBSE_OLE_FILE_NOT_FOUND 432 +#define VBSE_CANT_CREATE_OBJECT 429 +#define VBSE_SERVER_NOT_FOUND 462 + HRESULT WINAPI VBScriptFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; HRESULT WINAPI VBScriptRegExpFactory_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/version/tests/info.c wine1.7-1.7.16/dlls/version/tests/info.c --- wine1.7-1.7.13/dlls/version/tests/info.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/version/tests/info.c 2014-04-04 19:13:44.000000000 +0000 @@ -508,7 +508,7 @@ SetLastError(0xdeadbeef); ret = VerQueryValueA(ver, "StringFileInfo", (LPVOID*)&p, &len); ok(ret, "VerQueryValue error %u\n", GetLastError()); -todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); + ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); p = (char *)0xdeadbeef; @@ -516,7 +516,7 @@ SetLastError(0xdeadbeef); ret = VerQueryValueA(ver, "\\StringFileInfo", (LPVOID*)&p, &len); ok(ret, "VerQueryValue error %u\n", GetLastError()); -todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); + ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); p = (char *)0xdeadbeef; @@ -524,7 +524,7 @@ SetLastError(0xdeadbeef); ret = VerQueryValueA(ver, "\\\\StringFileInfo", (LPVOID*)&p, &len); ok(ret, "VerQueryValue error %u\n", GetLastError()); -todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); + ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); p = (char *)0xdeadbeef; @@ -532,7 +532,7 @@ SetLastError(0xdeadbeef); ret = VerQueryValueA(ver, "\\StringFileInfo\\\\", (LPVOID*)&p, &len); ok(ret, "VerQueryValue error %u\n", GetLastError()); -todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); + ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); sprintf(buf, "\\StringFileInfo\\%08x", translation); @@ -541,7 +541,7 @@ SetLastError(0xdeadbeef); ret = VerQueryValueA(ver, buf, (LPVOID*)&p, &len); ok(ret, "VerQueryValue error %u\n", GetLastError()); -todo_wine ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); + ok(len == 0, "VerQueryValue returned %u, expected 0\n", len); ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); for (i = 0; i < sizeof(value_name)/sizeof(value_name[0]); i++) @@ -574,10 +574,61 @@ HeapFree(GetProcessHeap(), 0, ver); } +static void test_extra_block(void) +{ + WORD extra_block[] = { + 72, 0, 0, 'W', 'i', 'n', 'e', 'T', 'e', 's', 't', '\0', + 24, 4, 0, 'B', 'i', 'n', 'a', 'r', 'y', '\0', 0xbeef, 0xdead, + 24, 4, 1, 'T', 'e', 'x', 't', '\0', 'B', '-', ')', '\0', + }; + char buf[MAX_PATH]; + UINT len, ret; + ULONG w; + char *ver, *p; + WORD *length; + + ret = GetModuleFileNameA(NULL, buf, sizeof(buf)); + ok(ret, "GetModuleFileNameA failed\n"); + + len = GetFileVersionInfoSizeA(buf, NULL); + ok(len, "GetFileVersionInfoSizeA(%s) error %u\n", buf, GetLastError()); + + ver = HeapAlloc(GetProcessHeap(), 0, len + sizeof(extra_block) * 2); + ok(ver != NULL, "Can't allocate memory\n"); + + ret = GetFileVersionInfoA(buf, 0, len, ver); + ok(ret, "GetFileVersionInfoA error %u\n", GetLastError()); + + /* forge the string table, as windres dislike an extra block */ + length = (WORD *)ver; /* see VS_VERSION_INFO_STRUCT32 for details */ + memcpy(ver + *length, extra_block, sizeof(extra_block)); + *length += sizeof(extra_block); + + p = (char *)0xdeadbeef; + len = 0xdeadbeef; + w = 0xdeadbeef; + ret = VerQueryValueA(ver, "WineTest\\Binary", (LPVOID*)&p, &len); + ok(ret, "VerQueryValue error %u\n", GetLastError()); + ok(len == 4, "VerQueryValue returned %u, expected 4\n", len); + ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); + ok(memcmp(p, &w, sizeof(w)) == 0, "got 0x%08x, expected 0x%08x\n", *(PULONG)p, w); + + p = (char *)0xdeadbeef; + len = 0xdeadbeef; + ret = VerQueryValueA(ver, "WineTest\\Text", (LPVOID*)&p, &len); + ok(ret, "VerQueryValue error %u\n", GetLastError()); + ok(len == 4, "VerQueryValue returned %u, expected 4\n", len); + ok(p != (char *)0xdeadbeef, "not expected 0xdeadbeef\n"); + ok(strcmp(p, "B-)") == 0, "got '%s', expected '%s'\n", p, "B-)"); + + HeapFree(GetProcessHeap(), 0, ver); +} + START_TEST(info) { test_info_size(); test_info(); test_32bit_win(); test_VerQueryValueA(); + test_extra_block(); } diff -Nru wine1.7-1.7.13/dlls/version/version.c wine1.7-1.7.16/dlls/version/version.c --- wine1.7-1.7.13/dlls/version/version.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/version/version.c 2014-04-04 19:13:44.000000000 +0000 @@ -567,7 +567,7 @@ { WORD wLength; WORD wValueLength; - WORD wType; + WORD wType; /* 1:Text, 0:Binary */ WCHAR szKey[1]; #if 0 /* variable length structure */ /* DWORD aligned */ @@ -887,7 +887,7 @@ * Gets a value from a 32-bit PE resource */ static BOOL VersionInfo32_QueryValue( const VS_VERSION_INFO_STRUCT32 *info, LPCWSTR lpSubBlock, - LPVOID *lplpBuffer, UINT *puLen ) + LPVOID *lplpBuffer, UINT *puLen, BOOL *pbText ) { TRACE("lpSubBlock : (%s)\n", debugstr_w(lpSubBlock)); @@ -923,6 +923,8 @@ *lplpBuffer = VersionInfo32_Value( info ); if (puLen) *puLen = info->wValueLength; + if (pbText) + *pbText = info->wType; return TRUE; } @@ -934,7 +936,6 @@ LPVOID *lplpBuffer, PUINT puLen ) { static const char rootA[] = "\\"; - static const char varfileinfoA[] = "\\VarFileInfo\\Translation"; const VS_VERSION_INFO_STRUCT16 *info = pBlock; TRACE("(%p,%s,%p,%p)\n", @@ -948,7 +949,7 @@ if ( !VersionInfoIs16( info ) ) { - BOOL ret; + BOOL ret, isText; INT len; LPWSTR lpSubBlockW; @@ -960,11 +961,11 @@ MultiByteToWideChar(CP_ACP, 0, lpSubBlock, -1, lpSubBlockW, len); - ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, puLen); + ret = VersionInfo32_QueryValue(pBlock, lpSubBlockW, lplpBuffer, puLen, &isText); HeapFree(GetProcessHeap(), 0, lpSubBlockW); - if (ret && strcasecmp( lpSubBlock, rootA ) && strcasecmp( lpSubBlock, varfileinfoA )) + if (ret && isText) { /* Set lpBuffer so it points to the 'empty' area where we store * the converted strings @@ -1040,7 +1041,7 @@ return ret; } - return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen); + return VersionInfo32_QueryValue(info, lpSubBlock, lplpBuffer, puLen, NULL); } diff -Nru wine1.7-1.7.13/dlls/wbemprox/builtin.c wine1.7-1.7.16/dlls/wbemprox/builtin.c --- wine1.7-1.7.13/dlls/wbemprox/builtin.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wbemprox/builtin.c 2014-04-04 19:13:44.000000000 +0000 @@ -75,6 +75,8 @@ {'_','_','P','A','R','A','M','E','T','E','R','S',0}; static const WCHAR class_physicalmediaW[] = {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','d','i','a',0}; +static const WCHAR class_physicalmemoryW[] = + {'W','i','n','3','2','_','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; static const WCHAR class_qualifiersW[] = {'_','_','Q','U','A','L','I','F','I','E','R','S',0}; static const WCHAR class_process_getowner_outW[] = @@ -101,10 +103,16 @@ {'A','d','a','p','t','e','r','T','y','p','e',0}; static const WCHAR prop_addresswidthW[] = {'A','d','d','r','e','s','s','W','i','d','t','h',0}; +static const WCHAR prop_availabilityW[] = + {'A','v','a','i','l','a','b','i','l','i','t','y',0}; static const WCHAR prop_bootableW[] = {'B','o','o','t','a','b','l','e',0}; static const WCHAR prop_bootpartitionW[] = {'B','o','o','t','P','a','r','t','i','t','i','o','n',0}; +static const WCHAR prop_buildnumberW[] = + {'B','u','i','l','d','N','u','m','b','e','r',0}; +static const WCHAR prop_capacityW[] = + {'C','a','p','a','c','i','t','y',0}; static const WCHAR prop_captionW[] = {'C','a','p','t','i','o','n',0}; static const WCHAR prop_classW[] = @@ -161,8 +169,12 @@ {'I','d','e','n','t','i','f','i','c','a','t','i','o','n','C','o','d','e',0}; static const WCHAR prop_indexW[] = {'I','n','d','e','x',0}; +static const WCHAR prop_installdateW[] = + {'I','n','s','t','a','l','l','D','a','t','e',0}; static const WCHAR prop_interfaceindexW[] = {'I','n','t','e','r','f','a','c','e','I','n','d','e','x',0}; +static const WCHAR prop_interfacetypeW[] = + {'I','n','t','e','r','f','a','c','e','T','y','p','e',0}; static const WCHAR prop_intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0}; static const WCHAR prop_ipconnectionmetricW[] = @@ -181,6 +193,8 @@ {'M','a','n','u','f','a','c','t','u','r','e','r',0}; static const WCHAR prop_maxclockspeedW[] = {'M','a','x','C','l','o','c','k','S','p','e','e','d',0}; +static const WCHAR prop_mediatypeW[] = + {'M','e','d','i','a','T','y','p','e',0}; static const WCHAR prop_memberW[] = {'M','e','m','b','e','r',0}; static const WCHAR prop_methodW[] = @@ -261,6 +275,8 @@ {'V','a','r','i','a','n','t','T','y','p','e',0}; static const WCHAR prop_versionW[] = {'V','e','r','s','i','o','n',0}; +static const WCHAR prop_volumeserialnumberW[] = + {'V','o','l','u','m','e','S','e','r','i','a','l','N','u','m','b','e','r',0}; /* column definitions must be kept in sync with record structures below */ static const struct column col_baseboard[] = @@ -285,6 +301,7 @@ { { prop_deviceidW, CIM_STRING|COL_FLAG_KEY }, { prop_driveW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_mediatypeW, CIM_STRING }, { prop_nameW, CIM_STRING }, { prop_pnpdeviceidW, CIM_STRING } }; @@ -312,11 +329,14 @@ }; static const struct column col_diskdrive[] = { - { prop_deviceidW, CIM_STRING|COL_FLAG_KEY }, - { prop_indexW, CIM_UINT32, VT_I4 }, - { prop_manufacturerW, CIM_STRING }, - { prop_modelW, CIM_STRING }, - { prop_serialnumberW, CIM_STRING } + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_indexW, CIM_UINT32, VT_I4 }, + { prop_interfacetypeW, CIM_STRING }, + { prop_manufacturerW, CIM_STRING }, + { prop_mediatypeW, CIM_STRING }, + { prop_modelW, CIM_STRING }, + { prop_serialnumberW, CIM_STRING }, + { prop_sizeW, CIM_UINT64 } }; static const struct column col_diskpartition[] = { @@ -332,12 +352,13 @@ }; static const struct column col_logicaldisk[] = { - { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, - { prop_drivetypeW, CIM_UINT32, VT_I4 }, - { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_freespaceW, CIM_UINT64 }, - { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, - { prop_sizeW, CIM_UINT64 } + { prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY }, + { prop_drivetypeW, CIM_UINT32, VT_I4 }, + { prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_freespaceW, CIM_UINT64 }, + { prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_sizeW, CIM_UINT64 }, + { prop_volumeserialnumberW, CIM_STRING|COL_FLAG_DYNAMIC } }; static const struct column col_networkadapter[] = { @@ -362,10 +383,12 @@ }; static const struct column col_os[] = { + { prop_buildnumberW, CIM_STRING }, { prop_captionW, CIM_STRING }, { prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_csdversionW, CIM_STRING }, + { prop_installdateW, CIM_DATETIME }, { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC }, @@ -374,6 +397,7 @@ { prop_oslanguageW, CIM_UINT32, VT_I4 }, { prop_osproductsuiteW, CIM_UINT32, VT_I4 }, { prop_ostypeW, CIM_UINT16, VT_I4 }, + { prop_serialnumberW, CIM_STRING }, { prop_servicepackmajorW, CIM_UINT16, VT_I4 }, { prop_servicepackminorW, CIM_UINT16, VT_I4 }, { prop_suitemaskW, CIM_UINT32, VT_I4 }, @@ -392,7 +416,12 @@ }; static const struct column col_physicalmedia[] = { - { prop_serialnumberW, CIM_STRING } + { prop_serialnumberW, CIM_STRING }, + { prop_tagW, CIM_STRING } +}; +static const struct column col_physicalmemory[] = +{ + { prop_capacityW, CIM_UINT64 } }; static const struct column col_process[] = { @@ -463,6 +492,7 @@ { { prop_adapterdactypeW, CIM_STRING }, { prop_adapterramW, CIM_UINT32, VT_I4 }, + { prop_availabilityW, CIM_UINT16 }, { prop_currentbitsperpixelW, CIM_UINT32 }, { prop_currenthorizontalresW, CIM_UINT32 }, { prop_currentverticalresW, CIM_UINT32 }, @@ -490,6 +520,8 @@ {'W','i','n','e',0}; static const WCHAR bios_versionW[] = {'W','I','N','E',' ',' ',' ','-',' ','1',0}; +static const WCHAR cdromdrive_mediatypeW[] = + {'C','D','-','R','O','M',0}; static const WCHAR cdromdrive_nameW[] = {'W','i','n','e',' ','C','D','-','R','O','M',' ','A','T','A',' ','D','e','v','i','c','e',0}; static const WCHAR cdromdrive_pnpdeviceidW[]= @@ -505,34 +537,46 @@ {'T','h','e',' ','W','i','n','e',' ','P','r','o','j','e','c','t',0}; static const WCHAR compsys_modelW[] = {'W','i','n','e',0}; -static const WCHAR diskdrive_deviceidW[] = - {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0}; -static const WCHAR diskdrive_modelW[] = - {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0}; +static const WCHAR diskdrive_interfacetypeW[] = + {'I','D','E',0}; static const WCHAR diskdrive_manufacturerW[] = {'(','S','t','a','n','d','a','r','d',' ','d','i','s','k',' ','d','r','i','v','e','s',')',0}; +static const WCHAR diskdrive_mediatype_fixedW[] = + {'F','i','x','e','d',' ','h','a','r','d',' ','d','i','s','k',0}; +static const WCHAR diskdrive_mediatype_removableW[] = + {'R','e','m','o','v','a','b','l','e',' ','m','e','d','i','a',0}; +static const WCHAR diskdrive_modelW[] = + {'W','i','n','e',' ','D','i','s','k',' ','D','r','i','v','e',0}; static const WCHAR diskdrive_serialW[] = {'W','I','N','E','H','D','I','S','K',0}; static const WCHAR networkadapter_pnpdeviceidW[]= {'P','C','I','\\','V','E','N','_','8','0','8','6','&','D','E','V','_','1','0','0','E','&', 'S','U','B','S','Y','S','_','0','0','1','E','8','0','8','6','&','R','E','V','_','0','2','\\', '3','&','2','6','7','A','6','1','6','A','&','1','&','1','8',0}; +static const WCHAR os_32bitW[] = + {'3','2','-','b','i','t',0}; +static const WCHAR os_64bitW[] = + {'6','4','-','b','i','t',0}; +static const WCHAR os_buildnumberW[] = + {'2','6','0','0',0}; static const WCHAR os_captionW[] = {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ', 'V','e','r','s','i','o','n',' ','=',' ','5','.','1','.','2','6','0','0',0}; static const WCHAR os_csdversionW[] = {'S','e','r','v','i','c','e',' ','P','a','c','k',' ','3',0}; -static const WCHAR os_32bitW[] = - {'3','2','-','b','i','t',0}; -static const WCHAR os_64bitW[] = - {'6','4','-','b','i','t',0}; +static const WCHAR os_installdateW[] = + {'2','0','1','4','0','1','0','1','0','0','0','0','0','0','.','0','0','0','0','0','0','+','0','0','0',0}; static const WCHAR os_nameW[] = {'M','i','c','r','o','s','o','f','t',' ','W','i','n','d','o','w','s',' ','X','P',' ', 'P','r','o','f','e','s','s','i','o','n','a','l','|','C',':','\\','W','I','N','D','O','W','S', '|','\\','D','e','v','i','c','e','\\','H','a','r','d','d','i','s','k','0', '\\','P','a','r','t','i','t','i','o','n','1',0}; +static const WCHAR os_serialnumberW[] = + {'1','2','3','4','5','-','O','E','M','-','1','2','3','4','5','6','7','-','1','2','3','4','5',0}; static const WCHAR os_versionW[] = {'5','.','1','.','2','6','0','0',0}; +static const WCHAR physicalmedia_tagW[] = + {'\\','\\','.','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','0',0}; static const WCHAR sounddevice_productnameW[] = {'W','i','n','e',' ','A','u','d','i','o',' ','D','e','v','i','c','e',0}; static const WCHAR videocontroller_dactypeW[] = @@ -563,6 +607,7 @@ { const WCHAR *device_id; const WCHAR *drive; + const WCHAR *mediatype; const WCHAR *name; const WCHAR *pnpdevice_id; }; @@ -592,9 +637,12 @@ { const WCHAR *device_id; UINT32 index; + const WCHAR *interfacetype; const WCHAR *manufacturer; - const WCHAR *name; + const WCHAR *mediatype; + const WCHAR *model; const WCHAR *serialnumber; + UINT64 size; }; struct record_diskpartition { @@ -616,6 +664,7 @@ UINT64 freespace; const WCHAR *name; UINT64 size; + const WCHAR *volumeserialnumber; }; struct record_networkadapter { @@ -640,10 +689,12 @@ }; struct record_operatingsystem { + const WCHAR *buildnumber; const WCHAR *caption; const WCHAR *codeset; const WCHAR *countrycode; const WCHAR *csdversion; + const WCHAR *installdate; const WCHAR *lastbootuptime; const WCHAR *localdatetime; const WCHAR *locale; @@ -652,6 +703,7 @@ UINT32 oslanguage; UINT32 osproductsuite; UINT16 ostype; + const WCHAR *serialnumber; UINT16 servicepackmajor; UINT16 servicepackminor; UINT32 suitemask; @@ -671,6 +723,11 @@ struct record_physicalmedia { const WCHAR *serialnumber; + const WCHAR *tag; +}; +struct record_physicalmemory +{ + UINT64 capacity; }; struct record_process { @@ -741,6 +798,7 @@ { const WCHAR *adapter_dactype; UINT32 adapter_ram; + UINT16 availability; UINT32 current_bitsperpixel; UINT32 current_horizontalres; UINT32 current_verticalres; @@ -760,10 +818,6 @@ { bios_descriptionW, bios_descriptionW, bios_manufacturerW, bios_releasedateW, bios_serialnumberW, bios_smbiosbiosversionW, bios_versionW } }; -static const struct record_diskdrive data_diskdrive[] = -{ - { diskdrive_deviceidW, 0, diskdrive_manufacturerW, diskdrive_modelW, diskdrive_serialW } -}; static const struct record_param data_param[] = { { class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 }, @@ -794,7 +848,7 @@ static const struct record_physicalmedia data_physicalmedia[] = { - { diskdrive_serialW } + { diskdrive_serialW, physicalmedia_tagW } }; static const struct record_qualifier data_qualifier[] = { @@ -874,6 +928,7 @@ rec->device_id = cdromdrive_pnpdeviceidW; sprintfW( drive, fmtW, 'A' + i ); rec->drive = heap_strdupW( drive ); + rec->mediatype = cdromdrive_mediatypeW; rec->name = cdromdrive_nameW; rec->pnpdevice_id = cdromdrive_pnpdeviceidW; if (!match_row( table, row, cond, &status )) @@ -1255,11 +1310,13 @@ DWORD drives = GetLogicalDrives(); WIN32_FIND_DATAW data; HANDLE handle; - struct dirstack *dirstack = alloc_dirstack(2); + struct dirstack *dirstack; enum fill_status status = FILL_STATUS_UNFILTERED; if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED; + dirstack = alloc_dirstack(2); + for (i = 0; i < sizeof(drives); i++) { if (!(drives & (1 << i))) continue; @@ -1285,6 +1342,7 @@ if (!resize_table( table, row + 1, sizeof(*rec) )) { status = FILL_STATUS_FAILED; + FindClose( handle ); goto done; } if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue; @@ -1294,6 +1352,7 @@ { if (push_dir( dirstack, new_path, len )) continue; heap_free( new_path ); + FindClose( handle ); status = FILL_STATUS_FAILED; goto done; } @@ -1427,16 +1486,6 @@ return status; } -static WCHAR *get_filesystem( const WCHAR *root ) -{ - static const WCHAR ntfsW[] = {'N','T','F','S',0}; - WCHAR buffer[MAX_PATH + 1]; - - if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 )) - return heap_strdupW( buffer ); - return heap_strdupW( ntfsW ); -} - static UINT64 get_freespace( const WCHAR *dir, UINT64 *disksize ) { WCHAR root[] = {'\\','\\','.','\\','A',':',0}; @@ -1458,6 +1507,69 @@ return free.QuadPart; } +static enum fill_status fill_diskdrive( struct table *table, const struct expr *cond ) +{ + static const WCHAR fmtW[] = + {'\\','\\','\\','\\','.','\\','\\','P','H','Y','S','I','C','A','L','D','R','I','V','E','%','u',0}; + WCHAR device_id[sizeof(fmtW)/sizeof(fmtW[0]) + 10], root[] = {'A',':','\\',0}; + struct record_diskdrive *rec; + UINT i, row = 0, offset = 0, index = 0, type; + UINT64 size = 1024 * 1024 * 1024; + DWORD drives = GetLogicalDrives(); + enum fill_status status = FILL_STATUS_UNFILTERED; + + if (!resize_table( table, 2, sizeof(*rec) )) return FILL_STATUS_FAILED; + + for (i = 0; i < sizeof(drives); i++) + { + if (drives & (1 << i)) + { + root[0] = 'A' + i; + type = GetDriveTypeW( root ); + if (type != DRIVE_FIXED && type != DRIVE_REMOVABLE) + continue; + + if (!resize_table( table, row + 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + + rec = (struct record_diskdrive *)(table->data + offset); + sprintfW( device_id, fmtW, index ); + rec->device_id = heap_strdupW( device_id ); + rec->index = index; + rec->interfacetype = diskdrive_interfacetypeW; + rec->manufacturer = diskdrive_manufacturerW; + if (type == DRIVE_FIXED) + rec->mediatype = diskdrive_mediatype_fixedW; + else + rec->mediatype = diskdrive_mediatype_removableW; + rec->model = diskdrive_modelW; + rec->serialnumber = diskdrive_serialW; + get_freespace( root, &size ); + rec->size = size; + if (!match_row( table, row, cond, &status )) + { + free_row_values( table, row ); + continue; + } + offset += sizeof(*rec); + index++; + row++; + } + } + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + +static WCHAR *get_filesystem( const WCHAR *root ) +{ + static const WCHAR ntfsW[] = {'N','T','F','S',0}; + WCHAR buffer[MAX_PATH + 1]; + + if (GetVolumeInformationW( root, NULL, 0, NULL, NULL, NULL, buffer, MAX_PATH + 1 )) + return heap_strdupW( buffer ); + return heap_strdupW( ntfsW ); +} + static enum fill_status fill_diskpartition( struct table *table, const struct expr *cond ) { static const WCHAR fmtW[] = @@ -1509,6 +1621,17 @@ return status; } +static WCHAR *get_volumeserialnumber( const WCHAR *root ) +{ + static const WCHAR fmtW[] = {'%','0','8','X',0}; + DWORD serial = 0; + WCHAR buffer[9]; + + GetVolumeInformationW( root, NULL, 0, &serial, NULL, NULL, NULL, 0 ); + sprintfW( buffer, fmtW, serial ); + return heap_strdupW( buffer ); +} + static enum fill_status fill_logicaldisk( struct table *table, const struct expr *cond ) { static const WCHAR fmtW[] = {'%','c',':',0}; @@ -1534,12 +1657,13 @@ rec = (struct record_logicaldisk *)(table->data + offset); sprintfW( device_id, fmtW, 'A' + i ); - rec->device_id = heap_strdupW( device_id ); - rec->drivetype = type; - rec->filesystem = get_filesystem( root ); - rec->freespace = get_freespace( root, &size ); - rec->name = heap_strdupW( device_id ); - rec->size = size; + rec->device_id = heap_strdupW( device_id ); + rec->drivetype = type; + rec->filesystem = get_filesystem( root ); + rec->freespace = get_freespace( root, &size ); + rec->name = heap_strdupW( device_id ); + rec->size = size; + rec->volumeserialnumber = get_volumeserialnumber( root ); if (!match_row( table, row, cond, &status )) { free_row_values( table, row ); @@ -1707,6 +1831,24 @@ return status; } +static enum fill_status fill_physicalmemory( struct table *table, const struct expr *cond ) +{ + struct record_physicalmemory *rec; + enum fill_status status = FILL_STATUS_UNFILTERED; + UINT row = 0; + + if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; + + rec = (struct record_physicalmemory *)table->data; + rec->capacity = get_total_physical_memory(); + if (!match_row( table, row, cond, &status )) free_row_values( table, row ); + else row++; + + TRACE("created %u rows\n", row); + table->num_rows = row; + return status; +} + static WCHAR *get_cmdline( DWORD process_id ) { if (process_id == GetCurrentProcessId()) return heap_strdupW( GetCommandLineW() ); @@ -1966,10 +2108,12 @@ if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED; rec = (struct record_operatingsystem *)table->data; + rec->buildnumber = os_buildnumberW; rec->caption = os_captionW; rec->codeset = get_codeset(); rec->countrycode = get_countrycode(); rec->csdversion = os_csdversionW; + rec->installdate = os_installdateW; rec->lastbootuptime = get_lastbootuptime(); rec->localdatetime = get_localdatetime(); rec->locale = get_locale(); @@ -1978,6 +2122,7 @@ rec->oslanguage = GetSystemDefaultLangID(); rec->osproductsuite = 2461140; /* Windows XP Professional */ rec->ostype = 18; /* WINNT */ + rec->serialnumber = os_serialnumberW; rec->servicepackmajor = 3; rec->servicepackminor = 0; rec->suitemask = 272; /* Single User + Terminal */ @@ -2205,6 +2350,7 @@ rec = (struct record_videocontroller *)table->data; rec->adapter_dactype = videocontroller_dactypeW; rec->adapter_ram = vidmem; + rec->availability = 3; /* Running or Full Power */ rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres ); rec->current_horizontalres = hres; rec->current_verticalres = vres; @@ -2231,7 +2377,7 @@ { class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys }, { class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile }, { class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory }, - { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, SIZEOF(data_diskdrive), 0, (BYTE *)data_diskdrive }, + { class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive }, { class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition }, { class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, { class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk }, @@ -2241,6 +2387,7 @@ { class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os }, { class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param }, { class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia }, + { class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory }, { class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process }, { class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor }, { class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier }, diff -Nru wine1.7-1.7.13/dlls/wbemprox/class.c wine1.7-1.7.16/dlls/wbemprox/class.c --- wine1.7-1.7.13/dlls/wbemprox/class.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wbemprox/class.c 2014-04-04 19:13:44.000000000 +0000 @@ -476,17 +476,17 @@ TRACE("%p, %s, %08x, %s, %p\n", iface, debugstr_w(wszQualifierName), lFlags, debugstr_variant(pQualifierVal), pNames); - if (wszQualifierName || pQualifierVal) - { - FIXME("qualifier not supported\n"); - return E_NOTIMPL; - } - if (lFlags != WBEM_FLAG_ALWAYS) + if (lFlags != WBEM_FLAG_ALWAYS && + lFlags != WBEM_FLAG_NONSYSTEM_ONLY && + lFlags != WBEM_FLAG_SYSTEM_ONLY) { FIXME("flags %08x not supported\n", lFlags); return E_NOTIMPL; } - return get_properties( ec->query->view, pNames ); + if (wszQualifierName || pQualifierVal) + FIXME("qualifier not supported\n"); + + return get_properties( ec->query->view, lFlags, pNames ); } static HRESULT WINAPI class_object_BeginEnumeration( diff -Nru wine1.7-1.7.13/dlls/wbemprox/query.c wine1.7-1.7.16/dlls/wbemprox/query.c --- wine1.7-1.7.13/dlls/wbemprox/query.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wbemprox/query.c 2014-04-04 19:13:44.000000000 +0000 @@ -250,6 +250,15 @@ UINT column; LONGLONG lval; + if (expr->op == OP_NOT) + { + hr = eval_cond( table, row, expr->left, &lval, type ); + if (hr != S_OK) + return hr; + *val = !lval; + return S_OK; + } + hr = get_column_index( table, expr->left->u.propval->name, &column ); if (hr != S_OK) return hr; @@ -950,7 +959,7 @@ return set_value( view->table, row, column, val, type ); } -HRESULT get_properties( const struct view *view, SAFEARRAY **props ) +HRESULT get_properties( const struct view *view, LONG flags, SAFEARRAY **props ) { SAFEARRAY *sa; BSTR str; @@ -961,8 +970,14 @@ for (i = 0; i < view->table->num_cols; i++) { + BOOL is_system; + if (is_method( view->table, i )) continue; + is_system = is_system_prop( view->table->columns[i].name ); + if ((flags & WBEM_FLAG_NONSYSTEM_ONLY) && is_system) continue; + else if ((flags & WBEM_FLAG_SYSTEM_ONLY) && !is_system) continue; + str = SysAllocString( view->table->columns[i].name ); if (!str || SafeArrayPutElement( sa, &i, str ) != S_OK) { diff -Nru wine1.7-1.7.13/dlls/wbemprox/tests/query.c wine1.7-1.7.16/dlls/wbemprox/tests/query.c --- wine1.7-1.7.13/dlls/wbemprox/tests/query.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wbemprox/tests/query.c 2014-04-04 19:13:44.000000000 +0000 @@ -46,7 +46,7 @@ { VARIANT var; - IEnumWbemClassObject_Next( *result, WBEM_INFINITE, 1, &obj, &count ); + IEnumWbemClassObject_Next( *result, 10000, 1, &obj, &count ); if (!count) break; if (IWbemClassObject_Get( obj, captionW, 0, &var, NULL, NULL ) == WBEM_S_NO_ERROR) @@ -616,6 +616,40 @@ SysFreeString( query ); } +static void test_GetNames( IWbemServices *services ) +{ + static const WCHAR queryW[] = + {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_', + 'O','p','e','r','a','t','i','n','g','S','y','s','t','e','m',0}; + BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW ); + IEnumWbemClassObject *result; + HRESULT hr; + + hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result ); + ok( hr == S_OK, "got %08x\n", hr ); + + for (;;) + { + IWbemClassObject *obj; + SAFEARRAY *names; + ULONG count; + VARIANT val; + + IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count ); + if (!count) break; + + VariantInit( &val ); + hr = IWbemClassObject_GetNames( obj, NULL, WBEM_FLAG_NONSYSTEM_ONLY, &val, &names ); + ok( hr == S_OK, "got %08x\n", hr ); + + SafeArrayDestroy( names ); + IWbemClassObject_Release( obj ); + } + IEnumWbemClassObject_Release( result ); + SysFreeString( query ); + SysFreeString( wql ); +} + START_TEST(query) { static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0}; @@ -647,6 +681,7 @@ test_StdRegProv( services ); test_notification_query_async( services ); test_query_async( services ); + test_GetNames( services ); SysFreeString( path ); IWbemServices_Release( services ); diff -Nru wine1.7-1.7.13/dlls/wbemprox/wbemprox_private.h wine1.7-1.7.16/dlls/wbemprox/wbemprox_private.h --- wine1.7-1.7.13/dlls/wbemprox/wbemprox_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wbemprox/wbemprox_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -53,7 +53,8 @@ OP_NE = 8, OP_ISNULL = 9, OP_NOTNULL = 10, - OP_LIKE = 11 + OP_LIKE = 11, + OP_NOT = 12 }; struct expr; @@ -199,7 +200,7 @@ SAFEARRAY *to_safearray( const struct array *, CIMTYPE ) DECLSPEC_HIDDEN; VARTYPE to_vartype( CIMTYPE ) DECLSPEC_HIDDEN; void destroy_array( struct array *, CIMTYPE ) DECLSPEC_HIDDEN; -HRESULT get_properties( const struct view *, SAFEARRAY ** ) DECLSPEC_HIDDEN; +HRESULT get_properties( const struct view *, LONG, SAFEARRAY ** ) DECLSPEC_HIDDEN; HRESULT get_object( const WCHAR *, IWbemClassObject ** ) DECLSPEC_HIDDEN; BSTR get_method_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN; BSTR get_property_name( const WCHAR *, UINT ) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/wbemprox/wql.y wine1.7-1.7.16/dlls/wbemprox/wql.y --- wine1.7-1.7.13/dlls/wbemprox/wql.y 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wbemprox/wql.y 2014-04-04 19:13:44.000000000 +0000 @@ -318,6 +318,12 @@ if (!$$) YYABORT; } + | TK_NOT expr + { + $$ = expr_unary( ctx, $2, OP_NOT ); + if (!$$) + YYABORT; + } | prop_val TK_EQ const_val { $$ = expr_complex( ctx, $1, OP_EQ, $3 ); diff -Nru wine1.7-1.7.13/dlls/wined3d/arb_program_shader.c wine1.7-1.7.16/dlls/wined3d/arb_program_shader.c --- wine1.7-1.7.13/dlls/wined3d/arb_program_shader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/arb_program_shader.c 2014-04-04 19:13:44.000000000 +0000 @@ -9,7 +9,7 @@ * Copyright 2006 Ivan Gyurdiev * Copyright 2006 Jason Green * Copyright 2006 Henri Verbeet - * Copyright 2007-2011, 2013 Stefan Dösinger for CodeWeavers + * Copyright 2007-2011, 2013-2014 Stefan Dösinger for CodeWeavers * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or @@ -1792,6 +1792,11 @@ static void shader_hw_nop(const struct wined3d_shader_instruction *ins) {} +static DWORD shader_arb_select_component(DWORD swizzle, DWORD component) +{ + return ((swizzle >> 2 * component) & 0x3) * 0x55; +} + static void shader_hw_mov(const struct wined3d_shader_instruction *ins) { const struct wined3d_shader *shader = ins->ctx->shader; @@ -1862,7 +1867,7 @@ * with more than one component. Thus replicate the first source argument over all * 4 components. For example, .xyzw -> .x (or better: .xxxx), .zwxy -> .z, etc) */ struct wined3d_shader_src_param tmp_src = ins->src[0]; - tmp_src.swizzle = (tmp_src.swizzle & 0x3) * 0x55; + tmp_src.swizzle = shader_arb_select_component(tmp_src.swizzle, 0); shader_arb_get_src_param(ins, &tmp_src, 0, src0_param); shader_addline(buffer, "ARL A0.x, %s;\n", src0_param); } @@ -2472,30 +2477,36 @@ } } -static void shader_hw_rcp(const struct wined3d_shader_instruction *ins) +static DWORD abs_modifier(DWORD mod, BOOL *need_abs) { - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - - char dst[50]; - char src[50]; + *need_abs = FALSE; - shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */ - shader_arb_get_src_param(ins, &ins->src[0], 0, src); - if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE) + switch(mod) { - /* Dx sdk says .x is used if no swizzle is given, but our test shows that - * .w is used - */ - strcat(src, ".w"); + case WINED3DSPSM_NONE: return WINED3DSPSM_ABS; + case WINED3DSPSM_NEG: return WINED3DSPSM_ABS; + case WINED3DSPSM_BIAS: *need_abs = TRUE; return WINED3DSPSM_BIAS; + case WINED3DSPSM_BIASNEG: *need_abs = TRUE; return WINED3DSPSM_BIASNEG; + case WINED3DSPSM_SIGN: *need_abs = TRUE; return WINED3DSPSM_SIGN; + case WINED3DSPSM_SIGNNEG: *need_abs = TRUE; return WINED3DSPSM_SIGNNEG; + case WINED3DSPSM_COMP: *need_abs = TRUE; return WINED3DSPSM_COMP; + case WINED3DSPSM_X2: *need_abs = TRUE; return WINED3DSPSM_X2; + case WINED3DSPSM_X2NEG: *need_abs = TRUE; return WINED3DSPSM_X2NEG; + case WINED3DSPSM_DZ: *need_abs = TRUE; return WINED3DSPSM_DZ; + case WINED3DSPSM_DW: *need_abs = TRUE; return WINED3DSPSM_DW; + case WINED3DSPSM_ABS: return WINED3DSPSM_ABS; + case WINED3DSPSM_ABSNEG: return WINED3DSPSM_ABS; } - - shader_addline(buffer, "RCP%s %s, %s;\n", shader_arb_get_modifier(ins), dst, src); + FIXME("Unknown modifier %u\n", mod); + return mod; } static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; const char *instruction; + struct wined3d_shader_src_param src0_copy = ins->src[0]; + BOOL need_abs = FALSE; char dst[50]; char src[50]; @@ -2504,24 +2515,46 @@ { case WINED3DSIH_RSQ: instruction = "RSQ"; break; case WINED3DSIH_RCP: instruction = "RCP"; break; - case WINED3DSIH_EXP: instruction = "EX2"; break; - case WINED3DSIH_EXPP: instruction = "EXP"; break; + case WINED3DSIH_EXPP: + if (ins->ctx->reg_maps->shader_version.major < 2) + { + instruction = "EXP"; + break; + } + /* Drop through. */ + case WINED3DSIH_EXP: + instruction = "EX2"; + break; + case WINED3DSIH_LOG: + case WINED3DSIH_LOGP: + /* The precision requirements suggest that LOGP matches ARBvp's LOG + * instruction, but notice that the output of those instructions is + * different. */ + src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs); + instruction = "LG2"; + break; default: instruction = ""; FIXME("Unhandled opcode %#x\n", ins->handler_idx); break; } + /* Dx sdk says .x is used if no swizzle is given, but our test shows that + * .w is used. */ + src0_copy.swizzle = shader_arb_select_component(src0_copy.swizzle, 3); + shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */ - shader_arb_get_src_param(ins, &ins->src[0], 0, src); - if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE) + shader_arb_get_src_param(ins, &src0_copy, 0, src); + + if(need_abs) { - /* Dx sdk says .x is used if no swizzle is given, but our test shows that - * .w is used - */ - strcat(src, ".w"); + shader_addline(buffer, "ABS TA.w, %s;\n", src); + shader_addline(buffer, "%s%s %s, TA.w;\n", instruction, shader_arb_get_modifier(ins), dst); + } + else + { + shader_addline(buffer, "%s%s %s, %s;\n", instruction, shader_arb_get_modifier(ins), dst, src); } - shader_addline(buffer, "%s%s %s, %s;\n", instruction, shader_arb_get_modifier(ins), dst, src); } static void shader_hw_nrm(const struct wined3d_shader_instruction *ins) @@ -2761,64 +2794,6 @@ shader_addline(buffer, "MUL%s %s, %s, ycorrection.y;\n", shader_arb_get_modifier(ins), dst, dst_name); } -static DWORD abs_modifier(DWORD mod, BOOL *need_abs) -{ - *need_abs = FALSE; - - switch(mod) - { - case WINED3DSPSM_NONE: return WINED3DSPSM_ABS; - case WINED3DSPSM_NEG: return WINED3DSPSM_ABS; - case WINED3DSPSM_BIAS: *need_abs = TRUE; return WINED3DSPSM_BIAS; - case WINED3DSPSM_BIASNEG: *need_abs = TRUE; return WINED3DSPSM_BIASNEG; - case WINED3DSPSM_SIGN: *need_abs = TRUE; return WINED3DSPSM_SIGN; - case WINED3DSPSM_SIGNNEG: *need_abs = TRUE; return WINED3DSPSM_SIGNNEG; - case WINED3DSPSM_COMP: *need_abs = TRUE; return WINED3DSPSM_COMP; - case WINED3DSPSM_X2: *need_abs = TRUE; return WINED3DSPSM_X2; - case WINED3DSPSM_X2NEG: *need_abs = TRUE; return WINED3DSPSM_X2NEG; - case WINED3DSPSM_DZ: *need_abs = TRUE; return WINED3DSPSM_DZ; - case WINED3DSPSM_DW: *need_abs = TRUE; return WINED3DSPSM_DW; - case WINED3DSPSM_ABS: return WINED3DSPSM_ABS; - case WINED3DSPSM_ABSNEG: return WINED3DSPSM_ABS; - } - FIXME("Unknown modifier %u\n", mod); - return mod; -} - -static void shader_hw_log(const struct wined3d_shader_instruction *ins) -{ - struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - char src0[50], dst[50]; - struct wined3d_shader_src_param src0_copy = ins->src[0]; - BOOL need_abs = FALSE; - const char *instr; - - switch(ins->handler_idx) - { - case WINED3DSIH_LOG: instr = "LG2"; break; - case WINED3DSIH_LOGP: instr = "LOG"; break; - default: - ERR("Unexpected instruction %d\n", ins->handler_idx); - return; - } - - /* LOG and LOGP operate on the absolute value of the input */ - src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs); - - shader_arb_get_dst_param(ins, &ins->dst[0], dst); - shader_arb_get_src_param(ins, &src0_copy, 0, src0); - - if(need_abs) - { - shader_addline(buffer, "ABS TA, %s;\n", src0); - shader_addline(buffer, "%s%s %s, TA;\n", instr, shader_arb_get_modifier(ins), dst); - } - else - { - shader_addline(buffer, "%s%s %s, %s;\n", instr, shader_arb_get_modifier(ins), dst, src0); - } -} - static void shader_hw_pow(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -5052,8 +5027,12 @@ static void shader_arb_free_context_data(struct wined3d_context *context) { - struct shader_arb_priv *priv = context->swapchain->device->shader_priv; + struct shader_arb_priv *priv; + + if (!context->swapchain) + return; + priv = context->swapchain->device->shader_priv; if (priv->last_context == context) priv->last_context = NULL; } @@ -5239,8 +5218,8 @@ /* WINED3DSIH_LABEL */ shader_hw_label, /* WINED3DSIH_LD */ NULL, /* WINED3DSIH_LIT */ shader_hw_map2gl, - /* WINED3DSIH_LOG */ shader_hw_log, - /* WINED3DSIH_LOGP */ shader_hw_log, + /* WINED3DSIH_LOG */ shader_hw_scalar_op, + /* WINED3DSIH_LOGP */ shader_hw_scalar_op, /* WINED3DSIH_LOOP */ shader_hw_loop, /* WINED3DSIH_LRP */ shader_hw_lrp, /* WINED3DSIH_LT */ NULL, @@ -5260,7 +5239,7 @@ /* WINED3DSIH_NRM */ shader_hw_nrm, /* WINED3DSIH_PHASE */ shader_hw_nop, /* WINED3DSIH_POW */ shader_hw_pow, - /* WINED3DSIH_RCP */ shader_hw_rcp, + /* WINED3DSIH_RCP */ shader_hw_scalar_op, /* WINED3DSIH_REP */ shader_hw_rep, /* WINED3DSIH_RET */ shader_hw_ret, /* WINED3DSIH_ROUND_NI */ NULL, diff -Nru wine1.7-1.7.13/dlls/wined3d/buffer.c wine1.7-1.7.16/dlls/wined3d/buffer.c --- wine1.7-1.7.13/dlls/wined3d/buffer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/buffer.c 2014-04-04 19:13:44.000000000 +0000 @@ -944,13 +944,20 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags) { - BOOL dirty = buffer_is_dirty(buffer); LONG count; BYTE *base; TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags); flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags); + /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture + * fill rate test seems to depend on this. When we map a buffer with + * GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the + * previous contents of the buffer. The r600g driver only does this when + * the buffer is currently in use, while the proprietary NVIDIA driver + * appears to do this unconditionally. */ + if (buffer->flags & WINED3D_BUFFER_DISCARD) + flags &= ~WINED3D_MAP_DISCARD; count = ++buffer->resource.map_count; if (buffer->buffer_object) @@ -1026,25 +1033,14 @@ context_release(context); } } - else - { - if (dirty) - { - if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3D_MAP_NOOVERWRITE)) - { - buffer->flags &= ~WINED3D_BUFFER_NOSYNC; - } - } - else if(flags & WINED3D_MAP_NOOVERWRITE) - { - buffer->flags |= WINED3D_BUFFER_NOSYNC; - } - if (flags & WINED3D_MAP_DISCARD) - { - buffer->flags |= WINED3D_BUFFER_DISCARD; - } - } + if (flags & WINED3D_MAP_DISCARD) + buffer->flags |= WINED3D_BUFFER_DISCARD; + + if (!(flags & WINED3D_MAP_NOOVERWRITE)) + buffer->flags &= ~WINED3D_BUFFER_NOSYNC; + else if (!buffer_is_dirty(buffer)) + buffer->flags |= WINED3D_BUFFER_NOSYNC; } base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.heap_memory; diff -Nru wine1.7-1.7.13/dlls/wined3d/context.c wine1.7-1.7.16/dlls/wined3d/context.c --- wine1.7-1.7.13/dlls/wined3d/context.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/context.c 2014-04-04 19:13:44.000000000 +0000 @@ -719,11 +719,47 @@ } } -static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC dc, int format) +static BOOL context_restore_pixel_format(struct wined3d_context *ctx) { - int current = GetPixelFormat(dc); + const struct wined3d_gl_info *gl_info = ctx->gl_info; + BOOL ret = FALSE; - if (current == format) return TRUE; + if (ctx->restore_pf && IsWindow(ctx->restore_pf_win)) + { + if (ctx->gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH]) + { + HDC dc = GetDC(ctx->restore_pf_win); + if (dc) + { + if (!(ret = GL_EXTCALL(wglSetPixelFormatWINE(dc, ctx->restore_pf)))) + { + ERR("wglSetPixelFormatWINE failed to restore pixel format %d on window %p.\n", + ctx->restore_pf, ctx->restore_pf_win); + } + ReleaseDC(ctx->restore_pf_win, dc); + } + } + else + { + ERR("can't restore pixel format %d on window %p\n", ctx->restore_pf, ctx->restore_pf_win); + } + } + + ctx->restore_pf = 0; + ctx->restore_pf_win = NULL; + return ret; +} + +static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BOOL private, int format) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + int current; + + if (dc == context->hdc && context->hdc_is_private && context->hdc_has_format) + return TRUE; + + current = GetPixelFormat(dc); + if (current == format) goto success; if (!current) { @@ -734,7 +770,10 @@ format, dc, GetLastError()); return FALSE; } - return TRUE; + + context->restore_pf = 0; + context->restore_pf_win = private ? NULL : WindowFromDC(dc); + goto success; } /* By default WGL doesn't allow pixel format adjustments but we need it @@ -743,13 +782,25 @@ * when really needed. */ if (gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH]) { + HWND win; + if (!GL_EXTCALL(wglSetPixelFormatWINE(dc, format))) { ERR("wglSetPixelFormatWINE failed to set pixel format %d on device context %p.\n", format, dc); return FALSE; } - return TRUE; + + win = private ? NULL : WindowFromDC(dc); + if (win != context->restore_pf_win) + { + context_restore_pixel_format(context); + + context->restore_pf = private ? 0 : current; + context->restore_pf_win = win; + } + + goto success; } /* OpenGL doesn't allow pixel format adjustments. Print an error and @@ -759,6 +810,11 @@ ERR("Unable to set pixel format %d on device context %p. Already using format %d.\n", format, dc, current); return TRUE; + +success: + if (dc == context->hdc && context->hdc_is_private) + context->hdc_has_format = TRUE; + return TRUE; } static BOOL context_set_gl_context(struct wined3d_context *ctx) @@ -766,7 +822,7 @@ struct wined3d_swapchain *swapchain = ctx->swapchain; BOOL backup = FALSE; - if (!context_set_pixel_format(ctx->gl_info, ctx->hdc, ctx->pixel_format)) + if (!context_set_pixel_format(ctx, ctx->hdc, ctx->hdc_is_private, ctx->pixel_format)) { WARN("Failed to set pixel format %d on device context %p.\n", ctx->pixel_format, ctx->hdc); @@ -799,7 +855,7 @@ return FALSE; } - if (!context_set_pixel_format(ctx->gl_info, dc, ctx->pixel_format)) + if (!context_set_pixel_format(ctx, dc, TRUE, ctx->pixel_format)) { ERR("Failed to set pixel format %d on device context %p.\n", ctx->pixel_format, dc); @@ -817,18 +873,12 @@ ctx->valid = 1; } + ctx->needs_set = 0; return TRUE; } -static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HDC dc, HGLRC gl_ctx, int pf) +static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HDC dc, HGLRC gl_ctx) { - if (!context_set_pixel_format(gl_info, dc, pf)) - { - ERR("Failed to restore pixel format %d on device context %p.\n", pf, dc); - context_set_current(NULL); - return; - } - if (!wglMakeCurrent(dc, gl_ctx)) { ERR("Failed to restore GL context %p on device context %p, last error %#x.\n", @@ -845,32 +895,20 @@ TRACE("Updating context %p window from %p to %p.\n", context, context->win_handle, context->swapchain->win_handle); - if (context->valid) + if (context->hdc) wined3d_release_dc(context->win_handle, context->hdc); - else - context->valid = 1; context->win_handle = context->swapchain->win_handle; + context->hdc_is_private = FALSE; + context->hdc_has_format = FALSE; + context->needs_set = 1; + context->valid = 1; if (!(context->hdc = GetDC(context->win_handle))) { ERR("Failed to get a device context for window %p.\n", context->win_handle); - goto err; + context->valid = 0; } - - if (!context_set_pixel_format(context->gl_info, context->hdc, context->pixel_format)) - { - ERR("Failed to set pixel format %d on device context %p.\n", - context->pixel_format, context->hdc); - goto err; - } - - context_set_gl_context(context); - - return; - -err: - context->valid = 0; } static void context_destroy_gl_resources(struct wined3d_context *context) @@ -882,11 +920,9 @@ HGLRC restore_ctx; HDC restore_dc; unsigned int i; - int restore_pf; restore_ctx = wglGetCurrentContext(); restore_dc = wglGetCurrentDC(); - restore_pf = GetPixelFormat(restore_dc); if (restore_ctx == context->glCtx) restore_ctx = NULL; @@ -964,9 +1000,10 @@ HeapFree(GetProcessHeap(), 0, context->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, context->free_event_queries); + context_restore_pixel_format(context); if (restore_ctx) { - context_restore_gl_context(gl_info, restore_dc, restore_ctx, restore_pf); + context_restore_gl_context(gl_info, restore_dc, restore_ctx); } else if (wglGetCurrentContext() && !wglMakeCurrent(NULL, NULL)) { @@ -1062,12 +1099,17 @@ WARN("Context %p is not the current context.\n", context); } - if (!--context->level && context->restore_ctx) + if (!--context->level) { - TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc); - context_restore_gl_context(context->gl_info, context->restore_dc, context->restore_ctx, context->restore_pf); - context->restore_ctx = NULL; - context->restore_dc = NULL; + if (context_restore_pixel_format(context)) + context->needs_set = 1; + if (context->restore_ctx) + { + TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc); + context_restore_gl_context(context->gl_info, context->restore_dc, context->restore_ctx); + context->restore_ctx = NULL; + context->restore_dc = NULL; + } } } @@ -1086,8 +1128,11 @@ current_gl, wglGetCurrentDC()); context->restore_ctx = current_gl; context->restore_dc = wglGetCurrentDC(); - context->restore_pf = GetPixelFormat(context->restore_dc); + context->needs_set = 1; } + else if (!context->needs_set && !(context->hdc_is_private && context->hdc_has_format) + && context->pixel_format != GetPixelFormat(context->hdc)) + context->needs_set = 1; } } @@ -1295,6 +1340,7 @@ int swap_interval; DWORD state; HDC hdc; + BOOL hdc_is_private = FALSE; TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle); @@ -1355,7 +1401,9 @@ { WARN("Failed to retireve device context, trying swapchain backup.\n"); - if (!(hdc = swapchain_get_backup_dc(swapchain))) + if ((hdc = swapchain_get_backup_dc(swapchain))) + hdc_is_private = TRUE; + else { ERR("Failed to retrieve a device context.\n"); goto out; @@ -1404,7 +1452,9 @@ context_enter(ret); - if (!context_set_pixel_format(gl_info, hdc, pixel_format)) + ret->gl_info = gl_info; + + if (!context_set_pixel_format(ret, hdc, hdc_is_private, pixel_format)) { ERR("Failed to set pixel format %d on device context %p.\n", pixel_format, hdc); context_release(ret); @@ -1459,7 +1509,6 @@ goto out; } - ret->gl_info = gl_info; ret->d3d_info = &device->adapter->d3d_info; ret->state_table = device->StateTable; @@ -1482,7 +1531,10 @@ ret->glCtx = ctx; ret->win_handle = swapchain->win_handle; ret->hdc = hdc; + ret->hdc_is_private = hdc_is_private; + ret->hdc_has_format = TRUE; ret->pixel_format = pixel_format; + ret->needs_set = 1; /* Set up the context defaults */ if (!context_set_current(ret)) @@ -3000,9 +3052,9 @@ context = swapchain_get_context(device->swapchains[0]); } + context_enter(context); context_update_window(context); context_setup_target(context, target); - context_enter(context); if (!context->valid) return context; if (context != current_context) @@ -3010,7 +3062,7 @@ if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); } - else if (context->restore_ctx) + else if (context->needs_set) { context_set_gl_context(context); } diff -Nru wine1.7-1.7.13/dlls/wined3d/cs.c wine1.7-1.7.16/dlls/wined3d/cs.c --- wine1.7-1.7.13/dlls/wined3d/cs.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/cs.c 2014-04-04 19:13:44.000000000 +0000 @@ -939,5 +939,6 @@ { state_cleanup(&cs->state); HeapFree(GetProcessHeap(), 0, cs->fb.render_targets); + HeapFree(GetProcessHeap(), 0, cs->data); HeapFree(GetProcessHeap(), 0, cs); } diff -Nru wine1.7-1.7.13/dlls/wined3d/directx.c wine1.7-1.7.16/dlls/wined3d/directx.c --- wine1.7-1.7.13/dlls/wined3d/directx.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/directx.c 2014-04-04 19:13:44.000000000 +0000 @@ -52,6 +52,7 @@ DRIVER_NVIDIA_GEFORCE2MX, DRIVER_NVIDIA_GEFORCEFX, DRIVER_NVIDIA_GEFORCE6, + DRIVER_VMWARE, DRIVER_UNKNOWN }; @@ -68,7 +69,6 @@ GL_VENDOR_UNKNOWN, GL_VENDOR_APPLE, GL_VENDOR_FGLRX, - GL_VENDOR_INTEL, GL_VENDOR_MESA, GL_VENDOR_NVIDIA, }; @@ -1168,6 +1168,9 @@ {DRIVER_NVIDIA_GEFORCEFX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 11, 7516}, {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 15, 12, 6658}, {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 15, 12, 6658}, + + /* VMware */ + {DRIVER_VMWARE, DRIVER_MODEL_NT5X, "vm3dum.dll", 14, 1, 1134}, }; struct gpu_description @@ -1296,6 +1299,10 @@ {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}, + + /* VMware */ + {HW_VENDOR_VMWARE, CARD_VMWARE_SVGA3D, "VMware SVGA 3D (Microsoft Corporation - WDDM)", DRIVER_VMWARE, 1024}, + /* Intel cards */ {HW_VENDOR_INTEL, CARD_INTEL_830M, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800, 32 }, {HW_VENDOR_INTEL, CARD_INTEL_855GM, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800, 32 }, @@ -1569,20 +1576,16 @@ if (strstr(gl_vendor_string, "ATI")) return GL_VENDOR_FGLRX; - if (strstr(gl_vendor_string, "Intel(R)") - /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */ - || strstr(gl_renderer, "Intel") - || strstr(gl_vendor_string, "Intel Inc.")) - return GL_VENDOR_INTEL; - if (strstr(gl_vendor_string, "Mesa") || strstr(gl_vendor_string, "X.Org") || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.") || strstr(gl_vendor_string, "DRI R300 Project") || strstr(gl_vendor_string, "Tungsten Graphics, Inc") || strstr(gl_vendor_string, "VMware, Inc.") + || strstr(gl_vendor_string, "Intel") || strstr(gl_renderer, "Mesa") - || strstr(gl_renderer, "Gallium")) + || strstr(gl_renderer, "Gallium") + || strstr(gl_renderer, "Intel")) return GL_VENDOR_MESA; FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n", @@ -1616,6 +1619,9 @@ || strstr(gl_vendor_string, "Intel Inc.")) return HW_VENDOR_INTEL; + if (strstr(gl_renderer, "SVGA3D")) + return HW_VENDOR_VMWARE; + if (strstr(gl_vendor_string, "Mesa") || strstr(gl_vendor_string, "Brian Paul") || strstr(gl_vendor_string, "Tungsten Graphics, Inc") @@ -2238,29 +2244,40 @@ return PCI_DEVICE_NONE; } +static enum wined3d_pci_device select_card_vmware(const struct wined3d_gl_info *gl_info, const char *gl_renderer) +{ + if (strstr(gl_renderer, "SVGA3D")) + return CARD_VMWARE_SVGA3D; + + return PCI_DEVICE_NONE; +} + static const struct gl_vendor_selection { enum wined3d_gl_vendor gl_vendor; const char *description; /* Description of the card selector i.e. Apple OS/X Intel */ enum wined3d_pci_device (*select_card)(const struct wined3d_gl_info *gl_info, const char *gl_renderer); } +amd_gl_vendor_table[] = +{ + {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_FGLRX, "AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_MESA, "Mesa AMD/ATI driver", select_card_amd_mesa}, +}, nvidia_gl_vendor_table[] = { - {GL_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_MESA, "Mesa Nouveau driver", select_card_nvidia_mesa}, + {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, + {GL_VENDOR_MESA, "Mesa Nouveau driver", select_card_nvidia_mesa}, + {GL_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, }, -amd_gl_vendor_table[] = +vmware_gl_vendor_table[] = { - {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, - {GL_VENDOR_FGLRX, "AMD/ATI binary driver", select_card_amd_binary}, - {GL_VENDOR_MESA, "Mesa AMD/ATI driver", select_card_amd_mesa}, + {GL_VENDOR_MESA, "VMware driver", select_card_vmware}, }, intel_gl_vendor_table[] = { - {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", select_card_intel}, - {GL_VENDOR_INTEL, "Mesa Intel driver", select_card_intel}, - {GL_VENDOR_MESA, "Mesa Intel driver", select_card_intel}, + {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", select_card_intel}, + {GL_VENDOR_MESA, "Mesa Intel driver", select_card_intel}, }; static enum wined3d_pci_device select_card_fallback_nvidia(const struct wined3d_gl_info *gl_info) @@ -2333,14 +2350,17 @@ } card_vendor_table[] = { - {HW_VENDOR_NVIDIA, "Nvidia", nvidia_gl_vendor_table, - sizeof(nvidia_gl_vendor_table) / sizeof(nvidia_gl_vendor_table[0]), + {HW_VENDOR_AMD, "AMD", amd_gl_vendor_table, + sizeof(amd_gl_vendor_table) / sizeof(*amd_gl_vendor_table), + select_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}, - {HW_VENDOR_AMD, "AMD", amd_gl_vendor_table, - sizeof(amd_gl_vendor_table) / sizeof(amd_gl_vendor_table[0]), + {HW_VENDOR_VMWARE, "VMware", vmware_gl_vendor_table, + sizeof(vmware_gl_vendor_table) / sizeof(*vmware_gl_vendor_table), select_card_fallback_amd}, - {HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table, - sizeof(intel_gl_vendor_table) / sizeof(intel_gl_vendor_table[0]), + {HW_VENDOR_INTEL, "Intel", intel_gl_vendor_table, + sizeof(intel_gl_vendor_table) / sizeof(*intel_gl_vendor_table), select_card_fallback_intel}, }; @@ -4453,8 +4473,8 @@ caps->MaxAnisotropy = gl_info->limits.anisotropy; caps->MaxPointSize = gl_info->limits.pointsize_max; - caps->MaxPrimitiveCount = 0xfffff; /* For now set 2^20-1 which is used by most >=Geforce3/Radeon8500 cards */ - caps->MaxVertexIndex = 0xfffff; + caps->MaxPrimitiveCount = 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */ + caps->MaxVertexIndex = 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */ caps->MaxStreams = MAX_STREAMS; caps->MaxStreamStride = 1024; @@ -5184,9 +5204,8 @@ wined3d_null_wined3d_object_destroyed, }; -HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags) +HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) { - wined3d->dxVersion = version; wined3d->ref = 1; wined3d->flags = flags; diff -Nru wine1.7-1.7.13/dlls/wined3d/resource.c wine1.7-1.7.16/dlls/wined3d/resource.c --- wine1.7-1.7.13/dlls/wined3d/resource.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/resource.c 2014-04-04 19:13:44.000000000 +0000 @@ -27,22 +27,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); -struct private_data -{ - struct list entry; - - GUID tag; - DWORD flags; /* DDSPD_* */ - - union - { - void *data; - IUnknown *object; - } ptr; - - DWORD size; -}; - static DWORD resource_access_from_pool(enum wined3d_pool pool) { switch (pool) @@ -116,7 +100,6 @@ resource->parent = parent; resource->parent_ops = parent_ops; resource->resource_ops = resource_ops; - list_init(&resource->privateData); if (size) { @@ -151,9 +134,6 @@ void resource_cleanup(struct wined3d_resource *resource) { const struct wined3d *d3d = resource->device->wined3d; - struct private_data *data; - struct list *e1, *e2; - HRESULT hr; TRACE("Cleaning up resource %p.\n", resource); @@ -163,14 +143,6 @@ adapter_adjust_memory(resource->device->adapter, 0 - resource->size); } - LIST_FOR_EACH_SAFE(e1, e2, &resource->privateData) - { - data = LIST_ENTRY(e1, struct private_data, entry); - hr = wined3d_resource_free_private_data(resource, &data->tag); - if (FAILED(hr)) - ERR("Failed to free private data when destroying resource %p, hr = %#x.\n", resource, hr); - } - wined3d_resource_free_sysmem(resource); device_resource_released(resource->device, resource); @@ -185,128 +157,6 @@ resource, resource->type); } -static struct private_data *resource_find_private_data(const struct wined3d_resource *resource, REFGUID tag) -{ - struct private_data *data; - struct list *entry; - - TRACE("Searching for private data %s\n", debugstr_guid(tag)); - LIST_FOR_EACH(entry, &resource->privateData) - { - data = LIST_ENTRY(entry, struct private_data, entry); - if (IsEqualGUID(&data->tag, tag)) { - TRACE("Found %p\n", data); - return data; - } - } - TRACE("Not found\n"); - return NULL; -} - -HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resource, REFGUID guid, - const void *data, DWORD data_size, DWORD flags) -{ - struct private_data *d; - - TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n", - resource, debugstr_guid(guid), data, data_size, flags); - - wined3d_resource_free_private_data(resource, guid); - - d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d)); - if (!d) return E_OUTOFMEMORY; - - d->tag = *guid; - d->flags = flags; - - if (flags & WINED3DSPD_IUNKNOWN) - { - if (data_size != sizeof(IUnknown *)) - { - WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size); - HeapFree(GetProcessHeap(), 0, d); - return WINED3DERR_INVALIDCALL; - } - d->ptr.object = (IUnknown *)data; - d->size = sizeof(IUnknown *); - IUnknown_AddRef(d->ptr.object); - } - else - { - d->ptr.data = HeapAlloc(GetProcessHeap(), 0, data_size); - if (!d->ptr.data) - { - HeapFree(GetProcessHeap(), 0, d); - return E_OUTOFMEMORY; - } - d->size = data_size; - memcpy(d->ptr.data, data, data_size); - } - list_add_tail(&resource->privateData, &d->entry); - - return WINED3D_OK; -} - -HRESULT CDECL wined3d_resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid, - void *data, DWORD *data_size) -{ - const struct private_data *d; - - TRACE("resource %p, guid %s, data %p, data_size %p.\n", - resource, debugstr_guid(guid), data, data_size); - - d = resource_find_private_data(resource, guid); - if (!d) return WINED3DERR_NOTFOUND; - - if (*data_size < d->size) - { - *data_size = d->size; - return WINED3DERR_MOREDATA; - } - - if (d->flags & WINED3DSPD_IUNKNOWN) - { - *(IUnknown **)data = d->ptr.object; - if (resource->device->wined3d->dxVersion != 7) - { - /* D3D8 and D3D9 addref the private data, DDraw does not. This - * can't be handled in ddraw because it doesn't know if the - * pointer returned is an IUnknown * or just a blob. */ - IUnknown_AddRef(d->ptr.object); - } - } - else - { - memcpy(data, d->ptr.data, d->size); - } - - return WINED3D_OK; -} -HRESULT CDECL wined3d_resource_free_private_data(struct wined3d_resource *resource, REFGUID guid) -{ - struct private_data *data; - - TRACE("resource %p, guid %s.\n", resource, debugstr_guid(guid)); - - data = resource_find_private_data(resource, guid); - if (!data) return WINED3DERR_NOTFOUND; - - if (data->flags & WINED3DSPD_IUNKNOWN) - { - if (data->ptr.object) - IUnknown_Release(data->ptr.object); - } - else - { - HeapFree(GetProcessHeap(), 0, data->ptr.data); - } - list_remove(&data->entry); - - HeapFree(GetProcessHeap(), 0, data); - - return WINED3D_OK; -} - DWORD resource_set_priority(struct wined3d_resource *resource, DWORD priority) { DWORD prev = resource->priority; diff -Nru wine1.7-1.7.13/dlls/wined3d/surface.c wine1.7-1.7.16/dlls/wined3d/surface.c --- wine1.7-1.7.13/dlls/wined3d/surface.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/surface.c 2014-04-04 19:13:44.000000000 +0000 @@ -2605,8 +2605,9 @@ HRESULT hr; DWORD valid_location = 0; - TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u.\n", - surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type); + TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u, " + "mem %p, pitch %u.\n", + surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type, mem, pitch); if (!resource_size) return WINED3DERR_INVALIDCALL; @@ -5122,7 +5123,8 @@ if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL) { - if (location == WINED3D_LOCATION_TEXTURE_RGB && surface->locations & WINED3D_LOCATION_DRAWABLE) + if (location == WINED3D_LOCATION_TEXTURE_RGB + && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED)) { struct wined3d_context *context = context_acquire(device, NULL); surface_load_ds_location(surface, context, location); diff -Nru wine1.7-1.7.13/dlls/wined3d/wined3d_main.c wine1.7-1.7.16/dlls/wined3d/wined3d_main.c --- wine1.7-1.7.13/dlls/wined3d/wined3d_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/wined3d_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -87,7 +87,7 @@ FALSE, /* 3D support enabled by default. */ }; -struct wined3d * CDECL wined3d_create(UINT version, DWORD flags) +struct wined3d * CDECL wined3d_create(DWORD flags) { struct wined3d *object; HRESULT hr; @@ -99,10 +99,10 @@ return NULL; } - if (version == 7 && wined3d_settings.no_3d) + if (wined3d_settings.no_3d) flags |= WINED3D_NO3D; - hr = wined3d_init(object, version, flags); + hr = wined3d_init(object, flags); if (FAILED(hr)) { WARN("Failed to initialize wined3d object, hr %#x.\n", hr); @@ -110,7 +110,7 @@ return NULL; } - TRACE("Created wined3d object %p for d3d%d support.\n", object, version); + TRACE("Created wined3d object %p.\n", object); return object; } diff -Nru wine1.7-1.7.13/dlls/wined3d/wined3d_private.h wine1.7-1.7.16/dlls/wined3d/wined3d_private.h --- wine1.7-1.7.13/dlls/wined3d/wined3d_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/wined3d_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -1085,7 +1085,10 @@ DWORD fixed_function_usage_map : 8; /* MAX_TEXTURES, 8 */ DWORD lowest_disabled_stage : 4; /* Max MAX_TEXTURES, 8 */ DWORD rebind_fbo : 1; - DWORD padding : 19; + DWORD needs_set : 1; + DWORD hdc_is_private : 1; + DWORD hdc_has_format : 1; /* only meaningful if hdc_is_private */ + DWORD padding : 16; DWORD shader_update_mask; DWORD constant_update_mask; DWORD numbered_array_mask; @@ -1103,6 +1106,7 @@ HGLRC restore_ctx; HDC restore_dc; int restore_pf; + HWND restore_pf_win; HGLRC glCtx; HWND win_handle; HDC hdc; @@ -1348,10 +1352,11 @@ enum wined3d_pci_vendor { - HW_VENDOR_SOFTWARE = 0x0000, - HW_VENDOR_AMD = 0x1002, - HW_VENDOR_NVIDIA = 0x10de, - HW_VENDOR_INTEL = 0x8086, + HW_VENDOR_SOFTWARE = 0x0000, + HW_VENDOR_AMD = 0x1002, + HW_VENDOR_NVIDIA = 0x10de, + HW_VENDOR_VMWARE = 0x15ad, + HW_VENDOR_INTEL = 0x8086, }; enum wined3d_pci_device @@ -1473,6 +1478,8 @@ CARD_NVIDIA_GEFORCE_GTX770M = 0x11e0, CARD_NVIDIA_GEFORCE_GTX770 = 0x1184, + CARD_VMWARE_SVGA3D = 0x0405, + CARD_INTEL_830M = 0x3577, CARD_INTEL_855GM = 0x3582, CARD_INTEL_845G = 0x2562, @@ -1780,12 +1787,11 @@ { LONG ref; DWORD flags; - UINT dxVersion; UINT adapter_count; struct wined3d_adapter adapters[1]; }; -HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags) DECLSPEC_HIDDEN; +HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) DECLSPEC_HIDDEN; BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN; void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; @@ -2001,7 +2007,6 @@ UINT size; DWORD priority; void *heap_memory; - struct list privateData; struct list resource_list_entry; void *parent; diff -Nru wine1.7-1.7.13/dlls/wined3d/wined3d.spec wine1.7-1.7.16/dlls/wined3d/wined3d.spec --- wine1.7-1.7.13/dlls/wined3d/wined3d.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wined3d/wined3d.spec 2014-04-04 19:13:44.000000000 +0000 @@ -6,7 +6,7 @@ @ cdecl wined3d_check_device_format_conversion(ptr long long long long) @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr) @ cdecl wined3d_check_device_type(ptr long long long long long) -@ cdecl wined3d_create(long long) +@ cdecl wined3d_create(long) @ cdecl wined3d_decref(ptr) @ cdecl wined3d_enum_adapter_modes(ptr long long long long ptr) @ cdecl wined3d_get_adapter_count(ptr) @@ -170,12 +170,9 @@ @ cdecl wined3d_query_incref(ptr) @ cdecl wined3d_query_issue(ptr long) -@ cdecl wined3d_resource_free_private_data(ptr ptr) @ cdecl wined3d_resource_get_desc(ptr ptr) @ cdecl wined3d_resource_get_parent(ptr) -@ cdecl wined3d_resource_get_private_data(ptr ptr ptr ptr) @ cdecl wined3d_resource_set_parent(ptr ptr) -@ cdecl wined3d_resource_set_private_data(ptr ptr ptr long long) @ cdecl wined3d_rendertarget_view_create(ptr ptr ptr) @ cdecl wined3d_rendertarget_view_decref(ptr) diff -Nru wine1.7-1.7.13/dlls/winemac.drv/cocoa_window.m wine1.7-1.7.16/dlls/winemac.drv/cocoa_window.m --- wine1.7-1.7.13/dlls/winemac.drv/cocoa_window.m 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winemac.drv/cocoa_window.m 2014-04-04 19:13:44.000000000 +0000 @@ -713,6 +713,12 @@ [self setStyleMask:newStyle ^ NSClosableWindowMask]; } [self setStyleMask:newStyle]; + + // -setStyleMask: resets the firstResponder to the window. Set it + // back to the content view. + if ([[self contentView] acceptsFirstResponder]) + [self makeFirstResponder:[self contentView]]; + [self adjustFullScreenBehavior:[self collectionBehavior]]; if ([[self title] length] == 0 && [title length] > 0) diff -Nru wine1.7-1.7.13/dlls/winemac.drv/ime.c wine1.7-1.7.16/dlls/winemac.drv/ime.c --- wine1.7-1.7.13/dlls/winemac.drv/ime.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winemac.drv/ime.c 2014-04-04 19:13:44.000000000 +0000 @@ -1410,7 +1410,7 @@ InitOnceExecuteOnce( &init_once, register_classes, NULL, NULL ); lpIMEInfo->dwPrivateDataSize = sizeof(IMEPRIVATE); lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET; - lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE; + lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE; lpIMEInfo->fdwSentenceCaps = IME_SMODE_AUTOMATIC; lpIMEInfo->fdwUICaps = UI_CAP_2700; /* Tell App we cannot accept ImeSetCompositionString calls */ diff -Nru wine1.7-1.7.13/dlls/winemac.drv/macdrv_cocoa.h wine1.7-1.7.16/dlls/winemac.drv/macdrv_cocoa.h --- wine1.7-1.7.13/dlls/winemac.drv/macdrv_cocoa.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winemac.drv/macdrv_cocoa.h 2014-04-04 19:13:44.000000000 +0000 @@ -89,7 +89,7 @@ #ifndef DECLSPEC_HIDDEN -# if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) +# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) # define DECLSPEC_HIDDEN # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden"))) diff -Nru wine1.7-1.7.13/dlls/winemac.drv/macdrv.h wine1.7-1.7.16/dlls/winemac.drv/macdrv.h --- wine1.7-1.7.13/dlls/winemac.drv/macdrv.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winemac.drv/macdrv.h 2014-04-04 19:13:44.000000000 +0000 @@ -141,6 +141,7 @@ unsigned int per_pixel_alpha : 1; /* is window using per-pixel alpha? */ unsigned int minimized : 1; /* is window minimized? */ unsigned int being_dragged : 1; /* is window being dragged under Cocoa's control? */ + unsigned int swap_interval : 1; /* GL swap interval for window */ struct window_surface *surface; struct window_surface *unminimized_surface; }; diff -Nru wine1.7-1.7.13/dlls/winemac.drv/opengl.c wine1.7-1.7.16/dlls/winemac.drv/opengl.c --- wine1.7-1.7.13/dlls/winemac.drv/opengl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winemac.drv/opengl.c 2014-04-04 19:13:44.000000000 +0000 @@ -26,6 +26,7 @@ #include "winuser.h" #include "winternl.h" +#include "winnt.h" #include "wine/library.h" #include "wine/debug.h" #include "wine/wgl.h" @@ -56,18 +57,32 @@ struct wgl_context { + struct list entry; int format; macdrv_opengl_context context; CGLContextObj cglcontext; + HWND draw_hwnd; macdrv_view draw_view; struct wgl_pbuffer *draw_pbuffer; macdrv_view read_view; struct wgl_pbuffer *read_pbuffer; BOOL has_been_current; BOOL sharing; + LONG update_swap_interval; DWORD last_flush_time; }; +static struct list context_list = LIST_INIT(context_list); + +static CRITICAL_SECTION context_section; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &context_section, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": context_section") } +}; +static CRITICAL_SECTION context_section = { &critsect_debug, -1, 0, 0, 0, 0 }; + struct wgl_pbuffer { @@ -101,6 +116,7 @@ static void (*pglCopyColorTable)(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width); static void (*pglCopyPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +static void (*pglFinish)(void); static void (*pglFlush)(void); static void (*pglFlushRenderAPPLE)(void); static const GLubyte *(*pglGetString)(GLenum name); @@ -1295,27 +1311,28 @@ */ static BOOL set_win_format(struct macdrv_win_data *data, int format) { - macdrv_window cocoa_window; - TRACE("hwnd %p format %d\n", data->hwnd, format); - if (!get_gl_view_window_rect(data, &cocoa_window, &data->gl_rect)) + if (!data->gl_view) { - ERR("no top-level parent with Cocoa window in this process\n"); - return FALSE; - } + macdrv_window cocoa_window; - if (data->gl_view) macdrv_dispose_view(data->gl_view); - data->gl_view = macdrv_create_view(cocoa_window, cgrect_from_rect(data->gl_rect)); + if (!get_gl_view_window_rect(data, &cocoa_window, &data->gl_rect)) + { + ERR("no top-level parent with Cocoa window in this process\n"); + return FALSE; + } - if (!data->gl_view) - { - WARN("failed to create GL view for window %p rect %s\n", cocoa_window, wine_dbgstr_rect(&data->gl_rect)); - return FALSE; - } + data->gl_view = macdrv_create_view(cocoa_window, cgrect_from_rect(data->gl_rect)); + if (!data->gl_view) + { + WARN("failed to create GL view for window %p rect %s\n", cocoa_window, wine_dbgstr_rect(&data->gl_rect)); + return FALSE; + } - TRACE("created GL view %p in window %p at %s\n", data->gl_view, cocoa_window, - wine_dbgstr_rect(&data->gl_rect)); + TRACE("created GL view %p in window %p at %s\n", data->gl_view, cocoa_window, + wine_dbgstr_rect(&data->gl_rect)); + } data->pixel_format = format; @@ -1462,6 +1479,55 @@ /********************************************************************** + * set_swap_interval + */ +static BOOL set_swap_interval(struct wgl_context *context, long interval) +{ + CGLError err; + + /* In theory, for single-buffered contexts, there's no such thing as a swap + so the swap interval shouldn't matter. But OS X will synchronize flushes + of single-buffered contexts if the interval is set to non-zero. */ + if (interval && !pixel_formats[context->format - 1].double_buffer) + interval = 0; + + err = CGLSetParameter(context->cglcontext, kCGLCPSwapInterval, (GLint*)&interval); + if (err != kCGLNoError) + WARN("CGLSetParameter(kCGLCPSwapInterval) failed; error %d %s\n", err, CGLErrorString(err)); + + return err == kCGLNoError; +} + + +/********************************************************************** + * sync_swap_interval + */ +static void sync_swap_interval(struct wgl_context *context) +{ + if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE)) + { + int interval; + + if (context->draw_hwnd) + { + struct macdrv_win_data *data = get_win_data(context->draw_hwnd); + if (data) + { + interval = data->swap_interval; + release_win_data(data); + } + else /* window was destroyed? */ + interval = 1; + } + else /* pbuffer */ + interval = 0; + + set_swap_interval(context, interval); + } +} + + +/********************************************************************** * macdrv_glCopyColorTable * * Hook into glCopyColorTable as part of the implementation of @@ -1508,25 +1574,48 @@ } +/********************************************************************** + * macdrv_glFinish + */ +static void macdrv_glFinish(void) +{ + struct wgl_context *context = NtCurrentTeb()->glContext; + + sync_swap_interval(context); + pglFinish(); +} + + +/********************************************************************** + * macdrv_glFlush + */ static void macdrv_glFlush(void) { struct wgl_context *context = NtCurrentTeb()->glContext; - const pixel_format *pf = &pixel_formats[context->format - 1]; - DWORD now = GetTickCount(); - TRACE("double buffer %d last flush time %d now %d\n", (int)pf->double_buffer, - context->last_flush_time, now); - if (pglFlushRenderAPPLE && !pf->double_buffer && (now - context->last_flush_time) < 17) - { - TRACE("calling glFlushRenderAPPLE()\n"); - pglFlushRenderAPPLE(); - } - else + sync_swap_interval(context); + + if (skip_single_buffer_flushes) { - TRACE("calling glFlush()\n"); - pglFlush(); - context->last_flush_time = now; + const pixel_format *pf = &pixel_formats[context->format - 1]; + DWORD now = GetTickCount(); + + TRACE("double buffer %d last flush time %d now %d\n", (int)pf->double_buffer, + context->last_flush_time, now); + if (pglFlushRenderAPPLE && !pf->double_buffer && (now - context->last_flush_time) < 17) + { + TRACE("calling glFlushRenderAPPLE()\n"); + pglFlushRenderAPPLE(); + return; + } + else + { + TRACE("calling glFlush()\n"); + context->last_flush_time = now; + } } + + pglFlush(); } @@ -2541,17 +2630,29 @@ static int macdrv_wglGetSwapIntervalEXT(void) { struct wgl_context *context = NtCurrentTeb()->glContext; + struct macdrv_win_data *data; long value; CGLError err; TRACE("\n"); - err = CGLGetParameter(context->cglcontext, kCGLCPSwapInterval, (GLint*)&value); - if (err != kCGLNoError) + if ((data = get_win_data(context->draw_hwnd))) { - WARN("CGLGetParameter(kCGLCPSwapInterval) failed; error %d %s\n", - err, CGLErrorString(err)); - value = 1; + value = data->swap_interval; + release_win_data(data); + + if (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE)) + set_swap_interval(context, value); + } + else + { + err = CGLGetParameter(context->cglcontext, kCGLCPSwapInterval, (GLint*)&value); + if (err != kCGLNoError) + { + WARN("CGLGetParameter(kCGLCPSwapInterval) failed; error %d %s\n", + err, CGLErrorString(err)); + value = 1; + } } return value; @@ -2606,6 +2707,10 @@ return FALSE; } + if (allow_vsync && (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || hwnd != context->draw_hwnd)) + set_swap_interval(context, data->swap_interval); + + context->draw_hwnd = hwnd; context->draw_view = data->gl_view; context->draw_pbuffer = NULL; release_win_data(data); @@ -2625,6 +2730,10 @@ SetLastError(ERROR_INVALID_PIXEL_FORMAT); return FALSE; } + + if (allow_vsync && + (InterlockedCompareExchange(&context->update_swap_interval, FALSE, TRUE) || pbuffer != context->draw_pbuffer)) + set_swap_interval(context, 0); } else { @@ -2634,6 +2743,7 @@ return FALSE; } + context->draw_hwnd = NULL; context->draw_view = NULL; context->draw_pbuffer = pbuffer; LeaveCriticalSection(&dc_pbuffers_section); @@ -2925,8 +3035,7 @@ static BOOL macdrv_wglSwapIntervalEXT(int interval) { struct wgl_context *context = NtCurrentTeb()->glContext; - long value; - CGLError err; + BOOL changed = FALSE; TRACE("interval %d\n", interval); @@ -2935,22 +3044,43 @@ SetLastError(ERROR_INVALID_DATA); return FALSE; } + if (interval > 1) + interval = 1; - if (!pixel_formats[context->format - 1].double_buffer) + if (context->draw_hwnd) + { + struct macdrv_win_data *data = get_win_data(context->draw_hwnd); + if (data) + { + changed = data->swap_interval != interval; + if (changed) + data->swap_interval = interval; + release_win_data(data); + } + } + else /* pbuffer */ interval = 0; - else if (interval > 1) - interval = 1; - value = interval; - err = CGLSetParameter(context->cglcontext, kCGLCPSwapInterval, (GLint*)&value); - if (err != kCGLNoError) + InterlockedExchange(&context->update_swap_interval, FALSE); + if (!set_swap_interval(context, interval)) { - WARN("CGLSetParameter(kCGLCPSwapInterval) failed; error %d %s\n", - err, CGLErrorString(err)); SetLastError(ERROR_GEN_FAILURE); return FALSE; } + if (changed) + { + struct wgl_context *ctx; + + EnterCriticalSection(&context_section); + LIST_FOR_EACH_ENTRY(ctx, &context_list, struct wgl_context, entry) + { + if (ctx != context && ctx->draw_hwnd == context->draw_hwnd) + InterlockedExchange(&context->update_swap_interval, TRUE); + } + LeaveCriticalSection(&context_section); + } + return TRUE; } @@ -3092,8 +3222,10 @@ REDIRECT(glGetString); REDIRECT(glReadPixels); REDIRECT(glViewport); - if (skip_single_buffer_flushes) + if (skip_single_buffer_flushes || allow_vsync) REDIRECT(glFlush); + if (allow_vsync) + REDIRECT(glFinish); #undef REDIRECT /* redirect some OpenGL extension functions */ @@ -3193,7 +3325,6 @@ CGLPixelFormatObj pix; GLint virtualScreens; CGLError err; - long swap_interval; pf = get_pixel_format(context->format, TRUE /* non-displayable */); if (!pf) @@ -3279,19 +3410,6 @@ return FALSE; } - /* According to the WGL_EXT_swap_control docs, the default swap interval for - a context is 1. CGL contexts default to 0, so we need to set it. This - only make sense for double-buffered contexts, though. In theory, for - single-buffered contexts, there's no such thing as a swap. But OS X - will synchronize flushes of single-buffered contexts if this is set. */ - if (pf->double_buffer && allow_vsync) - swap_interval = 1; - else - swap_interval = 0; - err = CGLSetParameter(context->cglcontext, kCGLCPSwapInterval, (GLint*)&swap_interval); - if (err != kCGLNoError) - WARN("CGLSetParameter(kCGLCPSwapInterval) failed with error %d %s; leaving un-vsynced\n", err, CGLErrorString(err)); - context->context = macdrv_create_opengl_context(context->cglcontext); CGLReleaseContext(context->cglcontext); if (!context->context) @@ -3300,6 +3418,9 @@ return FALSE; } + if (allow_vsync) + InterlockedExchange(&context->update_swap_interval, TRUE); + TRACE("created context %p/%p/%p\n", context, context->context, context->cglcontext); return TRUE; @@ -3415,6 +3536,10 @@ return NULL; } + EnterCriticalSection(&context_section); + list_add_tail(&context_list, &context->entry); + LeaveCriticalSection(&context_section); + return context; } @@ -3424,6 +3549,11 @@ static void macdrv_wglDeleteContext(struct wgl_context *context) { TRACE("deleting context %p/%p/%p\n", context, context->context, context->cglcontext); + + EnterCriticalSection(&context_section); + list_remove(&context->entry); + LeaveCriticalSection(&context_section); + macdrv_dispose_opengl_context(context->context); HeapFree(GetProcessHeap(), 0, context); } @@ -3553,17 +3683,61 @@ static BOOL macdrv_wglSwapBuffers(HDC hdc) { struct wgl_context *context = NtCurrentTeb()->glContext; + BOOL match = FALSE; + HWND hwnd; TRACE("hdc %p context %p/%p/%p\n", hdc, context, (context ? context->context : NULL), (context ? context->cglcontext : NULL)); - if (!context) + if (context) + sync_swap_interval(context); + + if ((hwnd = WindowFromDC(hdc))) { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; + struct macdrv_win_data *data; + + if (!(data = get_win_data(hwnd))) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (context && context->draw_view == data->gl_view) + match = TRUE; + + release_win_data(data); + } + else + { + struct wgl_pbuffer *pbuffer; + + EnterCriticalSection(&dc_pbuffers_section); + pbuffer = (struct wgl_pbuffer*)CFDictionaryGetValue(dc_pbuffers, hdc); + LeaveCriticalSection(&dc_pbuffers_section); + + if (!pbuffer) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + if (context && context->draw_pbuffer == pbuffer) + match = TRUE; + } + + if (match) + macdrv_flush_opengl_context(context->context); + else + { + FIXME("current context %p doesn't match hdc %p; can't swap\n", context, hdc); + + /* If there is a current context, then wglSwapBuffers should do an implicit + glFlush(). That would be taken care of by macdrv_flush_opengl_context() + in the other branch, but we have to do it explicitly here. */ + if (context) + pglFlush(); } - macdrv_flush_opengl_context(context->context); return TRUE; } diff -Nru wine1.7-1.7.13/dlls/winemac.drv/window.c wine1.7-1.7.16/dlls/winemac.drv/window.c --- wine1.7-1.7.13/dlls/winemac.drv/window.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winemac.drv/window.c 2014-04-04 19:13:44.000000000 +0000 @@ -239,6 +239,7 @@ { data->hwnd = hwnd; data->color_key = CLR_INVALID; + data->swap_interval = 1; EnterCriticalSection(&win_data_section); if (!win_datas) win_datas = CFDictionaryCreateMutable(NULL, 0, NULL, NULL); diff -Nru wine1.7-1.7.13/dlls/wineps.drv/bitmap.c wine1.7-1.7.16/dlls/wineps.drv/bitmap.c --- wine1.7-1.7.13/dlls/wineps.drv/bitmap.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wineps.drv/bitmap.c 2014-04-04 19:13:44.000000000 +0000 @@ -101,6 +101,7 @@ INT widthSrc, INT heightSrc) { PSCOLOR bkgnd, foregnd; + PSDRV_PDEVICE *physDev = get_psdrv_dev( dev ); assert(info->bmiHeader.biBitCount == 1); @@ -108,12 +109,20 @@ the foregnd color corresponds to a bit equal to 0 in the bitmap. */ - PSDRV_CreateColor(dev, &foregnd, RGB(info->bmiColors[0].rgbRed, - info->bmiColors[0].rgbGreen, - info->bmiColors[0].rgbBlue) ); - PSDRV_CreateColor(dev, &bkgnd, RGB(info->bmiColors[1].rgbRed, - info->bmiColors[1].rgbGreen, - info->bmiColors[1].rgbBlue) ); + if (!info->bmiHeader.biClrUsed) + { + PSDRV_CreateColor( dev, &foregnd, GetTextColor( dev->hdc ) ); + bkgnd = physDev->bkColor; + } + else + { + PSDRV_CreateColor( dev, &foregnd, RGB(info->bmiColors[0].rgbRed, + info->bmiColors[0].rgbGreen, + info->bmiColors[0].rgbBlue) ); + PSDRV_CreateColor( dev, &bkgnd, RGB(info->bmiColors[1].rgbRed, + info->bmiColors[1].rgbGreen, + info->bmiColors[1].rgbBlue) ); + } PSDRV_WriteGSave(dev); PSDRV_WriteNewPath(dev); diff -Nru wine1.7-1.7.13/dlls/wineps.drv/init.c wine1.7-1.7.16/dlls/wineps.drv/init.c --- wine1.7-1.7.13/dlls/wineps.drv/init.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wineps.drv/init.c 2014-04-04 19:13:44.000000000 +0000 @@ -503,7 +503,9 @@ case DESKTOPVERTRES: return physDev->vertRes; case BITSPIXEL: - return (physDev->pi->ppd->ColorDevice != CD_False) ? 32 : 1; + /* Although Windows returns 1 for monochrome printers, we want + CreateCompatibleBitmap to provide something other than 1 bpp */ + return 32; case PLANES: return 1; case NUMBRUSHES: diff -Nru wine1.7-1.7.13/dlls/winex11.drv/ime.c wine1.7-1.7.16/dlls/winex11.drv/ime.c --- wine1.7-1.7.13/dlls/winex11.drv/ime.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winex11.drv/ime.c 2014-04-04 19:13:44.000000000 +0000 @@ -564,7 +564,7 @@ InitOnceExecuteOnce( &init_once, register_classes, NULL, NULL ); lpIMEInfo->dwPrivateDataSize = sizeof (IMEPRIVATE); lpIMEInfo->fdwProperty = IME_PROP_UNICODE | IME_PROP_AT_CARET; - lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE; + lpIMEInfo->fdwConversionCaps = IME_CMODE_NATIVE | IME_CMODE_FULLSHAPE; lpIMEInfo->fdwSentenceCaps = IME_SMODE_AUTOMATIC; lpIMEInfo->fdwUICaps = UI_CAP_2700; /* Tell App we cannot accept ImeSetCompositionString calls */ diff -Nru wine1.7-1.7.13/dlls/winex11.drv/opengl.c wine1.7-1.7.16/dlls/winex11.drv/opengl.c --- wine1.7-1.7.13/dlls/winex11.drv/opengl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winex11.drv/opengl.c 2014-04-04 19:13:44.000000000 +0000 @@ -252,6 +252,7 @@ XVisualInfo *visual; /* information about the GL visual */ RECT rect; /* drawable rect, relative to whole window drawable */ int swap_interval; + BOOL refresh_swap_interval; }; enum glx_swap_control_method @@ -1185,6 +1186,43 @@ } } +static BOOL set_swap_interval(Drawable drawable, int interval) +{ + BOOL ret = TRUE; + + switch (swap_control_method) + { + case GLX_SWAP_CONTROL_EXT: + X11DRV_expect_error(gdi_display, GLXErrorHandler, NULL); + pglXSwapIntervalEXT(gdi_display, drawable, interval); + XSync(gdi_display, False); + ret = !X11DRV_check_error(); + break; + + case GLX_SWAP_CONTROL_MESA: + ret = !pglXSwapIntervalMESA(interval); + break; + + case GLX_SWAP_CONTROL_SGI: + /* wglSwapIntervalEXT considers an interval value of zero to mean that + * vsync should be disabled, but glXSwapIntervalSGI considers such a + * value to be an error. Just silently ignore the request for now. + */ + if (!interval) + WARN("Request to disable vertical sync is not handled\n"); + else + ret = !pglXSwapIntervalSGI(interval); + break; + + case GLX_SWAP_CONTROL_NONE: + /* Unlikely to happen on modern GLX implementations */ + WARN("Request to adjust swap interval is not handled\n"); + break; + } + + return ret; +} + static struct gl_drawable *get_gl_drawable( HWND hwnd, HDC hdc ) { struct gl_drawable *gl; @@ -1250,13 +1288,9 @@ /*********************************************************************** * create_gl_drawable */ -static BOOL create_gl_drawable( HWND hwnd, HWND parent, struct gl_drawable *gl ) +static BOOL create_gl_drawable( HWND hwnd, struct gl_drawable *gl ) { gl->drawable = 0; - /* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI - * there is no way to query it, so we have to store it here. - */ - gl->swap_interval = 1; if (GetAncestor( hwnd, GA_PARENT ) == GetDesktopWindow()) /* top-level window */ { @@ -1318,6 +1352,8 @@ } } + if (gl->drawable) + gl->refresh_swap_interval = TRUE; return gl->drawable != 0; } @@ -1327,10 +1363,14 @@ */ static BOOL set_win_format( HWND hwnd, const struct wgl_pixel_format *format ) { - HWND parent = GetAncestor( hwnd, GA_PARENT ); struct gl_drawable *gl, *prev; gl = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*gl) ); + /* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI + * there is no way to query it, so we have to store it here. + */ + gl->swap_interval = 1; + gl->refresh_swap_interval = TRUE; gl->format = format; gl->visual = pglXGetVisualFromFBConfig( gdi_display, format->fbconfig ); if (!gl->visual) @@ -1343,7 +1383,7 @@ gl->rect.right = min( max( 1, gl->rect.right ), 65535 ); gl->rect.bottom = min( max( 1, gl->rect.bottom ), 65535 ); - if (!create_gl_drawable( hwnd, parent, gl )) + if (!create_gl_drawable( hwnd, gl )) { XFree( gl->visual ); HeapFree( GetProcessHeap(), 0, gl ); @@ -1356,7 +1396,10 @@ EnterCriticalSection( &context_section ); if (!XFindContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char **)&prev )) + { + gl->swap_interval = prev->swap_interval; free_gl_drawable( prev ); + } XSaveContext( gdi_display, (XID)hwnd, gl_hwnd_context, (char *)gl ); LeaveCriticalSection( &context_section ); @@ -1450,7 +1493,7 @@ goto done; } - if (!create_gl_drawable( hwnd, parent, gl )) + if (!create_gl_drawable( hwnd, gl )) { XDeleteContext( gdi_display, (XID)hwnd, gl_hwnd_context ); release_gl_drawable( gl ); @@ -2280,11 +2323,9 @@ LeaveCriticalSection( &context_section ); escape.code = X11DRV_SET_DRAWABLE; - escape.hwnd = 0; escape.drawable = object->drawable; escape.mode = IncludeInferiors; SetRect( &escape.dc_rect, 0, 0, object->width, object->height ); - escape.fbconfig_id = object->fmt->fmt_id; ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); TRACE( "(%p)->(%p)\n", object, hdc ); @@ -2958,36 +2999,8 @@ return FALSE; } - switch (swap_control_method) - { - case GLX_SWAP_CONTROL_EXT: - X11DRV_expect_error(gdi_display, GLXErrorHandler, NULL); - pglXSwapIntervalEXT(gdi_display, gl->drawable, interval); - XSync(gdi_display, False); - ret = !X11DRV_check_error(); - break; - - case GLX_SWAP_CONTROL_MESA: - ret = !pglXSwapIntervalMESA(interval); - break; - - case GLX_SWAP_CONTROL_SGI: - /* wglSwapIntervalEXT considers an interval value of zero to mean that - * vsync should be disabled, but glXSwapIntervalSGI considers such a - * value to be an error. Just silently ignore the request for now. - */ - if (!interval) - WARN("Request to disable vertical sync is not handled\n"); - else - ret = !pglXSwapIntervalSGI(interval); - break; - - case GLX_SWAP_CONTROL_NONE: - /* Unlikely to happen on modern GLX implementations */ - WARN("Request to adjust swap interval is not handled\n"); - break; - } - + ret = set_swap_interval(gl->drawable, interval); + gl->refresh_swap_interval = FALSE; if (ret) gl->swap_interval = interval; else @@ -3203,6 +3216,12 @@ return FALSE; } + if (gl->refresh_swap_interval) + { + set_swap_interval(gl->drawable, gl->swap_interval); + gl->refresh_swap_interval = FALSE; + } + switch (gl->type) { case DC_GL_PIXMAP_WIN: diff -Nru wine1.7-1.7.13/dlls/winex11.drv/window.c wine1.7-1.7.16/dlls/winex11.drv/window.c --- wine1.7-1.7.13/dlls/winex11.drv/window.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winex11.drv/window.c 2014-04-04 19:13:44.000000000 +0000 @@ -1378,6 +1378,13 @@ int cx = min( max( 1, data->client_rect.right - data->client_rect.left ), 65535 ); int cy = min( max( 1, data->client_rect.bottom - data->client_rect.top ), 65535 ); + if (data->client_window) + { + XDeleteContext( data->display, data->client_window, winContext ); + XDestroyWindow( data->display, data->client_window ); + } + + if (data->colormap) XFreeColormap( data->display, data->colormap ); data->colormap = XCreateColormap( data->display, root_window, visual->visual, (visual->class == PseudoColor || visual->class == GrayScale || @@ -1963,10 +1970,8 @@ struct x11drv_escape_set_drawable escape; HWND parent; - escape.code = X11DRV_SET_DRAWABLE; - escape.hwnd = hwnd; - escape.mode = IncludeInferiors; - escape.fbconfig_id = 0; + escape.code = X11DRV_SET_DRAWABLE; + escape.mode = IncludeInferiors; escape.dc_rect.left = win_rect->left - top_rect->left; escape.dc_rect.top = win_rect->top - top_rect->top; @@ -2012,12 +2017,10 @@ struct x11drv_escape_set_drawable escape; escape.code = X11DRV_SET_DRAWABLE; - escape.hwnd = GetDesktopWindow(); escape.drawable = root_window; escape.mode = IncludeInferiors; escape.dc_rect = get_virtual_screen_rect(); OffsetRect( &escape.dc_rect, -2 * escape.dc_rect.left, -2 * escape.dc_rect.top ); - escape.fbconfig_id = 0; ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL ); } diff -Nru wine1.7-1.7.13/dlls/winex11.drv/wintab.c wine1.7-1.7.16/dlls/winex11.drv/wintab.c --- wine1.7-1.7.13/dlls/winex11.drv/wintab.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winex11.drv/wintab.c 2014-04-04 19:13:44.000000000 +0000 @@ -415,7 +415,7 @@ return FALSE; } -static BOOL is_stylus(const char *name, const char *type) +static UINT get_cursor_type(const char *name, const char *type) { int i; static const char* tablet_stylus_whitelist[] = { @@ -426,23 +426,21 @@ NULL }; + /* First check device type to avoid cases where name is "Pen and Eraser" and type is "ERASER" */ for (i=0; tablet_stylus_whitelist[i] != NULL; i++) { - if (name && match_token(name, tablet_stylus_whitelist[i])) - return TRUE; if (type && match_token(type, tablet_stylus_whitelist[i])) - return TRUE; + return CSR_TYPE_PEN; } - - return FALSE; -} - -static BOOL is_eraser(const char *name, const char *type) -{ - if (name && match_token(name, "eraser")) - return TRUE; if (type && match_token(type, "eraser")) - return TRUE; - return FALSE; + return CSR_TYPE_ERASER; + for (i=0; tablet_stylus_whitelist[i] != NULL; i++) { + if (name && match_token(name, tablet_stylus_whitelist[i])) + return CSR_TYPE_PEN; + } + if (name && match_token(name, "eraser")) + return CSR_TYPE_ERASER; + + return CSR_TYPE_OTHER; } /* cursors are placed in gSysCursor rows depending on their type @@ -538,6 +536,8 @@ gSysContext.lcSensZ = 65536; gSysContext.lcSysSensX= 65536; gSysContext.lcSysSensY= 65536; + gSysContext.lcOutExtX= GetSystemMetrics(SM_CXSCREEN); + gSysContext.lcOutExtY= GetSystemMetrics(SM_CYSCREEN); /* initialize cursors */ disable_system_cursors(); @@ -635,13 +635,7 @@ cursor.NPBTNMARKS[1] = 1 ; cursor.CAPABILITIES = CRC_MULTIMODE; - /* prefer finding TYPE_PEN(most capable) */ - if (is_stylus(target->name, device_type)) - cursor.TYPE = CSR_TYPE_PEN; - else if (is_eraser(target->name, device_type)) - cursor.TYPE = CSR_TYPE_ERASER; - else - cursor.TYPE = CSR_TYPE_OTHER; + cursor.TYPE = get_cursor_type(target->name, device_type); any = target->inputclassinfo; diff -Nru wine1.7-1.7.13/dlls/winex11.drv/x11drv.h wine1.7-1.7.16/dlls/winex11.drv/x11drv.h --- wine1.7-1.7.13/dlls/winex11.drv/x11drv.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winex11.drv/x11drv.h 2014-04-04 19:13:44.000000000 +0000 @@ -283,11 +283,9 @@ struct x11drv_escape_set_drawable { enum x11drv_escape_codes code; /* escape code (X11DRV_SET_DRAWABLE) */ - HWND hwnd; /* window for this drawable */ Drawable drawable; /* X drawable */ int mode; /* ClipByChildren or IncludeInferiors */ RECT dc_rect; /* DC rectangle relative to drawable */ - XID fbconfig_id; /* fbconfig id used by the GL drawable */ }; struct x11drv_escape_get_drawable diff -Nru wine1.7-1.7.13/dlls/winhttp/cookie.c wine1.7-1.7.16/dlls/winhttp/cookie.c --- wine1.7-1.7.13/dlls/winhttp/cookie.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winhttp/cookie.c 2014-04-04 19:13:44.000000000 +0000 @@ -134,10 +134,6 @@ const WCHAR *p; int len; - if (!(cookie = heap_alloc_zero( sizeof(cookie_t) ))) return NULL; - - list_init( &cookie->entry ); - if (!(p = strchrW( string, '=' ))) { WARN("no '=' in %s\n", debugstr_w(string)); @@ -148,6 +144,11 @@ WARN("empty cookie name in %s\n", debugstr_w(string)); return NULL; } + + if (!(cookie = heap_alloc_zero( sizeof(cookie_t) ))) return NULL; + + list_init( &cookie->entry ); + len = p - string; if (!(cookie->name = heap_alloc( (len + 1) * sizeof(WCHAR) ))) { diff -Nru wine1.7-1.7.13/dlls/winhttp/tests/winhttp.c wine1.7-1.7.16/dlls/winhttp/tests/winhttp.c --- wine1.7-1.7.13/dlls/winhttp/tests/winhttp.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winhttp/tests/winhttp.c 2014-04-04 19:13:44.000000000 +0000 @@ -1721,6 +1721,11 @@ SetLastError(0xdeadbeef); ret = WinHttpSendRequest(req, NULL, 0, NULL, 0, 0, 0); + if(ret == 1) + { + skip("nxdomain returned success. Broken ISP redirects?\n"); + return; + } ok(!ret, "sent request\n"); ok(GetLastError() == ERROR_WINHTTP_NAME_NOT_RESOLVED, "expected ERROR_WINHTTP_NAME_NOT_RESOLVED got %u\n", GetLastError()); diff -Nru wine1.7-1.7.13/dlls/wininet/http.c wine1.7-1.7.16/dlls/wininet/http.c --- wine1.7-1.7.13/dlls/wininet/http.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wininet/http.c 2014-04-04 19:13:44.000000000 +0000 @@ -379,16 +379,10 @@ return &req->custHeaders[HeaderIndex]; } -typedef enum { - READMODE_SYNC, - READMODE_ASYNC, - READMODE_NOBLOCK -} read_mode_t; - struct data_stream_vtbl_t { DWORD (*get_avail_data)(data_stream_t*,http_request_t*); BOOL (*end_of_data)(data_stream_t*,http_request_t*); - DWORD (*read)(data_stream_t*,http_request_t*,BYTE*,DWORD,DWORD*,read_mode_t); + DWORD (*read)(data_stream_t*,http_request_t*,BYTE*,DWORD,DWORD*,blocking_mode_t); BOOL (*drain_content)(data_stream_t*,http_request_t*); void (*destroy)(data_stream_t*); }; @@ -437,47 +431,45 @@ static BOOL gzip_end_of_data(data_stream_t *stream, http_request_t *req) { gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; - return gzip_stream->end_of_data; + return gzip_stream->end_of_data + || (!gzip_stream->buf_size && gzip_stream->parent_stream->vtbl->end_of_data(gzip_stream->parent_stream, req)); } static DWORD gzip_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DWORD size, - DWORD *read, read_mode_t read_mode) + DWORD *read, blocking_mode_t blocking_mode) { gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; z_stream *zstream = &gzip_stream->zstream; DWORD current_read, ret_read = 0; - BOOL end; int zres; DWORD res = ERROR_SUCCESS; - while(size && !gzip_stream->end_of_data) { - end = gzip_stream->parent_stream->vtbl->end_of_data(gzip_stream->parent_stream, req); + TRACE("(%d %d)\n", size, blocking_mode); - if(gzip_stream->buf_size <= 64 && !end) { + while(size && !gzip_stream->end_of_data) { + if(!gzip_stream->buf_size) { if(gzip_stream->buf_pos) { if(gzip_stream->buf_size) memmove(gzip_stream->buf, gzip_stream->buf+gzip_stream->buf_pos, gzip_stream->buf_size); gzip_stream->buf_pos = 0; } res = gzip_stream->parent_stream->vtbl->read(gzip_stream->parent_stream, req, gzip_stream->buf+gzip_stream->buf_size, - sizeof(gzip_stream->buf)-gzip_stream->buf_size, ¤t_read, read_mode); + sizeof(gzip_stream->buf)-gzip_stream->buf_size, ¤t_read, blocking_mode); gzip_stream->buf_size += current_read; if(res != ERROR_SUCCESS) break; - end = gzip_stream->parent_stream->vtbl->end_of_data(gzip_stream->parent_stream, req); - if(!current_read && !end) { - if(read_mode != READMODE_NOBLOCK) { + + if(!current_read) { + if(blocking_mode != BLOCKING_DISALLOW) { WARN("unexpected end of data\n"); gzip_stream->end_of_data = TRUE; } break; } - if(gzip_stream->buf_size <= 64 && !end) - continue; } zstream->next_in = gzip_stream->buf+gzip_stream->buf_pos; - zstream->avail_in = gzip_stream->buf_size-(end ? 0 : 64); + zstream->avail_in = gzip_stream->buf_size; zstream->next_out = buf+ret_read; zstream->avail_out = size; zres = inflate(&gzip_stream->zstream, 0); @@ -497,8 +489,8 @@ break; } - if(ret_read && read_mode == READMODE_ASYNC) - read_mode = READMODE_NOBLOCK; + if(ret_read && blocking_mode == BLOCKING_ALLOW) + blocking_mode = BLOCKING_DISALLOW; } TRACE("read %u bytes\n", ret_read); @@ -541,7 +533,7 @@ heap_free(address); } -static DWORD init_gzip_stream(http_request_t *req) +static DWORD init_gzip_stream(http_request_t *req, BOOL is_gzip) { gzip_stream_t *gzip_stream; int index, zres; @@ -554,7 +546,7 @@ gzip_stream->zstream.zalloc = wininet_zalloc; gzip_stream->zstream.zfree = wininet_zfree; - zres = inflateInit2(&gzip_stream->zstream, 0x1f); + zres = inflateInit2(&gzip_stream->zstream, is_gzip ? 0x1f : -15); if(zres != Z_OK) { ERR("inflateInit failed: %d\n", zres); heap_free(gzip_stream); @@ -579,7 +571,7 @@ #else -static DWORD init_gzip_stream(http_request_t *req) +static DWORD init_gzip_stream(http_request_t *req, BOOL is_gzip) { ERR("gzip stream not supported, missing zlib.\n"); return ERROR_SUCCESS; @@ -1945,7 +1937,7 @@ static void http_release_netconn(http_request_t *req, BOOL reuse) { - TRACE("%p %p\n",req, req->netconn); + TRACE("%p %p %x\n",req, req->netconn, reuse); if(!is_valid_netconn(req->netconn)) return; @@ -2497,7 +2489,7 @@ if (maxlen == -1) maxlen = sizeof(req->read_buf); res = NETCON_recv( req->netconn, req->read_buf + req->read_size, - maxlen - req->read_size, 0, &len ); + maxlen - req->read_size, BLOCKING_ALLOW, &len ); if(res == ERROR_SUCCESS) req->read_size += len; @@ -2566,11 +2558,11 @@ return !req->read_size && req->data_stream->vtbl->end_of_data(req->data_stream, req); } -static DWORD read_http_stream(http_request_t *req, BYTE *buf, DWORD size, DWORD *read, read_mode_t read_mode) +static DWORD read_http_stream(http_request_t *req, BYTE *buf, DWORD size, DWORD *read, blocking_mode_t blocking_mode) { DWORD res; - res = req->data_stream->vtbl->read(req->data_stream, req, buf, size, read, read_mode); + res = req->data_stream->vtbl->read(req->data_stream, req, buf, size, read, blocking_mode); assert(*read <= size); if(req->hCacheFile) { @@ -2591,7 +2583,7 @@ } /* fetch some more data into the read buffer (the read section must be held) */ -static DWORD refill_read_buffer(http_request_t *req, read_mode_t read_mode, DWORD *read_bytes) +static DWORD refill_read_buffer(http_request_t *req, blocking_mode_t blocking_mode, DWORD *read_bytes) { DWORD res, read=0; @@ -2605,7 +2597,7 @@ } res = read_http_stream(req, req->read_buf+req->read_size, sizeof(req->read_buf) - req->read_size, - &read, read_mode); + &read, blocking_mode); req->read_size += read; TRACE("read %u bytes, read_size %u\n", read, req->read_size); @@ -2639,7 +2631,7 @@ } static DWORD netconn_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DWORD size, - DWORD *read, read_mode_t read_mode) + DWORD *read, blocking_mode_t blocking_mode) { netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; DWORD res = ERROR_SUCCESS; @@ -2647,17 +2639,16 @@ size = min(size, netconn_stream->content_length-netconn_stream->content_read); - if(read_mode == READMODE_NOBLOCK) { - DWORD avail = netconn_get_avail_data(stream, req); - if (size > avail) - size = avail; - } - if(size && is_valid_netconn(req->netconn)) { - if((res = NETCON_recv(req->netconn, buf, size, read_mode == READMODE_SYNC ? MSG_WAITALL : 0, &len))) + if((res = NETCON_recv(req->netconn, buf, size, blocking_mode, &len))) { len = 0; - if(!len) + if(blocking_mode == BLOCKING_DISALLOW && res == WSAEWOULDBLOCK) + res = ERROR_SUCCESS; + else + netconn_stream->content_length = netconn_stream->content_read; + }else if(!len) { netconn_stream->content_length = netconn_stream->content_read; + } } netconn_stream->content_read += *read = len; @@ -2669,18 +2660,13 @@ { netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; BYTE buf[1024]; - DWORD avail; int len; if(netconn_end_of_data(stream, req)) return TRUE; do { - avail = netconn_get_avail_data(stream, req); - if(!avail) - return FALSE; - - if(NETCON_recv(req->netconn, buf, min(avail, sizeof(buf)), 0, &len) != ERROR_SUCCESS) + if(NETCON_recv(req->netconn, buf, sizeof(buf), BLOCKING_DISALLOW, &len) != ERROR_SUCCESS) return FALSE; netconn_stream->content_read += len; @@ -2720,7 +2706,7 @@ if (maxlen == -1) maxlen = sizeof(stream->buf); res = NETCON_recv( req->netconn, stream->buf + stream->buf_size, - maxlen - stream->buf_size, 0, &len ); + maxlen - stream->buf_size, BLOCKING_ALLOW, &len ); if(res == ERROR_SUCCESS) stream->buf_size += len; @@ -2808,7 +2794,7 @@ } static DWORD chunked_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DWORD size, - DWORD *read, read_mode_t read_mode) + DWORD *read, blocking_mode_t blocking_mode) { chunked_stream_t *chunked_stream = (chunked_stream_t*)stream; DWORD read_bytes = 0, ret_read = 0, res = ERROR_SUCCESS; @@ -2824,7 +2810,7 @@ read_bytes = min(size, min(chunked_stream->buf_size, chunked_stream->chunk_size)); /* this could block */ - if(read_mode == READMODE_NOBLOCK && read_bytes == chunked_stream->chunk_size) + if(blocking_mode == BLOCKING_DISALLOW && read_bytes == chunked_stream->chunk_size) break; memcpy(buf+ret_read, chunked_stream->buf+chunked_stream->buf_pos, read_bytes); @@ -2832,7 +2818,7 @@ }else { read_bytes = min(size, chunked_stream->chunk_size); - if(read_mode == READMODE_NOBLOCK) { + if(blocking_mode == BLOCKING_DISALLOW) { DWORD avail; if(!is_valid_netconn(req->netconn) || !NETCON_query_data_available(req->netconn, &avail) || !avail) @@ -2845,7 +2831,7 @@ break; } - res = NETCON_recv(req->netconn, (char *)buf+ret_read, read_bytes, 0, (int*)&read_bytes); + res = NETCON_recv(req->netconn, (char *)buf+ret_read, read_bytes, BLOCKING_ALLOW, (int*)&read_bytes); if(res != ERROR_SUCCESS) break; } @@ -2854,14 +2840,14 @@ size -= read_bytes; ret_read += read_bytes; if(size && !chunked_stream->chunk_size) { - assert(read_mode != READMODE_NOBLOCK); + assert(blocking_mode != BLOCKING_DISALLOW); res = start_next_chunk(chunked_stream, req); if(res != ERROR_SUCCESS) break; } - if(read_mode == READMODE_ASYNC) - read_mode = READMODE_NOBLOCK; + if(blocking_mode == BLOCKING_ALLOW) + blocking_mode = BLOCKING_DISALLOW; } TRACE("read %u bytes\n", ret_read); @@ -2939,12 +2925,19 @@ if(request->decoding) { int encoding_idx; + static const WCHAR deflateW[] = {'d','e','f','l','a','t','e',0}; static const WCHAR gzipW[] = {'g','z','i','p',0}; encoding_idx = HTTP_GetCustomHeaderIndex(request, szContent_Encoding, 0, FALSE); - if(encoding_idx != -1 && !strcmpiW(request->custHeaders[encoding_idx].lpszValue, gzipW)) { - HTTP_DeleteCustomHeader(request, encoding_idx); - return init_gzip_stream(request); + if(encoding_idx != -1) { + if(!strcmpiW(request->custHeaders[encoding_idx].lpszValue, gzipW)) { + HTTP_DeleteCustomHeader(request, encoding_idx); + return init_gzip_stream(request, TRUE); + } + if(!strcmpiW(request->custHeaders[encoding_idx].lpszValue, deflateW)) { + HTTP_DeleteCustomHeader(request, encoding_idx); + return init_gzip_stream(request, FALSE); + } } } @@ -2965,20 +2958,20 @@ static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif, DWORD *ret_size) { DWORD res, read = 0, avail = 0; - read_mode_t mode; + blocking_mode_t mode; TRACE("%p\n", req); EnterCriticalSection( &req->read_section ); - mode = first_notif && req->read_size ? READMODE_NOBLOCK : READMODE_ASYNC; + mode = first_notif && req->read_size ? BLOCKING_DISALLOW : BLOCKING_ALLOW; res = refill_read_buffer(req, mode, &read); if(res == ERROR_SUCCESS) avail = get_avail_data(req); LeaveCriticalSection( &req->read_section ); - if(res != ERROR_SUCCESS || (mode != READMODE_NOBLOCK && !read)) { + if(res != ERROR_SUCCESS || (mode != BLOCKING_DISALLOW && !read)) { WARN("res %u read %u, closing connection\n", res, read); http_release_netconn(req, FALSE); } @@ -3000,10 +2993,10 @@ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *read, BOOL sync) { DWORD current_read = 0, ret_read = 0; - read_mode_t read_mode; + blocking_mode_t blocking_mode; DWORD res = ERROR_SUCCESS; - read_mode = req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC ? READMODE_ASYNC : READMODE_SYNC; + blocking_mode = req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC ? BLOCKING_ALLOW : BLOCKING_WAITALL; EnterCriticalSection( &req->read_section ); @@ -3012,12 +3005,12 @@ memcpy(buffer, req->read_buf+req->read_pos, ret_read); req->read_size -= ret_read; req->read_pos += ret_read; - if(read_mode == READMODE_ASYNC) - read_mode = READMODE_NOBLOCK; + if(blocking_mode == BLOCKING_ALLOW) + blocking_mode = BLOCKING_DISALLOW; } if(ret_read < size) { - res = read_http_stream(req, (BYTE*)buffer+ret_read, size-ret_read, ¤t_read, read_mode); + res = read_http_stream(req, (BYTE*)buffer+ret_read, size-ret_read, ¤t_read, blocking_mode); ret_read += current_read; } @@ -3224,7 +3217,7 @@ /* never wait, if we can't enter the section we queue an async request right away */ if (TryEnterCriticalSection( &req->read_section )) { - refill_read_buffer(req, READMODE_NOBLOCK, NULL); + refill_read_buffer(req, BLOCKING_DISALLOW, NULL); if ((*available = get_avail_data( req ))) goto done; if (end_of_read_data( req )) goto done; LeaveCriticalSection( &req->read_section ); @@ -3240,7 +3233,7 @@ if (!(*available = get_avail_data( req )) && !end_of_read_data( req )) { - refill_read_buffer( req, READMODE_ASYNC, NULL ); + refill_read_buffer( req, BLOCKING_ALLOW, NULL ); *available = get_avail_data( req ); } diff -Nru wine1.7-1.7.13/dlls/wininet/internet.h wine1.7-1.7.16/dlls/wininet/internet.h --- wine1.7-1.7.13/dlls/wininet/internet.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wininet/internet.h 2014-04-04 19:13:44.000000000 +0000 @@ -438,14 +438,19 @@ DWORD dwStatusInfoLength) DECLSPEC_HIDDEN; BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundProxy, DWORD *foundProxyLen) DECLSPEC_HIDDEN; +typedef enum { + BLOCKING_ALLOW, + BLOCKING_DISALLOW, + BLOCKING_WAITALL +} blocking_mode_t; + DWORD create_netconn(BOOL,server_t*,DWORD,BOOL,DWORD,netconn_t**) DECLSPEC_HIDDEN; void free_netconn(netconn_t*) DECLSPEC_HIDDEN; void NETCON_unload(void) DECLSPEC_HIDDEN; DWORD NETCON_secure_connect(netconn_t*,server_t*) DECLSPEC_HIDDEN; DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags, int *sent /* out */) DECLSPEC_HIDDEN; -DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, - int *recvd /* out */) DECLSPEC_HIDDEN; +DWORD NETCON_recv(netconn_t*,void*,size_t,blocking_mode_t,int*) DECLSPEC_HIDDEN; BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available) DECLSPEC_HIDDEN; BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN; LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN; diff -Nru wine1.7-1.7.13/dlls/wininet/netconnection.c wine1.7-1.7.16/dlls/wininet/netconnection.c --- wine1.7-1.7.13/dlls/wininet/netconnection.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wininet/netconnection.c 2014-04-04 19:13:44.000000000 +0000 @@ -86,6 +86,11 @@ #define RESPONSE_TIMEOUT 30 /* FROM internet.c */ +#ifdef MSG_DONTWAIT +#define WINE_MSG_DONTWAIT MSG_DONTWAIT +#else +#define WINE_MSG_DONTWAIT 0 +#endif WINE_DEFAULT_DEBUG_CHANNEL(wininet); @@ -491,6 +496,14 @@ return err; } +static void set_socket_blocking(int socket, blocking_mode_t mode) +{ +#if defined(__MINGW32__) || defined (_MSC_VER) + ULONG arg = mode == BLOCKING_DISALLOW; + ioctlsocket(socket, FIONBIO, &arg); +#endif +} + static DWORD netcon_secure_connect_setup(netconn_t *connection, BOOL compat_mode) { SecBuffer out_buf = {0, SECBUFFER_TOKEN, NULL}, in_bufs[2] = {{0, SECBUFFER_TOKEN}, {0, SECBUFFER_EMPTY}}; @@ -747,37 +760,53 @@ } } -static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *ret_size, BOOL *eof) +static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, blocking_mode_t mode, SIZE_T *ret_size, BOOL *eof) { const SIZE_T ssl_buf_size = conn->ssl_sizes.cbHeader+conn->ssl_sizes.cbMaximumMessage+conn->ssl_sizes.cbTrailer; SecBuffer bufs[4]; SecBufferDesc buf_desc = {SECBUFFER_VERSION, sizeof(bufs)/sizeof(*bufs), bufs}; - SSIZE_T size, buf_len; + SSIZE_T size, buf_len = 0; + blocking_mode_t tmp_mode; int i; SECURITY_STATUS res; assert(conn->extra_len < ssl_buf_size); + /* BLOCKING_WAITALL is handled by caller */ + if(mode == BLOCKING_WAITALL) + mode = BLOCKING_ALLOW; + if(conn->extra_len) { memcpy(conn->ssl_buf, conn->extra_buf, conn->extra_len); buf_len = conn->extra_len; conn->extra_len = 0; heap_free(conn->extra_buf); conn->extra_buf = NULL; - }else { - buf_len = recv(conn->socket, conn->ssl_buf+conn->extra_len, ssl_buf_size-conn->extra_len, 0); - if(buf_len < 0) { - WARN("recv failed\n"); - return FALSE; - } + } + tmp_mode = buf_len ? BLOCKING_DISALLOW : mode; + set_socket_blocking(conn->socket, tmp_mode); + size = recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, tmp_mode == BLOCKING_ALLOW ? 0 : WINE_MSG_DONTWAIT); + if(size < 0) { if(!buf_len) { - *eof = TRUE; - return TRUE; + if(errno == EAGAIN || errno == EWOULDBLOCK) { + TRACE("would block\n"); + return WSAEWOULDBLOCK; + } + WARN("recv failed\n"); + return ERROR_INTERNET_CONNECTION_ABORTED; } + }else { + buf_len += size; + } + + *ret_size = buf_len; + + if(!buf_len) { + *eof = TRUE; + return ERROR_SUCCESS; } - *ret_size = 0; *eof = FALSE; do { @@ -793,19 +822,34 @@ case SEC_I_CONTEXT_EXPIRED: TRACE("context expired\n"); *eof = TRUE; - return TRUE; + return ERROR_SUCCESS; case SEC_E_INCOMPLETE_MESSAGE: assert(buf_len < ssl_buf_size); - size = recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, 0); - if(size < 1) - return FALSE; + set_socket_blocking(conn->socket, mode); + size = recv(conn->socket, conn->ssl_buf+buf_len, ssl_buf_size-buf_len, mode == BLOCKING_ALLOW ? 0 : WINE_MSG_DONTWAIT); + if(size < 1) { + if(size < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) { + TRACE("would block\n"); + + /* FIXME: Optimize extra_buf usage. */ + conn->extra_buf = heap_alloc(buf_len); + if(!conn->extra_buf) + return ERROR_NOT_ENOUGH_MEMORY; + + conn->extra_len = buf_len; + memcpy(conn->extra_buf, conn->ssl_buf, conn->extra_len); + return WSAEWOULDBLOCK; + } + + return ERROR_INTERNET_CONNECTION_ABORTED; + } buf_len += size; continue; default: WARN("failed: %08x\n", res); - return FALSE; + return ERROR_INTERNET_CONNECTION_ABORTED; } } while(res != SEC_E_OK); @@ -817,7 +861,7 @@ assert(!conn->peek_len); conn->peek_msg_mem = conn->peek_msg = heap_alloc(bufs[i].cbBuffer - size); if(!conn->peek_msg) - return FALSE; + return ERROR_NOT_ENOUGH_MEMORY; conn->peek_len = bufs[i].cbBuffer-size; memcpy(conn->peek_msg, (char*)bufs[i].pvBuffer+size, conn->peek_len); } @@ -830,14 +874,14 @@ if(bufs[i].BufferType == SECBUFFER_EXTRA) { conn->extra_buf = heap_alloc(bufs[i].cbBuffer); if(!conn->extra_buf) - return FALSE; + return ERROR_NOT_ENOUGH_MEMORY; conn->extra_len = bufs[i].cbBuffer; memcpy(conn->extra_buf, bufs[i].pvBuffer, conn->extra_len); } } - return TRUE; + return ERROR_SUCCESS; } /****************************************************************************** @@ -845,7 +889,7 @@ * Basically calls 'recv()' unless we should use SSL * number of chars received is put in *recvd */ -DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, int *recvd) +DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, blocking_mode_t mode, int *recvd) { *recvd = 0; if (!len) @@ -853,13 +897,28 @@ if (!connection->secure) { + int flags = 0; + + switch(mode) { + case BLOCKING_ALLOW: + break; + case BLOCKING_DISALLOW: + flags = WINE_MSG_DONTWAIT; + break; + case BLOCKING_WAITALL: + flags = MSG_WAITALL; + break; + } + + set_socket_blocking(connection->socket, mode); *recvd = recv(connection->socket, buf, len, flags); return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS; } else { SIZE_T size = 0, cread; - BOOL res, eof; + BOOL eof; + DWORD res; if(connection->peek_msg) { size = min(len, connection->peek_len); @@ -872,18 +931,23 @@ connection->peek_msg_mem = connection->peek_msg = NULL; } /* check if we have enough data from the peek buffer */ - if(!(flags & MSG_WAITALL) || size == len) { + if(mode != BLOCKING_WAITALL || size == len) { *recvd = size; return ERROR_SUCCESS; } + + mode = BLOCKING_DISALLOW; } do { - res = read_ssl_chunk(connection, (BYTE*)buf+size, len-size, &cread, &eof); - if(!res) { - WARN("read_ssl_chunk failed\n"); - if(!size) - return ERROR_INTERNET_CONNECTION_ABORTED; + res = read_ssl_chunk(connection, (BYTE*)buf+size, len-size, mode, &cread, &eof); + if(res != ERROR_SUCCESS) { + if(res == WSAEWOULDBLOCK) { + if(size) + res = ERROR_SUCCESS; + }else { + WARN("read_ssl_chunk failed\n"); + } break; } @@ -893,11 +957,11 @@ } size += cread; - }while(!size || ((flags & MSG_WAITALL) && size < len)); + }while(!size || (mode == BLOCKING_WAITALL && size < len)); TRACE("received %ld bytes\n", size); *recvd = size; - return ERROR_SUCCESS; + return res; } } diff -Nru wine1.7-1.7.13/dlls/wininet/tests/http.c wine1.7-1.7.16/dlls/wininet/tests/http.c --- wine1.7-1.7.13/dlls/wininet/tests/http.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wininet/tests/http.c 2014-04-04 19:13:44.000000000 +0000 @@ -2196,7 +2196,7 @@ if (!memcmp(buffer, "GET ", sizeof("GET ")-1) && !strstr(buffer, "Cache-Control: no-cache\r\n")) send(c, okmsg, sizeof(okmsg)-1, 0); else if (strstr(buffer, "Cache-Control: no-cache\r\n")) send(c, okmsg, sizeof(okmsg)-1, 0); - send(c, notokmsg, sizeof(notokmsg)-1, 0); + else send(c, notokmsg, sizeof(notokmsg)-1, 0); } if (strstr(buffer, "GET /test_premature_disconnect")) trace("closing connection\n"); @@ -2213,7 +2213,7 @@ static void test_basic_request(int port, const char *verb, const char *url) { HINTERNET hi, hc, hr; - DWORD r, count; + DWORD r, count, error; char buffer[0x100]; hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); @@ -2225,7 +2225,10 @@ hr = HttpOpenRequestA(hc, verb, url, NULL, NULL, NULL, 0, 0); ok(hr != NULL, "HttpOpenRequest failed\n"); + SetLastError(0xdeadbeef); r = HttpSendRequestA(hr, NULL, 0, NULL, 0); + error = GetLastError(); + ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %u\n", error); ok(r, "HttpSendRequest failed\n"); count = 0; @@ -2241,32 +2244,6 @@ InternetCloseHandle(hi); } -static void test_last_error(int port) -{ - HINTERNET hi, hc, hr; - DWORD error; - BOOL r; - - hi = InternetOpenA(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); - ok(hi != NULL, "open failed\n"); - - hc = InternetConnectA(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); - ok(hc != NULL, "connect failed\n"); - - hr = HttpOpenRequestA(hc, NULL, "/test1", NULL, NULL, NULL, 0, 0); - ok(hr != NULL, "HttpOpenRequest failed\n"); - - SetLastError(0xdeadbeef); - r = HttpSendRequestA(hr, NULL, 0, NULL, 0); - error = GetLastError(); - ok(r, "HttpSendRequest failed\n"); - ok(error == ERROR_SUCCESS || broken(error != ERROR_SUCCESS), "expected ERROR_SUCCESS, got %u\n", error); - - InternetCloseHandle(hr); - InternetCloseHandle(hc); - InternetCloseHandle(hi); -} - static void test_proxy_indirect(int port) { HINTERNET hi, hc, hr; @@ -3078,12 +3055,17 @@ CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_SENT); CHECK_NOTIFIED(INTERNET_STATUS_RECEIVING_RESPONSE); CHECK_NOTIFIED(INTERNET_STATUS_RESPONSE_RECEIVED); - CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION); - CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED); CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); close_async_handle(session, hCompleteEvent, 2); CloseHandle(hCompleteEvent); + + /* + * The connection should be closed before closing handle. This is true for most + * wininet versions (including Wine), but some old win2k versions fail to do that. + */ + CHECK_NOTIFIED(INTERNET_STATUS_CLOSING_CONNECTION); + CHECK_NOTIFIED(INTERNET_STATUS_CONNECTION_CLOSED); } static void test_conn_close(int port) @@ -3933,6 +3915,7 @@ ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); + InternetCloseHandle(request); request = HttpOpenRequestA(connect, "POST", "/test_cache_control_verb", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); @@ -3940,6 +3923,7 @@ ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); + InternetCloseHandle(request); request = HttpOpenRequestA(connect, "HEAD", "/test_cache_control_verb", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); @@ -3947,6 +3931,7 @@ ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); + InternetCloseHandle(request); request = HttpOpenRequestA(connect, "GET", "/test_cache_control_verb", NULL, NULL, NULL, INTERNET_FLAG_NO_CACHE_WRITE, 0); @@ -3954,8 +3939,8 @@ ret = HttpSendRequestA(request, NULL, 0, NULL, 0); ok(ret, "HttpSendRequest failed %u\n", GetLastError()); test_status_code(request, 200); - InternetCloseHandle(request); + InternetCloseHandle(connect); InternetCloseHandle(session); } @@ -3994,7 +3979,6 @@ test_response_without_headers(si.port); test_HttpQueryInfo(si.port); test_HttpSendRequestW(si.port); - test_last_error(si.port); test_options(si.port); test_no_content(si.port); test_conn_close(si.port); @@ -4029,9 +4013,9 @@ } cert_struct_test_t; static const cert_struct_test_t test_winehq_org_cert = { - "0mJuv1t-1CFypQkyTZwfvjHHBAbnUndG\r\n" + "6JcR7G3G8tgjkeoMcitK-bTbzcpumDSy\r\n" "GT98380011\r\n" - "See www.rapidssl.com/resources/cps (c)13\r\n" + "See www.rapidssl.com/resources/cps (c)14\r\n" "Domain Control Validated - RapidSSL(R)\r\n" "*.winehq.org", diff -Nru wine1.7-1.7.13/dlls/winmm/joystick.c wine1.7-1.7.16/dlls/winmm/joystick.c --- wine1.7-1.7.13/dlls/winmm/joystick.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winmm/joystick.c 2014-04-04 19:13:44.000000000 +0000 @@ -136,7 +136,7 @@ /************************************************************************** * joyGetNumDevs [WINMM.@] */ -UINT WINAPI joyGetNumDevs(void) +UINT WINAPI DECLSPEC_HOTPATCH joyGetNumDevs(void) { UINT ret = 0; int i; @@ -152,7 +152,7 @@ /************************************************************************** * joyGetDevCapsW [WINMM.@] */ -MMRESULT WINAPI joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize) +MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetDevCapsW(UINT_PTR wID, LPJOYCAPSW lpCaps, UINT wSize) { if (wID >= MAXJOYSTICK) return JOYERR_PARMS; if (!JOY_LoadDriver(wID)) return MMSYSERR_NODRIVER; @@ -166,7 +166,7 @@ /************************************************************************** * joyGetDevCapsA [WINMM.@] */ -MMRESULT WINAPI joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize) +MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetDevCapsA(UINT_PTR wID, LPJOYCAPSA lpCaps, UINT wSize) { JOYCAPSW jcw; MMRESULT ret; @@ -215,7 +215,7 @@ /************************************************************************** * joyGetPosEx [WINMM.@] */ -MMRESULT WINAPI joyGetPosEx(UINT wID, LPJOYINFOEX lpInfo) +MMRESULT WINAPI DECLSPEC_HOTPATCH joyGetPosEx(UINT wID, LPJOYINFOEX lpInfo) { TRACE("(%d, %p);\n", wID, lpInfo); diff -Nru wine1.7-1.7.13/dlls/winmm/tests/capture.c wine1.7-1.7.16/dlls/winmm/tests/capture.c --- wine1.7-1.7.13/dlls/winmm/tests/capture.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winmm/tests/capture.c 2014-04-04 19:13:44.000000000 +0000 @@ -454,7 +454,8 @@ format.cbSize=0; rc=waveInOpen(&win,device,&format,0,0,CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -472,7 +473,8 @@ format.cbSize=0; rc=waveInOpen(&win,device,&format,0,0,CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -496,7 +498,8 @@ rc=waveInOpen(&win,device,&wfex.Format,0,0, CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -520,7 +523,8 @@ rc=waveInOpen(&win,device,&wfex.Format,0,0, CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -544,7 +548,8 @@ rc=waveInOpen(&win,device,&wfex.Format,0,0, CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -571,7 +576,8 @@ rc=waveInOpen(&win,device,&wfex.Format,0,0, CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -596,7 +602,8 @@ rc=waveInOpen(&win,device,&wfex.Format,0,0, CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); @@ -620,7 +627,8 @@ rc=waveInOpen(&win,device,&wfex.Format,0,0, CALLBACK_NULL|WAVE_FORMAT_DIRECT); ok(rc==MMSYSERR_NOERROR || rc==WAVERR_BADFORMAT || - rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM, + rc==MMSYSERR_INVALFLAG || rc==MMSYSERR_INVALPARAM || + rc==MMSYSERR_ALLOCATED, "waveInOpen(%s): returned: %s\n",dev_name(device),wave_in_error(rc)); if (rc==MMSYSERR_NOERROR) { waveInClose(win); diff -Nru wine1.7-1.7.13/dlls/winmm/tests/mci.c wine1.7-1.7.16/dlls/winmm/tests/mci.c --- wine1.7-1.7.13/dlls/winmm/tests/mci.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winmm/tests/mci.c 2014-04-04 19:13:44.000000000 +0000 @@ -1297,8 +1297,14 @@ START_TEST(mci) { + char curdir[MAX_PATH], tmpdir[MAX_PATH]; MCIERROR err; HWND hwnd; + + GetCurrentDirectoryA(MAX_PATH, curdir); + GetTempPathA(MAX_PATH, tmpdir); + SetCurrentDirectoryA(tmpdir); + hwnd = CreateWindowExA(0, "static", "winmm test", WS_POPUP, 0,0,100,100, 0, 0, 0, NULL); test_mciParser(hwnd); @@ -1315,4 +1321,6 @@ ok(!err,"final close all returned %s\n", dbg_mcierr(err)); ok(DeleteFileA("tempfile.wav") || ok_saved, "Delete tempfile.wav (cause auto-open?)\n"); DestroyWindow(hwnd); + + SetCurrentDirectoryA(curdir); } diff -Nru wine1.7-1.7.13/dlls/winspool.drv/info.c wine1.7-1.7.16/dlls/winspool.drv/info.c --- wine1.7-1.7.13/dlls/winspool.drv/info.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winspool.drv/info.c 2014-04-04 19:13:44.000000000 +0000 @@ -8569,3 +8569,25 @@ } return ret; } + +/***************************************************************************** + * UploadPrinterDriverPackageA [WINSPOOL.@] + */ +HRESULT WINAPI UploadPrinterDriverPackageA( LPCSTR server, LPCSTR path, LPCSTR env, + DWORD flags, HWND hwnd, LPSTR dst, PULONG dstlen ) +{ + FIXME("%s, %s, %s, %x, %p, %p, %p\n", debugstr_a(server), debugstr_a(path), debugstr_a(env), + flags, hwnd, dst, dstlen); + return E_NOTIMPL; +} + +/***************************************************************************** + * UploadPrinterDriverPackageW [WINSPOOL.@] + */ +HRESULT WINAPI UploadPrinterDriverPackageW( LPCWSTR server, LPCWSTR path, LPCWSTR env, + DWORD flags, HWND hwnd, LPWSTR dst, PULONG dstlen ) +{ + FIXME("%s, %s, %s, %x, %p, %p, %p\n", debugstr_w(server), debugstr_w(path), debugstr_w(env), + flags, hwnd, dst, dstlen); + return E_NOTIMPL; +} diff -Nru wine1.7-1.7.13/dlls/winspool.drv/winspool.drv.spec wine1.7-1.7.16/dlls/winspool.drv/winspool.drv.spec --- wine1.7-1.7.13/dlls/winspool.drv/winspool.drv.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/winspool.drv/winspool.drv.spec 2014-04-04 19:13:44.000000000 +0000 @@ -176,6 +176,8 @@ @ stdcall StartDocPrinterA(long long ptr) @ stdcall StartDocPrinterW(long long ptr) @ stdcall StartPagePrinter(long) +@ stdcall UploadPrinterDriverPackageA(str str str long long ptr ptr) +@ stdcall UploadPrinterDriverPackageW(wstr wstr wstr long long ptr ptr) @ stub WaitForPrinterChange @ stdcall WritePrinter(long ptr long ptr) @ stdcall XcvDataW(long wstr ptr long ptr long ptr ptr) diff -Nru wine1.7-1.7.13/dlls/wintab32/context.c wine1.7-1.7.16/dlls/wintab32/context.c --- wine1.7-1.7.13/dlls/wintab32/context.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wintab32/context.c 2014-04-04 19:13:44.000000000 +0000 @@ -313,7 +313,7 @@ if (context->context.lcPktData & PK_CHANGED) ptr+=CopyTabletData(ptr,&wtp->pkChanged,sizeof(WTPKT)); if (context->context.lcPktData & PK_SERIAL_NUMBER) - ptr+=CopyTabletData(ptr,&wtp->pkChanged,sizeof(UINT)); + ptr+=CopyTabletData(ptr,&wtp->pkSerialNumber,sizeof(UINT)); if (context->context.lcPktData & PK_CURSOR) ptr+=CopyTabletData(ptr,&wtp->pkCursor,sizeof(UINT)); if (context->context.lcPktData & PK_BUTTONS) diff -Nru wine1.7-1.7.13/dlls/wldap32/tests/parse.c wine1.7-1.7.16/dlls/wldap32/tests/parse.c --- wine1.7-1.7.13/dlls/wldap32/tests/parse.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wldap32/tests/parse.c 2014-04-04 19:13:44.000000000 +0000 @@ -48,7 +48,7 @@ timeout.tv_sec = 20; timeout.tv_usec = 0; ret = ldap_search_ext_sA( ld, (char *)"", LDAP_SCOPE_ONELEVEL, (char *)"(ou=*)", NULL, 0, ctrls, NULL, &timeout, 10, &res ); - if (ret == LDAP_SERVER_DOWN) + if (ret == LDAP_SERVER_DOWN || ret == LDAP_TIMEOUT) { skip("test server can't be reached\n"); ldap_control_freeA( sort ); diff -Nru wine1.7-1.7.13/dlls/wmp/oleobj.c wine1.7-1.7.16/dlls/wmp/oleobj.c --- wine1.7-1.7.13/dlls/wmp/oleobj.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmp/oleobj.c 2014-04-04 19:13:44.000000000 +0000 @@ -261,6 +261,12 @@ }else if(IsEqualGUID(riid, &IID_IWMPPlayer4)) { TRACE("(%p)->(IID_IWMPPlayer4 %p)\n", This, ppv); *ppv = &This->IWMPPlayer4_iface; + }else if(IsEqualGUID(riid, &IID_IWMPSettings)) { + TRACE("(%p)->(IID_IWMPSettings %p)\n", This, ppv); + *ppv = &This->IWMPSettings_iface; + }else if(IsEqualGUID(riid, &IID_IOleControl)) { + TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv); + *ppv = &This->IOleControl_iface; }else { FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); *ppv = NULL; @@ -396,6 +402,16 @@ case OLEIVERB_INPLACEACTIVATE: TRACE("(%p)->(OLEIVERB_INPLACEACTIVATE)\n", This); return activate_inplace(This); + + case OLEIVERB_HIDE: + if(!This->hwnd) { + FIXME("No window to hide\n"); + return E_UNEXPECTED; + } + + ShowWindow(This->hwnd, SW_HIDE); + return S_OK; + default: FIXME("Unsupported iVerb %d\n", iVerb); } @@ -586,8 +602,16 @@ LPCRECT lprcPosRect, LPCRECT lprcClipRect) { WindowsMediaPlayer *This = impl_from_IOleInPlaceObjectWindowless(iface); - FIXME("(%p)->(%p %p)\n", This, lprcPosRect, lprcClipRect); - return E_NOTIMPL; + + TRACE("(%p)->(%s %s)\n", This, wine_dbgstr_rect(lprcPosRect), wine_dbgstr_rect(lprcClipRect)); + + if(This->hwnd) { + SetWindowPos(This->hwnd, NULL, lprcPosRect->left, lprcPosRect->top, + lprcPosRect->right-lprcPosRect->left, lprcPosRect->bottom-lprcPosRect->top, + SWP_NOZORDER | SWP_NOACTIVATE); + } + + return S_OK; } static HRESULT WINAPI OleInPlaceObjectWindowless_ReactivateAndUndo(IOleInPlaceObjectWindowless *iface) @@ -627,6 +651,67 @@ OleInPlaceObjectWindowless_GetDropTarget }; +static inline WindowsMediaPlayer *impl_from_IOleControl(IOleControl *iface) +{ + return CONTAINING_RECORD(iface, WindowsMediaPlayer, IOleControl_iface); +} + +static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv); +} + +static ULONG WINAPI OleControl_AddRef(IOleControl *iface) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + return IOleObject_AddRef(&This->IOleObject_iface); +} + +static ULONG WINAPI OleControl_Release(IOleControl *iface) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + return IOleObject_AddRef(&This->IOleObject_iface); +} + +static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + FIXME("(%p)->(%p)\n", This, pCI); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *msg) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + FIXME("(%p)->(%p)\n", This, msg); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + FIXME("(%p)->(%d)\n", This, dispID); + return E_NOTIMPL; +} + +static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL freeze) +{ + WindowsMediaPlayer *This = impl_from_IOleControl(iface); + FIXME("(%p)->(%x)\n", This, freeze); + return E_NOTIMPL; +} + +static const IOleControlVtbl OleControlVtbl = { + OleControl_QueryInterface, + OleControl_AddRef, + OleControl_Release, + OleControl_GetControlInfo, + OleControl_OnMnemonic, + OleControl_OnAmbientPropertyChange, + OleControl_FreezeEvents +}; + static inline WindowsMediaPlayer *impl_from_IProvideClassInfo2(IProvideClassInfo2 *iface) { return CONTAINING_RECORD(iface, WindowsMediaPlayer, IProvideClassInfo2_iface); @@ -744,8 +829,15 @@ static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface) { WindowsMediaPlayer *This = impl_from_IPersistStreamInit(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; + + TRACE("(%p)\n", This); + + if(!This->client_site) + return E_FAIL; + + /* Nothing to do, yet. */ + get_container_hwnd(This); + return S_OK; } static const IPersistStreamInitVtbl PersistStreamInitVtbl = { @@ -826,6 +918,7 @@ wmp->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl; wmp->IOleInPlaceObjectWindowless_iface.lpVtbl = &OleInPlaceObjectWindowlessVtbl; wmp->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl; + wmp->IOleControl_iface.lpVtbl = &OleControlVtbl; wmp->ref = 1; diff -Nru wine1.7-1.7.13/dlls/wmp/player.c wine1.7-1.7.16/dlls/wmp/player.c --- wine1.7-1.7.13/dlls/wmp/player.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmp/player.c 2014-04-04 19:13:44.000000000 +0000 @@ -123,8 +123,12 @@ static HRESULT WINAPI WMPPlayer4_get_settings(IWMPPlayer4 *iface, IWMPSettings **ppSettings) { WindowsMediaPlayer *This = impl_from_IWMPPlayer4(iface); - FIXME("(%p)->(%p)\n", This, ppSettings); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, ppSettings); + + IWMPSettings_AddRef(&This->IWMPSettings_iface); + *ppSettings = &This->IWMPSettings_iface; + return S_OK; } static HRESULT WINAPI WMPPlayer4_get_currentMedia(IWMPPlayer4 *iface, IWMPMedia **ppMedia) @@ -400,7 +404,258 @@ WMPPlayer4_openPlayer }; +static inline WindowsMediaPlayer *impl_from_IWMPSettings(IWMPSettings *iface) +{ + return CONTAINING_RECORD(iface, WindowsMediaPlayer, IWMPSettings_iface); +} + +static HRESULT WINAPI WMPSettings_QueryInterface(IWMPSettings *iface, REFIID riid, void **ppv) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + return IOleObject_QueryInterface(&This->IOleObject_iface, riid, ppv); +} + +static ULONG WINAPI WMPSettings_AddRef(IWMPSettings *iface) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + return IOleObject_AddRef(&This->IOleObject_iface); +} + +static ULONG WINAPI WMPSettings_Release(IWMPSettings *iface) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + return IOleObject_Release(&This->IOleObject_iface); +} + +static HRESULT WINAPI WMPSettings_GetTypeInfoCount(IWMPSettings *iface, UINT *pctinfo) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, pctinfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_GetTypeInfo(IWMPSettings *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%u %d %p)\n", This, iTInfo, lcid, ppTInfo); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_GetIDsOfNames(IWMPSettings *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%s %p %u %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_Invoke(IWMPSettings *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%d %s %d %x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), lcid, + wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_isAvailable(IWMPSettings *iface, BSTR item, VARIANT_BOOL *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(item), p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_autoStart(IWMPSettings *iface, VARIANT_BOOL *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_autoStart(IWMPSettings *iface, VARIANT_BOOL v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_baseURL(IWMPSettings *iface, BSTR *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_baseURL(IWMPSettings *iface, BSTR v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_defaultFrame(IWMPSettings *iface, BSTR *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_defaultFrame(IWMPSettings *iface, BSTR v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%s)\n", This, debugstr_w(v)); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_invokeURLs(IWMPSettings *iface, VARIANT_BOOL *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_invokeURLs(IWMPSettings *iface, VARIANT_BOOL v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_mute(IWMPSettings *iface, VARIANT_BOOL *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_mute(IWMPSettings *iface, VARIANT_BOOL v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_playCount(IWMPSettings *iface, LONG *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_playCount(IWMPSettings *iface, LONG v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_rate(IWMPSettings *iface, double *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_rate(IWMPSettings *iface, double v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%lf)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_balance(IWMPSettings *iface, LONG *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_balance(IWMPSettings *iface, LONG v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_volume(IWMPSettings *iface, LONG *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_volume(IWMPSettings *iface, LONG v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%d)\n", This, v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_getMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(mode), p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_setMode(IWMPSettings *iface, BSTR mode, VARIANT_BOOL v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%s %x)\n", This, debugstr_w(mode), v); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_get_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL *p) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%p)\n", This, p); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMPSettings_put_enableErrorDialogs(IWMPSettings *iface, VARIANT_BOOL v) +{ + WindowsMediaPlayer *This = impl_from_IWMPSettings(iface); + FIXME("(%p)->(%x)\n", This, v); + return E_NOTIMPL; +} + +static const IWMPSettingsVtbl WMPSettingsVtbl = { + WMPSettings_QueryInterface, + WMPSettings_AddRef, + WMPSettings_Release, + WMPSettings_GetTypeInfoCount, + WMPSettings_GetTypeInfo, + WMPSettings_GetIDsOfNames, + WMPSettings_Invoke, + WMPSettings_get_isAvailable, + WMPSettings_get_autoStart, + WMPSettings_put_autoStart, + WMPSettings_get_baseURL, + WMPSettings_put_baseURL, + WMPSettings_get_defaultFrame, + WMPSettings_put_defaultFrame, + WMPSettings_get_invokeURLs, + WMPSettings_put_invokeURLs, + WMPSettings_get_mute, + WMPSettings_put_mute, + WMPSettings_get_playCount, + WMPSettings_put_playCount, + WMPSettings_get_rate, + WMPSettings_put_rate, + WMPSettings_get_balance, + WMPSettings_put_balance, + WMPSettings_get_volume, + WMPSettings_put_volume, + WMPSettings_getMode, + WMPSettings_setMode, + WMPSettings_get_enableErrorDialogs, + WMPSettings_put_enableErrorDialogs +}; + void init_player_ifaces(WindowsMediaPlayer *wmp) { wmp->IWMPPlayer4_iface.lpVtbl = &WMPPlayer4Vtbl; + wmp->IWMPSettings_iface.lpVtbl = &WMPSettingsVtbl; } diff -Nru wine1.7-1.7.13/dlls/wmp/rsrc.rc wine1.7-1.7.16/dlls/wmp/rsrc.rc --- wine1.7-1.7.13/dlls/wmp/rsrc.rc 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmp/rsrc.rc 2014-04-04 19:13:44.000000000 +0000 @@ -22,3 +22,12 @@ /* @makedep: wmp.rgs */ 2 WINE_REGISTRY wmp.rgs + +#define WINE_FILEDESCRIPTION_STR "Wine Media Player" +#define WINE_FILENAME_STR "wmp.dll" +#define WINE_FILEVERSION 12,0,7601,16982 +#define WINE_FILEVERSION_STR "12.0.7601.16982" +#define WINE_PRODUCTVERSION 12,0,7601,16982 +#define WINE_PRODUCTVERSION_STR "12.0.7601.16982" + +#include "wine/wine_common_ver.rc" diff -Nru wine1.7-1.7.13/dlls/wmp/tests/oleobj.c wine1.7-1.7.16/dlls/wmp/tests/oleobj.c --- wine1.7-1.7.13/dlls/wmp/tests/oleobj.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmp/tests/oleobj.c 2014-04-04 19:13:44.000000000 +0000 @@ -788,6 +788,29 @@ return S_OK; } +static void test_wmp_ifaces(IOleObject *oleobj) +{ + IWMPSettings *settings, *settings_qi; + IWMPPlayer4 *player4; + HRESULT hres; + + hres = IOleObject_QueryInterface(oleobj, &IID_IWMPPlayer4, (void**)&player4); + ok(hres == S_OK, "Could not get IWMPPlayer4 iface: %08x\n", hres); + + settings = NULL; + hres = IWMPPlayer4_get_settings(player4, &settings); + ok(hres == S_OK, "get_settings failed: %08x\n", hres); + ok(settings != NULL, "settings = NULL\n"); + + hres = IOleObject_QueryInterface(oleobj, &IID_IWMPSettings, (void**)&settings_qi); + ok(hres == S_OK, "Could not get IWMPSettings iface: %08x\n", hres); + ok(settings == settings_qi, "settings != settings_qi\n"); + IWMPSettings_Release(settings_qi); + + IWMPSettings_Release(settings); + IWMPPlayer4_Release(player4); +} + #define test_rect_size(a,b,c) _test_rect_size(__LINE__,a,b,c) static void _test_rect_size(unsigned line, const RECT *r, int width, int height) { @@ -877,6 +900,9 @@ hres = IOleObject_QueryInterface(oleobj, &IID_IOleInPlaceObject, (void**)&ipobj); ok(hres == S_OK, "Could not get IOleInPlaceObject iface: %08x\n", hres); + hres = IPersistStreamInit_InitNew(psi); + ok(hres == E_FAIL || broken(hres == S_OK /* Old WMP */), "InitNew failed: %08x\n", hres); + SET_EXPECT(GetContainer); SET_EXPECT(GetExtendedControl); SET_EXPECT(GetWindow); @@ -893,6 +919,11 @@ ok(hres == S_OK, "GetClientSite failed: %08x\n", hres); ok(client_site == &ClientSite, "client_site != ClientSite\n"); + SET_EXPECT(GetWindow); + hres = IPersistStreamInit_InitNew(psi); + ok(hres == S_OK, "InitNew failed: %08x\n", hres); + CHECK_CALLED(GetWindow); + hwnd = (HWND)0xdeadbeef; hres = IOleInPlaceObject_GetWindow(ipobj, &hwnd); ok(hres == E_UNEXPECTED, "GetWindow failed: %08x\n", hres); @@ -918,6 +949,21 @@ test_window(hwnd); + pos.left = 1; + pos.top = 2; + pos.right = 301; + pos.bottom = 312; + hres = IOleInPlaceObject_SetObjectRects(ipobj, &pos, &pos); + ok(hres == S_OK, "SetObjectRects failed: %08x\n", hres); + GetClientRect(hwnd, &pos); + test_rect_size(&pos, 300, 310); + + test_wmp_ifaces(oleobj); + + hres = IOleObject_DoVerb(oleobj, OLEIVERB_HIDE, NULL, &ClientSite, 0, container_hwnd, &pos); + ok(hres == S_OK, "DoVerb failed: %08x\n", hres); + ok(!IsWindowVisible(hwnd), "Window is visible\n"); + SET_EXPECT(OnShowWindow_FALSE); SET_EXPECT(OnInPlaceDeactivate); hres = IOleObject_Close(oleobj, 0); diff -Nru wine1.7-1.7.13/dlls/wmp/wmp_private.h wine1.7-1.7.16/dlls/wmp/wmp_private.h --- wine1.7-1.7.13/dlls/wmp/wmp_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmp/wmp_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -28,7 +28,9 @@ IPersistStreamInit IPersistStreamInit_iface; IOleInPlaceObjectWindowless IOleInPlaceObjectWindowless_iface; IConnectionPointContainer IConnectionPointContainer_iface; + IOleControl IOleControl_iface; IWMPPlayer4 IWMPPlayer4_iface; + IWMPSettings IWMPSettings_iface; LONG ref; diff -Nru wine1.7-1.7.13/dlls/wmvcore/wmvcore_main.c wine1.7-1.7.16/dlls/wmvcore/wmvcore_main.c --- wine1.7-1.7.13/dlls/wmvcore/wmvcore_main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmvcore/wmvcore_main.c 2014-04-04 19:13:44.000000000 +0000 @@ -20,13 +20,26 @@ #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" +#include "initguid.h" #include "wmsdkidl.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wmvcore); +static inline void *heap_alloc(size_t len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); @@ -76,3 +89,126 @@ return E_NOTIMPL; } + +typedef struct { + IWMProfileManager IWMProfileManager_iface; + LONG ref; +} WMProfileManager; + +static inline WMProfileManager *impl_from_IWMProfileManager(IWMProfileManager *iface) +{ + return CONTAINING_RECORD(iface, WMProfileManager, IWMProfileManager_iface); +} + +static HRESULT WINAPI WMProfileManager_QueryInterface(IWMProfileManager *iface, REFIID riid, void **ppv) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); + *ppv = &This->IWMProfileManager_iface; + }else if(IsEqualGUID(&IID_IWMProfileManager, riid)) { + TRACE("(%p)->(IID_IWMProfileManager %p)\n", This, ppv); + *ppv = &This->IWMProfileManager_iface; + }else { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI WMProfileManager_AddRef(IWMProfileManager *iface) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + LONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + return ref; +} + +static ULONG WINAPI WMProfileManager_Release(IWMProfileManager *iface) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) ref=%d\n", This, ref); + + if(!ref) + heap_free(This); + + return ref; +} + +static HRESULT WINAPI WMProfileManager_CreateEmptyProfile(IWMProfileManager *iface, WMT_VERSION version, IWMProfile **ret) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + FIXME("(%p)->(%x %p)\n", This, version, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMProfileManager_LoadProfileByID(IWMProfileManager *iface, REFGUID guid, IWMProfile **ret) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_guid(guid), ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMProfileManager_LoadProfileByData(IWMProfileManager *iface, const WCHAR *profile, IWMProfile **ret) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + FIXME("(%p)->(%s %p)\n", This, debugstr_w(profile), ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMProfileManager_SaveProfile(IWMProfileManager *iface, IWMProfile *profile, WCHAR *profile_str, DWORD *len) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + FIXME("(%p)->(%p %p %p)\n", This, profile, profile_str, len); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMProfileManager_GetSystemProfileCount(IWMProfileManager *iface, DWORD *ret) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + FIXME("(%p)->(%p)\n", This, ret); + return E_NOTIMPL; +} + +static HRESULT WINAPI WMProfileManager_LoadSystemProfile(IWMProfileManager *iface, DWORD index, IWMProfile **ret) +{ + WMProfileManager *This = impl_from_IWMProfileManager(iface); + FIXME("(%p)->(%d %p)\n", This, index, ret); + return E_NOTIMPL; +} + +static const IWMProfileManagerVtbl WMProfileManagerVtbl = { + WMProfileManager_QueryInterface, + WMProfileManager_AddRef, + WMProfileManager_Release, + WMProfileManager_CreateEmptyProfile, + WMProfileManager_LoadProfileByID, + WMProfileManager_LoadProfileByData, + WMProfileManager_SaveProfile, + WMProfileManager_GetSystemProfileCount, + WMProfileManager_LoadSystemProfile +}; + +HRESULT WINAPI WMCreateProfileManager(IWMProfileManager **ret) +{ + WMProfileManager *profile_mgr; + + TRACE("(%p)\n", ret); + + profile_mgr = heap_alloc(sizeof(*profile_mgr)); + if(!profile_mgr) + return E_OUTOFMEMORY; + + profile_mgr->IWMProfileManager_iface.lpVtbl = &WMProfileManagerVtbl; + profile_mgr->ref = 1; + + *ret = &profile_mgr->IWMProfileManager_iface; + return S_OK; +} diff -Nru wine1.7-1.7.13/dlls/wmvcore/wmvcore.spec wine1.7-1.7.16/dlls/wmvcore/wmvcore.spec --- wine1.7-1.7.13/dlls/wmvcore/wmvcore.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wmvcore/wmvcore.spec 2014-04-04 19:13:44.000000000 +0000 @@ -8,7 +8,7 @@ @ stub WMCreateBackupRestorer @ stdcall WMCreateEditor(ptr) @ stub WMCreateIndexer -@ stub WMCreateProfileManager +@ stdcall WMCreateProfileManager(ptr) @ stdcall WMCreateReader(ptr long ptr) @ stub WMCreateReaderPriv @ stdcall WMCreateSyncReader(ptr long ptr) diff -Nru wine1.7-1.7.13/dlls/ws2_32/socket.c wine1.7-1.7.16/dlls/ws2_32/socket.c --- wine1.7-1.7.13/dlls/ws2_32/socket.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ws2_32/socket.c 2014-04-04 19:13:44.000000000 +0000 @@ -3337,12 +3337,13 @@ #endif #ifdef HAS_IRDA +#define MAX_IRDA_DEVICES 10 + case WS_SOL_IRLMP: switch(optname) { case WS_IRLMP_ENUMDEVICES: { - static const int MAX_IRDA_DEVICES = 10; char buf[sizeof(struct irda_device_list) + (MAX_IRDA_DEVICES - 1) * sizeof(struct irda_device_info)]; int res; @@ -3402,6 +3403,7 @@ return SOCKET_ERROR; } break; /* case WS_SOL_IRLMP */ +#undef MAX_IRDA_DEVICES #endif /* Levels WS_IPPROTO_TCP and WS_IPPROTO_IP convert directly */ @@ -3671,6 +3673,40 @@ (USHORT)(ioctl & 0xffff)); } +/* do an ioctl call through the server */ +static DWORD server_ioctl_sock( SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, + LPVOID out_buff, DWORD out_size, LPDWORD ret_size, + LPWSAOVERLAPPED overlapped, + LPWSAOVERLAPPED_COMPLETION_ROUTINE completion ) +{ + HANDLE event = overlapped ? overlapped->hEvent : 0; + HANDLE handle = SOCKET2HANDLE( s ); + struct ws2_async *wsa; + NTSTATUS status; + PIO_STATUS_BLOCK io; + + if (!(wsa = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(*wsa) ))) + return WSA_NOT_ENOUGH_MEMORY; + wsa->hSocket = handle; + wsa->user_overlapped = overlapped; + wsa->completion_func = completion; + io = (overlapped ? (PIO_STATUS_BLOCK)overlapped : &wsa->local_iosb); + + status = NtDeviceIoControlFile( handle, event, (PIO_APC_ROUTINE)ws2_async_apc, wsa, io, code, + in_buff, in_size, out_buff, out_size ); + if (status == STATUS_NOT_SUPPORTED) + { + FIXME("Unsupported ioctl %x (device=%x access=%x func=%x method=%x)\n", + code, code >> 16, (code >> 14) & 3, (code >> 2) & 0xfff, code & 3); + } + else if (status == STATUS_SUCCESS) + *ret_size = io->Information; /* "Information" is the size written to the output buffer */ + + if (status != STATUS_PENDING) RtlFreeHeap( GetProcessHeap(), 0, wsa ); + + return NtStatusToWSAError( status ); +} + /********************************************************************** * WSAIoctl (WS2_32.50) * @@ -3682,8 +3718,8 @@ int fd; DWORD status = 0, total = 0; - TRACE("%ld, 0x%08x, %p, %d, %p, %d, %p, %p, %p\n", - s, code, in_buff, in_size, out_buff, out_size, ret_size, overlapped, completion); + TRACE("%ld, %s, %p, %d, %p, %d, %p, %p, %p\n", + s, debugstr_wsaioctl(code), in_buff, in_size, out_buff, out_size, ret_size, overlapped, completion); switch (code) { @@ -3693,6 +3729,7 @@ WSASetLastError(WSAEFAULT); return SOCKET_ERROR; } + TRACE("-> FIONBIO (%x)\n", *(WS_u_long*)in_buff); if (_get_sock_mask(s)) { /* AsyncSelect()'ed sockets are always nonblocking */ @@ -3862,12 +3899,6 @@ break; } - case WS_SIO_ADDRESS_LIST_CHANGE: - FIXME("-> SIO_ADDRESS_LIST_CHANGE request: stub\n"); - /* FIXME: error and return code depend on whether socket was created - * with WSA_FLAG_OVERLAPPED, but there is no easy way to get this */ - break; - case WS_SIO_ADDRESS_LIST_QUERY: { DWORD size; @@ -4103,11 +4134,29 @@ WSASetLastError(WSAEOPNOTSUPP); return SOCKET_ERROR; default: - FIXME("unsupported WS_IOCTL cmd (%s)\n", debugstr_wsaioctl(code)); status = WSAEOPNOTSUPP; break; } + if (status == WSAEOPNOTSUPP) + { + status = server_ioctl_sock(s, code, in_buff, in_size, out_buff, out_size, &total, + overlapped, completion); + if (status != WSAEOPNOTSUPP) + { + if (status == 0 || status == WSA_IO_PENDING) + TRACE("-> %s request\n", debugstr_wsaioctl(code)); + else + ERR("-> %s request failed with status 0x%x\n", debugstr_wsaioctl(code), status); + + /* overlapped and completion operations will be handled by the server */ + completion = NULL; + overlapped = NULL; + } + else + FIXME("unsupported WS_IOCTL cmd (%s)\n", debugstr_wsaioctl(code)); + } + if (completion) { FIXME( "completion routine %p not supported\n", completion ); diff -Nru wine1.7-1.7.13/dlls/ws2_32/tests/sock.c wine1.7-1.7.16/dlls/ws2_32/tests/sock.c --- wine1.7-1.7.13/dlls/ws2_32/tests/sock.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/ws2_32/tests/sock.c 2014-04-04 19:13:44.000000000 +0000 @@ -297,22 +297,12 @@ ok ( n <= 0, "garbage data received: %d bytes\n", n ); } -static int do_oob_send ( SOCKET s, char *buf, int buflen, int sendlen ) +static int do_synchronous_send ( SOCKET s, char *buf, int buflen, int sendlen, int flags ) { char* last = buf + buflen, *p; int n = 1; for ( p = buf; n > 0 && p < last; p += n ) - n = send ( s, p, min ( sendlen, last - p ), MSG_OOB ); - wsa_ok ( n, 0 <=, "do_oob_send (%x): error %d\n" ); - return p - buf; -} - -static int do_synchronous_send ( SOCKET s, char *buf, int buflen, int sendlen ) -{ - char* last = buf + buflen, *p; - int n = 1; - for ( p = buf; n > 0 && p < last; p += n ) - n = send ( s, p, min ( sendlen, last - p ), 0 ); + n = send ( s, p, min ( sendlen, last - p ), flags ); wsa_ok ( n, 0 <=, "do_synchronous_send (%x): error %d\n" ); return p - buf; } @@ -551,7 +541,7 @@ ok ( pos == -1, "simple_server (%x): test pattern error: %d\n", id, pos); /* Echo data back */ - n_sent = do_synchronous_send ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen ); + n_sent = do_synchronous_send ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen, 0 ); ok ( n_sent == n_expected, "simple_server (%x): sent less data than expected: %d of %d\n", id, n_sent, n_expected ); @@ -573,7 +563,7 @@ test_params *gen = par->general; server_memory *mem; u_long atmark = 0; - int pos, n_recvd, n_expected = gen->n_chunks * gen->chunk_size, tmp, + int pos, n_sent, n_recvd, n_expected = gen->n_chunks * gen->chunk_size, tmp, id = GetCurrentThreadId(); trace ( "oob_server (%x) starting\n", id ); @@ -598,17 +588,23 @@ ok ( mem->sock[0].peer.sin_addr.s_addr == inet_addr ( gen->inet_addr ), "oob_server (%x): strange peer address\n", id ); - /* check atmark state */ + /* check initial atmark state */ ioctlsocket ( mem->sock[0].s, SIOCATMARK, &atmark ); ok ( atmark == 1, "oob_server (%x): unexpectedly at the OOB mark: %i\n", id, atmark ); - /* Receive normal data and check atmark state */ + /* Receive normal data */ n_recvd = do_synchronous_recv ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen ); ok ( n_recvd == n_expected, - "simple_server (%x): received less data than expected: %d of %d\n", id, n_recvd, n_expected ); + "oob_server (%x): received less data than expected: %d of %d\n", id, n_recvd, n_expected ); pos = test_buffer ( mem->sock[0].buf, gen->chunk_size, gen->n_chunks ); - ok ( pos == -1, "simple_server (%x): test pattern error: %d\n", id, pos); + ok ( pos == -1, "oob_server (%x): test pattern error: %d\n", id, pos); + + /* Echo data back */ + n_sent = do_synchronous_send ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen, 0 ); + ok ( n_sent == n_expected, + "oob_server (%x): sent less data than expected: %d of %d\n", id, n_sent, n_expected ); + /* check atmark state */ ioctlsocket ( mem->sock[0].s, SIOCATMARK, &atmark ); ok ( atmark == 1, "oob_server (%x): unexpectedly at the OOB mark: %i\n", id, atmark ); @@ -795,7 +791,7 @@ trace ( "simple_client (%x) connected\n", id ); /* send data to server */ - n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen ); + n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen, 0 ); ok ( n_sent == n_expected, "simple_client (%x): sent less data than expected: %d of %d\n", id, n_sent, n_expected ); @@ -824,7 +820,7 @@ { test_params *gen = par->general; client_memory *mem; - int n_sent, n_expected = gen->n_chunks * gen->chunk_size, id; + int pos, n_sent, n_recvd, n_expected = gen->n_chunks * gen->chunk_size, id; id = GetCurrentThreadId(); trace ( "oob_client (%x): starting\n", id ); @@ -845,12 +841,19 @@ trace ( "oob_client (%x) connected\n", id ); /* send data to server */ - n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen ); + n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen, 0 ); ok ( n_sent == n_expected, "oob_client (%x): sent less data than expected: %d of %d\n", id, n_sent, n_expected ); + /* Receive data echoed back & check it */ + n_recvd = do_synchronous_recv ( mem->s, mem->recv_buf, n_expected, par->buflen ); + ok ( n_recvd == n_expected, + "simple_client (%x): received less data than expected: %d of %d\n", id, n_recvd, n_expected ); + pos = test_buffer ( mem->recv_buf, gen->chunk_size, gen->n_chunks ); + ok ( pos == -1, "simple_client (%x): test pattern error: %d\n", id, pos); + /* send out-of-band data to server */ - n_sent = do_oob_send ( mem->s, mem->send_buf, n_expected, par->buflen ); + n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen, MSG_OOB ); ok ( n_sent == n_expected, "oob_client (%x): sent less data than expected: %d of %d\n", id, n_sent, n_expected ); @@ -893,7 +896,7 @@ trace ( "simple_client (%x) connected\n", id ); /* send data to server */ - n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen ); + n_sent = do_synchronous_send ( mem->s, mem->send_buf, n_expected, par->buflen, 0 ); ok ( n_sent == n_expected, "simple_client (%x): sent less data than expected: %d of %d\n", id, n_sent, n_expected ); @@ -1854,7 +1857,8 @@ int i, j; struct servent *pserv[2]; - ok ( WaitForSingleObject ( *starttest, TEST_TIMEOUT * 1000 ) != WAIT_TIMEOUT, "test_getservbyname: timeout waiting for start signal\n"); + ok ( WaitForSingleObject ( *starttest, TEST_TIMEOUT * 1000 ) != WAIT_TIMEOUT, + "test_getservbyname: timeout waiting for start signal\n" ); /* ensure that necessary buffer resizes are completed */ for ( j = 0; j < 2; j++) { @@ -1864,14 +1868,19 @@ for ( i = 0; i < NUM_QUERIES / 2; i++ ) { for ( j = 0; j < 2; j++ ) { pserv[j] = getservbyname ( serv[j].name, serv[j].proto ); - ok ( pserv[j] != NULL, "getservbyname could not retrieve information for %s: %d\n", serv[j].name, WSAGetLastError() ); + ok ( pserv[j] != NULL || broken(pserv[j] == NULL) /* win8, fixed in win81 */, + "getservbyname could not retrieve information for %s: %d\n", serv[j].name, WSAGetLastError() ); if ( !pserv[j] ) continue; - ok ( pserv[j]->s_port == htons(serv[j].port), "getservbyname returned the wrong port for %s: %d\n", serv[j].name, ntohs(pserv[j]->s_port) ); - ok ( !strcmp ( pserv[j]->s_proto, serv[j].proto ), "getservbyname returned the wrong protocol for %s: %s\n", serv[j].name, pserv[j]->s_proto ); - ok ( !strcmp ( pserv[j]->s_name, serv[j].name ), "getservbyname returned the wrong name for %s: %s\n", serv[j].name, pserv[j]->s_name ); + ok ( pserv[j]->s_port == htons(serv[j].port), + "getservbyname returned the wrong port for %s: %d\n", serv[j].name, ntohs(pserv[j]->s_port) ); + ok ( !strcmp ( pserv[j]->s_proto, serv[j].proto ), + "getservbyname returned the wrong protocol for %s: %s\n", serv[j].name, pserv[j]->s_proto ); + ok ( !strcmp ( pserv[j]->s_name, serv[j].name ), + "getservbyname returned the wrong name for %s: %s\n", serv[j].name, pserv[j]->s_name ); } - ok ( pserv[0] == pserv[1], "getservbyname: winsock resized servent buffer when not necessary\n" ); + ok ( pserv[0] == pserv[1] || broken(pserv[0] != pserv[1]) /* win8, fixed in win81 */, + "getservbyname: winsock resized servent buffer when not necessary\n" ); } return 0; @@ -5509,11 +5518,21 @@ result = (ADDRINFOW *)0xdeadbeef; ret = pGetAddrInfoW(NULL, NULL, NULL, &result); + if(ret == 0) + { + skip("nxdomain returned success. Broken ISP redirects?\n"); + return; + } ok(ret == WSAHOST_NOT_FOUND, "got %d expected WSAHOST_NOT_FOUND\n", ret); ok(result == NULL, "got %p\n", result); result = (ADDRINFOW *)0xdeadbeef; ret = pGetAddrInfoW(nxdomain, NULL, NULL, &result); + if(ret == 0) + { + skip("nxdomain returned success. Broken ISP redirects?\n"); + return; + } ok(ret == WSAHOST_NOT_FOUND, "got %d expected WSAHOST_NOT_FOUND\n", ret); ok(result == NULL, "got %p\n", result); @@ -5650,6 +5669,11 @@ result = (ADDRINFOA *)0xdeadbeef; ret = pgetaddrinfo("nxdomain.codeweavers.com", NULL, NULL, &result); + if(ret == 0) + { + skip("nxdomain returned success. Broken ISP redirects?\n"); + return; + } ok(ret == WSAHOST_NOT_FOUND, "got %d expected WSAHOST_NOT_FOUND\n", ret); ok(result == NULL, "got %p\n", result); @@ -7366,13 +7390,17 @@ ok(bret == FALSE, "failed to get completion status %u\n", bret); todo_wine ok(GetLastError() == ERROR_NETNAME_DELETED || GetLastError() == ERROR_OPERATION_ABORTED || - GetLastError() == ERROR_CONNECTION_ABORTED, "Last error was %d\n", GetLastError()); + GetLastError() == ERROR_CONNECTION_ABORTED || + GetLastError() == ERROR_PIPE_NOT_CONNECTED /* win 2000 */, + "Last error was %d\n", GetLastError()); ok(key == 125, "Key is %lu\n", key); ok(num_bytes == 0, "Number of bytes transferred is %u\n", num_bytes); ok(olp == &ov, "Overlapped structure is at %p\n", olp); todo_wine ok(olp && (olp->Internal == (ULONG)STATUS_LOCAL_DISCONNECT || olp->Internal == (ULONG)STATUS_CANCELLED || - olp->Internal == (ULONG)STATUS_CONNECTION_ABORTED), "Internal status is %lx\n", olp ? olp->Internal : 0); + olp->Internal == (ULONG)STATUS_CONNECTION_ABORTED || + olp->Internal == (ULONG)STATUS_PIPE_DISCONNECTED /* win 2000 */), + "Internal status is %lx\n", olp ? olp->Internal : 0); SetLastError(0xdeadbeef); key = 0xdeadbeef; diff -Nru wine1.7-1.7.13/dlls/wshom.ocx/tests/wshom.idl wine1.7-1.7.16/dlls/wshom.ocx/tests/wshom.idl --- wine1.7-1.7.13/dlls/wshom.ocx/tests/wshom.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wshom.ocx/tests/wshom.idl 2014-04-04 19:13:44.000000000 +0000 @@ -105,7 +105,7 @@ HRESULT Write([in] BSTR Text); [id(0x2718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); [id(0x2719)] HRESULT WriteBlankLines([in] long Lines); @@ -221,20 +221,20 @@ HRESULT Type([out, retval] BSTR* Type); [id(0x04b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x04b2)] HRESULT Copy( [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x04b4)] HRESULT Move([in] BSTR Destination); [id(0x044c)] HRESULT OpenAsTextStream( - [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, + [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); }; @@ -306,12 +306,12 @@ HRESULT Type([out, retval] BSTR* type); [id(0x04b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL force); [id(0x04b3)] HRESULT Copy( [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x04b5)] HRESULT Move([in] BSTR Destination); @@ -331,8 +331,8 @@ [id(0x044d)] HRESULT CreateTextFile( [in] BSTR FileName, - [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, + [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); }; @@ -573,7 +573,7 @@ HRESULT LogEvent( [in] VARIANT* Type, [in] BSTR Message, - [in, optional, defaultvalue("")] BSTR Target, + [in, defaultvalue("")] BSTR Target, [out, retval] VARIANT_BOOL* out_Success); [id(0x0bc2)] diff -Nru wine1.7-1.7.13/dlls/wshom.ocx/wshom.idl wine1.7-1.7.16/dlls/wshom.ocx/wshom.idl --- wine1.7-1.7.13/dlls/wshom.ocx/wshom.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wshom.ocx/wshom.idl 2014-04-04 19:13:44.000000000 +0000 @@ -107,7 +107,7 @@ HRESULT Write([in] BSTR Text); [id(0x2718)] - HRESULT WriteLine([in, optional, defaultvalue("")] BSTR Text); + HRESULT WriteLine([in, defaultvalue("")] BSTR Text); [id(0x2719)] HRESULT WriteBlankLines([in] long Lines); @@ -223,20 +223,20 @@ HRESULT Type([out, retval] BSTR* Type); [id(0x04b0)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL Force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL Force); [id(0x04b2)] HRESULT Copy( [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x04b4)] HRESULT Move([in] BSTR Destination); [id(0x044c)] HRESULT OpenAsTextStream( - [in, optional, defaultvalue(1)] IOMode IOMode, - [in, optional, defaultvalue(0)] Tristate Format, + [in, defaultvalue(1)] IOMode IOMode, + [in, defaultvalue(0)] Tristate Format, [out, retval] ITextStream** ppts); }; @@ -308,12 +308,12 @@ HRESULT Type([out, retval] BSTR* type); [id(0x04b1)] - HRESULT Delete([in, optional, defaultvalue(0)] VARIANT_BOOL force); + HRESULT Delete([in, defaultvalue(0)] VARIANT_BOOL force); [id(0x04b3)] HRESULT Copy( [in] BSTR Destination, - [in, optional, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); + [in, defaultvalue(-1)] VARIANT_BOOL OverWriteFiles); [id(0x04b5)] HRESULT Move([in] BSTR Destination); @@ -333,8 +333,8 @@ [id(0x044d)] HRESULT CreateTextFile( [in] BSTR FileName, - [in, optional, defaultvalue(-1)] VARIANT_BOOL Overwrite, - [in, optional, defaultvalue(0)] VARIANT_BOOL Unicode, + [in, defaultvalue(-1)] VARIANT_BOOL Overwrite, + [in, defaultvalue(0)] VARIANT_BOOL Unicode, [out, retval] ITextStream** ppts); }; @@ -575,7 +575,7 @@ HRESULT LogEvent( [in] VARIANT* Type, [in] BSTR Message, - [in, optional, defaultvalue("")] BSTR Target, + [in, defaultvalue("")] BSTR Target, [out, retval] VARIANT_BOOL* out_Success); [id(0x0bc2)] diff -Nru wine1.7-1.7.13/dlls/wtsapi32/tests/Makefile.in wine1.7-1.7.16/dlls/wtsapi32/tests/Makefile.in --- wine1.7-1.7.13/dlls/wtsapi32/tests/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/wtsapi32/tests/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,5 @@ +TESTDLL = wtsapi32.dll +IMPORTS = wtsapi32 + +C_SRCS = \ + wtsapi.c diff -Nru wine1.7-1.7.13/dlls/wtsapi32/tests/wtsapi.c wine1.7-1.7.16/dlls/wtsapi32/tests/wtsapi.c --- wine1.7-1.7.13/dlls/wtsapi32/tests/wtsapi.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/dlls/wtsapi32/tests/wtsapi.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,96 @@ +/* + * Copyright 2014 Stefan Leichter + * + * 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 +#include +#include +#include +#include +#include + +#include "wine/test.h" + +static void test_WTSEnumerateProcessesW(void) +{ + BOOL found = FALSE, ret; + DWORD count, i; + PWTS_PROCESS_INFOW info; + WCHAR *pname, nameW[MAX_PATH]; + + GetModuleFileNameW(NULL, nameW, MAX_PATH); + for (pname = nameW + lstrlenW(nameW); pname > nameW; pname--) + { + if(*pname == '/' || *pname == '\\') + { + pname++; + break; + } + } + + info = NULL; + SetLastError(0xdeadbeef); + ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 1, 1, &info, &count); + ok(!ret, "expected WTSEnumerateProcessesW to fail\n"); + ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError()); + if (info) WTSFreeMemory(info); + + info = NULL; + SetLastError(0xdeadbeef); + ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 0, &info, &count); + ok(!ret, "expected WTSEnumerateProcessesW to fail\n"); + ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError()); + if (info) WTSFreeMemory(info); + + info = NULL; + SetLastError(0xdeadbeef); + ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 2, &info, &count); + ok(!ret, "expected WTSEnumerateProcessesW to fail\n"); + ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError()); + if (info) WTSFreeMemory(info); + + SetLastError(0xdeadbeef); + ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 1, NULL, &count); + ok(!ret, "expected WTSEnumerateProcessesW to fail\n"); + ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError()); + + info = NULL; + SetLastError(0xdeadbeef); + ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 1, &info, NULL); + ok(!ret, "expected WTSEnumerateProcessesW to fail\n"); + ok(GetLastError()== ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got: %d\n", GetLastError()); + if (info) WTSFreeMemory(info); + + count = 0; + info = NULL; + SetLastError(0xdeadbeef); + ret = WTSEnumerateProcessesW(WTS_CURRENT_SERVER_HANDLE, 0, 1, &info, &count); + ok(ret || broken(!ret), /* fails on Win2K with error ERROR_APP_WRONG_OS */ + "expected WTSEnumerateProcessesW to succeed; failed with %d\n", GetLastError()); + for(i = 0; ret && i < count; i++) + { + found = found || !lstrcmpW(pname, info[i].pProcessName); + } + todo_wine + ok(found || broken(!ret), "process name %s not found\n", wine_dbgstr_w(pname)); + if (info) WTSFreeMemory(info); +} + +START_TEST (wtsapi) +{ + test_WTSEnumerateProcessesW(); +} diff -Nru wine1.7-1.7.13/dlls/wtsapi32/wtsapi32.c wine1.7-1.7.16/dlls/wtsapi32/wtsapi32.c --- wine1.7-1.7.13/dlls/wtsapi32/wtsapi32.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/wtsapi32/wtsapi32.c 2014-04-04 19:13:44.000000000 +0000 @@ -87,7 +87,11 @@ FIXME("Stub %p 0x%08x 0x%08x %p %p\n", hServer, Reserved, Version, ppProcessInfo, pCount); - if (!ppProcessInfo || !pCount) return FALSE; + if (!ppProcessInfo || !pCount || Reserved != 0 || Version != 1) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } *pCount = 0; *ppProcessInfo = NULL; diff -Nru wine1.7-1.7.13/dlls/xmllite/reader.c wine1.7-1.7.16/dlls/xmllite/reader.c --- wine1.7-1.7.13/dlls/xmllite/reader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/xmllite/reader.c 2014-04-04 19:13:44.000000000 +0000 @@ -40,13 +40,6 @@ typedef enum { - XmlEncoding_UTF16, - XmlEncoding_UTF8, - XmlEncoding_Unknown -} xml_encoding; - -typedef enum -{ XmlReadInState_Initial, XmlReadInState_XmlDecl, XmlReadInState_Misc_DTD, @@ -265,14 +258,6 @@ return CONTAINING_RECORD(iface, xmlreaderinput, IXmlReaderInput_iface); } -static inline void *m_alloc(IMalloc *imalloc, size_t len) -{ - if (imalloc) - return IMalloc_Alloc(imalloc, len); - else - return heap_alloc(len); -} - static inline void *m_realloc(IMalloc *imalloc, void *mem, size_t len) { if (imalloc) @@ -281,14 +266,6 @@ return heap_realloc(mem, len); } -static inline void m_free(IMalloc *imalloc, void *mem) -{ - if (imalloc) - IMalloc_Free(imalloc, mem); - else - heap_free(mem); -} - /* reader memory allocation functions */ static inline void *reader_alloc(xmlreader *reader, size_t len) { @@ -368,6 +345,7 @@ } list_init(&reader->attrs); reader->attr_count = 0; + reader->attr = NULL; } /* attribute data holds pointers to buffer data, so buffer shrink is not possible @@ -589,7 +567,7 @@ return S_OK; } -static xml_encoding parse_encoding_name(const WCHAR *name, int len) +xml_encoding parse_encoding_name(const WCHAR *name, int len) { int min, max, n, c; diff -Nru wine1.7-1.7.13/dlls/xmllite/tests/reader.c wine1.7-1.7.16/dlls/xmllite/tests/reader.c --- wine1.7-1.7.13/dlls/xmllite/tests/reader.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/xmllite/tests/reader.c 2014-04-04 19:13:44.000000000 +0000 @@ -838,7 +838,6 @@ ok(count == 0, "expected 0, got %d\n", count); ret = IXmlReader_IsEmptyElement(reader); -todo_wine ok(ret, "element should be empty\n"); hr = IXmlReader_GetValue(reader, &val, NULL); diff -Nru wine1.7-1.7.13/dlls/xmllite/tests/writer.c wine1.7-1.7.16/dlls/xmllite/tests/writer.c --- wine1.7-1.7.13/dlls/xmllite/tests/writer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/xmllite/tests/writer.c 2014-04-04 19:13:44.000000000 +0000 @@ -28,7 +28,44 @@ #include "xmllite.h" #include "wine/test.h" +#include "initguid.h" +DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a); + static HRESULT (WINAPI *pCreateXmlWriter)(REFIID riid, void **ppvObject, IMalloc *pMalloc); +static HRESULT (WINAPI *pCreateXmlWriterOutputWithEncodingName)(IUnknown *stream, + IMalloc *imalloc, + LPCWSTR encoding_name, + IXmlWriterOutput **output); + +static HRESULT WINAPI testoutput_QueryInterface(IUnknown *iface, REFIID riid, void **obj) +{ + if (IsEqualGUID(riid, &IID_IUnknown)) { + *obj = iface; + return S_OK; + } + else { + ok(0, "unknown riid=%s\n", wine_dbgstr_guid(riid)); + return E_NOINTERFACE; + } +} + +static ULONG WINAPI testoutput_AddRef(IUnknown *iface) +{ + return 2; +} + +static ULONG WINAPI testoutput_Release(IUnknown *iface) +{ + return 1; +} + +static const IUnknownVtbl testoutputvtbl = { + testoutput_QueryInterface, + testoutput_AddRef, + testoutput_Release +}; + +static IUnknown testoutput = { &testoutputvtbl }; static void test_writer_create(void) { @@ -44,10 +81,7 @@ hr = pCreateXmlWriter(&IID_IXmlWriter, (LPVOID*)&writer, NULL); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - if(hr == S_OK) - { - IXmlWriter_Release(writer); - } + IXmlWriter_Release(writer); } static BOOL init_pointers(void) @@ -63,15 +97,34 @@ #define MAKEFUNC(f) if (!(p##f = (void*)GetProcAddress(mod, #f))) return FALSE; MAKEFUNC(CreateXmlWriter); + MAKEFUNC(CreateXmlWriterOutputWithEncodingName); #undef MAKEFUNC return TRUE; } +static void test_writeroutput(void) +{ + static const WCHAR utf16W[] = {'u','t','f','-','1','6',0}; + IXmlWriterOutput *output; + IUnknown *unk; + HRESULT hr; + + hr = pCreateXmlWriterOutputWithEncodingName(&testoutput, NULL, utf16W, &output); + ok(hr == S_OK, "got %08x\n", hr); + unk = NULL; + hr = IUnknown_QueryInterface(output, &IID_IXmlWriterOutput, (void**)&unk); + ok(hr == S_OK, "got %08x\n", hr); + ok(unk != NULL, "got %p\n", unk); + /* releasing 'unk' crashes on native */ + IUnknown_Release(output); +} + START_TEST(writer) { if (!init_pointers()) return; test_writer_create(); + test_writeroutput(); } diff -Nru wine1.7-1.7.13/dlls/xmllite/writer.c wine1.7-1.7.16/dlls/xmllite/writer.c --- wine1.7-1.7.13/dlls/xmllite/writer.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/xmllite/writer.c 2014-04-04 19:13:44.000000000 +0000 @@ -24,11 +24,25 @@ #include "winbase.h" #include "objbase.h" #include "xmllite.h" +#include "xmllite_private.h" +#include "initguid.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(xmllite); +/* not defined in public headers */ +DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a); + +typedef struct +{ + IXmlWriterOutput IXmlWriterOutput_iface; + LONG ref; + IUnknown *output; + IMalloc *imalloc; + xml_encoding encoding; +} xmlwriteroutput; + typedef struct _xmlwriter { IXmlWriter IXmlWriter_iface; @@ -40,6 +54,22 @@ return CONTAINING_RECORD(iface, xmlwriter, IXmlWriter_iface); } +static inline xmlwriteroutput *impl_from_IXmlWriterOutput(IXmlWriterOutput *iface) +{ + return CONTAINING_RECORD(iface, xmlwriteroutput, IXmlWriterOutput_iface); +} + +/* reader input memory allocation functions */ +static inline void *writeroutput_alloc(xmlwriteroutput *output, size_t len) +{ + return m_alloc(output->imalloc, len); +} + +static inline void writeroutput_free(xmlwriteroutput *output, void *mem) +{ + m_free(output->imalloc, mem); +} + static HRESULT WINAPI xmlwriter_QueryInterface(IXmlWriter *iface, REFIID riid, void **ppvObject) { xmlwriter *This = impl_from_IXmlWriter(iface); @@ -73,9 +103,7 @@ ref = InterlockedDecrement(&This->ref); if (ref == 0) - { - HeapFree(GetProcessHeap(), 0, This); - } + heap_free(This); return ref; } @@ -385,6 +413,63 @@ xmlwriter_Flush }; +/** IXmlWriterOutput **/ +static HRESULT WINAPI xmlwriteroutput_QueryInterface(IXmlWriterOutput *iface, REFIID riid, void** ppvObject) +{ + xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface); + + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_IXmlWriterOutput) || + IsEqualGUID(riid, &IID_IUnknown)) + { + *ppvObject = iface; + } + else + { + WARN("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef(iface); + + return S_OK; +} + +static ULONG WINAPI xmlwriteroutput_AddRef(IXmlWriterOutput *iface) +{ + xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface); + ULONG ref = InterlockedIncrement(&This->ref); + TRACE("(%p)->(%d)\n", This, ref); + return ref; +} + +static ULONG WINAPI xmlwriteroutput_Release(IXmlWriterOutput *iface) +{ + xmlwriteroutput *This = impl_from_IXmlWriterOutput(iface); + LONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p)->(%d)\n", This, ref); + + if (ref == 0) + { + IMalloc *imalloc = This->imalloc; + if (This->output) IUnknown_Release(This->output); + writeroutput_free(This, This); + if (imalloc) IMalloc_Release(imalloc); + } + + return ref; +} + +static const struct IUnknownVtbl xmlwriteroutputvtbl = +{ + xmlwriteroutput_QueryInterface, + xmlwriteroutput_AddRef, + xmlwriteroutput_Release +}; + HRESULT WINAPI CreateXmlWriter(REFIID riid, void **pObject, IMalloc *pMalloc) { xmlwriter *writer; @@ -399,7 +484,7 @@ return E_FAIL; } - writer = HeapAlloc(GetProcessHeap(), 0, sizeof (*writer)); + writer = heap_alloc(sizeof(*writer)); if(!writer) return E_OUTOFMEMORY; writer->IXmlWriter_iface.lpVtbl = &xmlwriter_vtbl; @@ -411,3 +496,35 @@ return S_OK; } + +HRESULT WINAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, + IMalloc *imalloc, + LPCWSTR encoding, + IXmlWriterOutput **output) +{ + xmlwriteroutput *writeroutput; + + TRACE("%p %p %s %p\n", stream, imalloc, debugstr_w(encoding), output); + + if (!stream || !output) return E_INVALIDARG; + + if (imalloc) + writeroutput = IMalloc_Alloc(imalloc, sizeof(*writeroutput)); + else + writeroutput = heap_alloc(sizeof(*writeroutput)); + if(!writeroutput) return E_OUTOFMEMORY; + + writeroutput->IXmlWriterOutput_iface.lpVtbl = &xmlwriteroutputvtbl; + writeroutput->ref = 1; + writeroutput->imalloc = imalloc; + if (imalloc) IMalloc_AddRef(imalloc); + writeroutput->encoding = parse_encoding_name(encoding, -1); + + IUnknown_QueryInterface(stream, &IID_IUnknown, (void**)&writeroutput->output); + + *output = &writeroutput->IXmlWriterOutput_iface; + + TRACE("returning iface %p\n", *output); + + return S_OK; +} diff -Nru wine1.7-1.7.13/dlls/xmllite/xmllite_private.h wine1.7-1.7.16/dlls/xmllite/xmllite_private.h --- wine1.7-1.7.13/dlls/xmllite/xmllite_private.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/xmllite/xmllite_private.h 2014-04-04 19:13:44.000000000 +0000 @@ -37,4 +37,29 @@ return HeapFree(GetProcessHeap(), 0, mem); } +static inline void *m_alloc(IMalloc *imalloc, size_t len) +{ + if (imalloc) + return IMalloc_Alloc(imalloc, len); + else + return heap_alloc(len); +} + +static inline void m_free(IMalloc *imalloc, void *mem) +{ + if (imalloc) + IMalloc_Free(imalloc, mem); + else + heap_free(mem); +} + +typedef enum +{ + XmlEncoding_UTF16, + XmlEncoding_UTF8, + XmlEncoding_Unknown +} xml_encoding; + +xml_encoding parse_encoding_name(const WCHAR *name, int len) DECLSPEC_HIDDEN; + #endif /* __XMLLITE_PRIVATE__ */ diff -Nru wine1.7-1.7.13/dlls/xmllite/xmllite.spec wine1.7-1.7.16/dlls/xmllite/xmllite.spec --- wine1.7-1.7.13/dlls/xmllite/xmllite.spec 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/dlls/xmllite/xmllite.spec 2014-04-04 19:13:44.000000000 +0000 @@ -3,4 +3,4 @@ @ stdcall CreateXmlReaderInputWithEncodingName(ptr ptr ptr long ptr ptr) @ stdcall CreateXmlWriter(ptr ptr ptr) @ stub CreateXmlWriterOutputWithEncodingCodePage -@ stub CreateXmlWriterOutputWithEncodingName +@ stdcall CreateXmlWriterOutputWithEncodingName(ptr ptr wstr ptr) diff -Nru wine1.7-1.7.13/documentation/README.de wine1.7-1.7.16/documentation/README.de --- wine1.7-1.7.13/documentation/README.de 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.de 2014-04-04 19:13:44.000000000 +0000 @@ -32,7 +32,7 @@ folgenden Betriebssysteme: Linux version 2.0.36 oder neuer - FreeBSD 7.0 oder neuer + FreeBSD 8.0 oder neuer Solaris x86 9 oder neuer NetBSD-current Mac OS X 10.5 oder neuer @@ -43,7 +43,7 @@ Umständen in der Zukunft unterstützt. FreeBSD-Info: - Wine läuft prinzipiell erst ab FreeBSD 7.0 richtig. Siehe dazu auch + Wine läuft prinzipiell erst ab FreeBSD 8.0 richtig. Siehe dazu auch http://wiki.freebsd.org/Wine für weitere Informationen. Solaris-Info: diff -Nru wine1.7-1.7.13/documentation/README.es wine1.7-1.7.16/documentation/README.es --- wine1.7-1.7.13/documentation/README.es 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.es 2014-04-04 19:13:44.000000000 +0000 @@ -30,7 +30,7 @@ Para compilar y ejecutar Wine, deberá tener uno de los siguientes: Linux versión 2.0.36 o superior - FreeBSD 7.0 o superior + FreeBSD 8.0 o superior Solaris x86 9 o superior NetBSD-current Mac OS X 10.5 o superior @@ -42,7 +42,7 @@ Información sobre FreeBSD: Por lo general Wine no funcionará correctamente en versiones anteriores a - FreeBSD 7.0. Visite http://wiki.freebsd.org/Wine para más información. + FreeBSD 8.0. Visite http://wiki.freebsd.org/Wine para más información. Información sobre Solaris: Lo más probable es que necesite compilar con el conjunto de herramientas GNU diff -Nru wine1.7-1.7.13/documentation/README.fi wine1.7-1.7.16/documentation/README.fi --- wine1.7-1.7.13/documentation/README.fi 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.fi 2014-04-04 19:13:44.000000000 +0000 @@ -28,7 +28,7 @@ Winen kääntämiseen tarvitaan jokin seuraavista: Linuxin versio 2.0.36 tai uudempi - FreeBSD 7.0 tai uudempi + FreeBSD 8.0 tai uudempi Solaris x86 9 tai uudempi NetBSD-current Mac OS X 10.5 tai uudempi @@ -38,7 +38,7 @@ muillekin käyttöjärjestelmille, joissa on tarvittava tuki säikeille. Tietoa FreeBSD:lle: - Pääsääntöisesti Wine ei toimi vanhemmilla versioilla kuin FreeBSD 7.0. + Pääsääntöisesti Wine ei toimi vanhemmilla versioilla kuin FreeBSD 8.0. Osoitteessa http://wiki.freebsd.org/Wine kerrotaan tästä lisää. Tietoa Solarikselle: diff -Nru wine1.7-1.7.13/documentation/README.fr wine1.7-1.7.16/documentation/README.fr --- wine1.7-1.7.13/documentation/README.fr 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.fr 2014-04-04 19:13:44.000000000 +0000 @@ -30,7 +30,7 @@ d'exploitation suivants : Linux version 2.0.36 ou ultérieur - FreeBSD 7.0 ou ultérieur + FreeBSD 8.0 ou ultérieur Solaris x86 9 ou ultérieur NetBSD-current Mac OS X 10.5 ou ultérieur @@ -42,7 +42,7 @@ Informations FreeBSD : Wine ne fonctionnera généralement pas bien avec les versions FreeBSD - antérieures à 7.0. Voyez http://wiki.freebsd.org/Wine pour plus + antérieures à 8.0. Voyez http://wiki.freebsd.org/Wine pour plus d'informations. Informations Solaris : diff -Nru wine1.7-1.7.13/documentation/README.it wine1.7-1.7.16/documentation/README.it --- wine1.7-1.7.13/documentation/README.it 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.it 2014-04-04 19:13:44.000000000 +0000 @@ -31,7 +31,7 @@ Per compilare ed eseguire Wine, è necessario avere uno dei seguenti sistemi: Linux versione 2.0.36 o successiva - FreeBSD 7.0 o successiva + FreeBSD 8.0 o successiva Solaris x86 9 o successiva NetBSD-current Mac OS X 10.5 o successiva @@ -42,7 +42,7 @@ Informazioni per FreeBSD: In generale Wine non funzionerà correttamente con versioni precedenti - a FreeBSD 7.0. + a FreeBSD 8.0. Leggere http://wiki.freebsd.org/Wine per maggiori informazioni. Informazioni per Solaris: diff -Nru wine1.7-1.7.13/documentation/README.ja wine1.7-1.7.16/documentation/README.ja --- wine1.7-1.7.13/documentation/README.ja 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.ja 2014-04-04 19:13:44.000000000 +0000 @@ -30,7 +30,7 @@ Wineをコンパイルし実行するには、以下のうち一つを持っていなければなりません: Linux バージョン2.0.36以上 - FreeBSD 7.0以降 + FreeBSD 8.0以降 Solaris x86 9以降 NetBSD-current Mac OS X 10.5以降 @@ -41,7 +41,7 @@ 将来サポートされるかもしれません。 FreeBSD情報: - Wineは一般的にFreeBSD 7.0より前のバージョン上で正しく動作しないでしょう。 + Wineは一般的にFreeBSD 8.0より前のバージョン上で正しく動作しないでしょう。 詳細については http://wiki.freebsd.org/Wine を参照してください。 Solaris情報: diff -Nru wine1.7-1.7.13/documentation/README.no wine1.7-1.7.16/documentation/README.no --- wine1.7-1.7.13/documentation/README.no 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.no 2014-04-04 19:13:44.000000000 +0000 @@ -10,6 +10,7 @@ Wine er fri programvare, utgitt under vilkårene i GNU LGPL; se filen «LICENSE» for detaljer. + 2. KOM I GANG Det anbefales å bruke Wines installasjonsprogram for å bygge og @@ -22,12 +23,13 @@ Wines man-side og http://www.winehq.org/ for mer informasjon og problemløsing. + 3. SYSTEMKRAV -Følgende kreves for å bygge og kjøre Wine +Følgende kreves for å bygge og kjøre Wine: Linux versjon 2.0.36 eller nyere - FreeBSD 6.3 eller nyere + FreeBSD 8.0 eller nyere Solaris x86 9 eller nyere NetBSD-current Mac OS X 10.5 eller nyere @@ -36,36 +38,31 @@ operativsystemene ovenfor som støttes. Andre operativsystemer som støtter kjernetråder støttes kanskje i framtiden. -Informasjon for Linux - Selv om Linux 2.2.x antakelig virker, og Linux 2.0x kanskje virker - (tidligere 2.0.x-versjoner hadde problemer med tråder), er det - best å ha en ny kjerne som 2.4.x eller 2.6.x. - -Informasjon for FreeBSD - Wine vil som regel ikke virke på FreeBSD-versjoner eldre enn 6.3 eller 7.0. - FreeBSD 6.3 kan oppdateres for å forbedre støtten for Wine; se - for mer informasjon. +Informasjon for FreeBSD: + Wine vil som regel ikke virke på FreeBSD-versjoner eldre enn 8.0. + Se for mer informasjon. -Informsjon for Solaris +Informsjon for Solaris: Wine må antakelig bygges med GNU-verktøyene (gcc, gas etc.). Advarsel: selv om gas installeres er det ikke sikkert det brukes av gcc. Det sies at gcc må bygges på nytt, eller at symbolske koblinger for «cc», «as» og «ld» må legges til GNU-verktøyene. -Informasjon for NetBSD +Informasjon for NetBSD: USER_LDT, SYSVSHM, SYSVSEM og SYSVMSG må være aktivert i kjernen. Informasjon for Mac OS X: Du må ha Xcode 2.4 eller nyere for å bygge Wine ordentlig på x86. + Mac-driveren krever OS X 10.6 eller nyere og vil ikke bli bygget på 10.5. -Støttede filsystemer +Støttede filsystemer: Wine kan kjøre på de fleste filsystemer. Det har imidlertid vært rapportert om problemer med filtilgang gjennom Samba. Vi anbefaler ikke bruk av NTFS, siden dette ikke støtter funksjoner som noen - programmer trenger. Det anbefales å bruke et Linux-filsystem som ext3. + programmer trenger. Det anbefales å bruke et ekte Unix-filsystem. -Basiskrav +Basiskrav: Inkluderingsfilene for X11 må være installert (kalt «xlib6g-dev» i Debian og «XFree86-devel» i RedHat). @@ -87,7 +84,7 @@ 4. BYGGING -Kjør følgende kommandoer for å bygge Wine hvis du ikke bruker wineinstall +Kjør følgende kommandoer for å bygge Wine hvis du ikke bruker wineinstall: ./configure make @@ -97,7 +94,7 @@ Biblioteket «libwine» («Winelib») kan brukes til å bygge og koble Windows-kildekode i Unix. -Kjør «./configue --help» for å se valg for bygging. +Kjør «./configure --help» for å se valg for bygging. 5. INSTALLASJON @@ -116,7 +113,7 @@ Når du bruker Wine kan du oppgi hele stien til programfilen, eller bare et filnavn. -For å kjøre Notisblokk +Eksempel: for å kjøre Notisblokk: wine notepad (ved å bruke søkestien oppgitt i wine notepad.exe Wine-registeret for å finne filen) @@ -130,14 +127,14 @@ Wine er ikke helt ferdig ennå, så det er mulig at noen programmer klikker. -Hvis dette skjer vil Wine lage en logg som beskriver problemet; bruk -denne når du lager en feilrapport på http://bugs.winehq.org/ +Hvis dette skjer vil Wine lage en krasjlogg som du bør vedlegge til rapporten +når du rapporterer en feil. 7. MER INFORMASJON Internett: En god del informasjon om Wine finnes hos WineHQ på - http://www.winehq.org/: diverse veiledere, en programdatabase + http://www.winehq.org/ : diverse veiledere, en programdatabase og feilsporing. Dette er antakelig det beste stedet å begynnne. Svar: Wines spørsmål og svar finnes på http://www.winehq.org/FAQ @@ -159,7 +156,8 @@ Gå til http://www.winehq.org/git for mer informasjon. Hvis du legger til noe eller fikser en feil er det fint som du sender -en oppdateringsfil (helst laget med git format-patch) til listen wine-patches@winehq.org, slik at endringen kan tas med i neste Wine-utgivelse. +en oppdateringsfil (helst laget med git format-patch) til listen +wine-patches@winehq.org, slik at endringen kan tas med i neste Wine-utgivelse. -- Den originale versjonen ble skrevet av diff -Nru wine1.7-1.7.13/documentation/README.pt_br wine1.7-1.7.16/documentation/README.pt_br --- wine1.7-1.7.13/documentation/README.pt_br 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.pt_br 2014-04-04 19:13:44.000000000 +0000 @@ -31,7 +31,7 @@ Para compilar e executar o Wine, voc deve ter o seguinte: Linux verso 2.0.36 ou posterior - FreeBSD 7.0 ou posterior + FreeBSD 8.0 ou posterior Solaris x86 9 ou posterior NetBSD-atual Mac OS X 10.5 ou posterior @@ -42,7 +42,7 @@ ter suporte no futuro. Informaes para o FreeBSD: - O Wine em geral no deve funcionar corretamente em verses antes da 7.0. + O Wine em geral no deve funcionar corretamente em verses antes da 8.0. Veja http://wiki.freebsd.org/Wine para mais informaes. Informaes para o Solaris: diff -Nru wine1.7-1.7.13/documentation/README.ru wine1.7-1.7.16/documentation/README.ru --- wine1.7-1.7.13/documentation/README.ru 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.ru 2014-04-04 19:13:44.000000000 +0000 @@ -29,7 +29,7 @@ Компиляция и запуск Wine поддерживается в следующих операционных системах: Linux версии 2.0.36 или более новой - FreeBSD 7.0 или более новой + FreeBSD 8.0 или более новой Solaris x86 9 или более новой NetBSD-текущей версии Mac OS X 10.5 или более новой @@ -40,7 +40,7 @@ возможно будут поддерживаться Wine в будущем. FreeBSD: - Wine не будет работать как следует на версиях ниже, чем FreeBSD 7.0. + Wine не будет работать как следует на версиях ниже, чем FreeBSD 8.0. Посетите для дополнительной информации. Solaris: diff -Nru wine1.7-1.7.13/documentation/README.sv wine1.7-1.7.16/documentation/README.sv --- wine1.7-1.7.13/documentation/README.sv 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/documentation/README.sv 2014-04-04 19:13:44.000000000 +0000 @@ -10,6 +10,7 @@ Wine r fri programvara, utgett under villkoren i GNU LGPL; se filen LICENSE fr detaljer. + 2. KOM IGNG Nr du bygger Wine frn kllkod s rekommenderas du anvnda Wines @@ -27,7 +28,7 @@ Fr att kompilera och kra Wine krvs ett av fljande: Linux version 2.0.36 eller senare - FreeBSD 7.0 eller senare + FreeBSD 8.0 eller senare Solaris x86 9 eller senare NetBSD-current Mac OS X 10.5 eller senare @@ -36,24 +37,25 @@ operativsystemen ovan som stds. Andra operativsystem som stder kerneltrdar kommer eventuellt att stdjas i framtiden. -Information fr FreeBSD - Wine kommer i regel inte att fungera p FreeBSD-versioner ldre n 7.0. +Information fr FreeBSD: + Wine kommer i regel inte att fungera p FreeBSD-versioner ldre n 8.0. Se http://wiki.freebsd.org/Wine fr mer information. -Information fr Solaris +Information fr Solaris: Wine mste antagligen byggas med GNU toolchain (gcc, gas etc.). Varning: ven om gas installeras s r det inte skert att det anvnds av gcc. Det sgs att det r ndvndigt att antingen bygga gcc p nytt, eller skapa symboliska lnkar frn "cc", "as" och "ld" till GNU toolchain. -Information fr NetBSD +Information fr NetBSD: USER_LDT, SYSVSHM, SYSVSEM och SYSVMSG mste vara aktiverade i kerneln. Information fr Mac OS X: Du behver Xcode 2.4 eller senare fr att korrekt kunna bygga Wine p x86. + Mac-drivrutinen krver OS X 10.6 eller senare och kommer inte att byggas p 10.5. -Stdda filsystem +Stdda filsystem: Wine kan kra p de flesta filsystem, men det har rapporterats problem vad gller kompatibilitet d samba anvnds fr att ansluta till filer. NTFS tillhandahller inte heller alla filsystemsfunktioner som behvs av alla @@ -133,6 +135,12 @@ Frgor: Frgor och svar om Wine finns samlade p http://www.winehq.org/FAQ +Wiki: Wines Wiki finns p http://wiki.winehq.org + +E-postlistor: + Det finns flera e-postlistor fr Wine-anvndare och -utvecklare; se + http://www.winehq.org/forums fr mer information. + Fel: Rapportera fel till Wines Bugzilla p http://bugs.winehq.org Sk i Bugzilla-databasen fr att se om problemet redan finns rapporterat innan du snder en felrapport. @@ -143,12 +151,6 @@ Git: Wines nuvarande utvecklingsversion finns tillgnglig genom Git. G till http://www.winehq.org/git fr mer information. -E-postlistor: - Det finns flera e-postlistor fr Wine-anvndare och -utvecklare; se - http://www.winehq.org/forums fr mer information. - -Wiki: Wines Wiki finns p http://wiki.winehq.org - Om du lgger till ngot eller fixar ett fel, r det bra om du snder en patch (frslagsvis med git-format-patch) till listan wine-patches@winehq.org fr inkludering i nsta utgva av Wine. diff -Nru wine1.7-1.7.13/fonts/tahomabd.sfd wine1.7-1.7.16/fonts/tahomabd.sfd --- wine1.7-1.7.13/fonts/tahomabd.sfd 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/fonts/tahomabd.sfd 2014-04-04 19:13:44.000000000 +0000 @@ -102,6 +102,7 @@ !<)rC!;6Els31Q VStem: 361 308 LayerCount: 2 @@ -19527,8 +19529,63 @@ Refer: 970 806 S 1 0 0 1 -146.5 13 2 Refer: 85 116 N 1 0 0 1 0 0 3 EndChar + +StartChar: afii10101 +Encoding: 1108 1108 975 +Width: 1088 +Flags: W +HStem: -22 156<379.84 750.074> +LayerCount: 2 +Fore +SplineSet +734.45 688 m 17 + 246.609 688.039 l 1 + 258.777 769.045 285.982 836.366 328.226 890 c 0 + 369.559 951.333 453.559 982 580.226 982 c 0 + 684.893 982 789.893 953.333 895.226 896 c 1 + 895.226 1053 l 1 + 795.893 1099 692.893 1127.67 586.226 1139 c 1 + 418.226 1127 290.559 1081.33 203.226 1002 c 0 + 97.8926 902.667 45.2256 763 45.2256 583 c 0 + 29.8926 393 69.2256 245.667 163.226 141 c 0 + 241.226 32.333 367.559 -22 542.226 -22 c 0 + 662.893 -22 774.559 2 877.226 50 c 1 + 868.226 255 l 1 + 771.559 174.333 669.559 134 562.226 134 c 0 + 436.226 134 350.559 174.667 305.226 256 c 1 + 251.998 323.661 228.885 418.995 235.885 542 c 1 + 734.45 542 l 1 + 734.45 688 l 17 +EndSplineSet +EndChar + +StartChar: afii10053 +Encoding: 1028 1028 976 +Width: 1367 +Flags: W +HStem: 729.5 175.5<257.219 961> 1151 21G<1065.79 1173> +VStem: 43 205.5<450.026 729.5 905 1041.58> +LayerCount: 2 +Fore +SplineSet +257.219 905 m 1 + 961 905 l 1 + 961 729 l 1 + 248.5 729.5 l 0 + 248.5 275.006 486.995 167.646 688 144 c 0 + 826.667 128 988.33 192.333 1173 337 c 1 + 1173 101 l 1 + 780.549 -139.979 189.12 -67.8848 67 502 c 0 + 51 576.667 43 657 43 743 c 0 + 43 1215.54 271.645 1486.98 690 1516 c 0 + 876.797 1528.44 1006.01 1474.75 1173 1390 c 1 + 1173 1151 l 1 + 958.577 1330.82 779.285 1356.53 688 1346 c 0 + 435.849 1314.62 292.256 1167.62 257.219 905 c 1 +EndSplineSet +EndChar EndChars -BitmapFont: 9 976 7 2 1 +BitmapFont: 9 978 7 2 1 BDFChar: 0 65536 9 1 7 0 6 rdo`RJqEt% BDFChar: 1 32 3 0 0 0 0 @@ -20401,12 +20458,16 @@ ^jlCb BDFChar: 974 539 4 0 1 -3 -2 ^jlCb +BDFChar: 975 1108 5 0 4 0 4 +GeigaGQ7^D +BDFChar: 976 1028 7 0 5 0 6 +Gg*tu^s%$' BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N BDFRefChar: 974 85 0 0 N EndBitmapFont -BitmapFont: 10 976 8 2 1 +BitmapFont: 10 978 8 2 1 BDFChar: 0 65536 10 1 8 0 7 s+,`PJUrCP BDFChar: 1 32 3 0 0 0 0 @@ -21279,12 +21340,16 @@ ^jlCb BDFChar: 974 539 4 0 1 -3 -2 ^jlCb +BDFChar: 975 1108 6 0 4 0 4 +GeigaGQ7^D +BDFChar: 976 1028 7 0 5 0 6 +Gg*tu^s%$' BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N BDFRefChar: 974 85 0 0 N EndBitmapFont -BitmapFont: 11 976 9 2 1 FontForge +BitmapFont: 11 978 9 2 1 FontForge BDFStartProperties: 36 FONT 1 "-FontForge-Tahoma-Normal-R-Normal--11-80-96-96-P-62-ISO10646-1" FONTBOUNDINGBOX 1 "15 11 0 -2" @@ -22192,12 +22257,16 @@ @))aB BDFChar: 974 539 5 0 2 -3 -2 @))aB +BDFChar: 975 1108 6 0 4 0 5 +Geiga^j#hZ +BDFChar: 976 1028 7 0 5 0 7 +I)*Pm^qda5 BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N BDFRefChar: 974 85 0 0 N EndBitmapFont -BitmapFont: 12 976 10 2 1 FontForge +BitmapFont: 12 978 10 2 1 FontForge BDFStartProperties: 36 FONT 1 "-FontForge-Tahoma-Normal-R-Normal--12-90-96-96-P-70-ISO10646-1" FONTBOUNDINGBOX 1 "16 12 0 -2" @@ -22907,12 +22976,16 @@ @))aB BDFChar: 974 539 6 1 3 -3 -2 @))aB +BDFChar: 975 1108 6 0 5 0 6 +Gf7De^r1Ht +BDFChar: 976 1028 8 0 6 0 8 +I)<\7pqX\^HiO-H BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N BDFRefChar: 974 85 0 0 N EndBitmapFont -BitmapFont: 13 976 10 3 1 FontForge +BitmapFont: 13 978 10 3 1 FontForge BDFStartProperties: 36 FONT 1 "-FontForge-Tahoma-Normal-R-Normal--13-100-96-96-P-73-ISO10646-1" FONTBOUNDINGBOX 1 "15 13 0 -3" @@ -23618,12 +23691,16 @@ @))aB BDFChar: 974 539 4 0 2 -3 -2 @))aB +BDFChar: 975 1108 7 0 5 0 6 +Gf7Dm^r1Ht +BDFChar: 976 1028 9 0 7 0 8 +5%27Br4p*V4obQ_ BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N BDFRefChar: 974 85 0 0 N EndBitmapFont -BitmapFont: 15 976 12 3 1 FontForge +BitmapFont: 15 978 12 3 1 FontForge BDFStartProperties: 36 FONT 1 "-FontForge-Tahoma-Normal-R-Normal--15-110-96-96-P-85-ISO10646-1" FONTBOUNDINGBOX 1 "19 15 0 -3" @@ -24329,12 +24406,16 @@ @))aB BDFChar: 974 539 5 1 3 -3 -2 @))aB +BDFChar: 975 1108 8 0 5 0 7 +3(/;dJ:L$I +BDFChar: 976 1028 10 0 7 0 10 +5!a^LJGaqJJ3c@! BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N BDFRefChar: 974 85 0 0 N EndBitmapFont -BitmapFont: 16 976 13 3 1 FontForge +BitmapFont: 16 978 13 3 1 FontForge BDFStartProperties: 36 FONT 1 "-FontForge-Tahoma-Normal-R-Normal--16-120-96-96-P-93-ISO10646-1" FONTBOUNDINGBOX 1 "21 16 0 -3" @@ -25040,6 +25121,10 @@ @))aB BDFChar: 974 539 5 1 3 -3 -2 @))aB +BDFChar: 975 1108 8 0 5 0 8 +3(/:Ipjdl_2uipY +BDFChar: 976 1028 11 0 8 0 11 +*rmF65QH<7J,oQKJ,k*"J,hh7+FkO6 BDFRefChar: 971 52 0 0 N BDFRefChar: 972 84 0 0 N BDFRefChar: 973 53 0 0 N Binary files /tmp/qNPOTbG4JY/wine1.7-1.7.13/fonts/tahomabd.ttf and /tmp/GGrtppGXyS/wine1.7-1.7.16/fonts/tahomabd.ttf differ diff -Nru wine1.7-1.7.13/fonts/tahoma.sfd wine1.7-1.7.16/fonts/tahoma.sfd --- wine1.7-1.7.13/fonts/tahoma.sfd 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/fonts/tahoma.sfd 2014-04-04 19:13:44.000000000 +0000 @@ -102,6 +102,7 @@ !<)rC!;6Els31Q + +#ifdef __cplusplus +extern "C" { +#endif + +#define PHYSICAL_MONITOR_DESCRIPTION_SIZE 128 + +typedef struct _PHYSICAL_MONITOR +{ + HANDLE hPhysicalMonitor; + WCHAR szPhysicalMonitorDescription[PHYSICAL_MONITOR_DESCRIPTION_SIZE]; +} PHYSICAL_MONITOR, *LPPHYSICAL_MONITOR; + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_PHYSICALMONITORENUMERATIONAPI_H */ diff -Nru wine1.7-1.7.13/include/rpcndr.h wine1.7-1.7.16/include/rpcndr.h --- wine1.7-1.7.13/include/rpcndr.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/rpcndr.h 2014-04-04 19:13:44.000000000 +0000 @@ -37,6 +37,7 @@ # define CONST_VTBL #endif +#ifndef EXTERN_GUID #ifdef __cplusplus #define EXTERN_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ EXTERN_C const GUID DECLSPEC_SELECTANY name DECLSPEC_HIDDEN; \ @@ -48,6 +49,7 @@ const GUID DECLSPEC_SELECTANY name = \ { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } #endif +#endif /* stupid #if can't handle casts... this __stupidity is just a workaround for that limitation */ @@ -427,7 +429,7 @@ } MIDL_STUBLESS_PROXY_INFO, *PMIDL_STUBLESS_PROXY_INFO; -#if defined(__i386__) && !defined(__MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__) +#if defined(__i386__) && !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__CYGWIN__) /* Calling convention for returning structures/unions is different between Windows and gcc on i386 */ typedef LONG_PTR CLIENT_CALL_RETURN; #else diff -Nru wine1.7-1.7.13/include/shlobj.h wine1.7-1.7.16/include/shlobj.h --- wine1.7-1.7.13/include/shlobj.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/shlobj.h 2014-04-04 19:13:44.000000000 +0000 @@ -61,7 +61,7 @@ HRESULT WINAPI SHGetInstanceExplorer(IUnknown**); HRESULT WINAPI SHGetFolderPathAndSubDirA(HWND,int,HANDLE,DWORD,LPCSTR,LPSTR); HRESULT WINAPI SHGetFolderPathAndSubDirW(HWND,int,HANDLE,DWORD,LPCWSTR,LPWSTR); -#define SHGetFolderPathAndSubDir WINELIB_NAME_AW(SHGetFolderPathAndSubDir); +#define SHGetFolderPathAndSubDir WINELIB_NAME_AW(SHGetFolderPathAndSubDir) HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID,DWORD,HANDLE,PWSTR*); BOOL WINAPI SHGetPathFromIDListA(LPCITEMIDLIST,LPSTR); BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST,LPWSTR); @@ -72,7 +72,7 @@ HRESULT WINAPI SHParseDisplayName(LPCWSTR,IBindCtx*,LPITEMIDLIST*,SFGAOF,SFGAOF*); HRESULT WINAPI SHPathPrepareForWriteA(HWND,IUnknown*,LPCSTR,DWORD); HRESULT WINAPI SHPathPrepareForWriteW(HWND,IUnknown*,LPCWSTR,DWORD); -#define SHPathPrepareForWrite WINELIB_NAME_AW(SHPathPrepareForWrite); +#define SHPathPrepareForWrite WINELIB_NAME_AW(SHPathPrepareForWrite) UINT WINAPI SHReplaceFromPropSheetExtArray(HPSXA,UINT,LPFNADDPROPSHEETPAGE,LPARAM); LPITEMIDLIST WINAPI SHSimpleIDListFromPath(LPCWSTR); BOOL WINAPI SHRunControlPanel(LPCWSTR, HWND); diff -Nru wine1.7-1.7.13/include/shlwapi.h wine1.7-1.7.16/include/shlwapi.h --- wine1.7-1.7.13/include/shlwapi.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/shlwapi.h 2014-04-04 19:13:44.000000000 +0000 @@ -424,7 +424,7 @@ BOOL WINAPI PathIsFileSpecA(LPCSTR); BOOL WINAPI PathIsFileSpecW(LPCWSTR); -#define PathIsFileSpec WINELIB_NAME_AW(PathIsFileSpec); +#define PathIsFileSpec WINELIB_NAME_AW(PathIsFileSpec) BOOL WINAPI PathIsPrefixA(LPCSTR,LPCSTR); BOOL WINAPI PathIsPrefixW(LPCWSTR,LPCWSTR); diff -Nru wine1.7-1.7.13/include/stdole2.idl wine1.7-1.7.16/include/stdole2.idl --- wine1.7-1.7.13/include/stdole2.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/stdole2.idl 2014-04-04 19:13:44.000000000 +0000 @@ -20,6 +20,8 @@ #pragma makedep typelib +#include + [ uuid(00020430-0000-0000-C000-000000000046), version(2.0), @@ -272,14 +274,14 @@ ] dispinterface Font { properties: - [id(0x0)] BSTR Name; - [id(0x2)] CURRENCY Size; - [id(0x3)] VARIANT_BOOL Bold; - [id(0x4)] VARIANT_BOOL Italic; - [id(0x5)] VARIANT_BOOL Underline; - [id(0x6)] VARIANT_BOOL Strikethrough; - [id(0x7)] short Weight; - [id(0x8)] short Charset; + [id(DISPID_FONT_NAME)] BSTR Name; + [id(DISPID_FONT_SIZE)] CURRENCY Size; + [id(DISPID_FONT_BOLD)] VARIANT_BOOL Bold; + [id(DISPID_FONT_ITALIC)] VARIANT_BOOL Italic; + [id(DISPID_FONT_UNDER)] VARIANT_BOOL Underline; + [id(DISPID_FONT_STRIKE)] VARIANT_BOOL Strikethrough; + [id(DISPID_FONT_WEIGHT)] short Weight; + [id(DISPID_FONT_CHARSET)] short Charset; methods: } @@ -351,13 +353,14 @@ ] dispinterface Picture { properties: - [id(0x0), readonly] OLE_HANDLE Handle; - [id(0x2)] OLE_HANDLE hPal; - [id(0x3), readonly] short Type; - [id(0x4), readonly] OLE_XSIZE_HIMETRIC Width; - [id(0x5), readonly] OLE_YSIZE_HIMETRIC Height; + [id(DISPID_PICT_HANDLE), readonly] OLE_HANDLE Handle; + [id(DISPID_PICT_HPAL)] OLE_HANDLE hPal; + [id(DISPID_PICT_TYPE), readonly] short Type; + [id(DISPID_PICT_WIDTH), readonly] OLE_XSIZE_HIMETRIC Width; + [id(DISPID_PICT_HEIGHT), readonly] OLE_YSIZE_HIMETRIC Height; methods: - [id(0x6)] void Render(int hdc, + [id(DISPID_PICT_RENDER)] + void Render(int hdc, long x, long y, long cx, @@ -402,9 +405,9 @@ helpcontext(0x2775) ] HRESULT LoadPicture([in, optional] VARIANT filename, - [in, optional, defaultvalue(0)] int widthDesired, - [in, optional, defaultvalue(0)] int heightDesired, - [in, optional, defaultvalue(Default)] enum LoadPictureConstants flags, + [in, defaultvalue(0)] int widthDesired, + [in, defaultvalue(0)] int heightDesired, + [in, defaultvalue(Default)] enum LoadPictureConstants flags, [out, retval] IPictureDisp **retval); [ entry("OleSavePictureFile"), @@ -424,7 +427,7 @@ dispinterface FontEvents { properties: methods: - [id(0x9)] void FontChanged([in] BSTR PropertyName); + [id(DISPID_FONT_CHANGED)] void FontChanged([in] BSTR PropertyName); }; typedef [public] FontEvents IFontEventsDisp; diff -Nru wine1.7-1.7.13/include/tapi.h wine1.7-1.7.16/include/tapi.h --- wine1.7-1.7.13/include/tapi.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/tapi.h 2014-04-04 19:13:44.000000000 +0000 @@ -918,11 +918,11 @@ DWORD WINAPI lineGetCountry(DWORD,DWORD,LPLINECOUNTRYLIST); DWORD WINAPI lineGetDevCapsA(HLINEAPP,DWORD,DWORD,DWORD,LPLINEDEVCAPS); DWORD WINAPI lineGetDevCapsW(HLINEAPP,DWORD,DWORD,DWORD,LPLINEDEVCAPS); -#define lineGetDevCaps WINELIB_NAME_AW(lineGetDevCaps); +#define lineGetDevCaps WINELIB_NAME_AW(lineGetDevCaps) DWORD WINAPI lineGetDevConfig(DWORD,LPVARSTRING,LPCSTR); DWORD WINAPI lineGetIDA(HLINE,DWORD,HCALL,DWORD,LPVARSTRING,LPCSTR); DWORD WINAPI lineGetIDW(HLINE,DWORD,HCALL,DWORD,LPVARSTRING,LPCWSTR); -#define lineGetID WINELIB_NAME_AW(lineGetID); +#define lineGetID WINELIB_NAME_AW(lineGetID) DWORD WINAPI lineGetIcon(DWORD,LPCSTR,HICON *); DWORD WINAPI lineGetLineDevStatus(HLINE,LPLINEDEVSTATUS); DWORD WINAPI lineGetNewCalls(HLINE,DWORD,DWORD,LPLINECALLLIST); @@ -941,7 +941,7 @@ #define lineInitializeEx WINELIB_NAME_AW(lineInitializeEx) DWORD WINAPI lineMakeCallA(HLINE,LPHCALL,LPCSTR,DWORD,LPLINECALLPARAMS); DWORD WINAPI lineMakeCallW(HLINE,LPHCALL,LPCWSTR,DWORD,LPLINECALLPARAMS); -#define lineMakeCall WINELIB_NAMEAW(lineMakeCall); +#define lineMakeCall WINELIB_NAME_AW(lineMakeCall) DWORD WINAPI lineMonitorDigits(HCALL,DWORD); DWORD WINAPI lineMonitorMedia(HCALL,DWORD); DWORD WINAPI lineMonitorTones(HCALL,LPLINEMONITORTONE,DWORD); diff -Nru wine1.7-1.7.13/include/taskschd.idl wine1.7-1.7.16/include/taskschd.idl --- wine1.7-1.7.13/include/taskschd.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/taskschd.idl 2014-04-04 19:13:44.000000000 +0000 @@ -58,7 +58,7 @@ { TASK_RUNLEVEL_LUA, TASK_RUNLEVEL_HIGHEST -} TASK_RUNLEVEL; +} TASK_RUNLEVEL_TYPE; typedef enum _TASK_TRIGGER_TYPE2 { @@ -509,8 +509,8 @@ [propput] HRESULT LogonType([in] TASK_LOGON_TYPE logon); [propget] HRESULT GroupId([out, retval] BSTR *group); [propput] HRESULT GroupId([in] BSTR group); - [propget] HRESULT RunLevel([out, retval] TASK_RUNLEVEL *level); - [propput] HRESULT RunLevel([in] TASK_RUNLEVEL level); + [propget] HRESULT RunLevel([out, retval] TASK_RUNLEVEL_TYPE *level); + [propput] HRESULT RunLevel([in] TASK_RUNLEVEL_TYPE level); } [ diff -Nru wine1.7-1.7.13/include/textserv.h wine1.7-1.7.16/include/textserv.h --- wine1.7-1.7.13/include/textserv.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/textserv.h 2014-04-04 19:13:44.000000000 +0000 @@ -112,7 +112,7 @@ STDMETHOD(TxSetText)( THIS_ LPCWSTR pszText) PURE; - STDMETHOD(TxGetCurrentTargetX)( THIS_ + STDMETHOD(TxGetCurTargetX)( THIS_ LONG* x) PURE; STDMETHOD(TxGetBaseLinePos)( THIS_ diff -Nru wine1.7-1.7.13/include/urlmon.idl wine1.7-1.7.16/include/urlmon.idl --- wine1.7-1.7.13/include/urlmon.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/urlmon.idl 2014-04-04 19:13:44.000000000 +0000 @@ -722,7 +722,13 @@ BINDSTRING_URL, BINDSTRING_IID, BINDSTRING_FLAG_BIND_TO_OBJECT, - BINDSTRING_PTR_BIND_CONTEXT + BINDSTRING_PTR_BIND_CONTEXT, + BINDSTRING_XDR_ORIGIN, + BINDSTRING_DOWNLOADPATH, + BINDSTRING_ROOTDOC_URL, + BINDSTRING_INITIAL_FILENAME, + BINDSTRING_PROXY_USERNAME, + BINDSTRING_PROXY_PASSWORD } BINDSTRING; HRESULT GetBindInfo( diff -Nru wine1.7-1.7.13/include/wbemdisp.idl wine1.7-1.7.16/include/wbemdisp.idl --- wine1.7-1.7.13/include/wbemdisp.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/wbemdisp.idl 2014-04-04 19:13:44.000000000 +0000 @@ -53,6 +53,85 @@ interface ISWbemSecurity; interface ISWbemServices; +typedef +[ + v1_enum, + uuid(bf078c2a-07d9-11d2-8b21-00600806d9b6) +] +enum WbemTimeout +{ + wbemTimeoutInfinite = 0xffffffff +} WbemTimeout; + +typedef +[ + v1_enum, + uuid(4a249b72-fc9a-11d1-8b1e-00600806d9b6) +] +enum WbemChangeFlagEnum +{ + wbemChangeFlagCreateOrUpdate = 0, + wbemChangeFlagUpdateOnly = 0x00000001, + wbemChangeFlagCreateOnly = 0x00000002, + wbemChangeFlagUpdateCompatible = 0x00000000, + wbemChangeFlagUpdateSafeMode = 0x00000020, + wbemChangeFlagUpdateForceMode = 0x00000040, + wbemChangeFlagStrongValidation = 0x00000080, + wbemChangeFlagAdvisory = 0x00010000 +} WbemChangeFlagEnum; + +typedef +[ + v1_enum, + uuid(4a249b73-fc9a-11d1-8b1e-00600806d9b6) +] +enum WbemFlagEnum +{ + wbemFlagReturnImmediately = 0x00010, + wbemFlagReturnWhenComplete = 0, + wbemFlagBidirectional = 0, + wbemFlagForwardOnly = 0x00020, + wbemFlagNoErrorObject = 0x00040, + wbemFlagReturnErrorObject = 0, + wbemFlagSendStatus = 0x00080, + wbemFlagDontSendStatus = 0, + wbemFlagEnsureLocatable = 0x00100, + wbemFlagDirectRead = 0x00200, + wbemFlagSendOnlySelected = 0, + wbemFlagUseAmendedQualifiers = 0x20000, + wbemFlagGetDefault = 0x0, + wbemFlagSpawnInstance = 0x00001, + wbemFlagUseCurrentTime = 0x00001 +} WbemFlagEnum; + +typedef +[ + v1_enum, + uuid(4a249b76-fc9a-11d1-8b1e-00600806d9b6) +] +enum WbemQueryFlagEnum +{ + wbemQueryFlagDeep, + wbemQueryFlagShallow, + wbemQueryFlagPrototype +} WbemQueryFlagEnum; + +typedef +[ + v1_enum, + uuid(4A249B79-FC9A-11d1-8B1E-00600806D9B6) +] +enum WbemComparisonFlagEnum +{ + wbemComparisonFlagIncludeAll = 0, + wbemComparisonFlagIgnoreQualifiers = 1, + wbemComparisonFlagIgnoreObjectSource = 2, + wbemComparisonFlagIgnoreDefaultValues = 4, + wbemComparisonFlagIgnoreClass = 8, + wbemComparisonFlagIgnoreCase = 16, + wbemComparisonFlagIgnoreFlavor = 32 +} WbemComparisonFlagEnum; + [ object, local, @@ -66,7 +145,7 @@ { [ id(1) ] HRESULT NextEvent( - [in] long iTimeoutMs, + [in, defaultvalue(wbemTimeoutInfinite)] long iTimeoutMs, [out, retval] ISWbemObject **objWbemObject); [ id(2), propget ] @@ -87,19 +166,18 @@ { [ id(1) ] HRESULT ConnectServer( - [in] BSTR strServer, - [in] BSTR strNamespace, - [in] BSTR strUser, - [in] BSTR strPassword, - [in] BSTR strLocale, - [in] BSTR strAuthority, - [in] long iSecurityFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(".")] BSTR strServer, + [in, defaultvalue("")] BSTR strNamespace, + [in, defaultvalue("")] BSTR strUser, + [in, defaultvalue("")] BSTR strPassword, + [in, defaultvalue("")] BSTR strLocale, + [in, defaultvalue("")] BSTR strAuthority, + [in, defaultvalue(0)] long iSecurityFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemServices **objWbemServices); [ id(2), propget ] - HRESULT Security_( - ISWbemSecurity **objWbemSecurity); + HRESULT Security_([out, retval] ISWbemSecurity **objWbemSecurity); }; [ @@ -153,7 +231,7 @@ [ id(DISPID_VALUE) ] HRESULT Item( [in] BSTR strName, - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemMethod **objWbemMethod); [ id(1), propget ] @@ -201,7 +279,7 @@ [ id(DISPID_VALUE) ] HRESULT Item( [in] BSTR strName, - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemNamedValue **objWbemNamedValue); [ id(1), propget ] @@ -212,13 +290,13 @@ HRESULT Add( [in] BSTR strName, [in] VARIANT *varValue, - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemNamedValue **objWbemNamedValue); [ id(3) ] HRESULT Remove( [in] BSTR strName, - [in] long iFlags); + [in, defaultvalue(0)] long iFlags); [ id(4) ] HRESULT Clone( @@ -240,123 +318,123 @@ { [ id(1) ] HRESULT Put_( - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(wbemChangeFlagCreateOrUpdate)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectPath **objWbemObjectPath); [ id(2) ] HRESULT PutAsync_( [in] IDispatch *objWbemSink, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(wbemChangeFlagCreateOrUpdate)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id (3) ] HRESULT Delete_( - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet); + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet); [ id (4) ] HRESULT DeleteAsync_( [in] IDispatch *objWbemSink, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(5) ] HRESULT Instances_( - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(6) ] HRESULT InstancesAsync_( [in] IDispatch *objWbemSink, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(7) ] HRESULT Subclasses_( - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(wbemFlagReturnImmediately|wbemQueryFlagDeep)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(8) ] HRESULT SubclassesAsync_( [in] IDispatch *objWbemSink, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(wbemQueryFlagDeep)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(9) ] HRESULT Associators_( - [in] BSTR strAssocClass, - [in] BSTR strResultClass, - [in] BSTR strResultRole, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredAssocQualifier, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("")] BSTR strAssocClass, + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strResultRole, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredAssocQualifier, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(10) ] HRESULT AssociatorsAsync_( [in] IDispatch *objWbemSink, - [in] BSTR strAssocClass, - [in] BSTR strResultClass, - [in] BSTR strResultRole, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredAssocQualifier, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("")] BSTR strAssocClass, + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strResultRole, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredAssocQualifier, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(11) ] HRESULT References_( - [in] BSTR strResultClass, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(12) ] HRESULT ReferencesAsync_( [in] IDispatch *objWbemSink, - [in] BSTR strResultClass, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(13) ] HRESULT ExecMethod_( [in] BSTR strMethodName, - [in] IDispatch *objWbemInParameters, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemInParameters, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObject **objWbemOutParameters); [ id(14) ] HRESULT ExecMethodAsync_( [in] IDispatch *objWbemSink, [in] BSTR strMethodName, - [in] IDispatch *objWbemInParameters, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(0)] IDispatch *objWbemInParameters, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(15) ] HRESULT Clone_( @@ -364,23 +442,23 @@ [ id(16) ] HRESULT GetObjectText_( - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] BSTR *strObjectText); [ id(17) ] HRESULT SpawnDerivedClass_( - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemObject **objWbemObject); [ id(18) ] HRESULT SpawnInstance_( - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemObject **objWbemObject); [ id(19) ] HRESULT CompareTo_( [in] IDispatch *objWbemObject, - [in] long iFlags, + [in, defaultvalue(wbemComparisonFlagIncludeAll)] long iFlags, [out, retval] VARIANT_BOOL *bResult); [ id(20), propget ] @@ -528,7 +606,7 @@ [ id(DISPID_VALUE) ] HRESULT Item( [in] BSTR strObjectPath, - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemObject **objWbemObject); [ id(1), propget ] @@ -640,7 +718,7 @@ [ id(2) ] HRESULT Add( [in] WbemPrivilegeEnum iPrivilege, - [in] VARIANT_BOOL bIsEnabled, + [in, defaultvalue(TRUE)] VARIANT_BOOL bIsEnabled, [out, retval] ISWbemPrivilege **objWbemPrivilege); [ id(3) ] @@ -653,7 +731,7 @@ [ id(5) ] HRESULT AddAsString( [in] BSTR strPrivilege, - [in] VARIANT_BOOL bIsEnabled, + [in, defaultvalue(TRUE)] VARIANT_BOOL bIsEnabled, [out, retval] ISWbemPrivilege **objWbemPrivilege); }; @@ -743,7 +821,7 @@ [ id(DISPID_VALUE) ] HRESULT Item( [in] BSTR strName, - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemProperty **objWbemProperty); [ id(1), propget ] @@ -754,14 +832,14 @@ HRESULT Add( [in] BSTR strName, [in] WbemCimtypeEnum iCIMType, - [in] VARIANT_BOOL bIsArray, - [in] long iFlags, + [in, defaultvalue(FALSE)] VARIANT_BOOL bIsArray, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemProperty **objWbemProperty); [ id(3) ] HRESULT Remove( [in] BSTR strName, - [in] long iFlags); + [in, defaultvalue(0)] long iFlags); }; [ @@ -839,7 +917,7 @@ [ id(DISPID_VALUE) ] HRESULT Item( [in] BSTR name, - [in] long iFlags, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemQualifier **objWbemQualifier); [ id(1), propget ] @@ -850,16 +928,16 @@ HRESULT Add( [in] BSTR strName, [in] VARIANT *varVal, - [in] VARIANT_BOOL bPropagatesToSubclass, - [in] VARIANT_BOOL bPropagatesToInstance, - [in] VARIANT_BOOL bIsOverridable, - [in] long iFlags, + [in, defaultvalue(TRUE)] VARIANT_BOOL bPropagatesToSubclass, + [in, defaultvalue(TRUE)] VARIANT_BOOL bPropagatesToInstance, + [in, defaultvalue(TRUE)] VARIANT_BOOL bIsOverridable, + [in, defaultvalue(0)] long iFlags, [out, retval] ISWbemQualifier **objWbemQualifier); [ id(3) ] HRESULT Remove( [in] BSTR strName, - [in] long iFlags); + [in, defaultvalue(0)] long iFlags); }; typedef @@ -936,160 +1014,160 @@ { [ id(1) ] HRESULT Get( - [in] BSTR strObjectPath, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("")] BSTR strObjectPath, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObject **objWbemObject); [ id(2) ] HRESULT GetAsync( [in] IDispatch *objWbemSink, - [in] BSTR strObjectPath, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("")] BSTR strObjectPath, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(3) ] HRESULT Delete( [in] BSTR strObjectPath, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet); + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet); [ id(4) ] HRESULT DeleteAsync( [in] IDispatch *objWbemSink, [in] BSTR strObjectPath, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(5) ] HRESULT InstancesOf( [in] BSTR strClass, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(6) ] HRESULT InstancesOfAsync( [in] IDispatch *objWbemSink, [in] BSTR strClass, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(7) ] HRESULT SubclassesOf( - [in] BSTR strSuperclass, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("")] BSTR strSuperclass, + [in, defaultvalue(wbemFlagReturnImmediately|wbemQueryFlagDeep)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(8) ] HRESULT SubclassesOfAsync( [in] IDispatch *objWbemSink, - [in] BSTR strSuperclass, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("")] BSTR strSuperclass, + [in, defaultvalue(wbemQueryFlagDeep)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(9) ] HRESULT ExecQuery( [in] BSTR strQuery, - [in] BSTR strQueryLanguage, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("WQL")] BSTR strQueryLanguage, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(10) ] HRESULT ExecQueryAsync( [in] IDispatch *objWbemSink, [in] BSTR strQuery, - [in] BSTR strQueryLanguage, - [in] long lFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("WQL")] BSTR strQueryLanguage, + [in, defaultvalue(0)] long lFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(11) ] HRESULT AssociatorsOf( [in] BSTR strObjectPath, - [in] BSTR strAssocClass, - [in] BSTR strResultClass, - [in] BSTR strResultRole, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredAssocQualifier, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("")] BSTR strAssocClass, + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strResultRole, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredAssocQualifier, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(12) ] HRESULT AssociatorsOfAsync( [in] IDispatch *objWbemSink, [in] BSTR strObjectPath, - [in] BSTR strAssocClass, - [in] BSTR strResultClass, - [in] BSTR strResultRole, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredAssocQualifier, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("")] BSTR strAssocClass, + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strResultRole, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredAssocQualifier, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(13) ] HRESULT ReferencesTo( [in] BSTR strObjectPath, - [in] BSTR strResultClass, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(wbemFlagReturnImmediately)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObjectSet **objWbemObjectSet); [ id(14) ] HRESULT ReferencesToAsync( [in] IDispatch *objWbemSink, [in] BSTR strObjectPath, - [in] BSTR strResultClass, - [in] BSTR strRole, - [in] VARIANT_BOOL bClassesOnly, - [in] VARIANT_BOOL bSchemaOnly, - [in] BSTR strRequiredQualifier, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("")] BSTR strResultClass, + [in, defaultvalue("")] BSTR strRole, + [in, defaultvalue(FALSE)] VARIANT_BOOL bClassesOnly, + [in, defaultvalue(FALSE)] VARIANT_BOOL bSchemaOnly, + [in, defaultvalue("")] BSTR strRequiredQualifier, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(15) ] HRESULT ExecNotificationQuery( [in] BSTR strQuery, - [in] BSTR strQueryLanguage, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue("WQL")] BSTR strQueryLanguage, + [in, defaultvalue(wbemFlagReturnImmediately|wbemFlagForwardOnly)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemEventSource **objWbemEventSource); [ id(16) ] HRESULT ExecNotificationQueryAsync( [in] IDispatch *objWbemSink, [in] BSTR strQuery, - [in] BSTR strQueryLanguage, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue("WQL")] BSTR strQueryLanguage, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(17) ] HRESULT ExecMethod( [in] BSTR strObjectPath, [in] BSTR strMethodName, - [in] IDispatch *objWbemInParameters, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemInParameters, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, [out, retval] ISWbemObject **objWbemOutParameters); [ id(18) ] @@ -1097,10 +1175,10 @@ [in] IDispatch *objWbemSink, [in] BSTR strObjectPath, [in] BSTR strMethodName, - [in] IDispatch *objWbemInParameters, - [in] long iFlags, - [in] IDispatch *objWbemNamedValueSet, - [in] IDispatch *objWbemAsyncContext); + [in, defaultvalue(0)] IDispatch *objWbemInParameters, + [in, defaultvalue(0)] long iFlags, + [in, defaultvalue(0)] IDispatch *objWbemNamedValueSet, + [in, defaultvalue(0)] IDispatch *objWbemAsyncContext); [ id(19), propget ] HRESULT Security_( diff -Nru wine1.7-1.7.13/include/werapi.h wine1.7-1.7.16/include/werapi.h --- wine1.7-1.7.13/include/werapi.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/werapi.h 2014-04-04 19:13:44.000000000 +0000 @@ -175,6 +175,8 @@ HRESULT WINAPI WerAddExcludedApplication(PCWSTR, BOOL); HRESULT WINAPI WerRegisterFile(PCWSTR file, WER_REGISTER_FILE_TYPE regfiletype, DWORD flags); +HRESULT WINAPI WerRegisterMemoryBlock(void *block, DWORD size); +HRESULT WINAPI WerRegisterRuntimeExceptionModule(PCWSTR callbackdll, void *context); HRESULT WINAPI WerRemoveExcludedApplication(PCWSTR, BOOL); HRESULT WINAPI WerReportAddFile(HREPORT, PCWSTR, WER_FILE_TYPE, DWORD); HRESULT WINAPI WerReportCloseHandle(HREPORT); @@ -182,6 +184,8 @@ HRESULT WINAPI WerReportSetParameter(HREPORT, DWORD, PCWSTR, PCWSTR); HRESULT WINAPI WerReportSetUIOption(HREPORT, WER_REPORT_UI, PCWSTR); HRESULT WINAPI WerReportSubmit(HREPORT, WER_CONSENT, DWORD, PWER_SUBMIT_RESULT); +HRESULT WINAPI WerSetFlags(DWORD flags); +HRESULT WINAPI WerUnregisterMemoryBlock(void *block); #ifdef __cplusplus } diff -Nru wine1.7-1.7.13/include/winbase.h wine1.7-1.7.16/include/winbase.h --- wine1.7-1.7.13/include/winbase.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winbase.h 2014-04-04 19:13:44.000000000 +0000 @@ -285,6 +285,7 @@ typedef enum _FINDEX_INFO_LEVELS { FindExInfoStandard, + FindExInfoBasic, FindExInfoMaxInfoLevel } FINDEX_INFO_LEVELS; @@ -1511,6 +1512,23 @@ /* initialization callback prototype */ typedef BOOL (WINAPI *PINIT_ONCE_FN)(PINIT_ONCE,PVOID,PVOID*); +typedef struct _REASON_CONTEXT +{ + ULONG Version; + DWORD Flags; + union + { + struct + { + HMODULE LocalizedReasonModule; + ULONG LocalizedReasonId; + ULONG ReasonStringCount; + LPWSTR *ReasonStrings; + } Detailed; + LPWSTR SimpleReasonString; + } Reason; +} REASON_CONTEXT, *PREASON_CONTEXT; + WINBASEAPI BOOL WINAPI ActivateActCtx(HANDLE,ULONG_PTR *); WINADVAPI BOOL WINAPI AddAccessAllowedAce(PACL,DWORD,DWORD,PSID); WINADVAPI BOOL WINAPI AddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID); @@ -2362,6 +2380,7 @@ WINBASEAPI BOOL WINAPI SetVolumeMountPointW(LPCSTR,LPCSTR); #define SetVolumeMountPoint WINELIB_NAME_AW(SetVolumeMountPoint) WINBASEAPI BOOL WINAPI SetWaitableTimer(HANDLE,const LARGE_INTEGER*,LONG,PTIMERAPCROUTINE,LPVOID,BOOL); +WINBASEAPI BOOL WINAPI SetWaitableTimerEx(HANDLE,const LARGE_INTEGER*,LONG,PTIMERAPCROUTINE,LPVOID,REASON_CONTEXT*,ULONG); WINBASEAPI BOOL WINAPI SetupComm(HANDLE,DWORD,DWORD); WINBASEAPI DWORD WINAPI SignalObjectAndWait(HANDLE,HANDLE,DWORD,BOOL); WINBASEAPI DWORD WINAPI SizeofResource(HMODULE,HRSRC); diff -Nru wine1.7-1.7.13/include/wine/schrpc.idl wine1.7-1.7.16/include/wine/schrpc.idl --- wine1.7-1.7.13/include/wine/schrpc.idl 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/include/wine/schrpc.idl 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,100 @@ +/* + * Task Scheduler Service definitions + * + * Copyright 2014 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 + */ + +cpp_quote("#define SCHEDSVC_TRANSPORT {'n','c','a','l','r','p','c',0}") + +import "oaidl.idl"; +import "ocidl.idl"; + +[ + uuid(86d35949-83c9-4044-b424-db363231fd0c), + implicit_handle(handle_t rpc_handle), + version(1.0), + pointer_default(unique) +] +interface ITaskSchedulerService +{ + typedef struct _TASK_USER_CRED + { + [string] const WCHAR *user; + [string] const WCHAR *password; + DWORD flags; + } TASK_USER_CRED; + + typedef struct _TASK_XML_ERROR_INFO + { + DWORD line, column; + [string] WCHAR *node; + [string] WCHAR *value; + } TASK_XML_ERROR_INFO; + + typedef [string] WCHAR **TASK_NAMES; + + HRESULT SchRpcHighestVersion([out] DWORD *version); + HRESULT SchRpcRegisterTask([in, string, unique] const WCHAR *path, + [in, string] const WCHAR *xml, [in] DWORD flags, + [in, string, unique] const WCHAR *sddl, + [in] DWORD task_logon_type, [in] DWORD n_creds, + [in, size_is(n_creds), unique] const TASK_USER_CRED *creds, + [out, string] WCHAR **actual_path, + [out] TASK_XML_ERROR_INFO **xml_error_info); + HRESULT SchRpcRetrieveTask([in, string] const WCHAR *path, + [in, string] const WCHAR *languages, + [in] unsigned long *n_languages, [out, string] WCHAR **xml); + HRESULT SchRpcCreateFolder([in, string] const WCHAR *path, + [in, string, unique] const WCHAR *sddl, [in] DWORD flags); + HRESULT SchRpcSetSecurity([in, string] const WCHAR *path, + [in, string] const WCHAR *sddl, [in] DWORD flags); + HRESULT SchRpcGetSecurity([in, string] const WCHAR *path, + [in] DWORD flags, [out, string] WCHAR **sddl); + HRESULT SchRpcEnumFolders([in, string] const WCHAR *path, + [in] DWORD flags, [in, out] DWORD *start_index, + [in] DWORD n_requested, [out] DWORD *n_names, + [out, string, size_is(,*n_names)] TASK_NAMES *names); + HRESULT SchRpcEnumTasks([in, string] const WCHAR *path, + [in] DWORD flags, [in, out] DWORD *start_index, + [in] DWORD n_requested, [out] DWORD *n_names, + [out, string, size_is(,*n_names)] TASK_NAMES *names); + HRESULT SchRpcEnumInstances([in, string, unique] const WCHAR *path, + [in] DWORD flags, [out] DWORD *n_guids, + [out, size_is(,*n_guids)] GUID **guids); + HRESULT SchRpcGetInstanceInfo([in] GUID guid, [out, string] WCHAR **path, + [out] DWORD *task_state, [out, string] WCHAR **action, + [out, string] WCHAR **info, [out] DWORD *n_instances, + [out, size_is(,*n_instances)] GUID **instances, [out] DWORD *pid); + HRESULT SchRpcStopInstance([in] GUID guid, [in] DWORD flags); + HRESULT SchRpcStop([in, string, unique] const WCHAR *path, [in] DWORD flags); + HRESULT SchRpcRun([in, string] const WCHAR *path, + [in] DWORD n_args, [in, size_is(n_args),unique] const WCHAR **args, + [in] DWORD flags, [in] DWORD session_id, + [in, unique, string] const WCHAR *user, [out] GUID *guid); + HRESULT SchRpcDelete([in, string] const WCHAR *path, [in] DWORD flags); + HRESULT SchRpcRename([in, string] const WCHAR *path, [in, string] const WCHAR *name, [in] DWORD flags); + HRESULT SchRpcScheduledRuntimes([in, string] const WCHAR *path, + [in, unique] SYSTEMTIME *start, [in, unique] SYSTEMTIME *end, + [in] DWORD flags, [in] DWORD n_requested, [out] DWORD *n_runtimes, + [out, size_is(,*n_runtimes)] SYSTEMTIME **runtimes); + HRESULT SchRpcGetLastRunInfo([in, string] const WCHAR *path, + [out] SYSTEMTIME *last_runtime, [out] DWORD *last_return_code); + HRESULT SchRpcGetTaskInfo([in, string] const WCHAR *path, [in] DWORD flags, + [out] DWORD *enabled, [out] DWORD *task_state); + HRESULT SchRpcGetNumberOfMissedRuns([in, string] const WCHAR *path, [out] DWORD *runs); + HRESULT SchRpcEnableTask([in, string] const WCHAR *path, [in] DWORD enabled); +} diff -Nru wine1.7-1.7.13/include/wine/wined3d.h wine1.7-1.7.16/include/wine/wined3d.h --- wine1.7-1.7.13/include/wine/wined3d.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/wine/wined3d.h 2014-04-04 19:13:44.000000000 +0000 @@ -26,6 +26,8 @@ #ifndef __WINE_WINED3D_H #define __WINE_WINED3D_H +#include "wine/list.h" + #define WINED3D_OK S_OK #define _FACWINED3D 0x876 @@ -1983,6 +1985,25 @@ struct wined3d_swapchain_desc *desc, struct wined3d_swapchain **swapchain); }; +struct wined3d_private_store +{ + struct list content; +}; + +struct wined3d_private_data +{ + struct list entry; + + GUID tag; + DWORD flags; /* DDSPD_* */ + DWORD size; + union + { + BYTE data[1]; + IUnknown *object; + } content; +}; + typedef HRESULT (CDECL *wined3d_device_reset_cb)(struct wined3d_resource *resource); void __stdcall wined3d_mutex_lock(void); @@ -2003,7 +2024,7 @@ HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_device_type device_type, enum wined3d_format_id display_format_id, enum wined3d_format_id backbuffer_format_id, BOOL windowed); -struct wined3d * __cdecl wined3d_create(UINT version, DWORD flags); +struct wined3d * __cdecl wined3d_create(DWORD flags); ULONG __cdecl wined3d_decref(struct wined3d *wined3d); HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, enum wined3d_format_id format_id, enum wined3d_scanline_ordering scanline_ordering, @@ -2245,15 +2266,84 @@ ULONG __cdecl wined3d_query_incref(struct wined3d_query *query); HRESULT __cdecl wined3d_query_issue(struct wined3d_query *query, DWORD flags); -HRESULT __cdecl wined3d_resource_free_private_data(struct wined3d_resource *resource, REFGUID guid); +static inline void wined3d_private_store_init(struct wined3d_private_store *store) +{ + list_init(&store->content); +} + +static inline struct wined3d_private_data *wined3d_private_store_get_private_data( + const struct wined3d_private_store *store, const GUID *tag) +{ + struct wined3d_private_data *data; + struct list *entry; + + LIST_FOR_EACH(entry, &store->content) + { + data = LIST_ENTRY(entry, struct wined3d_private_data, entry); + if (IsEqualGUID(&data->tag, tag)) + return data; + } + return NULL; +} + +static inline void wined3d_private_store_free_private_data(struct wined3d_private_store *store, + struct wined3d_private_data *entry) +{ + if (entry->flags & WINED3DSPD_IUNKNOWN) + IUnknown_Release(entry->content.object); + list_remove(&entry->entry); + HeapFree(GetProcessHeap(), 0, entry); +} + +static inline void wined3d_private_store_cleanup(struct wined3d_private_store *store) +{ + struct wined3d_private_data *data; + struct list *e1, *e2; + + LIST_FOR_EACH_SAFE(e1, e2, &store->content) + { + data = LIST_ENTRY(e1, struct wined3d_private_data, entry); + wined3d_private_store_free_private_data(store, data); + } +} + +static inline HRESULT wined3d_private_store_set_private_data(struct wined3d_private_store *store, + const GUID *guid, const void *data, DWORD data_size, DWORD flags) +{ + struct wined3d_private_data *d, *old; + const void *ptr = data; + + if (flags & WINED3DSPD_IUNKNOWN) + { + if (data_size != sizeof(IUnknown *)) + return WINED3DERR_INVALIDCALL; + ptr = &data; + } + + if (!(d = HeapAlloc(GetProcessHeap(), 0, + FIELD_OFFSET(struct wined3d_private_data, content.data[data_size])))) + return E_OUTOFMEMORY; + + d->tag = *guid; + d->flags = flags; + d->size = data_size; + + memcpy(d->content.data, ptr, data_size); + if (flags & WINED3DSPD_IUNKNOWN) + IUnknown_AddRef(d->content.object); + + old = wined3d_private_store_get_private_data(store, guid); + if (old) + wined3d_private_store_free_private_data(store, old); + list_add_tail(&store->content, &d->entry); + + return WINED3D_OK; +} + void __cdecl wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc); void * __cdecl wined3d_resource_get_parent(const struct wined3d_resource *resource); -HRESULT __cdecl wined3d_resource_get_private_data(const struct wined3d_resource *resource, - REFGUID guid, void *data, DWORD *data_size); void __cdecl wined3d_resource_set_parent(struct wined3d_resource *resource, void *parent); -HRESULT __cdecl wined3d_resource_set_private_data(struct wined3d_resource *resource, - REFGUID guid, const void *data, DWORD data_size, DWORD flags); HRESULT __cdecl wined3d_rendertarget_view_create(struct wined3d_resource *resource, void *parent, struct wined3d_rendertarget_view **rendertarget_view); diff -Nru wine1.7-1.7.13/include/winnt.h wine1.7-1.7.16/include/winnt.h --- wine1.7-1.7.13/include/winnt.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winnt.h 2014-04-04 19:13:44.000000000 +0000 @@ -154,7 +154,7 @@ # define DECLSPEC_EXPORT #endif -#if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) +#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) # define DECLSPEC_HIDDEN #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3))) # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden"))) diff -Nru wine1.7-1.7.13/include/winreg.h wine1.7-1.7.16/include/winreg.h --- wine1.7-1.7.13/include/winreg.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winreg.h 2014-04-04 19:13:44.000000000 +0000 @@ -87,10 +87,10 @@ #define AbortSystemShutdown WINELIB_NAME_AW(AbortSystemShutdown) WINADVAPI BOOL WINAPI InitiateSystemShutdownA(LPSTR,LPSTR,DWORD,BOOL,BOOL); WINADVAPI BOOL WINAPI InitiateSystemShutdownW(LPWSTR,LPWSTR,DWORD,BOOL,BOOL); -#define InitiateSystemShutdown WINELIB_NAME_AW(InitiateSystemShutdown); +#define InitiateSystemShutdown WINELIB_NAME_AW(InitiateSystemShutdown) WINADVAPI BOOL WINAPI InitiateSystemShutdownExA(LPSTR,LPSTR,DWORD,BOOL,BOOL,DWORD); WINADVAPI BOOL WINAPI InitiateSystemShutdownExW(LPWSTR,LPWSTR,DWORD,BOOL,BOOL,DWORD); -#define InitiateSystemShutdownEx WINELIB_NAME_AW(InitiateSystemShutdownEx); +#define InitiateSystemShutdownEx WINELIB_NAME_AW(InitiateSystemShutdownEx) WINADVAPI LSTATUS WINAPI RegCloseKey(HKEY); WINADVAPI LSTATUS WINAPI RegConnectRegistryA(LPCSTR,HKEY,PHKEY); WINADVAPI LSTATUS WINAPI RegConnectRegistryW(LPCWSTR,HKEY,PHKEY); diff -Nru wine1.7-1.7.13/include/winsock2.h wine1.7-1.7.16/include/winsock2.h --- wine1.7-1.7.13/include/winsock2.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winsock2.h 2014-04-04 19:13:44.000000000 +0000 @@ -724,7 +724,7 @@ typedef int (WINAPI *LPFN_WSAJOINLEAF)(SOCKET,const struct WS(sockaddr)*,int,LPWSABUF,LPWSABUF,LPQOS,LPQOS,DWORD); typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINA)(LPWSAQUERYSETA,DWORD,LPHANDLE); typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEBEGINW)(LPWSAQUERYSETW,DWORD,LPHANDLE); -#define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN); +#define LPFN_WSALOOKUPSERVICEBEGIN WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICEBEGIN) typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND)(HANDLE); typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA); typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW); diff -Nru wine1.7-1.7.13/include/winspool.h wine1.7-1.7.16/include/winspool.h --- wine1.7-1.7.13/include/winspool.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winspool.h 2014-04-04 19:13:44.000000000 +0000 @@ -297,6 +297,10 @@ #define DSPRINT_REPUBLISH 0x00000008 #define DSPRINT_PENDING 0x80000000 +#define UPDP_SILENT_UPLOAD 0x00000001 +#define UPDP_UPLOAD_ALWAYS 0x00000002 +#define UPDP_CHECK_DRIVERSTORE 0x00000004 + /* ##################################### */ /* TYPES */ @@ -1801,6 +1805,10 @@ LPWSTR WINAPI StartDocDlgW(HANDLE hPrinter, DOCINFOW *doc); #define StartDocDlg WINELIB_NAME_AW(StartDocDlg) +HRESULT WINAPI UploadPrinterDriverPackageA(LPCSTR,LPCSTR,LPCSTR,DWORD,HWND,LPSTR,PULONG); +HRESULT WINAPI UploadPrinterDriverPackageW(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,HWND,LPWSTR,PULONG); +#define UploadPrinterDriverPackage WINELIB_NAME_AW(UploadPrinterDriverPackage) + BOOL WINAPI XcvDataW(HANDLE hXcv, LPCWSTR pszDataName, PBYTE pInputData, DWORD cbInputData, PBYTE pOutputData, DWORD cbOutputData, PDWORD pcbOutputNeeded, PDWORD pdwStatus); diff -Nru wine1.7-1.7.13/include/winternl.h wine1.7-1.7.16/include/winternl.h --- wine1.7-1.7.13/include/winternl.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winternl.h 2014-04-04 19:13:44.000000000 +0000 @@ -2469,6 +2469,7 @@ NTSYSAPI NTSTATUS WINAPI RtlQueryProcessDebugInformation(ULONG,ULONG,PDEBUG_BUFFER); NTSYSAPI NTSTATUS WINAPI RtlQueryRegistryValues(ULONG, PCWSTR, PRTL_QUERY_REGISTRY_TABLE, PVOID, PVOID); NTSYSAPI NTSTATUS WINAPI RtlQueryTimeZoneInformation(RTL_TIME_ZONE_INFORMATION*); +NTSYSAPI NTSTATUS WINAPI RtlQueryUnbiasedInterruptTime(ULONGLONG*); NTSYSAPI NTSTATUS WINAPI RtlQueueWorkItem(PRTL_WORK_ITEM_ROUTINE,PVOID,ULONG); NTSYSAPI void WINAPI RtlRaiseException(PEXCEPTION_RECORD); NTSYSAPI void WINAPI RtlRaiseStatus(NTSTATUS); diff -Nru wine1.7-1.7.13/include/winuser.h wine1.7-1.7.16/include/winuser.h --- wine1.7-1.7.13/include/winuser.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/winuser.h 2014-04-04 19:13:44.000000000 +0000 @@ -3219,6 +3219,27 @@ #define AnsiToOemBuffW CharToOemBuffW #define AnsiToOemBuff WINELIB_NAME_AW(AnsiToOemBuff) +/* ChangeWindowMessageFilter flags */ +#define MSGFLT_ADD 1 +#define MSGFLT_REMOVE 2 + +/* ChangeWindowMessageFilterEx defines */ +#define MSGFLTINFO_NONE 0 +#define MSGFLTINFO_ALREADYALLOWED_FORWND 1 +#define MSGFLTINFO_ALREADYDISALLOWED_FORWND 2 +#define MSGFLTINFO_ALLOWED_HIGHER 3 + +typedef struct tagCHANGEFILTERSTRUCT +{ + DWORD cbSize; + DWORD ExtStatus; +} CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT; + +/* Actions for ChangeWindowMessageFilterEx */ +#define MSGFLT_RESET 0 +#define MSGFLT_ALLOW 1 +#define MSGFLT_DISALLOW 2 + #if defined(_WINGDI_) && !defined(NOGDI) WINUSERAPI LONG WINAPI ChangeDisplaySettingsA(LPDEVMODEA,DWORD); WINUSERAPI LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW,DWORD); @@ -3293,6 +3314,8 @@ WINUSERAPI BOOL WINAPI ChangeMenuA(HMENU,UINT,LPCSTR,UINT,UINT); WINUSERAPI BOOL WINAPI ChangeMenuW(HMENU,UINT,LPCWSTR,UINT,UINT); #define ChangeMenu WINELIB_NAME_AW(ChangeMenu) +WINUSERAPI BOOL WINAPI ChangeWindowMessageFilter(UINT,DWORD); +WINUSERAPI BOOL WINAPI ChangeWindowMessageFilterEx(HWND,UINT,DWORD,CHANGEFILTERSTRUCT*); WINUSERAPI LPSTR WINAPI CharLowerA(LPSTR); WINUSERAPI LPWSTR WINAPI CharLowerW(LPWSTR); #define CharLower WINELIB_NAME_AW(CharLower) diff -Nru wine1.7-1.7.13/include/wmsdkidl.idl wine1.7-1.7.16/include/wmsdkidl.idl --- wine1.7-1.7.13/include/wmsdkidl.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/wmsdkidl.idl 2014-04-04 19:13:44.000000000 +0000 @@ -110,6 +110,15 @@ WMT_ON = 2, } WMT_STREAM_SELECTION; +typedef enum WMT_VERSION +{ + WMT_VER_4_0 = 0x00040000, + WMT_VER_7_0 = 0x00070000, + WMT_VER_8_0 = 0x00080000, + WMT_VER_9_0 = 0x00090000 +} WMT_VERSION; + +typedef LPCWSTR LPCWSTR_WMSDK_TYPE_SAFE; [ object, @@ -146,6 +155,167 @@ [ object, + uuid(96406Bdd-2b2b-11d3-b36b-00c04f6108ff), + pointer_default(unique), + local +] +interface IWMStreamList : IUnknown +{ + HRESULT GetStreams( + [out, size_is(*pcStreams)] WORD *pwStreamNumArray, + [in, out] WORD *pcStreams); + + HRESULT AddStream([in] WORD wStreamNum); + HRESULT RemoveStream([in] WORD wStreamNum); +} + +[ + object, + uuid(96406Bde-2b2b-11d3-b36b-00c04f6108ff), + pointer_default(unique), + local +] +interface IWMMutualExclusion : IWMStreamList +{ + HRESULT GetType([out] GUID *pguidType); + HRESULT SetType([in] REFGUID guidType); +} + +[ + object, + uuid(96406Bdc-2b2b-11d3-b36b-00c04f6108ff), + pointer_default(unique), + local +] +interface IWMStreamConfig : IUnknown +{ + HRESULT GetStreamType([out] GUID *pguidStreamType); + HRESULT GetStreamNumber([out] WORD *pwStreamNum); + HRESULT SetStreamNumber([in] WORD wStreamNum); + + HRESULT GetStreamName( + [out, size_is(*pcchStreamName)] WCHAR *pwszStreamName, + [in, out] WORD *pcchStreamName); + + HRESULT SetStreamName([in] LPCWSTR_WMSDK_TYPE_SAFE pwszStreamName); + + HRESULT GetConnectionName( + [out, size_is(*pcchInputName)] WCHAR *pwszInputName, + [in, out] WORD *pcchInputName); + + HRESULT SetConnectionName([in] LPCWSTR_WMSDK_TYPE_SAFE pwszInputName); + HRESULT GetBitrate([out] DWORD *pdwBitrate); + HRESULT SetBitrate([in] DWORD pdwBitrate); + HRESULT GetBufferWindow([out] DWORD *pmsBufferWindow); + HRESULT SetBufferWindow([in] DWORD msBufferWindow); +} + +[ + object, + uuid(96406bdb-2b2b-11d3-b36b-00c04f6108ff), + pointer_default(unique), + local +] +interface IWMProfile : IUnknown +{ + HRESULT GetVersion( + [out] WMT_VERSION *pdwVersion); + + HRESULT GetName( + [out, size_is(*pcchName)] WCHAR *pwszName, + [in, out] DWORD *pcchName); + + HRESULT SetName( + [in] const WCHAR *pwszName); + + HRESULT GetDescription( + [out, size_is(*pcchDescription)] WCHAR *pwszDescription, + [in, out] DWORD *pcchDescription); + + HRESULT SetDescription( + [in] const WCHAR *pwszDescription); + + HRESULT GetStreamCount( + [out] DWORD *pcStreams); + + HRESULT GetStream( + [in] DWORD dwStreamIndex, + [out] IWMStreamConfig **ppConfig); + + HRESULT GetStreamByNumber( + [in] WORD wStreamNum, + [out] IWMStreamConfig **ppConfig); + + HRESULT RemoveStream( + [in] IWMStreamConfig *pConfig); + + HRESULT RemoveStreamByNumber( + [in] WORD wStreamNum); + + HRESULT AddStream( + [in] IWMStreamConfig *pConfig); + + HRESULT ReconfigStream( + [in] IWMStreamConfig *pConfig); + + HRESULT CreateNewStream( + [in] REFGUID guidStreamType, + [out] IWMStreamConfig **ppConfig); + + HRESULT GetMutualExclusionCount( + [out] DWORD *pcME); + + HRESULT GetMutualExclusion( + [in] DWORD dwMEIndex, + [out] IWMMutualExclusion **ppME); + + HRESULT RemoveMutualExclusion( + [in] IWMMutualExclusion *pME); + + HRESULT AddMutualExclusion( + [in] IWMMutualExclusion *pME); + + HRESULT CreateNewMutualExclusion( + [out] IWMMutualExclusion **ppME); +} + +[ + object, + uuid(d16679f2-6ca0-472d-8d31-2f5d55aee155), + pointer_default(unique), + local +] +interface IWMProfileManager : IUnknown +{ + HRESULT CreateEmptyProfile( + [in] WMT_VERSION dwVersion, + [out] IWMProfile **ppProfile); + + HRESULT LoadProfileByID( + [in] REFGUID guidProfile, + [out] IWMProfile **ppProfile); + + HRESULT LoadProfileByData( + [in] const WCHAR *pwszProfile, + [out] IWMProfile **ppProfile); + + HRESULT SaveProfile( + [in] IWMProfile *pIWMProfile, + [in] WCHAR *pwszProfile, + [in, out] DWORD *pdwLength); + + HRESULT GetSystemProfileCount( + [out] DWORD *pcProfiles); + + HRESULT LoadSystemProfile( + [in] DWORD dwProfileIndex, + [out] IWMProfile **ppProfile); +} + +cpp_quote("HRESULT WINAPI WMCreateProfileManager(IWMProfileManager**);") + +[ + object, uuid(96406bce-2b2b-11d3-b36b-00c04f6108ff), pointer_default(unique), local diff -Nru wine1.7-1.7.13/include/wtsapi32.h wine1.7-1.7.16/include/wtsapi32.h --- wine1.7-1.7.13/include/wtsapi32.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/wtsapi32.h 2014-04-04 19:13:44.000000000 +0000 @@ -135,6 +135,8 @@ DECL_WINELIB_TYPE_AW(WTS_SERVER_INFO) DECL_WINELIB_TYPE_AW(PWTS_SERVER_INFO) +#define WTS_CURRENT_SERVER_HANDLE ((HANDLE)NULL) + void WINAPI WTSCloseServer(HANDLE); BOOL WINAPI WTSConnectSessionA(ULONG, ULONG, PSTR, BOOL); BOOL WINAPI WTSConnectSessionW(ULONG, ULONG, PWSTR, BOOL); diff -Nru wine1.7-1.7.13/include/xmllite.idl wine1.7-1.7.16/include/xmllite.idl --- wine1.7-1.7.13/include/xmllite.idl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/include/xmllite.idl 2014-04-04 19:13:44.000000000 +0000 @@ -293,3 +293,10 @@ HRESULT WriteWhitespace([in] LPCWSTR pwszWhitespace); HRESULT Flush(); } + +/* IXmlWriter construction */ +cpp_quote("STDAPI CreateXmlWriter(REFIID riid, void **ppvObject, IMalloc *pMalloc);") + +cpp_quote("typedef IUnknown IXmlWriterOutput;") +cpp_quote("STDAPI CreateXmlWriterOutputWithEncodingName(IUnknown *stream, IMalloc *pMalloc,") +cpp_quote(" LPCWSTR encoding, IXmlWriterOutput **output);") diff -Nru wine1.7-1.7.13/loader/wine.inf.in wine1.7-1.7.16/loader/wine.inf.in --- wine1.7-1.7.13/loader/wine.inf.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/loader/wine.inf.in 2014-04-04 19:13:44.000000000 +0000 @@ -121,8 +121,10 @@ AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices AddService=PlugPlay,0,PlugPlayService -AddService=FontCache3.0.0.0,0,FontCacheService +AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService +AddService=FontCache,0,FontCacheService +AddService=Schedule,0,TaskSchedulerService [DefaultInstall.NT.Services] AddService=BITS,0,BITSService @@ -132,8 +134,10 @@ AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices AddService=PlugPlay,0,PlugPlayService -AddService=FontCache3.0.0.0,0,FontCacheService +AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService +AddService=FontCache,0,FontCacheService +AddService=Schedule,0,TaskSchedulerService [DefaultInstall.ntamd64.Services] AddService=BITS,0,BITSService @@ -143,8 +147,10 @@ AddService=StiSvc,0,StiService AddService=TermService,0,TerminalServices AddService=PlugPlay,0,PlugPlayService -AddService=FontCache3.0.0.0,0,FontCacheService +AddService=FontCache3.0.0.0,0,WPFFontCacheService AddService=LanmanServer,0,LanmanServerService +AddService=FontCache,0,FontCacheService +AddService=Schedule,0,TaskSchedulerService [Strings] MciExtStr="Software\Microsoft\Windows NT\CurrentVersion\MCI Extensions" @@ -2507,6 +2513,7 @@ 10,logs, 10,temp, 11,mui, +11,tasks, 11,spool\drivers\color, 11,spool\printers, 10,,explorer.exe @@ -2539,6 +2546,9 @@ 11,wbem,wbemprox.dll 11,wbem,wmic.exe 11,wbem,wmiutils.dll +; empty folders to make sure the parent dirs are not removed +16410,Microsoft, +16412,Microsoft, 16422,Internet Explorer,iexplore.exe 16427,System\OLE DB,oledb32.dll 16427,System\OLE DB,msdaps.dll @@ -2989,7 +2999,7 @@ StartType=2 ErrorControl=1 -[FontCacheService] +[WPFFontCacheService] Description="Windows Presentation Foundation font cache service" DisplayName="Windows Presentation Foundation Font Cache 3.0.0.0" ServiceBinary="%10%\Microsoft.Net\Framework\v3.0\wpf\presentationfontcache.exe" @@ -3010,6 +3020,32 @@ HKR,Parameters,"ServiceDll",,"%11%\srvsvc.dll" ;; HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"lanmanserver" +[FontCacheService] +AddReg=FontCacheServiceKeys +Description="Windows Font Cache Service" +DisplayName="Windows Font Cache Service" +ServiceBinary="%11%\svchost.exe -k netsvcs" +ServiceType=32 +StartType=3 +ErrorControl=1 + +[FontCacheServiceKeys] +HKR,Parameters,"ServiceDll",,"%11%\fntcache.dll" +;; HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"fontcache" + +[TaskSchedulerService] +AddReg=TaskSchedulerServiceKeys +Description="Task Scheduler" +DisplayName="Task Scheduler" +ServiceBinary="%11%\svchost.exe -k netsvcs" +ServiceType=32 +StartType=3 +ErrorControl=1 + +[TaskSchedulerServiceKeys] +HKR,Parameters,"ServiceDll",,"%11%\schedsvc.dll" +HKLM,%CurrentVersionNT%\SvcHost,"netsvcs",0x00010008,"Schedule" + [Services] HKLM,%CurrentVersion%\RunServices,"winemenubuilder",2,"%11%\winemenubuilder.exe -a -r" HKLM,"System\CurrentControlSet\Services\Eventlog\Application",,16 diff -Nru wine1.7-1.7.13/po/ar.po wine1.7-1.7.16/po/ar.po --- wine1.7-1.7.13/po/ar.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ar.po 2014-04-04 19:13:44.000000000 +0000 @@ -11628,6 +11628,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "تصدير الفرع المختار من السجل إلى ملف نصي" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "فشل فتح '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/bg.po wine1.7-1.7.16/po/bg.po --- wine1.7-1.7.13/po/bg.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/bg.po 2014-04-04 19:13:44.000000000 +0000 @@ -11500,6 +11500,74 @@ "Записва цялото или част от съдържанието на системния регистър във текстов " "файл" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/ca.po wine1.7-1.7.16/po/ca.po --- wine1.7-1.7.13/po/ca.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ca.po 2014-04-04 19:13:44.000000000 +0000 @@ -11856,6 +11856,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exporta la branca del registre seleccionada a un fitxer de text" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "S'ha fallat en obrir '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/cs.po wine1.7-1.7.16/po/cs.po --- wine1.7-1.7.13/po/cs.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/cs.po 2014-04-04 19:13:44.000000000 +0000 @@ -11509,6 +11509,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exportuje vybranou větev registru do textového souboru" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Otevření „%1“ se nezdařilo\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/da.po wine1.7-1.7.16/po/da.po --- wine1.7-1.7.13/po/da.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/da.po 2014-04-04 19:13:44.000000000 +0000 @@ -11765,6 +11765,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Eksporter udvalgte gren af registreringsdatabasen til en tekst fil" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Kunne ikke åbne «%1»\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/de.po wine1.7-1.7.16/po/de.po --- wine1.7-1.7.13/po/de.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/de.po 2014-04-04 19:13:44.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: 2013-12-02 22:42+0100\n" +"PO-Revision-Date: 2014-03-29 15:03+0100\n" "Last-Translator: Julian Rüger\n" "Language-Team: none\n" "Language: German\n" @@ -6593,10 +6593,8 @@ msgstr "Der Benutzername konnte nicht gefunden werden.\n" #: winerror.mc:3741 -#, fuzzy -#| msgid "The site does not exist.\n" msgid "This network connection does not exist.\n" -msgstr "Die Seite existiert nicht.\n" +msgstr "Diese Netzwerkverbindung existiert nicht.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -11745,6 +11743,110 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exportiert den ausgewählten Zweig der Registry in eine Textdatei" +#: regsvr32.rc:32 +#, fuzzy +#| msgid "" +#| "Wine DLL Registration Server\n" +#| "\n" +#| "Provides DLL registration services.\n" +#| "\n" +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Wine DLL-Registrierungsserver\n" +"\n" +"Stellt Dienste zur DLL-Registrierung bereit.\n" +"\n" + +#: regsvr32.rc:40 +#, fuzzy +#| msgid "" +#| "Usage:\n" +#| " regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +#| "\n" +#| "Options:\n" +#| " [/u] Unregister a module from the server.\n" +#| " [/s] Silent mode (no messages will be displayed).\n" +#| " [/i] Call DllInstall, passing an optional [cmdline].\n" +#| "\tWhen used with [/u], regsvr32 also calls DLL Uninstall.\n" +#| " [/n] Do not call DllRegisterServer. This option must be used with [/" +#| "i].\n" +#| "\n" +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Aufruf:\n" +" regsvr32 [/u] [/s] [/n] [/i[:Befehlszeile]] DllName\n" +"\n" +"Optionen:\n" +" [/u] Registrierung eines Moduls vom Server aufheben.\n" +" [/s] Stiller Modus (es werden keine Meldungen angezeigt).\n" +" [/i] DllInstall mit einer optionalen [Befehlszeile] aufrufen.\n" +"\tBei Angabe von [/u], ruft regsvr32 auch DLL Uninstall auf.\n" +" [/n] DllRegisterServer nicht aufrufen. Muss in Verbindung mit [/i]\n" +"\tbenutzt werden.\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: Ungültiges oder nicht erkanntes Argument [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: DLL '%1' konnte nicht geladen werden\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1 nicht in DLL '%2' implementiert\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: DLL '%1' konnte nicht registriert werden\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: DLL '%1' erfolgreich registriert\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: Registrierung von DLL '%1' konnte nicht aufgehoben werden\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: Registrierung von DLL '%1' erfolgreich aufgehoben\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: DLL '%1' konnte nicht installiert werden\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: DLL '%1' erfolgreich installiert\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: DLL '%1' konnte nicht deinstalliert werden\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: DLL '%1' erfolgreich deinstalliert\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/el.po wine1.7-1.7.16/po/el.po --- wine1.7-1.7.13/po/el.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/el.po 2014-04-04 19:13:44.000000000 +0000 @@ -11297,6 +11297,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/en.po wine1.7-1.7.16/po/en.po --- wine1.7-1.7.13/po/en.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/en.po 2014-04-04 19:13:44.000000000 +0000 @@ -11667,6 +11667,90 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exports selected branch of the registry to a text file" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: Failed to load DLL '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1 not implemented in DLL '%2'\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: Failed to register DLL '%1'\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: Successfully registered DLL '%1'\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: Failed to unregister DLL '%1'\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: Successfully unregistered DLL '%1'\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: Failed to install DLL '%1'\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: Successfully installed DLL '%1'\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: Failed to uninstall DLL '%1'\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: Successfully uninstalled DLL '%1'\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/en_US.po wine1.7-1.7.16/po/en_US.po --- wine1.7-1.7.13/po/en_US.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/en_US.po 2014-04-04 19:13:44.000000000 +0000 @@ -11667,6 +11667,90 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exports selected branch of the registry to a text file" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: Failed to load DLL '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1 not implemented in DLL '%2'\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: Failed to register DLL '%1'\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: Successfully registered DLL '%1'\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: Failed to unregister DLL '%1'\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: Successfully unregistered DLL '%1'\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: Failed to install DLL '%1'\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: Successfully installed DLL '%1'\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: Failed to uninstall DLL '%1'\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: Successfully uninstalled DLL '%1'\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/eo.po wine1.7-1.7.16/po/eo.po --- wine1.7-1.7.13/po/eo.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/eo.po 2014-04-04 19:13:44.000000000 +0000 @@ -11163,6 +11163,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Eksportas elektitan branĉon de la registrejo al tekstodosiero" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/es.po wine1.7-1.7.16/po/es.po --- wine1.7-1.7.13/po/es.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/es.po 2014-04-04 19:13:44.000000000 +0000 @@ -11852,6 +11852,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exporta la rama seleccionada del registro a un archivo de texto" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "No se pudo abrir '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/fa.po wine1.7-1.7.16/po/fa.po --- wine1.7-1.7.13/po/fa.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/fa.po 2014-04-04 19:13:44.000000000 +0000 @@ -11304,6 +11304,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/fi.po wine1.7-1.7.16/po/fi.po --- wine1.7-1.7.13/po/fi.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/fi.po 2014-04-04 19:13:44.000000000 +0000 @@ -11647,6 +11647,90 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Vie rekisterin valitun haaran tekstitiedostoon" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Winen DLL-rekisteröintityökalu\n" +"\n" +"Tuottaa DLL-rekisteröintipalvelut.\n" +"\n" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Käyttö:\n" +" regsvr32 [/u] [/s] [/n] [/i[:komentorivi]] Dll-tiedostonNimi\n" +"\n" +"Valitsimet:\n" +" [/u] Pura palvelimen rekisteröinti.\n" +" [/s] Hiljainen tila (mitään viestejä ei näytetä).\n" +" [/i] Kutsu funktiota DllInstall, välitä valinnainen [komentorivi].\n" +"\tValitsimen [/u] kanssa kutsuu funktiota DllInstall poistotilassa.\n" +" [/n] Älä kutsu funktiota DllRegisterServer. Vaatii valitsimen [/i].\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: Virheellinen tai tuntematon valitsin [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' lataaminen epäonnistui\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1-toteutusta ei ole DLL:ssä '%2'\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' rekisteröinti epäonnistui\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: DLL '%1' rekisteröity\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' rekisteröinnin purkaminen epäonnistui\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' rekisteröinti purettu\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' asennus epäonnistui\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: DLL '%1' asennettu\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' asennuksen purku epäonnistui\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: DLL:n '%1' asennus purettu\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/fr.po wine1.7-1.7.16/po/fr.po --- wine1.7-1.7.13/po/fr.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/fr.po 2014-04-04 19:13:44.000000000 +0000 @@ -11803,6 +11803,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exporte la branche du registre sélectionnée dans un fichier texte" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Impossible d'ouvrir « %1 »\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/he.po wine1.7-1.7.16/po/he.po --- wine1.7-1.7.13/po/he.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/he.po 2014-04-04 19:13:44.000000000 +0000 @@ -11840,6 +11840,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "יצוא הענף הנבחר מרישום המערכת לקובץ טקסט" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Failed to open '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/hi.po wine1.7-1.7.16/po/hi.po --- wine1.7-1.7.13/po/hi.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/hi.po 2014-04-04 19:13:44.000000000 +0000 @@ -11118,6 +11118,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/hr.po wine1.7-1.7.16/po/hr.po --- wine1.7-1.7.13/po/hr.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/hr.po 2014-04-04 19:13:44.000000000 +0000 @@ -11327,6 +11327,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Neuspjelo otvaranje '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/hu.po wine1.7-1.7.16/po/hu.po --- wine1.7-1.7.13/po/hu.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/hu.po 2014-04-04 19:13:44.000000000 +0000 @@ -11771,6 +11771,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Az egész kijelölt regisztrációs ágat kiexportálja egy szövegfájlba" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "'%1' megnyitása sikertelen\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/it.po wine1.7-1.7.16/po/it.po --- wine1.7-1.7.13/po/it.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/it.po 2014-04-04 19:13:44.000000000 +0000 @@ -11852,6 +11852,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Esporta il ramo selezionato del registro in un file di testo" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Impossibile aprire '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/ja.po wine1.7-1.7.16/po/ja.po --- wine1.7-1.7.13/po/ja.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ja.po 2014-04-04 19:13:44.000000000 +0000 @@ -11661,6 +11661,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "選択したレジストリ キー以下をテキスト ファイルに出力" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "'%1' を開けません\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/ko.po wine1.7-1.7.16/po/ko.po --- wine1.7-1.7.13/po/ko.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ko.po 2014-04-04 19:13:44.000000000 +0000 @@ -11652,6 +11652,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "레지스트리의 선택된 부분을 텍스트 파일로 내보내기" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "'%1' 열기 실패\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/lt.po wine1.7-1.7.16/po/lt.po --- wine1.7-1.7.13/po/lt.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/lt.po 2014-04-04 19:13:44.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-02-10 22:51+0300\n" +"PO-Revision-Date: 2014-04-03 21:16+0300\n" "Last-Translator: Aurimas Fišeras \n" "Language-Team: komp_lt@konf.lt\n" "Language: Lithuanian\n" @@ -11673,6 +11673,90 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Eksportuoja pasirinktą registro šaką į tekstinį failą" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Wine DLL bibliotekų registravimo programa\n" +"\n" +"Teikia DLL bibliotekų registravimo paslaugą.\n" +"\n" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Naudojimas:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdeilutė]] DllVardas\n" +"\n" +"Parametrai:\n" +" [/u] Išregistruoti serverį.\n" +" [/s] Tyli veiksena (nebus rodomi pranešimai).\n" +" [/i] Kviesti „DllInstall“, perduodant nebūtiną [cmdeilutę].\n" +"\tKai naudojama su [/u], „DllInstall“ kviečiamas pašalinimo veiksenoje.\n" +" [/n] Nekviesti „DllRegisterServer“. Privalo būti naudojamas su [/i].\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: Netinkamas arba neatpažintas parametras [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: Nepavyko įkelti DLL bibliotekos „%1“\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1 neįgyvendinta DLL bibliotekoje „%2“\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: Nepavyko užregistruoti DLL bibliotekos „%1“\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: Sėkmingai užregistruota DLL biblioteka „%1“\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: Nepavyko išregistruoti DLL bibliotekos „%1“\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: Sėkmingai išregistruota DLL biblioteka „%1“\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: Nepavyko įdiegti DLL bibliotekos „%1“\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: Sėkmingai įdiegta DLL biblioteka „%1“\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: Nepavyko pašalinti DLL bibliotekos „%1“\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: Sėkmingai pašalinta DLL biblioteka „%1“\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/ml.po wine1.7-1.7.16/po/ml.po --- wine1.7-1.7.13/po/ml.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ml.po 2014-04-04 19:13:44.000000000 +0000 @@ -11118,6 +11118,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/nb_NO.po wine1.7-1.7.16/po/nb_NO.po --- wine1.7-1.7.13/po/nb_NO.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/nb_NO.po 2014-04-04 19:13:44.000000000 +0000 @@ -11670,6 +11670,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Eksporterer den valgte greinen av registeret til en tekstfil" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Klarte ikke åpne «%1»\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/nl.po wine1.7-1.7.16/po/nl.po --- wine1.7-1.7.13/po/nl.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/nl.po 2014-04-04 19:13:44.000000000 +0000 @@ -11818,6 +11818,76 @@ "Exporteert de geselecteerde subsleutel van het register naar een tekst " "bestand" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Openen van '%1' is mislukt\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/or.po wine1.7-1.7.16/po/or.po --- wine1.7-1.7.13/po/or.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/or.po 2014-04-04 19:13:44.000000000 +0000 @@ -11118,6 +11118,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/pa.po wine1.7-1.7.16/po/pa.po --- wine1.7-1.7.13/po/pa.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/pa.po 2014-04-04 19:13:44.000000000 +0000 @@ -11118,6 +11118,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/pl.po wine1.7-1.7.16/po/pl.po --- wine1.7-1.7.13/po/pl.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/pl.po 2014-04-04 19:13:44.000000000 +0000 @@ -11727,6 +11727,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Eksportuje zaznaczoną gałąź rejestru do pliku tekstowego" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Nieudane otwarcie '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/pt_BR.po wine1.7-1.7.16/po/pt_BR.po --- wine1.7-1.7.13/po/pt_BR.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/pt_BR.po 2014-04-04 19:13:44.000000000 +0000 @@ -6597,10 +6597,8 @@ msgstr "O nome de usuário não foi encontrado.\n" #: winerror.mc:3741 -#, fuzzy -#| msgid "The site does not exist.\n" msgid "This network connection does not exist.\n" -msgstr "O site não existe.\n" +msgstr "Esta conexão de rede não existe.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -11732,6 +11730,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exporta o ramo do registro selecionado para um arquivo de texto" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Falha ao abrir '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/pt_PT.po wine1.7-1.7.16/po/pt_PT.po --- wine1.7-1.7.13/po/pt_PT.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/pt_PT.po 2014-04-04 19:13:44.000000000 +0000 @@ -30,11 +30,6 @@ msgstr "&Instalar..." #: appwiz.rc:65 -#, fuzzy -#| msgid "" -#| "The following software can be automatically removed. To remove a program " -#| "or to modify its installed components, select it from the list and click " -#| "Change/Remove." msgid "" "The following software can be automatically removed. To remove a program or " "to modify its installed components, select it from the list and click Modify/" @@ -163,21 +158,10 @@ msgstr "Cancelar" #: appwiz.rc:115 -#, fuzzy -#| msgid "Wine Gecko Installer" msgid "Wine Mono Installer" -msgstr "Instalador Wine Gecko" +msgstr "Instalador Wine Mono" #: appwiz.rc:118 -#, fuzzy -#| msgid "" -#| "Wine could not find a Gecko package which is needed for applications " -#| "embedding HTML to work correctly. Wine can automatically download and " -#| "install it for you.\n" -#| "\n" -#| "Note: it is recommended to use your distribution's packages instead. See " -#| "http://wiki.winehq.org/Gecko " -#| "for details." msgid "" "Wine could not find a Mono package which is needed for .NET applications to " "work correctly. Wine can automatically download and install it for you.\n" @@ -186,13 +170,13 @@ "href=\"http://wiki.winehq.org/Mono\">http://wiki.winehq.org/Mono for " "details." msgstr "" -"O Wine não conseguiu encontrar o pacote Gecko que é necessário para " +"O Wine não conseguiu encontrar o pacote Mono que é necessário para " "aplicações com HTML embutido funcionarem corretamente. O Wine pode " "automaticamente efetuar o download e instalá-lo por si.\n" "\n" "Nota: é recomendável usar os pacotes da sua distribuição em vez disso. Veja " -"http://wiki.winehq.org/Gecko " -"para mais detalhes." +"http://wiki.winehq.org/Mono para " +"mais detalhes." #: appwiz.rc:31 msgid "Add/Remove Programs" @@ -2228,16 +2212,12 @@ "confiáveis:" #: cryptui.rc:299 -#, fuzzy -#| msgid "Cryptographic Message Syntax Standard/PKCS #7 Messages (.p7b)" msgid "Cryptographic Message Syntax Standard/PKCS #7 Messages (*.p7b)" -msgstr "Norma de Sintaxe de Mensagens Cifradas/PKCS #7 Mensagens (.p7b)" +msgstr "Norma de Sintaxe de Mensagens Cifradas/PKCS #7 Mensagens (*.p7b)" #: cryptui.rc:301 -#, fuzzy -#| msgid "Personal Information Exchange/PKCS #12 (.pfx, .p12)" msgid "Personal Information Exchange/PKCS #12 (*.pfx; *.p12)" -msgstr "Troca de Informações Pessoais/PKCS #12 (.pfx, .p12)" +msgstr "Troca de Informações Pessoais/PKCS #12 (*.pfx, *.p12)" #: cryptui.rc:303 cryptui.rc:81 cryptui.rc:162 msgid "Microsoft Serialized Certificate Store (*.sst)" @@ -2381,32 +2361,24 @@ msgstr "Seleccione o formato que deseja utilizar:" #: cryptui.rc:408 -#, fuzzy -#| msgid "&DER-encoded X.509 (.cer)" msgid "&DER-encoded X.509 (*.cer)" -msgstr "X.509 codificado em &DER (.cer)" +msgstr "X.509 codificado em &DER (*.cer)" #: cryptui.rc:410 -#, fuzzy -#| msgid "Ba&se64-encoded X.509 (.cer):" msgid "Ba&se64-encoded X.509 (*.cer):" -msgstr "X509 codificado em Base64 (.cer)" +msgstr "X509 codificado em Base64 (*.cer)" #: cryptui.rc:412 -#, fuzzy -#| msgid "&Cryptographic Message Syntax Standard/PKCS #7 Message (.p7b)" msgid "&Cryptographic Message Syntax Standard/PKCS #7 Message (*.p7b)" -msgstr "Norma de Sintaxe de Mensagens &Cifradas/PKCS #7 Message (.p7b)" +msgstr "Norma de Sintaxe de Mensagens &Cifradas/PKCS #7 Message (*.p7b)" #: cryptui.rc:414 msgid "&Include all certificates in the certification path if possible" msgstr "&Incluir todos os certificados no caminho de certificação se possível" #: cryptui.rc:416 -#, fuzzy -#| msgid "&Personal Information Exchange/PKCS #12 (.pfx)" msgid "&Personal Information Exchange/PKCS #12 (*.pfx)" -msgstr "Troca de Informações &Pessoais/PKCS #12 (.pfx)" +msgstr "Troca de Informações &Pessoais/PKCS #12 (*.pfx)" #: cryptui.rc:418 msgid "Incl&ude all certificates in the certification path if possible" @@ -3475,22 +3447,16 @@ msgstr "&Desactivar" #: joy.rc:40 -#, fuzzy -#| msgid "&enable" msgid "&Enable" -msgstr "&activar" +msgstr "&Activar" #: joy.rc:41 -#, fuzzy -#| msgid "Disconnected" msgid "Connected" -msgstr "Desligado" +msgstr "Conectado" #: joy.rc:43 -#, fuzzy -#| msgid "&Disable" msgid "Disabled" -msgstr "&Desactivar" +msgstr "Desactivado" #: joy.rc:45 msgid "" @@ -3511,10 +3477,8 @@ msgstr "" #: joy.rc:67 -#, fuzzy -#| msgid "Available formats" msgid "Available Effects" -msgstr "Formatos Disponíveis" +msgstr "Efeitos Disponíveis" #: joy.rc:69 msgid "" @@ -3577,10 +3541,8 @@ msgstr "')' esperado" #: jscript.rc:40 -#, fuzzy -#| msgid "Invalid parameter.\n" msgid "Invalid character" -msgstr "Parâmetro inválido.\n" +msgstr "Caractere inválido" #: jscript.rc:41 msgid "Unterminated string constant" @@ -3669,10 +3631,8 @@ msgstr "Valor de enumeração fora dos limites.\n" #: jscript.rc:62 -#, fuzzy -#| msgid "Subscript out of range" msgid "Precision is out of range" -msgstr "Subscripto fora de alcance" +msgstr "Precisão fora de alcance" #: jscript.rc:63 msgid "Array length must be a finite positive integer" @@ -4747,8 +4707,6 @@ msgstr "Sem tradução Unicode.\n" #: winerror.mc:1366 -#, fuzzy -#| msgid "DLL init failed.\n" msgid "DLL initialization failed.\n" msgstr "Arranque do DLL falhou.\n" @@ -6637,10 +6595,8 @@ msgstr "O nome de utilizador não foi encontrado.\n" #: winerror.mc:3741 -#, fuzzy -#| msgid "The site does not exist.\n" msgid "This network connection does not exist.\n" -msgstr "O sítio não existe.\n" +msgstr "Esta conexão de rede não existe.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -8326,19 +8282,15 @@ #, fuzzy #| msgid "Installation transform failed to apply.\n" msgid "Installation of component failed: %08x" -msgstr "Falha na aplicação da operaçao de instalação.\n" +msgstr "Instalação do componente falhou: %08x" #: urlmon.rc:52 -#, fuzzy -#| msgid "&Install" msgid "Install (%d)" -msgstr "&Instalar" +msgstr "Instalar (%d)" #: urlmon.rc:53 -#, fuzzy -#| msgid "&Install" msgid "Install" -msgstr "&Instalar" +msgstr "Instalar" #: user32.rc:30 user32.rc:43 taskmgr.rc:138 msgctxt "window" @@ -11785,6 +11737,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exporta o ramo seleccionado do registo para um ficheiro de texto" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Falhou ao abrir '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/rm.po wine1.7-1.7.16/po/rm.po --- wine1.7-1.7.13/po/rm.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/rm.po 2014-04-04 19:13:44.000000000 +0000 @@ -11200,6 +11200,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/ro.po wine1.7-1.7.16/po/ro.po --- wine1.7-1.7.13/po/ro.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ro.po 2014-04-04 19:13:44.000000000 +0000 @@ -11859,6 +11859,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exportă ramura de registru selectată ca fișier text" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Deschiderea „%1” a eșuat\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/ru.po wine1.7-1.7.16/po/ru.po --- wine1.7-1.7.13/po/ru.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/ru.po 2014-04-04 19:13:44.000000000 +0000 @@ -6591,10 +6591,8 @@ msgstr "Имя пользователя не найдено.\n" #: winerror.mc:3741 -#, fuzzy -#| msgid "The site does not exist.\n" msgid "This network connection does not exist.\n" -msgstr "Указанный сайт не существует.\n" +msgstr "Указанное сетевое соединение не существует.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -11675,6 +11673,90 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Экспортирует выделенную ветку реестра в текстовый файл" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Утилита регистрации DLL в Wine\n" +"\n" +"Используется для регистрации DLL.\n" +"\n" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Использование:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] имя_dll\n" +"\n" +"Параметры:\n" +" [/u] Разрегистрировать сервер.\n" +" [/s] Тихий режим (сообщения не выводятся).\n" +" [/i] Вызвать DllInstall с дополнительными параметрами [cmdline].\n" +"\tПри использовании с [/u] DllInstall будет вызвана в режиме удаления.\n" +" [/n] Не вызывать DllRegisterServer. Используется с [/i].\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: неверный или неизвестный параметр [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: не удалось загрузить DLL «%1»\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1 не реализован в DLL «%2»\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: не удалось зарегистрировать «%1»\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: DLL «%1» успешно зарегистрирована\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: не удалось разрегистрировать DLL «%1»\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: DLL «%1» успешно разрегистрирована\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: не удалось установить DLL «%1»\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: DLL «%1» успешно установлена\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: не удалось удалить DLL «%1»\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: DLL «%1» успешно удалена\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/sk.po wine1.7-1.7.16/po/sk.po --- wine1.7-1.7.13/po/sk.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/sk.po 2014-04-04 19:13:44.000000000 +0000 @@ -11316,6 +11316,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/sl.po wine1.7-1.7.16/po/sl.po --- wine1.7-1.7.13/po/sl.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/sl.po 2014-04-04 19:13:44.000000000 +0000 @@ -11793,6 +11793,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Izvozi izbrano vejo registra v besedilno datoteko" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Odpiranje '%1' je spodletelo\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/sr_RS@cyrillic.po wine1.7-1.7.16/po/sr_RS@cyrillic.po --- wine1.7-1.7.13/po/sr_RS@cyrillic.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/sr_RS@cyrillic.po 2014-04-04 19:13:44.000000000 +0000 @@ -11733,6 +11733,75 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Отварање „%s“ датотеке није успело\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/sr_RS@latin.po wine1.7-1.7.16/po/sr_RS@latin.po --- wine1.7-1.7.13/po/sr_RS@latin.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/sr_RS@latin.po 2014-04-04 19:13:44.000000000 +0000 @@ -11879,6 +11879,75 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Otvaranje „%s“ datoteke nije uspelo\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/sv.po wine1.7-1.7.16/po/sv.po --- wine1.7-1.7.13/po/sv.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/sv.po 2014-04-04 19:13:44.000000000 +0000 @@ -11562,6 +11562,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Exporterar vald gren av registret till en textfil" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "Misslyckades med att öppna '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/te.po wine1.7-1.7.16/po/te.po --- wine1.7-1.7.13/po/te.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/te.po 2014-04-04 19:13:44.000000000 +0000 @@ -11118,6 +11118,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/th.po wine1.7-1.7.16/po/th.po --- wine1.7-1.7.13/po/th.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/th.po 2014-04-04 19:13:44.000000000 +0000 @@ -11334,6 +11334,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/tr.po wine1.7-1.7.16/po/tr.po --- wine1.7-1.7.13/po/tr.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/tr.po 2014-04-04 19:13:44.000000000 +0000 @@ -11623,6 +11623,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Sistem kaydının seçilen kısmını dosyasına aktarır" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "'%1' açılamadı\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/uk.po wine1.7-1.7.16/po/uk.po --- wine1.7-1.7.13/po/uk.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/uk.po 2014-04-04 19:13:44.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-01-17 12:58+0300\n" +"PO-Revision-Date: 2014-04-02 17:53+0300\n" "Last-Translator: Andrey Gusev \n" "Language-Team: none\n" "Language: Ukrainian\n" @@ -2204,8 +2204,6 @@ "списку анульованих сертифікатів, чи списку довірених сертифікатів:" #: cryptui.rc:299 -#, fuzzy -#| msgid "CMS/PKCS #7 Messages (*.p7b)" msgid "Cryptographic Message Syntax Standard/PKCS #7 Messages (*.p7b)" msgstr "Повідомлення CMS/PKCS #7 (*.p7b)" @@ -2356,15 +2354,13 @@ #: cryptui.rc:408 msgid "&DER-encoded X.509 (*.cer)" -msgstr "" +msgstr "X.509 в кодуванні &DER (*.cer)" #: cryptui.rc:410 msgid "Ba&se64-encoded X.509 (*.cer):" -msgstr "" +msgstr "X.509 в кодуванні Ba&se64 (*.cer):" #: cryptui.rc:412 -#, fuzzy -#| msgid "CMS/PKCS #7 Messages (*.p7b)" msgid "&Cryptographic Message Syntax Standard/PKCS #7 Message (*.p7b)" msgstr "Повідомлення CMS/PKCS #7 (*.p7b)" @@ -4865,7 +4861,7 @@ #: winerror.mc:1571 msgid "No match found.\n" -msgstr "Немає співпадіння.\n" +msgstr "Відповідностей не знайдено.\n" #: winerror.mc:1576 msgid "Property set not found.\n" @@ -6588,10 +6584,8 @@ msgstr "Ім'я користувача не знайдено.\n" #: winerror.mc:3741 -#, fuzzy -#| msgid "The site does not exist.\n" msgid "This network connection does not exist.\n" -msgstr "Сайт не існує.\n" +msgstr "Цього мережевого з'єднання не існує.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -6824,7 +6818,7 @@ #: msi.rc:60 msgid "enter which folder contains %s" -msgstr "вкажіть папку, що містить %s" +msgstr "вкажіть теку, що містить %s" #: msi.rc:61 msgid "install source for feature missing" @@ -6840,7 +6834,7 @@ #: msi.rc:64 msgid "choose which folder contains %s" -msgstr "виберіть папку, що містить %s" +msgstr "виберіть теку, що містить %s" #: msrle32.rc:31 msgid "Wine MS-RLE video codec" @@ -11707,6 +11701,90 @@ msgid "Exports selected branch of the registry to a text file" msgstr "Експортує вибрану гілку реєстру до текстового файлу" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" +"Утиліта реєстрації DLL у Wine\n" +"\n" +"Слугує сервісом для реєстрації DLL\n" +"\n" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" +"Використання:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Опції:\n" +" [/u] Скасувати реєстрацію сервера.\n" +" [/s] Тихий режим (повідомлення не відображатимуться).\n" +" [/i] Виклик DllInstall з додатковими параметрами [cmdline].\n" +"\tПри використанні з [/u] DllInstall буде викликана в режимі видалення.\n" +" [/n] Не викликати DllRegisterServer. Має використовуватися з [/i].\n" +"\n" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" +"regsvr32: Невірний або нерозпізнаний параметр [%1]\n" +"\n" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "regsvr32: Не вдалося завантажити DLL '%1'\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "regsvr32: %1 не реалізовано у DLL '%2'\n" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "regsvr32: Не вдалося зареєструвати DLL '%1'\n" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "regsvr32: DLL '%1' успішно зареєстрована\n" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "regsvr32: Не вдалося скасувати реєстрацію DLL '%1'\n" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "regsvr32: Реєстрація для DLL '%1' успішно скасована\n" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "regsvr32: Не вдалося встановити DLL '%1'\n" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "regsvr32: DLL '%1' успішно встановлена\n" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "regsvr32: Не вдалося видалити DLL '%1'\n" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "regsvr32: DLL '%1' успішно видалена\n" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/wa.po wine1.7-1.7.16/po/wa.po --- wine1.7-1.7.13/po/wa.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/wa.po 2014-04-04 19:13:44.000000000 +0000 @@ -11248,6 +11248,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/wine.pot wine1.7-1.7.16/po/wine.pot --- wine1.7-1.7.13/po/wine.pot 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/wine.pot 2014-04-04 19:13:44.000000000 +0000 @@ -11057,6 +11057,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/zh_CN.po wine1.7-1.7.16/po/zh_CN.po --- wine1.7-1.7.13/po/zh_CN.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/zh_CN.po 2014-04-04 19:13:44.000000000 +0000 @@ -11169,6 +11169,74 @@ msgid "Exports selected branch of the registry to a text file" msgstr "把选定的注册表分支导出为文本文件" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/po/zh_TW.po wine1.7-1.7.16/po/zh_TW.po --- wine1.7-1.7.13/po/zh_TW.po 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/po/zh_TW.po 2014-04-04 19:13:44.000000000 +0000 @@ -11537,6 +11537,76 @@ msgid "Exports selected branch of the registry to a text file" msgstr "匯出註冊表的所選分支到文字檔" +#: regsvr32.rc:32 +msgid "" +"Wine DLL Registration Utility\n" +"\n" +"Provides DLL registration services.\n" +"\n" +msgstr "" + +#: regsvr32.rc:40 +msgid "" +"Usage:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n" +"\n" +"Options:\n" +" [/u] Unregister a server.\n" +" [/s] Silent mode (no messages will be displayed).\n" +" [/i] Call DllInstall, passing an optional [cmdline].\n" +"\tWhen used with [/u] DllInstall is called in uninstall mode.\n" +" [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" +"\n" +msgstr "" + +#: regsvr32.rc:41 +msgid "" +"regsvr32: Invalid or unrecognized switch [%1]\n" +"\n" +msgstr "" + +#: regsvr32.rc:42 +#, fuzzy +#| msgid "Failed to open '%1'\n" +msgid "regsvr32: Failed to load DLL '%1'\n" +msgstr "開啟 %1 失敗\n" + +#: regsvr32.rc:43 +msgid "regsvr32: %1 not implemented in DLL '%2'\n" +msgstr "" + +#: regsvr32.rc:44 +msgid "regsvr32: Failed to register DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:45 +msgid "regsvr32: Successfully registered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:46 +msgid "regsvr32: Failed to unregister DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:47 +msgid "regsvr32: Successfully unregistered DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:48 +msgid "regsvr32: Failed to install DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:49 +msgid "regsvr32: Successfully installed DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:50 +msgid "regsvr32: Failed to uninstall DLL '%1'\n" +msgstr "" + +#: regsvr32.rc:51 +msgid "regsvr32: Successfully uninstalled DLL '%1'\n" +msgstr "" + #: start.rc:55 msgid "" "Application could not be started, or no application associated with the " diff -Nru wine1.7-1.7.13/programs/cmd/tests/batch.c wine1.7-1.7.16/programs/cmd/tests/batch.c --- wine1.7-1.7.13/programs/cmd/tests/batch.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/cmd/tests/batch.c 2014-04-04 19:13:44.000000000 +0000 @@ -459,8 +459,14 @@ drive[0] = workdir[0]; drive[1] = workdir[1]; /* Should be ':' */ memcpy(path, workdir + drive_len, (workdir_len - drive_len) * sizeof(drive[0])); - path[workdir_len - drive_len] = '\\'; - path_len = workdir_len - drive_len + 1; + + /* Only add trailing backslash to 'path' for non-root directory */ + if (workdir_len - drive_len > 1) { + path[workdir_len - drive_len] = '\\'; + path_len = workdir_len - drive_len + 1; + } else { + path_len = 1; /* \ */ + } shortpath_len = GetShortPathNameA(path, shortpath, sizeof(shortpath)/sizeof(shortpath[0])); diff -Nru wine1.7-1.7.13/programs/cmd/tests/test_builtins.cmd wine1.7-1.7.16/programs/cmd/tests/test_builtins.cmd --- wine1.7-1.7.13/programs/cmd/tests/test_builtins.cmd 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/cmd/tests/test_builtins.cmd 2014-04-04 19:13:44.000000000 +0000 @@ -308,6 +308,13 @@ echo ------------ Testing variable expansion ------------ call :setError 0 +echo ~p0 should be path containing batch file +echo %~p0 +mkdir dummydir +cd dummydir +echo %~p0 +cd .. +rmdir dummydir echo ~dp0 should be directory containing batch file echo %~dp0 mkdir dummydir diff -Nru wine1.7-1.7.13/programs/cmd/tests/test_builtins.cmd.exp wine1.7-1.7.16/programs/cmd/tests/test_builtins.cmd.exp --- wine1.7-1.7.13/programs/cmd/tests/test_builtins.cmd.exp 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/cmd/tests/test_builtins.cmd.exp 2014-04-04 19:13:44.000000000 +0000 @@ -259,9 +259,12 @@ 'jim' 'apple"banana"grape' ------------ Testing variable expansion ------------ +~p0 should be path containing batch file +@path@ +@path@ ~dp0 should be directory containing batch file -@pwd@\ -@pwd@\ +@drive@@path@ +@drive@@path@ CD value @pwd@@or_broken@CD value@space@ % P @@ -296,8 +299,8 @@ C 'A B'@or_broken@'' 'C'@or_broken@'' -@pwd@\C D@or_broken@%~ff -@pwd@\E@or_broken@%~ff +@drive@@path@C D@or_broken@%~ff +@drive@@path@E@or_broken@%~ff @drive@ @drive@ @path@@or_broken@%~pd @@ -332,8 +335,8 @@ C 'A B'@or_broken@'' 'C'@or_broken@'' -@pwd@\C D -@pwd@\E +@drive@@path@C D +@drive@@path@E @drive@ @drive@ @path@ @@ -389,22 +392,22 @@ foo6@space@ @todo_wine@------------ Testing cd ------------ singleFile -Current dir: @pwd@\foobar@or_broken@Current dir:@space@ -@pwd@\foobar +Current dir: @drive@@path@foobar@or_broken@Current dir:@space@ +@drive@@path@foobar @pwd@ -@pwd@\foobar +@drive@@path@foobar @pwd@ -@pwd@\foobar +@drive@@path@foobar @pwd@ @pwd@ @pwd@ -@pwd@\foobar\bar bak -@pwd@\foobar\bar bak -@pwd@\foobar\bar bak -@pwd@\foobar\bar bak -@pwd@\foobar\bar bak +@drive@@path@foobar\bar bak +@drive@@path@foobar\bar bak +@drive@@path@foobar\bar bak +@drive@@path@foobar\bar bak +@drive@@path@foobar\bar bak @pwd@ -@pwd@\foobar +@drive@@path@foobar ------------ Testing type ------------ @pwd@>type foobaz@space@ @@ -1087,31 +1090,31 @@ --- pushing non-existing dir @pwd@ --- basic behaviour -@pwd@\foobar +@drive@@path@foobar @pwd@ -@pwd@\foobar\baz -@pwd@\foobar -@pwd@\foobar +@drive@@path@foobar\baz +@drive@@path@foobar +@drive@@path@foobar @pwd@ -@pwd@\foobar +@drive@@path@foobar @pwd@ ------------ Testing attrib ------------ -A @pwd@\foobar\foo@or_broken@A @pwd@\foobar\foo@or_broken@A I @pwd@\foobar\foo +A @drive@@path@foobar\foo@or_broken@A @drive@@path@foobar\foo@or_broken@A I @drive@@path@foobar\foo --- read-only attribute -A R @pwd@\foobar\foo@or_broken@A R @pwd@\foobar\foo@or_broken@A R I @pwd@\foobar\foo +A R @drive@@path@foobar\foo@or_broken@A R @drive@@path@foobar\foo@or_broken@A R I @drive@@path@foobar\foo foo foo original contents Read-only file not deleted Read-only file forcibly deleted --- recursive behaviour -A @pwd@\foobar\baz\level2@or_broken@A @pwd@\foobar\baz\level2@or_broken@A I @pwd@\foobar\baz\level2 -A R @pwd@\foobar\level1@or_broken@A R @pwd@\foobar\level1@or_broken@A R I @pwd@\foobar\level1 -A R @pwd@\foobar\baz\level2@or_broken@A R @pwd@\foobar\baz\level2@or_broken@A R I @pwd@\foobar\baz\level2 -A @pwd@\foobar\bar@or_broken@A @pwd@\foobar\bar@or_broken@A I @pwd@\foobar\bar +A @drive@@path@foobar\baz\level2@or_broken@A @drive@@path@foobar\baz\level2@or_broken@A I @drive@@path@foobar\baz\level2 +A R @drive@@path@foobar\level1@or_broken@A R @drive@@path@foobar\level1@or_broken@A R I @drive@@path@foobar\level1 +A R @drive@@path@foobar\baz\level2@or_broken@A R @drive@@path@foobar\baz\level2@or_broken@A R I @drive@@path@foobar\baz\level2 +A @drive@@path@foobar\bar@or_broken@A @drive@@path@foobar\bar@or_broken@A I @drive@@path@foobar\bar --- folders processing - @pwd@\foobar@or_broken@ @pwd@\foobar@or_broken@ I @pwd@\foobar -@todo_wine@ R @pwd@\foobar\baz@or_broken@ R @pwd@\foobar\baz@or_broken@ @pwd@\foobar\baz@or_broken@ R I @pwd@\foobar\baz -A @pwd@\foobar\baz\toto@or_broken@A @pwd@\foobar\baz\toto@or_broken@A I @pwd@\foobar\baz\toto + @drive@@path@foobar@or_broken@ @drive@@path@foobar@or_broken@ I @drive@@path@foobar +@todo_wine@ R @drive@@path@foobar\baz@or_broken@ R @drive@@path@foobar\baz@or_broken@ @drive@@path@foobar\baz@or_broken@ R I @drive@@path@foobar\baz +A @drive@@path@foobar\baz\toto@or_broken@A @drive@@path@foobar\baz\toto@or_broken@A I @drive@@path@foobar\baz\toto toto lulu file created in read-only dir @@ -1248,17 +1251,17 @@ --- setlocal with corresponding endlocal globalval localval -@pwd@\foobar\foobar2 +@drive@@path@foobar\foobar2 globalval -@pwd@\foobar +@drive@@path@foobar globalval -@pwd@\foobar +@drive@@path@foobar --- setlocal with no corresponding endlocal globalval localval -@pwd@\foobar\foobar2 +@drive@@path@foobar\foobar2 globalval -@pwd@\foobar +@drive@@path@foobar --- setlocal within same batch program Var1 ok 1 Var2 ok 2 @@ -1276,23 +1279,23 @@ --- Extra setlocal in called batch value2 2set1endvalue1 -@pwd@\foobar\foodir3 +@drive@@path@foobar\foodir3 Finished: value2 -@pwd@\foobar\foodir2 +@drive@@path@foobar\foodir2 value1 -@pwd@\foobar +@drive@@path@foobar --- Extra endlocal in called batch value2 value2 -@pwd@\foobar\foodir2 +@drive@@path@foobar\foodir2 value2 -@pwd@\foobar\foodir2 +@drive@@path@foobar\foodir2 Finished: value2 -@pwd@\foobar\foodir2 +@drive@@path@foobar\foodir2 value1 -@pwd@\foobar +@drive@@path@foobar --- endlocal in called function rather than batch pgm is ineffective 2 2 diff -Nru wine1.7-1.7.13/programs/notepad/main.c wine1.7-1.7.16/programs/notepad/main.c --- wine1.7-1.7.13/programs/notepad/main.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/notepad/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -616,8 +616,8 @@ static void HandleCommandLine(LPWSTR cmdline) { WCHAR delimiter; - int opt_print=0; - + BOOL opt_print = FALSE; + /* skip white space */ while (*cmdline == ' ') cmdline++; @@ -644,7 +644,7 @@ { case 'p': case 'P': - opt_print=1; + opt_print = TRUE; break; } } diff -Nru wine1.7-1.7.13/programs/oleview/details.c wine1.7-1.7.16/programs/oleview/details.c --- wine1.7-1.7.13/programs/oleview/details.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/oleview/details.c 2014-04-04 19:13:44.000000000 +0000 @@ -158,7 +158,7 @@ RegCloseKey(hCurKey); - memmove(&wszData[6], wszData, sizeof(WCHAR[lenData])); + memmove(&wszData[6], wszData, lenData * sizeof(WCHAR)); memcpy(wszData, wszCLSID, sizeof(WCHAR[6])); wszData[5] = '\\'; @@ -187,7 +187,7 @@ RegCloseKey(hCurKey); - memmove(&wszData[8], wszData, sizeof(WCHAR[lenData])); + memmove(&wszData[8], wszData, lenData * sizeof(WCHAR)); memcpy(wszData, wszTypeLib, sizeof(WCHAR[8])); wszData[7] = '\\'; RegOpenKeyW(HKEY_CLASSES_ROOT, wszData, &hCurKey); @@ -238,9 +238,9 @@ if(RegQueryValueW(hKey, NULL, wszTree, (LONG *)&lenTree) == ERROR_SUCCESS) { memmove(&wszTree[lenBuffer-lastLenBuffer+3], wszTree, - sizeof(WCHAR[lenTree])); + lenTree * sizeof(WCHAR)); memcpy(wszTree, &buffer[lastLenBuffer], - sizeof(WCHAR[lenBuffer-lastLenBuffer])); + (lenBuffer - lastLenBuffer) * sizeof(WCHAR)); if(lenTree == 1) wszTree[lenBuffer-lastLenBuffer] = '\0'; else diff -Nru wine1.7-1.7.13/programs/oleview/tree.c wine1.7-1.7.16/programs/oleview/tree.c --- wine1.7-1.7.13/programs/oleview/tree.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/oleview/tree.c 2014-04-04 19:13:44.000000000 +0000 @@ -225,7 +225,7 @@ int bufLen; BOOL ret; - memset(buffer, 0, sizeof(WCHAR[bufSize])); + memset(buffer, 0, bufSize * sizeof(WCHAR)); memset(&tvi, 0, sizeof(TVITEMW)); tvi.hItem = item; @@ -239,8 +239,8 @@ if(tvi.lParam && (((ITEM_INFO *)tvi.lParam)->cFlag & (REGPATH|REGTOP))) { bufLen = lstrlenW(((ITEM_INFO *)tvi.lParam)->info); - memmove(&buffer[bufLen], buffer, sizeof(WCHAR[bufSize-bufLen])); - memcpy(buffer, ((ITEM_INFO *)tvi.lParam)->info, sizeof(WCHAR[bufLen])); + memmove(&buffer[bufLen], buffer, (bufSize - bufLen) * sizeof(WCHAR)); + memcpy(buffer, ((ITEM_INFO *)tvi.lParam)->info, bufLen * sizeof(WCHAR)); } if(tvi.lParam && ((ITEM_INFO *)tvi.lParam)->cFlag & REGTOP) break; diff -Nru wine1.7-1.7.13/programs/regsvr32/Makefile.in wine1.7-1.7.16/programs/regsvr32/Makefile.in --- wine1.7-1.7.13/programs/regsvr32/Makefile.in 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/regsvr32/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -1,6 +1,6 @@ MODULE = regsvr32.exe APPMODE = -mconsole -IMPORTS = ole32 +IMPORTS = ole32 user32 C_SRCS = \ regsvr32.c diff -Nru wine1.7-1.7.13/programs/regsvr32/regsvr32.c wine1.7-1.7.16/programs/regsvr32/regsvr32.c --- wine1.7-1.7.13/programs/regsvr32/regsvr32.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/regsvr32/regsvr32.c 2014-04-04 19:13:44.000000000 +0000 @@ -51,10 +51,13 @@ #include "config.h" #include "wine/port.h" -#include #include #include #include +#include "regsvr32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(regsvr32); typedef HRESULT (*DLLREGISTER) (void); typedef HRESULT (*DLLUNREGISTER) (void); @@ -62,16 +65,38 @@ static BOOL Silent = FALSE; -static int Usage(void) +static void __cdecl output_write(UINT id, ...) { - printf("regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname ...\n"); - printf("\t[/u] unregister server\n"); - printf("\t[/s] silent (no message boxes)\n"); - printf("\t[/i] Call DllInstall passing it an optional [cmdline];\n"); - printf("\t when used with /u calls dll uninstall\n"); - printf("\t[/n] Do not call DllRegisterServer; this option " - "must be used with [/i]\n"); - return 0; + char fmt[1024]; + __ms_va_list va_args; + char *str; + DWORD len, nOut, ret; + + if (Silent) return; + + if (!LoadStringA(GetModuleHandleA(NULL), id, fmt, sizeof(fmt)/sizeof(fmt[0]))) + { + WINE_FIXME("LoadString failed with %d\n", GetLastError()); + return; + } + + __ms_va_start(va_args, id); + SetLastError(NO_ERROR); + len = FormatMessageA(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER, + fmt, 0, 0, (LPSTR)&str, 0, &va_args); + __ms_va_end(va_args); + if (len == 0 && GetLastError() != NO_ERROR) + { + WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_a(fmt)); + return; + } + + ret = WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), str, len, &nOut, NULL); + + if (!ret) + WINE_WARN("regsvr32: WriteConsoleA() failed.\n"); + + LocalFree(str); } /** @@ -89,16 +114,13 @@ *DllHandle = LoadLibraryExA(strDll, 0, LOAD_WITH_ALTERED_SEARCH_PATH); if(!*DllHandle) { - if(!Silent) - printf("Failed to load DLL %s\n", strDll); - + output_write(STRING_DLL_LOAD_FAILED, strDll); ExitProcess(1); } proc = (VOID *) GetProcAddress(*DllHandle, procName); if(!proc) { - if(!Silent) - printf("%s not implemented in DLL %s\n", procName, strDll); + output_write(STRING_PROC_NOT_IMPLEMENTED, procName, strDll); FreeLibrary(*DllHandle); return NULL; } @@ -118,13 +140,10 @@ hr = pfRegister(); if(FAILED(hr)) { - if(!Silent) - printf("Failed to register DLL %s\n", strDll); - + output_write(STRING_REGISTER_FAILED, strDll); return -1; } - if(!Silent) - printf("Successfully registered DLL %s\n", strDll); + output_write(STRING_REGISTER_SUCCESSFUL, strDll); if(DllHandle) FreeLibrary(DllHandle); @@ -144,13 +163,10 @@ hr = pfUnregister(); if(FAILED(hr)) { - if(!Silent) - printf("Failed to unregister DLL %s\n", strDll); - + output_write(STRING_UNREGISTER_FAILED, strDll); return -1; } - if(!Silent) - printf("Successfully unregistered DLL %s\n", strDll); + output_write(STRING_UNREGISTER_SUCCESSFUL, strDll); if(DllHandle) FreeLibrary(DllHandle); @@ -170,14 +186,16 @@ hr = pfInstall(install, command_line); if(FAILED(hr)) { - if(!Silent) - printf("Failed to %s DLL %s\n", install ? "install" : "uninstall", - strDll); + if (install) + output_write(STRING_INSTALL_FAILED, strDll); + else + output_write(STRING_UNINSTALL_FAILED, strDll); return -1; } - if(!Silent) - printf("Successfully %s DLL %s\n", install ? "installed" : "uninstalled", - strDll); + if (install) + output_write(STRING_INSTALL_SUCCESSFUL, strDll); + else + output_write(STRING_UNINSTALL_SUCCESSFUL, strDll); if(DllHandle) FreeLibrary(DllHandle); @@ -197,7 +215,7 @@ OleInitialize(NULL); /* Strictly, the Microsoft version processes all the flags before - * the files (e.g. regsvr32 file1 /s file2 is silent even for file1. + * the files (e.g. regsvr32 file1 /s file2 is silent even for file1). * For ease, we will not replicate that and will process the arguments * in order. */ @@ -254,7 +272,11 @@ else if((!strcasecmp(argv[i], "/c"))||(!strcasecmp(argv[i], "-c"))) /* console output */; else if (argv[i][0] == '/' && (!argv[i][2] || argv[i][2] == ':')) - printf("Unrecognized switch %s\n", argv[i]); + { + output_write(STRING_UNRECOGNIZED_SWITCH, argv[i]); + output_write(STRING_USAGE); + return 1; + } else { char *DllName = argv[i]; @@ -285,10 +307,9 @@ if (!DllFound) { - if(!Silent) - return Usage(); - else - return -1; + output_write(STRING_HEADER); + output_write(STRING_USAGE); + return 1; } OleUninitialize(); diff -Nru wine1.7-1.7.13/programs/regsvr32/regsvr32.h wine1.7-1.7.16/programs/regsvr32/regsvr32.h --- wine1.7-1.7.13/programs/regsvr32/regsvr32.h 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/programs/regsvr32/regsvr32.h 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,34 @@ +/* + * Regsvr32 definitions + * + * Copyright 2014 Hugh McMaster + * + * 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 + */ + +/* Resource strings */ +#define STRING_HEADER 1000 +#define STRING_USAGE 1001 +#define STRING_UNRECOGNIZED_SWITCH 1002 +#define STRING_DLL_LOAD_FAILED 1003 +#define STRING_PROC_NOT_IMPLEMENTED 1004 +#define STRING_REGISTER_FAILED 1005 +#define STRING_REGISTER_SUCCESSFUL 1006 +#define STRING_UNREGISTER_FAILED 1007 +#define STRING_UNREGISTER_SUCCESSFUL 1008 +#define STRING_INSTALL_FAILED 1009 +#define STRING_INSTALL_SUCCESSFUL 1010 +#define STRING_UNINSTALL_FAILED 1011 +#define STRING_UNINSTALL_SUCCESSFUL 1012 diff -Nru wine1.7-1.7.13/programs/regsvr32/regsvr32.rc wine1.7-1.7.16/programs/regsvr32/regsvr32.rc --- wine1.7-1.7.13/programs/regsvr32/regsvr32.rc 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/regsvr32/regsvr32.rc 2014-04-04 19:13:44.000000000 +0000 @@ -1,6 +1,7 @@ -/* Language neutral resources. +/* Regsvr32 resource strings * * Copyright 2003 Stefan Leichter + * Copyright 2014 Hugh McMaster * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,8 +18,40 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include +#include "regsvr32.h" + +#pragma makedep po + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +STRINGTABLE +{ + STRING_HEADER, "Wine DLL Registration Utility\n\n\ +Provides DLL registration services.\n\n" + STRING_USAGE, "Usage:\n\ +\ regsvr32 [/u] [/s] [/n] [/i[:cmdline]] DllName\n\n\ +Options:\n\ +\ [/u] Unregister a server.\n\ +\ [/s] Silent mode (no messages will be displayed).\n\ +\ [/i] Call DllInstall, passing an optional [cmdline].\n\ +\tWhen used with [/u] DllInstall is called in uninstall mode.\n\ +\ [/n] Do not call DllRegisterServer. This option must be used with [/i].\n\n" + STRING_UNRECOGNIZED_SWITCH, "regsvr32: Invalid or unrecognized switch [%1]\n\n" + STRING_DLL_LOAD_FAILED, "regsvr32: Failed to load DLL '%1'\n" + STRING_PROC_NOT_IMPLEMENTED, "regsvr32: %1 not implemented in DLL '%2'\n" + STRING_REGISTER_FAILED, "regsvr32: Failed to register DLL '%1'\n" + STRING_REGISTER_SUCCESSFUL, "regsvr32: Successfully registered DLL '%1'\n" + STRING_UNREGISTER_FAILED, "regsvr32: Failed to unregister DLL '%1'\n" + STRING_UNREGISTER_SUCCESSFUL, "regsvr32: Successfully unregistered DLL '%1'\n" + STRING_INSTALL_FAILED, "regsvr32: Failed to install DLL '%1'\n" + STRING_INSTALL_SUCCESSFUL, "regsvr32: Successfully installed DLL '%1'\n" + STRING_UNINSTALL_FAILED, "regsvr32: Failed to uninstall DLL '%1'\n" + STRING_UNINSTALL_SUCCESSFUL, "regsvr32: Successfully uninstalled DLL '%1'\n" +} + #define WINE_FILEDESCRIPTION_STR "Wine Register Server" -#define WINE_FILENAME_STR "REGSVR32" +#define WINE_FILENAME_STR "REGSVR32.EXE" #define WINE_FILETYPE VFT_APP #define WINE_FILEVERSION 5,0,1586,1 #define WINE_FILEVERSION_STR "5.0.1586.1" diff -Nru wine1.7-1.7.13/programs/start/start.c wine1.7-1.7.16/programs/start/start.c --- wine1.7-1.7.13/programs/start/start.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/start/start.c 2014-04-04 19:13:44.000000000 +0000 @@ -181,8 +181,8 @@ DWORD creation_flags; WCHAR *args = NULL; int i; - int unix_mode = 0; - int progid_open = 0; + BOOL unix_mode = FALSE; + BOOL progid_open = FALSE; WCHAR *title = NULL; WCHAR *dos_filename = NULL; WCHAR *parent_directory = NULL; @@ -313,10 +313,10 @@ /* Wine extensions */ else if (is_option(argv[i], unixW)) { - unix_mode = 1; + unix_mode = TRUE; } else if (is_option(argv[i], progIDOpenW)) { - progid_open = 1; + progid_open = TRUE; } else { diff -Nru wine1.7-1.7.13/programs/taskkill/taskkill.c wine1.7-1.7.16/programs/taskkill/taskkill.c --- wine1.7-1.7.13/programs/taskkill/taskkill.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/taskkill/taskkill.c 2014-04-04 19:13:44.000000000 +0000 @@ -472,7 +472,7 @@ for (i = 1; i < argc; i++) { - int got_im = 0, got_pid = 0; + BOOL got_im = FALSE, got_pid = FALSE; argdata = argv[i]; if (*argdata != '/' && *argdata != '-') diff -Nru wine1.7-1.7.13/programs/wevtutil/main.c wine1.7-1.7.16/programs/wevtutil/main.c --- wine1.7-1.7.13/programs/wevtutil/main.c 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/programs/wevtutil/main.c 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,33 @@ +/* + * Copyright 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 + * 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 "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wevtutil); + +int wmain(int argc, WCHAR *argv[]) +{ + int i; + + WINE_FIXME("stub:"); + for (i = 0; i < argc; i++) + WINE_FIXME(" %s", wine_dbgstr_w(argv[i])); + WINE_FIXME("\n"); + + return 0; +} diff -Nru wine1.7-1.7.13/programs/wevtutil/Makefile.in wine1.7-1.7.16/programs/wevtutil/Makefile.in --- wine1.7-1.7.13/programs/wevtutil/Makefile.in 1970-01-01 00:00:00.000000000 +0000 +++ wine1.7-1.7.16/programs/wevtutil/Makefile.in 2014-04-04 19:13:44.000000000 +0000 @@ -0,0 +1,5 @@ +MODULE = wevtutil.exe +APPMODE = -mconsole -municode + +C_SRCS = \ + main.c diff -Nru wine1.7-1.7.13/programs/winemenubuilder/winemenubuilder.c wine1.7-1.7.16/programs/winemenubuilder/winemenubuilder.c --- wine1.7-1.7.13/programs/winemenubuilder/winemenubuilder.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/winemenubuilder/winemenubuilder.c 2014-04-04 19:13:44.000000000 +0000 @@ -1862,11 +1862,10 @@ if (hr == ERROR_SUCCESS) { WCHAR *s, *d; - int bcount, in_quotes; + int bcount = 0; + BOOL in_quotes = FALSE; /* Extract the application path */ - bcount=0; - in_quotes=0; s=szCmdline; d=szPath; while (*s) diff -Nru wine1.7-1.7.13/programs/xcopy/tests/xcopy.c wine1.7-1.7.16/programs/xcopy/tests/xcopy.c --- wine1.7-1.7.13/programs/xcopy/tests/xcopy.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/programs/xcopy/tests/xcopy.c 2014-04-04 19:13:44.000000000 +0000 @@ -31,7 +31,11 @@ /* Create a writable copy for CreateProcessA() */ wcmd = HeapAlloc(GetProcessHeap(), 0, strlen(cmd) + 1); strcpy(wcmd, cmd); - rc = CreateProcessA(NULL, wcmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + + /* On Windows 2003 and older, xcopy.exe fails if stdin is not a console + * handle, even with '/I /Y' options. + */ + rc = CreateProcessA(NULL, wcmd, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); HeapFree(GetProcessHeap(), 0, wcmd); if (!rc) return 260; diff -Nru wine1.7-1.7.13/server/queue.c wine1.7-1.7.16/server/queue.c --- wine1.7-1.7.13/server/queue.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/server/queue.c 2014-04-04 19:13:44.000000000 +0000 @@ -117,8 +117,10 @@ struct fd *fd; /* optional file descriptor to poll */ unsigned int wake_bits; /* wakeup bits */ unsigned int wake_mask; /* wakeup mask */ + unsigned int wake_get_msg; /* wakeup mask of last get_message */ unsigned int changed_bits; /* changed wakeup bits */ unsigned int changed_mask; /* changed wakeup mask */ + unsigned int changed_get_msg; /* changed wakeup mask of last get_message */ int paint_count; /* pending paint messages count */ int hotkey_count; /* pending hotkey messages count */ int quit_message; /* is there a pending quit message? */ @@ -277,8 +279,10 @@ queue->fd = NULL; queue->wake_bits = 0; queue->wake_mask = 0; + queue->wake_get_msg = 0; queue->changed_bits = 0; queue->changed_mask = 0; + queue->changed_get_msg = 0; queue->paint_count = 0; queue->hotkey_count = 0; queue->quit_message = 0; @@ -927,8 +931,8 @@ static void msg_queue_satisfied( struct object *obj, struct wait_queue_entry *entry ) { struct msg_queue *queue = (struct msg_queue *)obj; - queue->wake_mask = 0; - queue->changed_mask = 0; + queue->wake_mask = queue->wake_get_msg; + queue->changed_mask = queue->changed_get_msg; } static void msg_queue_destroy( struct object *obj ) @@ -2197,7 +2201,11 @@ if (is_signaled( queue )) { /* if skip wait is set, do what would have been done in the subsequent wait */ - if (req->skip_wait) queue->wake_mask = queue->changed_mask = 0; + if (req->skip_wait) + { + queue->wake_mask = queue->wake_get_msg; + queue->changed_mask = queue->changed_get_msg; + } else wake_up( &queue->obj, 0 ); } } @@ -2369,6 +2377,7 @@ if (!queue) return; queue->last_get_msg = current_time; + queue->wake_get_msg = queue->changed_get_msg = 0; if (!filter) filter = QS_ALLINPUT; /* first check for sent messages */ @@ -2440,8 +2449,8 @@ } if (get_win == -1 && current->process->idle_event) set_event( current->process->idle_event ); - queue->wake_mask = req->wake_mask; - queue->changed_mask = req->changed_mask; + queue->wake_mask = queue->wake_get_msg = req->wake_mask; + queue->changed_mask = queue->changed_get_msg = req->changed_mask; set_error( STATUS_PENDING ); /* FIXME */ } @@ -2860,9 +2869,9 @@ reply->send_msg_old = (reply->previous && desktop->foreground_input != queue->input); reply->send_msg_new = FALSE; - if (is_top_level_window( req->handle ) && - ((thread = get_window_thread( req->handle ))) && - (thread->queue->input->desktop == desktop)) + if (is_valid_foreground_window( req->handle ) && + (thread = get_window_thread( req->handle )) && + thread->queue->input->desktop == desktop) { set_foreground_input( desktop, thread->queue->input ); reply->send_msg_new = (desktop->foreground_input != queue->input); diff -Nru wine1.7-1.7.13/server/user.h wine1.7-1.7.16/server/user.h --- wine1.7-1.7.13/server/user.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/server/user.h 2014-04-04 19:13:44.000000000 +0000 @@ -152,7 +152,7 @@ extern void destroy_window( struct window *win ); extern void destroy_thread_windows( struct thread *thread ); extern int is_child_window( user_handle_t parent, user_handle_t child ); -extern int is_top_level_window( user_handle_t window ); +extern int is_valid_foreground_window( user_handle_t window ); extern int is_window_visible( user_handle_t window ); extern int is_window_transparent( user_handle_t window ); extern int make_window_active( user_handle_t window ); diff -Nru wine1.7-1.7.13/server/window.c wine1.7-1.7.16/server/window.c --- wine1.7-1.7.13/server/window.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/server/window.c 2014-04-04 19:13:44.000000000 +0000 @@ -581,11 +581,11 @@ return 0; } -/* check whether window is a top-level window */ -int is_top_level_window( user_handle_t window ) +/* check if window can be set as foreground window */ +int is_valid_foreground_window( user_handle_t window ) { struct window *win = get_user_object( window, USER_WINDOW ); - return (win && (is_desktop_window(win) || is_desktop_window(win->parent))); + return win && (win->style & (WS_POPUP|WS_CHILD)) != WS_CHILD; } /* make a window active if possible */ diff -Nru wine1.7-1.7.13/tools/c2man.pl wine1.7-1.7.16/tools/c2man.pl --- wine1.7-1.7.13/tools/c2man.pl 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/c2man.pl 2014-04-04 19:13:44.000000000 +0000 @@ -99,13 +99,14 @@ sub process_spec_file($) { my $spec_name = shift; - my ($dll_name, $dll_ext) = split(/\./, $spec_name); + (my $basename = $spec_name) =~ s/.*\///; + my ($dll_name, $dll_ext) = split(/\./, $basename); $dll_ext = "dll" if ( $dll_ext eq "spec" ); my $uc_dll_name = uc $dll_name; my $spec_details = { - NAME => $spec_name, + NAME => $basename, DLL_NAME => $dll_name, DLL_EXT => $dll_ext, NUM_EXPORTS => 0, diff -Nru wine1.7-1.7.13/tools/makedep.c wine1.7-1.7.16/tools/makedep.c --- wine1.7-1.7.13/tools/makedep.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/makedep.c 2014-04-04 19:13:44.000000000 +0000 @@ -94,22 +94,43 @@ static const struct strarray empty_strarray; +/* variables common to all makefiles */ +static struct strarray linguas; +static struct strarray dll_flags; +static struct strarray target_flags; +static struct strarray msvcrt_flags; +static struct strarray extra_cflags; +static struct strarray cpp_flags; +static struct strarray unwind_flags; +static struct strarray libs; +static struct strarray cmdline_vars; +static struct strarray top_make_vars; +static const char *root_src_dir; +static const char *tools_dir; +static const char *tools_ext; +static const char *exe_ext; +static const char *dll_ext; +static const char *man_ext; +static const char *dll_prefix; +static const char *crosstarget; +static const char *fontforge; +static const char *convert; +static const char *rsvg; +static const char *icotool; + +/* variables that can be set by individual makefiles */ static struct strarray include_args; static struct strarray define_args; static struct strarray appmode; -static struct strarray dllflags; static struct strarray imports; static struct strarray make_vars; -static struct strarray cmdline_vars; static struct strarray testlist_files; - static const char *base_dir; static const char *src_dir; static const char *top_src_dir; static const char *top_obj_dir; static const char *parent_dir; -static const char *tools_dir; -static const char *tools_ext; + static const char *makefile_name = "Makefile"; static const char *Separator = "### Dependencies"; static const char *input_file_name; @@ -324,6 +345,42 @@ /******************************************************************* + * strarray_get_value + * + * Find a value in a name/value pair string array. + */ +static char *strarray_get_value( const struct strarray *array, const char *name ) +{ + unsigned int i; + + for (i = 0; i < array->count; i += 2) + if (!strcmp( array->str[i], name )) return xstrdup( array->str[i + 1] ); + return NULL; +} + + +/******************************************************************* + * strarray_set_value + * + * Define a value in a name/value pair string array. + */ +static void strarray_set_value( struct strarray *array, const char *name, const char *value ) +{ + unsigned int i; + + /* redefining a variable replaces the previous value */ + for (i = 0; i < array->count; i += 2) + { + if (strcmp( array->str[i], name )) continue; + array->str[i + 1] = value; + return; + } + strarray_add( array, name ); + strarray_add( array, value ); +} + + +/******************************************************************* * output_filename */ static void output_filename( const char *name ) @@ -454,12 +511,23 @@ /******************************************************************* + * concat_paths + */ +static char *concat_paths( const char *base, const char *path ) +{ + if (!base) return xstrdup( path[0] ? path : "." ); + if (path[0] == '/') return xstrdup( path ); + if (!path[0]) return xstrdup( base ); + return strmake( "%s/%s", base, path ); +} + + +/******************************************************************* * base_dir_path */ static char *base_dir_path( const char *path ) { - if (base_dir && path[0] != '/') return strmake( "%s/%s", base_dir, path ); - return xstrdup( path ); + return concat_paths( base_dir, path ); } @@ -468,8 +536,7 @@ */ static char *src_dir_path( const char *path ) { - if (src_dir) return strmake( "%s/%s", src_dir, path ); - return xstrdup( path ); + return concat_paths( src_dir, path ); } @@ -478,8 +545,7 @@ */ static char *top_obj_dir_path( const char *path ) { - if (top_obj_dir) return strmake( "%s/%s", top_obj_dir, path ); - return xstrdup( path ); + return concat_paths( top_obj_dir, path ); } @@ -488,7 +554,7 @@ */ static char *top_dir_path( const char *path ) { - if (top_src_dir) return strmake( "%s/%s", top_src_dir, path ); + if (top_src_dir) return concat_paths( top_src_dir, path ); return top_obj_dir_path( path ); } @@ -498,9 +564,8 @@ */ static char *tools_dir_path( const char *path ) { - if (tools_dir) return strmake( "%s/tools/%s", tools_dir, path ); - if (top_obj_dir) return strmake( "%s/tools/%s", top_obj_dir, path ); - return strmake( "tools/%s", path ); + if (tools_dir) return top_obj_dir_path( strmake( "%s/tools/%s", tools_dir, path )); + return top_obj_dir_path( strmake( "tools/%s", path )); } @@ -509,9 +574,7 @@ */ static char *tools_path( const char *name ) { - if (tools_dir) return strmake( "%s/tools/%s/%s%s", tools_dir, name, name, tools_ext ); - if (top_obj_dir) return strmake( "%s/tools/%s/%s%s", top_obj_dir, name, name, tools_ext ); - return strmake( "tools/%s/%s%s", name, name, tools_ext ); + return strmake( "%s/%s%s", tools_dir_path( name ), name, tools_ext ); } @@ -1199,15 +1262,11 @@ */ static char *get_make_variable( const char *name ) { - unsigned int i; + char *ret; - for (i = 0; i < cmdline_vars.count; i += 2) - if (!strcmp( cmdline_vars.str[i], name )) - return xstrdup( cmdline_vars.str[i + 1] ); - - for (i = 0; i < make_vars.count; i += 2) - if (!strcmp( make_vars.str[i], name )) - return xstrdup( make_vars.str[i + 1] ); + if ((ret = strarray_get_value( &cmdline_vars, name ))) return ret; + if ((ret = strarray_get_value( &make_vars, name ))) return ret; + if ((ret = strarray_get_value( &top_make_vars, name ))) return ret; return NULL; } @@ -1281,7 +1340,6 @@ */ static int set_make_variable( struct strarray *array, const char *assignment ) { - unsigned int i; char *p, *name; p = name = xstrdup( assignment ); @@ -1296,15 +1354,7 @@ *p++ = 0; while (isspace(*p)) p++; - /* redefining a variable replaces the previous value */ - for (i = 0; i < array->count; i += 2) - { - if (strcmp( array->str[i], name )) continue; - array->str[i + 1] = p; - return 1; - } - strarray_add( array, name ); - strarray_add( array, p ); + strarray_set_value( array, name, p ); return 1; } @@ -1312,26 +1362,23 @@ /******************************************************************* * parse_makefile */ -static void parse_makefile(void) +static void parse_makefile( const char *name, const char *separator, struct strarray *vars ) { char *buffer; FILE *file; - input_file_name = base_dir_path( makefile_name ); - if (!(file = fopen( input_file_name, "r" ))) - { - fatal_perror( "open" ); - exit( 1 ); - } + *vars = empty_strarray; + input_file_name = name; + if (!(file = fopen( input_file_name, "r" ))) fatal_perror( "open" ); input_line = 0; while ((buffer = get_line( file ))) { - if (Separator && !strncmp( buffer, Separator, strlen(Separator) )) break; + if (separator && !strncmp( buffer, separator, strlen(separator) )) break; if (*buffer == '\t') continue; /* command */ while (isspace( *buffer )) buffer++; if (*buffer == '#') continue; /* comment */ - set_make_variable( &make_vars, buffer ); + set_make_variable( vars, buffer ); } fclose( file ); input_file_name = NULL; @@ -1456,7 +1503,6 @@ struct incl_file *source; unsigned int i; int is_win16 = 0; - const char *dllext = ".so"; struct strarray object_files = empty_strarray; struct strarray crossobj_files = empty_strarray; struct strarray res_files = empty_strarray; @@ -1471,18 +1517,13 @@ struct strarray includes = empty_strarray; struct strarray subdirs = empty_strarray; struct strarray phony_targets = empty_strarray; - struct strarray linguas = get_expanded_make_var_array( "LINGUAS" ); struct strarray all_targets = get_expanded_make_var_array( "PROGRAMS" ); - struct strarray targetflags = get_expanded_make_var_array( "TARGETFLAGS" ); struct strarray delayimports = get_expanded_make_var_array( "DELAYIMPORTS" ); struct strarray extradllflags = get_expanded_make_var_array( "EXTRADLLFLAGS" ); char *module = get_expanded_make_variable( "MODULE" ); - char *exeext = get_expanded_make_variable( "EXEEXT" ); char *testdll = get_expanded_make_variable( "TESTDLL" ); char *staticlib = get_expanded_make_variable( "STATICLIB" ); - char *crosstarget = get_expanded_make_variable( "CROSSTARGET" ); - if (exeext && !strcmp( exeext, ".exe" )) dllext = ""; if (module && strendswith( module, ".a" )) staticlib = module; for (i = 0; i < extradllflags.count; i++) if (!strcmp( extradllflags.str[i], "-m16" )) is_win16 = 1; @@ -1553,7 +1594,7 @@ output( "%s.res: %s %s\n", obj, tools_path( "wrc" ), source->filename ); output( "\t%s -o $@ %s", tools_path( "wrc" ), source->filename ); if (is_win16) output_filename( "-m16" ); - else output_filenames( targetflags ); + else output_filenames( target_flags ); output_filename( "--nostdinc" ); output_filenames( includes ); output_filenames( define_args ); @@ -1608,7 +1649,7 @@ output_filenames( targets ); output( ": %s\n", tools_path( "widl" )); output( "\t%s -o $@ %s", tools_path( "widl" ), source->filename ); - output_filenames( targetflags ); + output_filenames( target_flags ); output_filenames( includes ); output_filenames( define_args ); output_filenames( extradefs ); @@ -1648,12 +1689,12 @@ else if (!strcmp( ext, "sfd" )) /* font file */ { char *ttf_file = src_dir_path( strmake( "%s.ttf", obj )); - char *fontforge = get_expanded_make_variable( "FONTFORGE" ); if (fontforge && !src_dir) { output( "%s: %s\n", ttf_file, source->filename ); output( "\t%s -script %s %s $@\n", fontforge, top_dir_path( "fonts/genttf.ff" ), source->filename ); + if (!(source->flags & FLAG_SFD_FONTS)) output( "all: %s\n", ttf_file ); } if (source->flags & FLAG_INSTALL) { @@ -1678,27 +1719,24 @@ output( "\t$(INSTALL_DATA) %s $(DESTDIR)$(fontdir)/%s\n", font, font ); output( "uninstall::\n" ); output( "\t$(RM) $(DESTDIR)$(fontdir)/%s\n", font ); - strarray_add_uniq( &phony_targets, "install" ); - strarray_add_uniq( &phony_targets, "install-lib" ); - strarray_add_uniq( &phony_targets, "uninstall" ); } } + if (source->flags & (FLAG_INSTALL | FLAG_SFD_FONTS)) + { + strarray_add_uniq( &phony_targets, "install" ); + strarray_add_uniq( &phony_targets, "install-lib" ); + strarray_add_uniq( &phony_targets, "uninstall" ); + } continue; /* no dependencies */ } else if (!strcmp( ext, "svg" )) /* svg file */ { - char *convert = get_expanded_make_variable( "CONVERT" ); - char *rsvg = get_expanded_make_variable( "RSVG" ); - char *icotool = get_expanded_make_variable( "ICOTOOL" ); if (convert && rsvg && icotool && !src_dir) { output( "%s.ico %s.bmp: %s\n", obj, obj, source->filename ); output( "\tCONVERT=\"%s\" ICOTOOL=\"%s\" RSVG=\"%s\" %s %s $@\n", convert, icotool, rsvg, top_dir_path( "tools/buildimage" ), source->filename ); } - free( convert ); - free( rsvg ); - free( icotool ); continue; /* no dependencies */ } else if (!strcmp( ext, "res" )) @@ -1719,9 +1757,13 @@ output_filenames( includes ); output_filenames( define_args ); output_filenames( extradefs ); - if (module || staticlib || testdll) output_filenames( dllflags ); - output_filenames( get_expanded_make_var_array( "EXTRACFLAGS" )); - output_filenames( get_expanded_make_var_array( "CPPFLAGS" )); + if (module || staticlib || testdll) + { + output_filenames( dll_flags ); + if (use_msvcrt) output_filenames( msvcrt_flags ); + } + output_filenames( extra_cflags ); + output_filenames( cpp_flags ); output_filename( "$(CFLAGS)" ); output( "\n" ); if (crosstarget && need_cross) @@ -1733,7 +1775,7 @@ output_filenames( define_args ); output_filenames( extradefs ); output_filename( "-DWINE_CROSSTEST" ); - output_filenames( get_expanded_make_var_array( "CPPFLAGS" )); + output_filenames( cpp_flags ); output_filename( "$(CFLAGS)" ); output( "\n" ); } @@ -1743,7 +1785,7 @@ output( "%s.ok:\n", obj ); output( "\t%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n", top_dir_path( "tools/runtest" ), top_obj_dir, - testdll, replace_extension( testdll, ".dll", "_test.exe" ), dllext, obj ); + testdll, replace_extension( testdll, ".dll", "_test.exe" ), dll_ext, obj ); } if (!strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED)) strarray_add( &c2man_files, source->filename ); @@ -1767,7 +1809,7 @@ output( "\t%s -O pot -o $@", tools_path( "wrc" )); output_filenames( po_files ); if (is_win16) output_filename( "-m16" ); - else output_filenames( targetflags ); + else output_filenames( target_flags ); output_filename( "--nostdinc" ); output_filenames( includes ); output_filenames( define_args ); @@ -1808,15 +1850,15 @@ for (i = 0; i < delayimports.count; i++) strarray_add( &all_libs, strmake( "-Wb,-d%s", delayimports.str[i] )); strarray_add( &all_libs, "-lwine" ); - strarray_addall( &all_libs, get_expanded_make_var_array( "LIBPORT" )); + strarray_add( &all_libs, top_obj_dir_path( "libs/port/libwine_port.a" )); strarray_addall( &all_libs, get_expanded_make_var_array( "EXTRALIBS" )); - strarray_addall( &all_libs, get_expanded_make_var_array( "LIBS" )); + strarray_addall( &all_libs, libs ); - if (*dllext) + if (*dll_ext) { - strarray_add( &all_targets, strmake( "%s%s", module, dllext )); + strarray_add( &all_targets, strmake( "%s%s", module, dll_ext )); strarray_add( &all_targets, strmake( "%s.fake", module )); - output( "%s%s %s.fake:", module, dllext, module ); + output( "%s%s %s.fake:", module, dll_ext, module ); } else { @@ -1830,8 +1872,8 @@ output( "\t%s -o $@", tools_path( "winegcc" )); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir )); - output_filenames( targetflags ); - output_filenames( get_expanded_make_var_array( "UNWINDFLAGS" )); + output_filenames( target_flags ); + output_filenames( unwind_flags ); if (spec_file) { output( " -shared %s", spec_file ); @@ -1846,12 +1888,12 @@ if (spec_file && importlib) { - if (*dllext) + if (*dll_ext) { strarray_add( &clean_files, strmake( "lib%s.def", importlib )); output( "lib%s.def: %s %s\n", importlib, tools_path( "winebuild" ), spec_file ); output( "\t%s -w --def -o $@ --export %s", tools_path( "winebuild" ), spec_file ); - output_filenames( targetflags ); + output_filenames( target_flags ); if (is_win16) output_filename( "-m16" ); output( "\n" ); if (implib_objs.count) @@ -1874,7 +1916,7 @@ output_filenames( implib_objs ); output( "\n" ); output( "\t%s -w --implib -o $@ --export %s", tools_path( "winebuild" ), spec_file ); - output_filenames( targetflags ); + output_filenames( target_flags ); output_filenames( implib_objs ); output( "\n" ); } @@ -1894,32 +1936,34 @@ if (spec_file) { - if (c2man_files.count && top_obj_dir) + if (c2man_files.count) { - char *manext = get_expanded_make_variable( "api_manext" ); - output( "manpages::\n" ); - output( "\t%s -w %s -R%s", top_dir_path( "tools/c2man.pl" ), spec_file, top_obj_dir ); + output( "\t%s -w %s", top_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", top_dir_path( "" ))); output_filename( strmake( "-I%s", top_dir_path( "include" ))); - output_filename( strmake( "-o %s/documentation/man%s", top_obj_dir, manext ? manext : "3w" )); + output_filename( strmake( "-o %s/man%s", top_obj_dir_path( "documentation" ), man_ext )); output_filenames( c2man_files ); output( "\n" ); output( "htmlpages::\n" ); - output( "\t%s -Th -w %s -R%s", top_dir_path( "tools/c2man.pl" ), spec_file, top_obj_dir ); + output( "\t%s -Th -w %s", top_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", top_dir_path( "" ))); output_filename( strmake( "-I%s", top_dir_path( "include" ))); - output_filename( strmake( "-o %s/documentation/html", top_obj_dir )); + output_filename( strmake( "-o %s", top_obj_dir_path( "documentation/html" ))); output_filenames( c2man_files ); output( "\n" ); output( "sgmlpages::\n" ); - output( "\t%s -Ts -w %s -R%s", top_dir_path( "tools/c2man.pl" ), spec_file, top_obj_dir ); + output( "\t%s -Ts -w %s", top_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", top_dir_path( "" ))); output_filename( strmake( "-I%s", top_dir_path( "include" ))); - output_filename( strmake( "-o %s/documentation/api-guide", top_obj_dir )); + output_filename( strmake( "-o %s", top_obj_dir_path( "documentation/api-guide" ))); output_filenames( c2man_files ); output( "\n" ); output( "xmlpages::\n" ); - output( "\t%s -Tx -w %s -R%s", top_dir_path( "tools/c2man.pl" ), spec_file, top_obj_dir ); + output( "\t%s -Tx -w %s", top_dir_path( "tools/c2man.pl" ), spec_file ); + output_filename( strmake( "-R%s", top_dir_path( "" ))); output_filename( strmake( "-I%s", top_dir_path( "include" ))); - output_filename( strmake( "-o %s/documentation/api-guide-xml", top_obj_dir )); + output_filename( strmake( "-o %s", top_obj_dir_path( "documentation/api-guide-xml" ))); output_filenames( c2man_files ); output( "\n" ); strarray_add( &phony_targets, "manpages" ); @@ -1963,26 +2007,26 @@ for (i = 0; i < imports.count; i++) strarray_add( &all_libs, strmake( "-l%s", imports.str[i] )); strarray_addall( &all_libs, get_expanded_make_var_array( "LIBS" )); - strarray_add( &all_targets, strmake( "%s%s", testmodule, dllext )); - strarray_add( &clean_files, strmake( "%s%s", stripped, dllext )); - output( "%s%s:\n", testmodule, dllext ); + strarray_add( &all_targets, strmake( "%s%s", testmodule, dll_ext )); + strarray_add( &clean_files, strmake( "%s%s", stripped, dll_ext )); + output( "%s%s:\n", testmodule, dll_ext ); output( "\t%s -o $@", tools_path( "winegcc" )); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir )); - output_filenames( targetflags ); - output_filenames( get_expanded_make_var_array( "UNWINDFLAGS" )); + output_filenames( target_flags ); + output_filenames( unwind_flags ); output_filenames( appmode ); output_filenames( object_files ); output_filenames( res_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - output( "%s%s:\n", stripped, dllext ); + output( "%s%s:\n", stripped, dll_ext ); output( "\t%s -o $@", tools_path( "winegcc" )); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir )); - output_filenames( targetflags ); - output_filenames( get_expanded_make_var_array( "UNWINDFLAGS" )); + output_filenames( target_flags ); + output_filenames( unwind_flags ); output_filename( strmake( "-Wb,-F,%s", testmodule )); output_filenames( appmode ); output_filenames( object_files ); @@ -1990,7 +2034,7 @@ output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - output( "%s%s %s%s:", testmodule, dllext, stripped, dllext ); + output( "%s%s %s%s:", testmodule, dll_ext, stripped, dll_ext ); output_filenames( object_files ); output_filenames( res_files ); output( "\n" ); @@ -1999,9 +2043,9 @@ { char *testres = replace_extension( testdll, ".dll", "_test.res" ); output( "all: %s/%s\n", top_obj_dir_path( "programs/winetest" ), testres ); - output( "%s/%s: %s%s\n", top_obj_dir_path( "programs/winetest" ), testres, stripped, dllext ); + output( "%s/%s: %s%s\n", top_obj_dir_path( "programs/winetest" ), testres, stripped, dll_ext ); output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n", - testmodule, stripped, dllext, tools_path( "wrc" )); + testmodule, stripped, dll_ext, tools_path( "wrc" )); } if (crosstarget) @@ -2027,7 +2071,7 @@ } output_filenames( ok_files ); - output( ": %s%s ../%s%s\n", testmodule, dllext, testdll, dllext ); + output( ": %s%s ../%s%s\n", testmodule, dll_ext, testdll, dll_ext ); output( "check test:" ); output_filenames( ok_files ); output( "\n" ); @@ -2296,23 +2340,19 @@ base_dir = path; if (!strcmp( base_dir, "." )) base_dir = NULL; output_file_name = base_dir_path( makefile_name ); - parse_makefile(); + parse_makefile( output_file_name, Separator, &make_vars ); src_dir = get_expanded_make_variable( "srcdir" ); top_src_dir = get_expanded_make_variable( "top_srcdir" ); top_obj_dir = get_expanded_make_variable( "top_builddir" ); parent_dir = get_expanded_make_variable( "PARENTSRC" ); - tools_dir = get_expanded_make_variable( "TOOLSDIR" ); - tools_ext = get_expanded_make_variable( "TOOLSEXT" ); /* ignore redundant source paths */ if (src_dir && !strcmp( src_dir, "." )) src_dir = NULL; if (top_src_dir && top_obj_dir && !strcmp( top_src_dir, top_obj_dir )) top_src_dir = NULL; - if (tools_dir && top_obj_dir && !strcmp( tools_dir, top_obj_dir )) tools_dir = NULL; if (top_obj_dir && !strcmp( top_obj_dir, "." )) top_obj_dir = NULL; appmode = get_expanded_make_var_array( "APPMODE" ); - dllflags = get_expanded_make_var_array( "DLLFLAGS" ); imports = get_expanded_make_var_array( "IMPORTS" ); use_msvcrt = 0; @@ -2325,8 +2365,6 @@ define_args = empty_strarray; strarray_add( &define_args, "-D__WINESRC__" ); - if (!tools_ext) tools_ext = ""; - value = get_expanded_make_var_array( "EXTRAINCL" ); for (i = 0; i < value.count; i++) if (!strncmp( value.str[i], "-I", 2 )) @@ -2335,8 +2373,6 @@ strarray_add_uniq( &define_args, value.str[i] ); strarray_addall( &define_args, get_expanded_make_var_array( "EXTRADEFS" )); - if (use_msvcrt) strarray_add( &dllflags, get_expanded_make_variable( "MSVCRTFLAGS" )); - list_init( &sources ); list_init( &includes ); @@ -2464,6 +2500,35 @@ signal( SIGHUP, exit_on_signal ); #endif + parse_makefile( makefile_name, "# End of common header", &top_make_vars ); + + linguas = get_expanded_make_var_array( "LINGUAS" ); + target_flags = get_expanded_make_var_array( "TARGETFLAGS" ); + msvcrt_flags = get_expanded_make_var_array( "MSVCRTFLAGS" ); + dll_flags = get_expanded_make_var_array( "DLLFLAGS" ); + extra_cflags = get_expanded_make_var_array( "EXTRACFLAGS" ); + cpp_flags = get_expanded_make_var_array( "CPPFLAGS" ); + unwind_flags = get_expanded_make_var_array( "UNWINDFLAGS" ); + libs = get_expanded_make_var_array( "LIBS" ); + + root_src_dir = get_expanded_make_variable( "srcdir" ); + tools_dir = get_expanded_make_variable( "TOOLSDIR" ); + tools_ext = get_expanded_make_variable( "TOOLSEXT" ); + exe_ext = get_expanded_make_variable( "EXEEXT" ); + man_ext = get_expanded_make_variable( "api_manext" ); + dll_ext = (exe_ext && !strcmp( exe_ext, ".exe" )) ? "" : ".so"; + dll_prefix = get_expanded_make_variable( "DLLPREFIX" ); + crosstarget = get_expanded_make_variable( "CROSSTARGET" ); + fontforge = get_expanded_make_variable( "FONTFORGE" ); + convert = get_expanded_make_variable( "CONVERT" ); + rsvg = get_expanded_make_variable( "RSVG" ); + icotool = get_expanded_make_variable( "ICOTOOL" ); + + if (tools_dir && !strcmp( tools_dir, "." )) tools_dir = NULL; + if (!tools_ext) tools_ext = ""; + if (!dll_prefix) dll_prefix = ""; + if (!man_ext) man_ext = "3w"; + for (i = 1; i < argc; i++) update_makefile( argv[i] ); return 0; } diff -Nru wine1.7-1.7.13/tools/make_xftmpl.c wine1.7-1.7.16/tools/make_xftmpl.c --- wine1.7-1.7.13/tools/make_xftmpl.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/make_xftmpl.c 2014-04-04 19:13:44.000000000 +0000 @@ -69,13 +69,6 @@ #define TOKEN_CSTRING 51 #define TOKEN_ARRAY 52 -struct parser -{ - FILE *infile; - FILE *outfile; - int line_no; -}; - struct keyword { const char *word; @@ -106,7 +99,10 @@ static char *option_inc_size_name = NULL; static const char *option_outfile_name = "-"; static char *program_name; +static FILE *infile; +static int line_no; static const char *infile_name; +static FILE *outfile; static BYTE *output_data; static UINT output_pos, output_size; @@ -114,15 +110,15 @@ #define __attribute__(x) #endif -static void fatal_error( struct parser *parser, const char *msg, ... ) __attribute__ ((__format__ (__printf__, 2, 3))); +static void fatal_error( const char *msg, ... ) __attribute__ ((__format__ (__printf__, 1, 2))); -static void fatal_error( struct parser *parser, const char *msg, ... ) +static void fatal_error( const char *msg, ... ) { va_list valist; va_start( valist, msg ); if (infile_name) { - fprintf( stderr, "%s:%d:", infile_name, parser->line_no ); + fprintf( stderr, "%s:%d:", infile_name, line_no ); fprintf( stderr, " error: " ); } else fprintf( stderr, "%s: error: ", program_name ); @@ -132,43 +128,43 @@ } -static inline BOOL read_byte(struct parser *parser, char *byte) +static inline BOOL read_byte( char *byte ) { - int c = fgetc(parser->infile); + int c = fgetc(infile); *byte = c; - if (c == '\n') parser->line_no++; + if (c == '\n') line_no++; return c != EOF; } -static inline BOOL unread_byte(struct parser *parser, char last_byte) +static inline BOOL unread_byte( char last_byte ) { - if (last_byte == '\n') parser->line_no--; - return ungetc(last_byte, parser->infile) != EOF; + if (last_byte == '\n') line_no--; + return ungetc(last_byte, infile) != EOF; } -static inline BOOL read_bytes(struct parser *parser, void *data, DWORD size) +static inline BOOL read_bytes( void *data, DWORD size ) { - return fread(data, size, 1, parser->infile) > 0; + return fread(data, size, 1, infile) > 0; } -static BOOL write_c_hex_bytes(struct parser *parser) +static BOOL write_c_hex_bytes(void) { UINT i; for (i = 0; i < output_pos; i++) { if (i % 12 == 0) - fprintf(parser->outfile, "\n "); - fprintf(parser->outfile, " 0x%02x,", output_data[i]); + fprintf(outfile, "\n "); + fprintf(outfile, " 0x%02x,", output_data[i]); } return TRUE; } -static BOOL write_raw_bytes(struct parser *parser) +static BOOL write_raw_bytes(void) { - return fwrite(output_data, output_pos, 1, parser->outfile) > 0; + return fwrite(output_data, output_pos, 1, outfile) > 0; } -static inline BOOL write_bytes(struct parser *parser, const void *data, DWORD size) +static inline BOOL write_bytes(const void *data, DWORD size) { if (output_pos + size > output_size) { @@ -181,19 +177,36 @@ return TRUE; } -static inline BOOL write_byte(struct parser *parser, BYTE value) +static inline BOOL write_byte(BYTE value) +{ + return write_bytes( &value, sizeof(value) ); +} + +static inline BOOL write_word(WORD value) +{ + return write_byte( value ) && + write_byte( value >> 8 ); +} + +static inline BOOL write_dword(DWORD value) { - return write_bytes(parser, &value, sizeof(value)); + return write_word( value ) && + write_word( value >> 16 ); } -static inline BOOL write_word(struct parser *parser, WORD value) +static inline BOOL write_float(float value) { - return write_bytes(parser, &value, sizeof(value)); + DWORD val; + memcpy( &val, &value, sizeof(value) ); + return write_dword( val ); } -static inline BOOL write_dword(struct parser *parser, DWORD value) +static inline BOOL write_guid(const GUID *guid) { - return write_bytes(parser, &value, sizeof(value)); + return write_dword( guid->Data1 ) && + write_word( guid->Data2 ) && + write_word( guid->Data3 ) && + write_bytes( guid->Data4, sizeof(guid->Data4) ); } static int compare_names(const void *a, const void *b) @@ -201,7 +214,7 @@ return strcasecmp(*(const char **)a, *(const char **)b); } -static BOOL parse_keyword(struct parser *parser, const char *name) +static BOOL parse_keyword( const char *name ) { const struct keyword *keyword; @@ -210,10 +223,10 @@ if (!keyword) return FALSE; - return write_word(parser, keyword->token); + return write_word(keyword->token); } -static BOOL parse_guid(struct parser *parser) +static BOOL parse_guid(void) { char buf[39]; GUID guid; @@ -222,11 +235,11 @@ static const char *guidfmt = "<%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X>"; buf[0] = '<'; - if (!read_bytes(parser, buf + 1, 37)) fatal_error( parser, "truncated GUID\n" ); + if (!read_bytes(buf + 1, 37)) fatal_error( "truncated GUID\n" ); buf[38] = 0; ret = sscanf(buf, guidfmt, &guid.Data1, tab, tab+1, tab+2, tab+3, tab+4, tab+5, tab+6, tab+7, tab+8, tab+9); - if (ret != 11) fatal_error( parser, "invalid GUID '%s'\n", buf ); + if (ret != 11) fatal_error( "invalid GUID '%s'\n", buf ); guid.Data2 = tab[0]; guid.Data3 = tab[1]; @@ -239,35 +252,35 @@ guid.Data4[6] = tab[8]; guid.Data4[7] = tab[9]; - return write_word(parser, TOKEN_GUID) && - write_bytes(parser, &guid, sizeof(guid)); + return write_word(TOKEN_GUID) && + write_guid(&guid); } -static BOOL parse_name(struct parser *parser) +static BOOL parse_name(void) { char c; int len = 0; char name[512]; - while (read_byte(parser, &c) && len < sizeof(name) && + while (read_byte(&c) && len < sizeof(name) && (isalnum(c) || c == '_' || c == '-')) { if (len + 1 < sizeof(name)) name[len++] = c; } - unread_byte(parser, c); + unread_byte(c); name[len] = 0; - if (parse_keyword(parser, name)) { + if (parse_keyword(name)) { return TRUE; } else { - return write_word(parser, TOKEN_NAME) && - write_dword(parser, len) && - write_bytes(parser, name, len); + return write_word(TOKEN_NAME) && + write_dword(len) && + write_bytes(name, len); } } -static BOOL parse_number(struct parser *parser) +static BOOL parse_number(void) { int len = 0; char c; @@ -275,7 +288,7 @@ BOOL dot = FALSE; BOOL ret; - while (read_byte(parser, &c) && + while (read_byte(&c) && ((!len && c == '-') || (!dot && c == '.') || isdigit(c))) { if (len + 1 < sizeof(buffer)) @@ -283,33 +296,33 @@ if (c == '.') dot = TRUE; } - unread_byte(parser, c); + unread_byte(c); buffer[len] = 0; if (dot) { float value; ret = sscanf(buffer, "%f", &value); - if (!ret) fatal_error( parser, "invalid float token\n" ); - ret = write_word(parser, TOKEN_FLOAT) && - write_bytes(parser, &value, sizeof(value)); + if (!ret) fatal_error( "invalid float token\n" ); + ret = write_word(TOKEN_FLOAT) && + write_float(value); } else { int value; ret = sscanf(buffer, "%d", &value); - if (!ret) fatal_error( parser, "invalid integer token\n" ); - ret = write_word(parser, TOKEN_INTEGER) && - write_dword(parser, value); + if (!ret) fatal_error( "invalid integer token\n" ); + ret = write_word(TOKEN_INTEGER) && + write_dword(value); } return ret; } -static BOOL parse_token(struct parser *parser) +static BOOL parse_token(void) { char c; int len; char *tok, buffer[512]; - if (!read_byte(parser, &c)) + if (!read_byte(&c)) return FALSE; switch (c) @@ -320,27 +333,27 @@ case '\t': return TRUE; - case '{': return write_word(parser, TOKEN_OBRACE); - case '}': return write_word(parser, TOKEN_CBRACE); - case '[': return write_word(parser, TOKEN_OBRACKET); - case ']': return write_word(parser, TOKEN_CBRACKET); - case '(': return write_word(parser, TOKEN_OPAREN); - case ')': return write_word(parser, TOKEN_CPAREN); - case ',': return write_word(parser, TOKEN_COMMA); - case ';': return write_word(parser, TOKEN_SEMICOLON); - case '.': return write_word(parser, TOKEN_DOT); + case '{': return write_word(TOKEN_OBRACE); + case '}': return write_word(TOKEN_CBRACE); + case '[': return write_word(TOKEN_OBRACKET); + case ']': return write_word(TOKEN_CBRACKET); + case '(': return write_word(TOKEN_OPAREN); + case ')': return write_word(TOKEN_CPAREN); + case ',': return write_word(TOKEN_COMMA); + case ';': return write_word(TOKEN_SEMICOLON); + case '.': return write_word(TOKEN_DOT); case '/': - if (!read_byte(parser, &c) || c != '/') - fatal_error( parser, "invalid single '/' comment token\n" ); - while (read_byte(parser, &c) && c != '\n'); + if (!read_byte(&c) || c != '/') + fatal_error( "invalid single '/' comment token\n" ); + while (read_byte(&c) && c != '\n'); return c == '\n'; case '#': len = 0; - while (read_byte(parser, &c) && c != '\n') + while (read_byte(&c) && c != '\n') if (len + 1 < sizeof(buffer)) buffer[len++] = c; - if (c != '\n') fatal_error( parser, "line too long\n" ); + if (c != '\n') fatal_error( "line too long\n" ); buffer[len] = 0; tok = strtok( buffer, " \t" ); if (!tok || strcmp( tok, "pragma" )) return TRUE; @@ -361,28 +374,28 @@ return TRUE; case '<': - return parse_guid(parser); + return parse_guid(); case '"': len = 0; /* FIXME: Handle '\' (e.g. "valid\"string") */ - while (read_byte(parser, &c) && c != '"') { + while (read_byte(&c) && c != '"') { if (len + 1 < sizeof(buffer)) buffer[len++] = c; } - if (c != '"') fatal_error( parser, "unterminated string\n" ); - return write_word(parser, TOKEN_STRING) && - write_dword(parser, len) && - write_bytes(parser, buffer, len); + if (c != '"') fatal_error( "unterminated string\n" ); + return write_word(TOKEN_STRING) && + write_dword(len) && + write_bytes(buffer, len); default: - unread_byte(parser, c); + unread_byte(c); if (isdigit(c) || c == '-') - return parse_number(parser); + return parse_number(); if (isalpha(c) || c == '_') - return parse_name(parser); - fatal_error( parser, "invalid character '%c' to start token\n", c ); + return parse_name(); + fatal_error( "invalid character '%c' to start token\n", c ); } return TRUE; @@ -443,7 +456,6 @@ int main(int argc, char **argv) { char header[16]; - struct parser parser; char **args; char *header_name = NULL; @@ -457,17 +469,17 @@ return 1; } - parser.infile = stdin; - parser.outfile = NULL; + infile = stdin; + outfile = NULL; if (!strcmp(infile_name, "-")) { infile_name = "stdin"; - } else if (!(parser.infile = fopen(infile_name, "rb"))) { + } else if (!(infile = fopen(infile_name, "rb"))) { perror(infile_name); goto error; } - if (!read_bytes(&parser, header, sizeof(header))) { + if (!read_bytes(header, sizeof(header))) { fprintf(stderr, "%s: Failed to read file header\n", program_name); goto error; } @@ -496,7 +508,7 @@ if (!strcmp(option_outfile_name, "-")) { option_outfile_name = "stdout"; - parser.outfile = stdout; + outfile = stdout; } else { output_file = option_outfile_name; atexit(cleanup_files); @@ -505,19 +517,19 @@ #ifdef SIGHUP signal(SIGHUP, exit_on_signal); #endif - if (!(parser.outfile = fopen(output_file, "wb"))) { + if (!(outfile = fopen(output_file, "wb"))) { perror(option_outfile_name); goto error; } } - if (!write_bytes(&parser, "xof 0302bin 0064", 16)) + if (!write_bytes("xof 0302bin 0064", 16)) goto error; - parser.line_no = 1; - while (parse_token(&parser)); + line_no = 1; + while (parse_token()); - if (ferror(parser.outfile) || ferror(parser.infile)) + if (ferror(outfile) || ferror(infile)) goto error; if (option_header) @@ -525,7 +537,7 @@ char *str_ptr; if (!option_inc_var_name) - fatal_error( &parser, "variable name must be specified with -i or #pragma name\n" ); + fatal_error( "variable name must be specified with -i or #pragma name\n" ); header_name = strrchr(option_outfile_name, '/'); if (header_name) @@ -546,7 +558,7 @@ str_ptr++; } - fprintf(parser.outfile, + fprintf(outfile, "/* File generated automatically from %s; do not edit */\n" "\n" "#ifndef __WINE_%s\n" @@ -554,31 +566,31 @@ "\n" "unsigned char %s[] = {", infile_name, header_name, header_name, option_inc_var_name); - write_c_hex_bytes( &parser ); - fprintf(parser.outfile, "\n};\n\n"); + write_c_hex_bytes(); + fprintf(outfile, "\n};\n\n"); if (option_inc_size_name) - fprintf(parser.outfile, "#define %s %u\n\n", option_inc_size_name, output_pos); - fprintf(parser.outfile, "#endif /* __WINE_%s */\n", header_name); - if (ferror(parser.outfile)) + fprintf(outfile, "#define %s %u\n\n", option_inc_size_name, output_pos); + fprintf(outfile, "#endif /* __WINE_%s */\n", header_name); + if (ferror(outfile)) goto error; } - else write_raw_bytes( &parser ); + else write_raw_bytes(); - fclose(parser.infile); - fclose(parser.outfile); + fclose(infile); + fclose(outfile); output_file = NULL; return 0; error: - if (parser.infile) { - if (ferror(parser.infile)) + if (infile) { + if (ferror(infile)) perror(infile_name); - fclose(parser.infile); + fclose(infile); } - if (parser.outfile) { - if (ferror(parser.outfile)) + if (outfile) { + if (ferror(outfile)) perror(option_outfile_name); - fclose(parser.outfile); + fclose(outfile); } return 1; } diff -Nru wine1.7-1.7.13/tools/widl/header.c wine1.7-1.7.16/tools/widl/header.c --- wine1.7-1.7.13/tools/widl/header.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/widl/header.c 2014-04-04 19:13:44.000000000 +0000 @@ -109,16 +109,6 @@ return 0; } -int is_void(const type_t *t) -{ - return type_get_type(t) == TYPE_VOID; -} - -int is_conformant_array(const type_t *t) -{ - return is_array(t) && type_array_has_conformance(t); -} - static void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid) { if (!uuid) return; diff -Nru wine1.7-1.7.13/tools/widl/header.h wine1.7-1.7.16/tools/widl/header.h --- wine1.7-1.7.13/tools/widl/header.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/widl/header.h 2014-04-04 19:13:44.000000000 +0000 @@ -28,9 +28,6 @@ extern int is_attr(const attr_list_t *list, enum attr_type t); extern void *get_attrp(const attr_list_t *list, enum attr_type t); extern unsigned int get_attrv(const attr_list_t *list, enum attr_type t); -extern int is_void(const type_t *t); -extern int is_conformant_array(const type_t *t); -extern int is_declptr(const type_t *t); extern const char* get_name(const var_t *v); extern void write_type_left(FILE *h, type_t *t, int declonly); extern void write_type_right(FILE *h, type_t *t, int is_field); @@ -58,6 +55,31 @@ extern int has_out_arg_or_return(const var_t *func); extern int is_const_decl(const var_t *var); +static inline int is_ptr(const type_t *t) +{ + return type_get_type(t) == TYPE_POINTER; +} + +static inline int is_array(const type_t *t) +{ + return type_get_type(t) == TYPE_ARRAY; +} + +static inline int is_void(const type_t *t) +{ + return type_get_type(t) == TYPE_VOID; +} + +static inline int is_declptr(const type_t *t) +{ + return is_ptr(t) || (type_get_type(t) == TYPE_ARRAY && type_array_is_decl_as_ptr(t)); +} + +static inline int is_conformant_array(const type_t *t) +{ + return is_array(t) && type_array_has_conformance(t); +} + static inline int last_ptr(const type_t *type) { return is_ptr(type) && !is_declptr(type_pointer_get_ref(type)); diff -Nru wine1.7-1.7.13/tools/widl/typegen.c wine1.7-1.7.16/tools/widl/typegen.c --- wine1.7-1.7.13/tools/widl/typegen.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/widl/typegen.c 2014-04-04 19:13:44.000000000 +0000 @@ -85,6 +85,8 @@ static unsigned int field_memsize(const type_t *type, unsigned int *offset); static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align); static unsigned int type_memsize_and_alignment(const type_t *t, unsigned int *align); +static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type, + const char *name, unsigned int *typestring_offset); static unsigned int write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff); static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type, const char *name, int write_ptr, unsigned int *tfsoff); @@ -860,7 +862,7 @@ do { \ if (file) \ fprintf(file, "/* %2u */\n", typestring_offset); \ - print_file((file), 2, "0x%02x, /* " #fctype " */\n", RPC_##fctype); \ + print_file((file), 2, "0x%02x,\t/* " #fctype " */\n", RPC_##fctype); \ } \ while (0) @@ -1447,8 +1449,8 @@ if (!is_new_style) { print_file(file, 0, "/* %u (void) */\n", *offset); - print_file(file, indent, "0x5b, /* FC_END */\n"); - print_file(file, indent, "0x5c, /* FC_PAD */\n"); + print_file(file, indent, "0x5b,\t/* FC_END */\n"); + print_file(file, indent, "0x5c,\t/* FC_PAD */\n"); *offset += 2; } } @@ -2316,7 +2318,7 @@ error("Unsupported member type %d\n", type_get_type(type)); } -static void write_array_element_type(FILE *file, const type_t *type, +static void write_array_element_type(FILE *file, const attr_list_t *attrs, const type_t *type, int cont_is_complex, unsigned int *tfsoff) { type_t *elem = type_array_get_element(type); @@ -2331,7 +2333,7 @@ ref->typestring_offset, tfsoff); return; } - if (cont_is_complex && is_string_type(NULL, elem)) + if (cont_is_complex && is_string_type(attrs, elem)) { write_string_tfs(file, NULL, elem, TYPE_CONTEXT_CONTAINER, NULL, tfsoff); return; @@ -2350,10 +2352,10 @@ { if (*tfsoff % 2 == 0) { - print_file(file, 2, "0x%x,\t\t/* FC_PAD */\n", RPC_FC_PAD); + print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); *tfsoff += 1; } - print_file(file, 2, "0x%x,\t\t/* FC_END */\n", RPC_FC_END); + print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END); *tfsoff += 1; } @@ -2728,7 +2730,7 @@ return pointer_count; } -static void write_pointer_description(FILE *file, type_t *type, +static void write_pointer_description(FILE *file, const attr_list_t *attrs, type_t *type, unsigned int *typestring_offset) { unsigned int offset_in_buffer; @@ -2757,7 +2759,7 @@ if (is_conformant_array(type) && (type_array_is_decl_as_ptr(type) || !current_structure)) write_conformant_array_pointer_descriptions( - file, NULL, type, 0, typestring_offset); + file, attrs, type, 0, typestring_offset); else if (type_get_type(type) == TYPE_STRUCT && get_struct_fc(type) == RPC_FC_CPSTRUCT) { @@ -2774,11 +2776,6 @@ &offset_in_memory, &offset_in_buffer, typestring_offset); } -int is_declptr(const type_t *t) -{ - return is_ptr(t) || (type_get_type(t) == TYPE_ARRAY && type_array_is_decl_as_ptr(t)); -} - static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, type_t *type, enum type_context context, const char *name, unsigned int *typestring_offset) @@ -2814,6 +2811,9 @@ else elem_type = type_pointer_get_ref(type); + if (type_get_type(elem_type) == TYPE_POINTER && is_array(type)) + return write_array_tfs(file, attrs, type, name, typestring_offset); + if (type_get_type(elem_type) != TYPE_BASIC) { error("write_string_tfs: Unimplemented for non-basic type %s\n", name); @@ -2842,7 +2842,7 @@ WRITE_FCTYPE(file, FC_WSTRING, *typestring_offset); else WRITE_FCTYPE(file, FC_CSTRING, *typestring_offset); - print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); + print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", (unsigned short)dim, dim); @@ -2857,7 +2857,7 @@ WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset); else WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); - print_file(file, 2, "0x%x, /* FC_STRING_SIZED */\n", RPC_FC_STRING_SIZED); + print_file(file, 2, "0x%x,\t/* FC_STRING_SIZED */\n", RPC_FC_STRING_SIZED); *typestring_offset += 2; *typestring_offset += write_conf_or_var_desc( @@ -2878,7 +2878,7 @@ WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset); else WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); - print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); + print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; update_tfsoff(type, start_offset, file); @@ -2904,7 +2904,8 @@ if (!pointer_type) pointer_type = RPC_FC_RP; - write_embedded_types(file, attrs, type_array_get_element(type), name, FALSE, typestring_offset); + if (!is_string_type(attrs, type_array_get_element(type))) + write_embedded_types(file, attrs, type_array_get_element(type), name, FALSE, typestring_offset); size = type_memsize(is_conformant_array(type) ? type_array_get_element(type) : type); align = type_buffer_alignment(is_conformant_array(type) ? type_array_get_element(type) : type); @@ -2964,15 +2965,15 @@ if (type_has_pointers(type_array_get_element(type)) && (type_array_is_decl_as_ptr(type) || !current_structure)) { - print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); - print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); + print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP); + print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - write_pointer_description(file, type, typestring_offset); - print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); + write_pointer_description(file, is_string_type(attrs, type) ? attrs : NULL, type, typestring_offset); + print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END); *typestring_offset += 1; } - write_array_element_type(file, type, FALSE, typestring_offset); + write_array_element_type(file, is_string_type(attrs, type) ? attrs : NULL, type, FALSE, typestring_offset); write_end(file, typestring_offset); } else @@ -2987,7 +2988,7 @@ += write_conf_or_var_desc(file, current_structure, baseoff, type, length_is); - write_array_element_type(file, type, TRUE, typestring_offset); + write_array_element_type(file, is_string_type(attrs, type) ? attrs : NULL, type, TRUE, typestring_offset); write_end(file, typestring_offset); } @@ -3151,11 +3152,11 @@ (fc == RPC_FC_CPSTRUCT) || (fc == RPC_FC_CVSTRUCT && type_has_pointers(type))) { - print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); - print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); + print_file(file, 2, "0x%x,\t/* FC_PP */\n", RPC_FC_PP); + print_file(file, 2, "0x%x,\t/* FC_PAD */\n", RPC_FC_PAD); *tfsoff += 2; - write_pointer_description(file, type, tfsoff); - print_file(file, 2, "0x%x, /* FC_END */\n", RPC_FC_END); + write_pointer_description(file, NULL, type, tfsoff); + print_file(file, 2, "0x%x,\t/* FC_END */\n", RPC_FC_END); *tfsoff += 1; } @@ -3586,12 +3587,26 @@ case TGT_POINTER: { enum type_context ref_context; + type_t *ref = type_pointer_get_ref(type); + if (context == TYPE_CONTEXT_TOPLEVELPARAM) ref_context = TYPE_CONTEXT_PARAM; else if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) ref_context = TYPE_CONTEXT_CONTAINER; else ref_context = context; + + if (is_string_type(attrs, ref)) + { + if (context != TYPE_CONTEXT_CONTAINER_NO_POINTERS) + write_pointer_tfs(file, attrs, type, *typeformat_offset + 4, context, typeformat_offset); + + offset = write_type_tfs(file, indent, attrs, ref, name, ref_context, typeformat_offset); + if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) + return 0; + return offset; + } + offset = write_type_tfs( file, indent, attrs, type_pointer_get_ref(type), name, ref_context, typeformat_offset); if (context == TYPE_CONTEXT_CONTAINER_NO_POINTERS) diff -Nru wine1.7-1.7.13/tools/widl/typelib.c wine1.7-1.7.16/tools/widl/typelib.c --- wine1.7-1.7.13/tools/widl/typelib.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/widl/typelib.c 2014-04-04 19:13:44.000000000 +0000 @@ -49,16 +49,6 @@ static typelib_t *typelib; -int is_ptr(const type_t *t) -{ - return type_get_type(t) == TYPE_POINTER; -} - -int is_array(const type_t *t) -{ - return type_get_type(t) == TYPE_ARRAY; -} - /* List of oleauto types that should be recognized by name. * (most of) these seem to be intrinsic types in mktyplib. * This table MUST be alphabetically sorted on the kw field. diff -Nru wine1.7-1.7.13/tools/widl/widltypes.h wine1.7-1.7.16/tools/widl/widltypes.h --- wine1.7-1.7.13/tools/widl/widltypes.h 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/widl/widltypes.h 2014-04-04 19:13:44.000000000 +0000 @@ -544,9 +544,6 @@ void set_all_tfswrite(int val); void clear_all_offsets(void); -int is_ptr(const type_t *t); -int is_array(const type_t *t); - #define tsENUM 1 #define tsSTRUCT 2 #define tsUNION 3 diff -Nru wine1.7-1.7.13/tools/widl/write_msft.c wine1.7-1.7.16/tools/widl/write_msft.c --- wine1.7-1.7.13/tools/widl/write_msft.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/widl/write_msft.c 2014-04-04 19:13:44.000000000 +0000 @@ -1191,6 +1191,8 @@ case VT_UINT: case VT_HRESULT: case VT_PTR: + case VT_UNKNOWN: + case VT_DISPATCH: { const unsigned int lv = get_ulong_val(*(const unsigned int *)value, vt); if((lv & 0x3ffffff) == lv) { @@ -1257,6 +1259,33 @@ return S_OK; } +/* It's possible to have a default value for pointer arguments too. + In this case default value has a referenced type, e.g. + 'LONG*' argument gets VT_I4, 'DOUBLE*' - VT_R8. IUnknown* and IDispatch* + are recognised too and stored as VT_UNKNOWN and VT_DISPATCH. + But IUnknown/IDispatch arguments can only have default value of 0 + (or expression that resolves to zero) while other pointers can have + any default value. */ +static int get_defaultvalue_vt(type_t *type) +{ + int vt = get_type_vt(type); + if (type_get_type(type) == TYPE_ENUM) + vt = VT_I4; + else + { + vt = get_type_vt(type); + if (vt == VT_PTR && is_ptr(type)) { + vt = get_type_vt(type_pointer_get_ref(type)); + /* The only acceptable value for pointers to non-basic types + is NULL, it's stored as VT_I4 for both 32 and 64 bit typelibs. */ + if (vt == VT_USERDEFINED) + vt = VT_I4; + } + } + + return vt; +} + static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) { int offset, name_offset; @@ -1481,10 +1510,7 @@ { int vt; expr_t *expr = (expr_t *)attr->u.pval; - if (type_get_type(arg->type) == TYPE_ENUM) - vt = VT_INT; - else - vt = get_type_vt(arg->type); + vt = get_defaultvalue_vt(arg->type); paramflags |= 0x30; /* PARAMFLAG_FHASDEFAULT | PARAMFLAG_FOPT */ if (expr->type == EXPR_STRLIT || expr->type == EXPR_WSTRLIT) { @@ -2101,6 +2127,9 @@ var_t *cur; msft_typeinfo_t *msft_typeinfo; + if (-1 < enumeration->typelib_idx) + return; + enumeration->typelib_idx = typelib->typelib_header.nrtypeinfos; msft_typeinfo = create_msft_typeinfo(typelib, TKIND_ENUM, enumeration->name, enumeration->attrs); msft_typeinfo->typeinfo->size = 0; diff -Nru wine1.7-1.7.13/tools/winedump/tlb.c wine1.7-1.7.16/tools/winedump/tlb.c --- wine1.7-1.7.13/tools/winedump/tlb.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/winedump/tlb.c 2014-04-04 19:13:44.000000000 +0000 @@ -44,6 +44,61 @@ TKIND_MAX }; +enum VARENUM { + VT_EMPTY = 0, + VT_NULL = 1, + VT_I2 = 2, + VT_I4 = 3, + VT_R4 = 4, + VT_R8 = 5, + VT_CY = 6, + VT_DATE = 7, + VT_BSTR = 8, + VT_DISPATCH = 9, + VT_ERROR = 10, + VT_BOOL = 11, + VT_VARIANT = 12, + VT_UNKNOWN = 13, + VT_DECIMAL = 14, + VT_I1 = 16, + VT_UI1 = 17, + VT_UI2 = 18, + VT_UI4 = 19, + VT_I8 = 20, + VT_UI8 = 21, + VT_INT = 22, + VT_UINT = 23, + VT_VOID = 24, + VT_HRESULT = 25, + VT_PTR = 26, + VT_SAFEARRAY = 27, + VT_CARRAY = 28, + VT_USERDEFINED = 29, + VT_LPSTR = 30, + VT_LPWSTR = 31, + VT_RECORD = 36, + VT_INT_PTR = 37, + VT_UINT_PTR = 38, + VT_FILETIME = 64, + VT_BLOB = 65, + VT_STREAM = 66, + VT_STORAGE = 67, + VT_STREAMED_OBJECT = 68, + VT_STORED_OBJECT = 69, + VT_BLOB_OBJECT = 70, + VT_CF = 71, + VT_CLSID = 72, + VT_VERSIONED_STREAM = 73, + VT_BSTR_BLOB = 0xfff, + VT_VECTOR = 0x1000, + VT_ARRAY = 0x2000, + VT_BYREF = 0x4000, + VT_RESERVED = 0x8000, + VT_ILLEGAL = 0xffff, + VT_ILLEGALMASKED = 0xfff, + VT_TYPEMASK = 0xfff +}; + struct seg_t; typedef BOOL (*dump_seg_t)(struct seg_t*); @@ -54,6 +109,25 @@ int offset; int length; } seg_t; +static seg_t segdir[]; + +enum SEGDIRTYPE { + SEGDIR_TYPEINFO, + SEGDIR_IMPINFO, + SEGDIR_IMPFILES, + SEGDIR_REF, + SEGDIR_GUIDHASH, + SEGDIR_GUID, + SEGDIR_NAMEHASH, + SEGDIR_NAME, + SEGDIR_STRING, + SEGDIR_TYPEDESC, + SEGDIR_ARRAYDESC, + SEGDIR_CUSTDATA, + SEGDIR_CDGUID, + SEGDIR_res0e, + SEGDIR_res0f +}; static int offset=0; static int indent; @@ -172,6 +246,25 @@ guid.Data4[5], guid.Data4[6], guid.Data4[7]); } +static void print_vartype(int vartype) +{ + static const char *vartypes[VT_LPWSTR+1] = { + "VT_EMPTY", "VT_NULL", "VT_I2", "VT_I4", "VT_R4", + "VT_R8", "VT_CY", "VT_DATE", "VT_BSTR", "VT_DISPATCH", + "VT_ERROR", "VT_BOOL", "VT_VARIANT", "VT_UNKNOWN","VT_DECIMAL", + "unk 15", "VT_I1", "VT_UI1", "VT_UI2", "VT_UI4", + "VT_I8", "VT_UI8", "VT_INT", "VT_UINT", "VT_VOID", + "VT_HRESULT", "VT_PTR", "VT_SAFEARRAY","VT_CARRAY", "VT_USERDEFINED", + "VT_LPSTR", "VT_LPWSTR" + }; + + vartype &= VT_TYPEMASK; + if (vartype >= VT_EMPTY && vartype <= VT_LPWSTR) + printf("%s\n", vartypes[vartype]); + else + printf("unk %d\n", vartype); +} + static void print_ctl2(const char *name) { int len; @@ -214,6 +307,29 @@ printf("\n"); } +static int dump_msft_varflags(void) +{ + static const char *syskind[] = { + "SYS_WIN16", "SYS_WIN32", "SYS_MAC", "SYS_WIN64", "unknown" + }; + int kind, flags; + + print_offset(); + flags = tlb_read_int(); + kind = flags & 0xf; + if (kind > 3) kind = 4; + printf("varflags = %08x, syskind = %s\n", flags, syskind[kind]); + return flags; +} + +static void dump_msft_version(void) +{ + int version; + print_offset(); + version = tlb_read_int(); + printf("version = %d.%d\n", version & 0xff, version >> 16); +} + static void dump_msft_header(void) { print_begin_block("Header"); @@ -222,15 +338,15 @@ print_hex("magic2"); print_hex("posguid"); print_hex("lcid"); - print_hex("lsid2"); - header_flags = print_hex("varflags"); - print_hex("version"); + print_hex("lcid2"); + header_flags = dump_msft_varflags(); + dump_msft_version(); print_hex("flags"); typeinfo_cnt = print_dec("ntypeinfos"); - print_hex("helpstring"); - print_hex("helpstringcontext"); - print_hex("helpcontext"); - print_dec("nametablecont"); + print_dec("helpstring"); + print_dec("helpstringcontext"); + print_dec("helpcontext"); + print_dec("nametablecount"); print_dec("nametablechars"); print_hex("NameOffset"); print_hex("helpfile"); @@ -243,11 +359,27 @@ print_end_block(); } +static int dump_msft_typekind(void) +{ + static const char *tkind[TKIND_MAX] = { + "TKIND_ENUM", "TKIND_RECORD", "TKIND_MODULE", + "TKIND_INTERFACE", "TKIND_DISPATCH", "TKIND_COCLASS", + "TKIND_ALIAS", "TKIND_UNION" + }; + int ret, typekind; + + print_offset(); + ret = tlb_read_int(); + typekind = ret & 0xf; + printf("typekind = %s, align = %d\n", typekind < TKIND_MAX ? tkind[typekind] : "unknown", (ret >> 11) & 0x1f); + return ret; +} + static void dump_msft_typeinfobase(void) { print_begin_block_id("TypeInfoBase", msft_typeinfo_cnt); - msft_typeinfo_kind[msft_typeinfo_cnt] = print_hex("typekind"); + msft_typeinfo_kind[msft_typeinfo_cnt] = dump_msft_typekind(); msft_typeinfo_offs[msft_typeinfo_cnt] = print_hex("memoffset"); print_hex("res2"); print_hex("res3"); @@ -508,7 +640,7 @@ n = tlb_read_int(); switch(vt) { - case 8 /* VT_BSTR */: + case VT_BSTR: printf(" len %d: ", n); dump_string(n, 2); printf("\n"); @@ -563,6 +695,75 @@ return TRUE; } +/* Used for function return value and arguments type */ +static void dump_msft_datatype(const char *name) +{ + int datatype; + + print_offset(); + datatype = tlb_read_int(); + printf("%s = %08x", name, datatype); + if (datatype < 0) { + printf(", "); + print_vartype(datatype); + } + else { + const short *vt; + + if (datatype > segdir[SEGDIR_TYPEDESC].length) { + printf(", invalid offset\n"); + return; + } + + /* FIXME: in case of VT_USERDEFINED use hreftype */ + vt = PRD(segdir[SEGDIR_TYPEDESC].offset + datatype, 4*sizeof(short)); + datatype = vt[0] & VT_TYPEMASK; + if (datatype == VT_PTR) { + printf(", VT_PTR -> "); + if (vt[3] < 0) + datatype = vt[2]; + else { + vt = PRD(segdir[SEGDIR_TYPEDESC].offset + vt[2], 4*sizeof(short)); + datatype = *vt; + } + } + else { + printf(", "); + datatype = *vt; + } + + print_vartype(datatype); + } +} + +static void dump_defaultvalue(int id) +{ + int offset; + + print_offset(); + offset = tlb_read_int(); + + printf("default value[%d] = %08x", id, offset); + if (offset == -1) + printf("\n"); + else if (offset < 0) { + printf(", "); + print_vartype((offset & 0x7c000000) >> 26); + } + else { + const unsigned short *vt; + + if (offset > segdir[SEGDIR_CUSTDATA].length) { + printf(", invalid offset\n"); + return; + } + + vt = PRD(segdir[SEGDIR_CUSTDATA].offset + offset, sizeof(*vt)); + printf(", "); + print_vartype(*vt); + } +} + static void dump_msft_func(int n) { int size, args_cnt, i, extra_attr, fkccic; @@ -571,7 +772,7 @@ size = print_short_hex("size"); print_short_hex("index"); - print_hex("DataType"); + dump_msft_datatype("retval type"); print_hex("flags"); print_short_hex("VtableOffset"); print_short_hex("funcdescsize"); @@ -600,16 +801,16 @@ if(fkccic & 0x1000) { for(i=0; i < args_cnt; i++) - print_hex_id("default value[%d]", i); + dump_defaultvalue(i); } for(i=0; i < args_cnt; i++) { print_begin_block_id("param", i); /* FIXME: Handle default values */ - print_hex("data[0]"); + dump_msft_datatype("datatype"); + print_hex("name"); print_hex("paramflags"); - print_hex("data[2]"); print_end_block(); } diff -Nru wine1.7-1.7.13/tools/winegcc/winegcc.c wine1.7-1.7.16/tools/winegcc/winegcc.c --- wine1.7-1.7.13/tools/winegcc/winegcc.c 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/tools/winegcc/winegcc.c 2014-04-04 19:13:44.000000000 +0000 @@ -564,6 +564,16 @@ strarray_add(comp_args, "-D_stdcall=__attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))"); strarray_add(comp_args, "-D_cdecl=__attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))"); } + else if (opts->target_cpu == CPU_ARM || opts->target_cpu == CPU_ARM64) + { + strarray_add(comp_args, "-D__stdcall="); + strarray_add(comp_args, "-D__cdecl="); + strarray_add(comp_args, "-D_stdcall="); + strarray_add(comp_args, "-D_cdecl="); + strarray_add(comp_args, "-D__fastcall="); + strarray_add(comp_args, "-D_fastcall="); + fastcall_done = 1; + } else { strarray_add(comp_args, "-D__stdcall=__attribute__((__stdcall__))"); diff -Nru wine1.7-1.7.13/VERSION wine1.7-1.7.16/VERSION --- wine1.7-1.7.13/VERSION 2014-02-20 18:27:43.000000000 +0000 +++ wine1.7-1.7.16/VERSION 2014-04-04 19:13:44.000000000 +0000 @@ -1 +1 @@ -Wine version 1.7.13 +Wine version 1.7.16