From hugh.mcmaster at outlook.com Sat Nov 1 05:57:05 2014 From: hugh.mcmaster at outlook.com (Hugh McMaster) Date: Sat, 1 Nov 2014 21:57:05 +1100 Subject: [PATCH] cmd/tests: Add tests for 'del' (Fixes bug 35970) Message-ID: Wine currently raises an errorlevel of 1 when trying to delete a non-existant file. This is incorrect. The correct value is 0 for all versions of Windows (on the testbot), except Windows 2000, which raises a value of 1. The patch fixes bug 35970. -------------- next part -------------- A non-text attachment was scrubbed... Name: cmd-tests-del.patch Type: application/octet-stream Size: 2496 bytes Desc: not available URL: From marcus at jet.franken.de Sat Nov 1 11:40:45 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sat, 1 Nov 2014 17:40:45 +0100 Subject: [PATCH] cmd: lastPath is either NULL or not (Coverity) Message-ID: <1414860045-29338-1-git-send-email-marcus@jet.franken.de> 210510 Dereference after null check --- programs/cmd/wcmdmain.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index e5865e6..4ac2715 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1080,12 +1080,17 @@ void WCMD_run_program (WCHAR *command, BOOL called) /* Convert eg. ..\fred to include a directory by removing file part */ GetFullPathNameW(firstParam, sizeof(pathtosearch)/sizeof(WCHAR), pathtosearch, NULL); lastSlash = strrchrW(pathtosearch, '\\'); - if (lastSlash && strchrW(lastSlash, '.') != NULL) extensionsupplied = TRUE; - strcpyW(stemofsearch, lastSlash+1); - - /* Reduce pathtosearch to a path with trailing '\' to support c:\a.bat and - c:\windows\a.bat syntax */ - if (lastSlash) *(lastSlash + 1) = 0x00; + if (lastSlash) + { + if (strchrW(lastSlash, '.') != NULL) extensionsupplied = TRUE; + strcpyW(stemofsearch, lastSlash+1); + /* Reduce pathtosearch to a path with trailing '\' to support c:\a.bat and + c:\windows\a.bat syntax */ + *(lastSlash + 1) = 0x00; + } else { + WINE_FIXME("getfullpathname returned a path %s without slash?\n", pathtosearch); + strcpyW(stemofsearch, pathtosearch); + } } /* Now extract PATHEXT */ -- 1.8.4.5 From frederic.delanoy at gmail.com Sat Nov 1 15:26:31 2014 From: frederic.delanoy at gmail.com (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?=) Date: Sat, 1 Nov 2014 21:26:31 +0100 Subject: [website] French translation for release 1.7.30 Message-ID: <1414873591-20361-1-git-send-email-frederic.delanoy@gmail.com> --- news/fr/2014103101.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 news/fr/2014103101.xml diff --git a/news/fr/2014103101.xml b/news/fr/2014103101.xml new file mode 100644 index 0000000..74aff99 --- /dev/null +++ b/news/fr/2014103101.xml @@ -0,0 +1,15 @@ + +31 octobre 2014 +Sortie de Wine 1.7.30 + +

La version de d?veloppement 1.7.30 de Wine est disponible.

+

Nouveaut?s de cette version : +

    +
  • Meilleure prise en charge des polices de caract?res dans DirectWrite.
  • +
  • Prise en charge am?lior?e des thunks ATL.
  • +
  • Plusieurs fonctions additionnelles dans le moteur d'ex?cution C.
  • +
  • Correctifs dans l'import/export de regedit
  • +
  • Diverses corrections de bugs.
  • +

+

Le code source est disponible d?s ? pr?sent. Les paquets binaires sont en cours de construction, et appara?tront sous peu sur leurs sites de t?l?chargement respectifs. +

-- 2.1.1 From marcus at jet.franken.de Sun Nov 2 04:10:16 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 2 Nov 2014 11:10:16 +0100 Subject: [PATCH] dwrite: remove unused hresult assignment (Coverity) Message-ID: <1414923016-6297-1-git-send-email-marcus@jet.franken.de> 1250627 Unused value it is not checked below either. --- dlls/dwrite/font.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index ed0a760..d5819ef 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1499,7 +1499,7 @@ HRESULT create_font_collection(IDWriteFactory* factory, IDWriteFontFileEnumerato exists = FALSE; hr = collection_find_family(collection, buffer, &index, &exists); if (exists) - hr = fontfamily_add_font(collection->family_data[index], font_data); + fontfamily_add_font(collection->family_data[index], font_data); else { struct dwrite_fontfamily_data *family_data; -- 1.8.4.5 From marcus at jet.franken.de Sun Nov 2 04:10:22 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 2 Nov 2014 11:10:22 +0100 Subject: [PATCH] dwrite: fixed memory leak on error (Coverity) Message-ID: <1414923022-6354-1-git-send-email-marcus@jet.franken.de> 1250624 Resource leak --- dlls/dwrite/font.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 8420fdc..ed0a760 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1476,8 +1476,10 @@ HRESULT create_font_collection(IDWriteFactory* factory, IDWriteFontFileEnumerato init_font_data(factory, file, i, face_type, font_data); hr = get_filestream_from_file(file, &stream); - if (FAILED(hr)) + if (FAILED(hr)) { + heap_free (font_data); return hr; + } /* get family name from font file */ name_table = NULL; -- 1.8.4.5 From mstefani at redhat.de Sun Nov 2 15:28:15 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Sun, 2 Nov 2014 22:28:15 +0100 Subject: crypt32/tests: Avoid an always true ok() condition (PVS-Studio) Message-ID: <20141102212815.GA8794@redhat.com> --- dlls/crypt32/tests/ctl.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/dlls/crypt32/tests/ctl.c b/dlls/crypt32/tests/ctl.c index 55bbc6e..79a60f8 100644 --- a/dlls/crypt32/tests/ctl.c +++ b/dlls/crypt32/tests/ctl.c @@ -390,20 +390,8 @@ static void testAddCTLToStore(void) signedCTLWithCTLInnerContentAndBadSig, sizeof(signedCTLWithCTLInnerContentAndBadSig), CERT_STORE_ADD_NEW, NULL); - if (ret) - { - /* win9x */ - ok(GetLastError() == CRYPT_E_NOT_FOUND || - GetLastError() == OSS_DATA_ERROR /* some win98 */, - "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); - } - else - { - ok(!ret && (GetLastError() == CRYPT_E_EXISTS || - GetLastError() == OSS_DATA_ERROR), - "expected CRYPT_E_EXISTS or OSS_DATA_ERROR, got %d %08x\n", ret, - GetLastError()); - } + ok(!ret && (GetLastError() == CRYPT_E_EXISTS || GetLastError() == OSS_DATA_ERROR), + "expected CRYPT_E_EXISTS or OSS_DATA_ERROR, got %d %08x\n", ret, GetLastError()); CertCloseStore(store, 0); store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, -- 1.8.3.1 From mstefani at redhat.de Sun Nov 2 15:29:55 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Sun, 2 Nov 2014 22:29:55 +0100 Subject: d3d8/tests: Remove an always false condition (PVS-Studio) Message-ID: <20141102212955.GB8794@redhat.com> --- The previous if deals with the !tex and returns. dlls/d3d8/tests/visual.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index ba73bb6..163110c 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -66,7 +66,7 @@ static DWORD getPixelColor(IDirect3DDevice8 *device, UINT x, UINT y) return 0xdeadbeef; } hr = IDirect3DTexture8_GetSurfaceLevel(tex, 0, &surf); - if(FAILED(hr) || !tex ) /* This is not a test */ + if (FAILED(hr)) /* This is not a test */ { trace("Can't get surface from texture, hr=%#08x\n", hr); ret = 0xdeadbeee; -- 1.8.3.1 From mstefani at redhat.de Sun Nov 2 15:31:29 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Sun, 2 Nov 2014 22:31:29 +0100 Subject: gdi32: Remove a basically unused variable (PVS-Studio) Message-ID: <20141102213129.GC8794@redhat.com> --- PVS-Studio complained about the always true and always false conditional subexpressions in the if. dlls/gdi32/freetype.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index d49a3f8..924f5f3 100644 --- a/dlls/gdi32/freetype.c +++ b/dlls/gdi32/freetype.c @@ -6937,7 +6937,6 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, INT x, src_pitch, src_width, src_height, rgb_interval, hmul, vmul; INT x_shift, y_shift; BOOL rgb; - FT_LcdFilter lcdfilter = FT_LCD_FILTER_DEFAULT; FT_Render_Mode render_mode = (format == WINE_GGO_HRGB_BITMAP || format == WINE_GGO_HBGR_BITMAP)? FT_RENDER_MODE_LCD: FT_RENDER_MODE_LCD_V; @@ -6948,20 +6947,17 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, return GDI_ERROR; } - if ( lcdfilter == FT_LCD_FILTER_DEFAULT || lcdfilter == FT_LCD_FILTER_LIGHT ) + if ( render_mode == FT_RENDER_MODE_LCD) { - if ( render_mode == FT_RENDER_MODE_LCD) - { - gm.gmBlackBoxX += 2; - gm.gmptGlyphOrigin.x -= 1; - left -= (1 << 6); - } - else - { - gm.gmBlackBoxY += 2; - gm.gmptGlyphOrigin.y += 1; - top += (1 << 6); - } + gm.gmBlackBoxX += 2; + gm.gmptGlyphOrigin.x -= 1; + left -= (1 << 6); + } + else + { + gm.gmBlackBoxY += 2; + gm.gmptGlyphOrigin.y += 1; + top += (1 << 6); } width = gm.gmBlackBoxX; @@ -6981,7 +6977,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format, pFT_Outline_Transform (&ft_face->glyph->outline, &transMatTategaki); if ( pFT_Library_SetLcdFilter ) - pFT_Library_SetLcdFilter( library, lcdfilter ); + pFT_Library_SetLcdFilter( library, FT_LCD_FILTER_DEFAULT ); pFT_Render_Glyph (ft_face->glyph, render_mode); src = ft_face->glyph->bitmap.buffer; -- 1.8.3.1 From amine.khaldi at reactos.org Sun Nov 2 16:42:53 2014 From: amine.khaldi at reactos.org (Amine Khaldi) Date: Sun, 02 Nov 2014 23:42:53 +0100 Subject: gdi32/tests: Add basic tests for the handling of dwCount parameter in ExtCreateRegion. Message-ID: <5456B36D.6050706@reactos.org> Regards, Amine. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gdi32-tests-Add-basic-tests-for-the-handling-of-dwCo.patch Type: text/x-patch Size: 3272 bytes Desc: not available URL: From austinenglish at gmail.com Sun Nov 2 20:28:02 2014 From: austinenglish at gmail.com (Austin English) Date: Sun, 2 Nov 2014 20:28:02 -0600 Subject: msi: add stubs for MsiRemovePatches(A/W) Message-ID: For https://bugs.winehq.org/show_bug.cgi?id=35722 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index 433776d..6589ca9 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -4244,3 +4244,21 @@ UINT WINAPI Migrate10CachedPackagesW(void* a, void* b, void* c, DWORD d) FIXME("%p,%p,%p,%08x\n", a, b, c, d); return ERROR_SUCCESS; } + +/*********************************************************************** + * MsiRemovePatchesA [MSI.@] + */ +UINT WINAPI MsiRemovePatchesA(LPCSTR patchlist, LPCSTR product, INSTALLTYPE type, LPCSTR propertylist) +{ + FIXME("(%s %s %d %s\n", debugstr_a(patchlist), debugstr_a(product), type, debugstr_a(propertylist)); + return ERROR_SUCCESS; +} + +/*********************************************************************** + * MsiRemovePatchesW [MSI.@] + */ +UINT WINAPI MsiRemovePatchesW(LPCWSTR patchlist, LPCWSTR product, INSTALLTYPE type, LPCWSTR propertylist) +{ + FIXME("(%s %s %d %s\n", debugstr_w(patchlist), debugstr_w(product), type, debugstr_w(propertylist)); + return ERROR_SUCCESS; +} diff --git a/dlls/msi/msi.spec b/dlls/msi/msi.spec index a2b1007..2d065b1 100644 --- a/dlls/msi/msi.spec +++ b/dlls/msi/msi.spec @@ -230,8 +230,8 @@ 234 stub MsiDeleteUserDataW 235 stub Migrate10CachedPackagesA 236 stdcall Migrate10CachedPackagesW(ptr ptr ptr long) -237 stub MsiRemovePatchesA -238 stub MsiRemovePatchesW +237 stdcall MsiRemovePatchesA(str str long str) +238 stdcall MsiRemovePatchesW(wstr wstr long wstr) 239 stdcall MsiApplyMultiplePatchesA(str str str) 240 stdcall MsiApplyMultiplePatchesW(wstr wstr wstr) 241 stub MsiExtractPatchXMLDataA From sebastian at fds-team.de Sun Nov 2 23:35:11 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 03 Nov 2014 06:35:11 +0100 Subject: [1/2] d3dx9_36: Implement D3DXCreatePolygon. Message-ID: <5457140F.40703@fds-team.de> Based on a patch by David Adam. For bug 13632. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 89 +++++++++++++++++++++++++++++++++++++++++++++ include/d3dx9shape.h | 2 + 3 files changed, 92 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-Implement-D3DXCreatePolygon.patch Type: text/x-patch Size: 4942 bytes Desc: not available URL: From sebastian at fds-team.de Sun Nov 2 23:35:17 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 03 Nov 2014 06:35:17 +0100 Subject: [2/2] d3dx9_36/tests: Add tests for D3DXCreatePolygon. Message-ID: <54571415.4090202@fds-team.de> Based on a patch by David Adam. --- dlls/d3dx9_36/tests/mesh.c | 154 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch Type: text/x-patch Size: 5597 bytes Desc: not available URL: From sebastian at fds-team.de Sun Nov 2 23:46:55 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 03 Nov 2014 06:46:55 +0100 Subject: [1/2] iphlpapi: Add stub for CancelMibChangeNotify2. Message-ID: <545716CF.5020503@fds-team.de> Based on a patch by Yann Leretaille. For bug 34573. --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-iphlpapi-Add-stub-for-CancelMibChangeNotify2.patch Type: text/x-patch Size: 1542 bytes Desc: not available URL: From sebastian at fds-team.de Sun Nov 2 23:47:02 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 03 Nov 2014 06:47:02 +0100 Subject: [2/2] iphlpapi: Add stub for NotifyIpInterfaceChange. Message-ID: <545716D6.1010807@fds-team.de> Based on a patch by Yann Leretaille. For bug 34573. --- dlls/iphlpapi/iphlpapi.spec | 2 +- dlls/iphlpapi/iphlpapi_main.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-iphlpapi-Add-stub-for-NotifyIpInterfaceChange.patch Type: text/x-patch Size: 1855 bytes Desc: not available URL: From sebastian at fds-team.de Sun Nov 2 23:59:49 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 03 Nov 2014 06:59:49 +0100 Subject: user32: Fix invalid argument passed to ExtCreateRegion. Message-ID: <545719D5.20207@fds-team.de> The tests http://source.winehq.org/patches/data/107382 show that ExtCreateRegion is called with incorrect arguments at a lot of places in the wine source. Please note that the variable 'size' doesn't include the header size. At one place the RECT count is passed instead of the size in bytes. --- dlls/user32/painting.c | 4 ++-- dlls/user32/winpos.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-Fix-invalid-argument-passed-to-ExtCreateRegio.patch Type: text/x-patch Size: 3184 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 3 00:07:01 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 03 Nov 2014 07:07:01 +0100 Subject: kernel32: Set proper error codes if FindFirstFileExW doesn't support specific search_ops / levels. Message-ID: <54571B85.7010304@fds-team.de> --- dlls/kernel32/file.c | 2 ++ 1 file changed, 2 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-kernel32-Set-proper-error-codes-if-FindFirstFileExW-.patch Type: text/x-patch Size: 1045 bytes Desc: not available URL: From penghao at linuxdeepin.com Mon Nov 3 01:26:39 2014 From: penghao at linuxdeepin.com (=?utf-8?B?SGFvIFBlbmc=?=) Date: Mon, 3 Nov 2014 15:26:39 +0800 Subject: [PATCH] iphlpapi: call WSASetLastError in NotifyAddrChange/NotifyRouteChange Message-ID: call WSASetLastError in NotifyAddrChange/NotifyRouteChange to make following DEMO code working. void main() { OVERLAPPED overlap; DWORD ret; HANDLE hand = NULL; overlap.hEvent = WSACreateEvent(); ret = NotifyAddrChange(&hand, &overlap); if (ret != NO_ERROR) { if (WSAGetLastError() != WSA_IO_PENDING) { printf("NotifyAddrChange error...%d\n", WSAGetLastError()); return; } } if ( WaitForSingleObject(overlap.hEvent, INFINITE) == WAIT_OBJECT_0 ) printf("IP Address table changed..\n"); } --- dlls/iphlpapi/iphlpapi_main.c | 57 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 12 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-iphlpapi-call-WSASetLastError-in-NotifyAddrChange-Noti.txt Type: application/octet-stream Size: 6062 bytes Desc: not available URL: From hverbeet at codeweavers.com Mon Nov 3 01:59:34 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 3 Nov 2014 08:59:34 +0100 Subject: [PATCH 1/5] d3d10core: Implement d3d10_device_ClearState(). Message-ID: <1415001578-16597-1-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/device.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index aac53dd..05639b9 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -1260,7 +1260,73 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_SetPrivateDataInterface(ID3D10Devi static void STDMETHODCALLTYPE d3d10_device_ClearState(ID3D10Device1 *iface) { - FIXME("iface %p stub!\n", iface); + static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f}; + struct d3d10_device *device = impl_from_ID3D10Device(iface); + unsigned int i; + + TRACE("iface %p.\n", iface); + + wined3d_device_set_vertex_shader(device->wined3d_device, NULL); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + wined3d_device_set_vs_sampler(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + wined3d_device_set_vs_resource_view(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + wined3d_device_set_vs_cb(device->wined3d_device, i, NULL); + } + wined3d_device_set_geometry_shader(device->wined3d_device, NULL); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + wined3d_device_set_gs_sampler(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + wined3d_device_set_gs_resource_view(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + wined3d_device_set_gs_cb(device->wined3d_device, i, NULL); + } + wined3d_device_set_pixel_shader(device->wined3d_device, NULL); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + wined3d_device_set_ps_sampler(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + wined3d_device_set_ps_resource_view(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + wined3d_device_set_ps_cb(device->wined3d_device, i, NULL); + } + for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + wined3d_device_set_stream_source(device->wined3d_device, i, NULL, 0, 0); + } + wined3d_device_set_index_buffer(device->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + wined3d_device_set_vertex_declaration(device->wined3d_device, NULL); + wined3d_device_set_primitive_type(device->wined3d_device, WINED3D_PT_UNDEFINED); + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + wined3d_device_set_rendertarget_view(device->wined3d_device, i, NULL, FALSE); + } + wined3d_device_set_depth_stencil_view(device->wined3d_device, NULL); + ID3D10Device1_OMSetDepthStencilState(iface, NULL, 0); + ID3D10Device1_OMSetBlendState(iface, NULL, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device1_RSSetViewports(iface, 0, NULL); + ID3D10Device1_RSSetScissorRects(iface, 0, NULL); + ID3D10Device1_RSSetState(iface, NULL); + for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) + { + wined3d_device_set_stream_output(device->wined3d_device, i, NULL, 0); + } + wined3d_device_set_predication(device->wined3d_device, NULL, FALSE); } static void STDMETHODCALLTYPE d3d10_device_Flush(ID3D10Device1 *iface) -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 3 01:59:36 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 3 Nov 2014 08:59:36 +0100 Subject: [PATCH 3/5] d2d1: Pass the correct vtbl in d2d_linear_gradient_brush_init(). Message-ID: <1415001578-16597-3-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index ed92d60..6e46036 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -412,5 +412,5 @@ void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1RenderTarget * { FIXME("Ignoring brush properties.\n"); - d2d_brush_init(brush, render_target, brush_desc, (ID2D1BrushVtbl *)&d2d_solid_color_brush_vtbl); + d2d_brush_init(brush, render_target, brush_desc, (ID2D1BrushVtbl *)&d2d_linear_gradient_brush_vtbl); } -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 3 01:59:37 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 3 Nov 2014 08:59:37 +0100 Subject: [PATCH 4/5] d2d1: Implement d2d_gradient_GetGradientStopCount(). Message-ID: <1415001578-16597-4-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 8 ++++++-- dlls/d2d1/d2d1_private.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 6e46036..4d7a5ad 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -80,9 +80,11 @@ static void STDMETHODCALLTYPE d2d_gradient_GetFactory(ID2D1GradientStopCollectio static UINT32 STDMETHODCALLTYPE d2d_gradient_GetGradientStopCount(ID2D1GradientStopCollection *iface) { - FIXME("iface %p stub!\n", iface); + struct d2d_gradient *gradient = impl_from_ID2D1GradientStopCollection(iface); - return 0; + TRACE("iface %p.\n", iface); + + return gradient->stop_count; } static void STDMETHODCALLTYPE d2d_gradient_GetGradientStops(ID2D1GradientStopCollection *iface, @@ -124,6 +126,8 @@ void d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_ gradient->ID2D1GradientStopCollection_iface.lpVtbl = &d2d_gradient_vtbl; gradient->refcount = 1; + + gradient->stop_count = stop_count; } static void d2d_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target, diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 2d1fea2..3fd3cdd 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -85,6 +85,8 @@ struct d2d_gradient { ID2D1GradientStopCollection ID2D1GradientStopCollection_iface; LONG refcount; + + UINT32 stop_count; }; void d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target, -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 3 01:59:35 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 3 Nov 2014 08:59:35 +0100 Subject: [PATCH 2/5] d3d10core/tests: Add a test for ID3D10Device_ClearState(). Message-ID: <1415001578-16597-2-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/tests/device.c | 868 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 868 insertions(+) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 4b3a325..7387231 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -20,6 +20,7 @@ #include "initguid.h" #include "d3d10.h" #include "wine/test.h" +#include static ULONG get_refcount(IUnknown *iface) { @@ -27,6 +28,22 @@ static ULONG get_refcount(IUnknown *iface) return IUnknown_Release(iface); } +static BOOL compare_float(float f, float g, unsigned int ulps) +{ + int x = *(int *)&f; + int y = *(int *)&g; + + if (x < 0) + x = INT_MIN - x; + if (y < 0) + y = INT_MIN - y; + + if (abs(x - y) > ulps) + return FALSE; + + return TRUE; +} + static BOOL compare_color(DWORD c1, DWORD c2, BYTE max_diff) { if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) @@ -1186,6 +1203,856 @@ static void test_scissor(void) DestroyWindow(window); } +static void test_clear_state(void) +{ + static const D3D10_INPUT_ELEMENT_DESC layout_desc[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + }; +#if 0 +float4 main(float4 pos : POSITION) : POSITION +{ + return pos; +} +#endif + static const DWORD simple_vs[] = + { + 0x43425844, 0x66689e7c, 0x643f0971, 0xb7f67ff4, 0xabc48688, 0x00000001, 0x000000d4, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0xababab00, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x52444853, 0x00000038, 0x00010040, + 0x0000000e, 0x0300005f, 0x001010f2, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x05000036, + 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, + }; + +#if 0 +struct gs_out +{ + float4 pos : SV_POSITION; +}; + +[maxvertexcount(4)] +void main(point float4 vin[1] : POSTION, inout TriangleStream vout) +{ + float offset = 0.1 * vin[0].w; + gs_out v; + + v.pos = float4(vin[0].x - offset, vin[0].y - offset, vin[0].z, vin[0].w); + vout.Append(v); + v.pos = float4(vin[0].x - offset, vin[0].y + offset, vin[0].z, vin[0].w); + vout.Append(v); + v.pos = float4(vin[0].x + offset, vin[0].y - offset, vin[0].z, vin[0].w); + vout.Append(v); + v.pos = float4(vin[0].x + offset, vin[0].y + offset, vin[0].z, vin[0].w); + vout.Append(v); +} +#endif + static const DWORD simple_gs[] = + { + 0x43425844, 0x9786dfb7, 0xad78ae61, 0x34364b9a, 0xf3b719f8, 0x00000001, 0x00000238, 0x00000003, + 0x0000002c, 0x0000005c, 0x00000090, 0x4e475349, 0x00000028, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x54534f50, 0x004e4f49, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, 0x00000000, + 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x000001a0, 0x00020040, 0x00000068, + 0x0400005f, 0x002010f2, 0x00000001, 0x00000000, 0x02000068, 0x00000001, 0x0100085d, 0x0100285c, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x0200005e, 0x00000004, 0x0f000032, 0x00100032, + 0x00000000, 0x80201ff6, 0x00000041, 0x00000000, 0x00000000, 0x00004002, 0x3dcccccd, 0x3dcccccd, + 0x00000000, 0x00000000, 0x00201046, 0x00000000, 0x00000000, 0x05000036, 0x00102032, 0x00000000, + 0x00100046, 0x00000000, 0x06000036, 0x001020c2, 0x00000000, 0x00201ea6, 0x00000000, 0x00000000, + 0x01000013, 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x0e000032, 0x00100052, + 0x00000000, 0x00201ff6, 0x00000000, 0x00000000, 0x00004002, 0x3dcccccd, 0x00000000, 0x3dcccccd, + 0x00000000, 0x00201106, 0x00000000, 0x00000000, 0x05000036, 0x00102022, 0x00000000, 0x0010002a, + 0x00000000, 0x06000036, 0x001020c2, 0x00000000, 0x00201ea6, 0x00000000, 0x00000000, 0x01000013, + 0x05000036, 0x00102012, 0x00000000, 0x0010000a, 0x00000000, 0x05000036, 0x00102022, 0x00000000, + 0x0010001a, 0x00000000, 0x06000036, 0x001020c2, 0x00000000, 0x00201ea6, 0x00000000, 0x00000000, + 0x01000013, 0x05000036, 0x00102032, 0x00000000, 0x00100086, 0x00000000, 0x06000036, 0x001020c2, + 0x00000000, 0x00201ea6, 0x00000000, 0x00000000, 0x01000013, 0x0100003e, + }; + +#if 0 +float4 main(float4 color : COLOR) : SV_TARGET +{ + return color; +} +#endif + static const DWORD simple_ps[] = + { + 0x43425844, 0x08c2b568, 0x17d33120, 0xb7d82948, 0x13a570fb, 0x00000001, 0x000000d0, 0x00000003, + 0x0000002c, 0x0000005c, 0x00000090, 0x4e475349, 0x00000028, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x4f4c4f43, 0xabab0052, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000038, 0x00000040, 0x0000000e, + 0x03001062, 0x001010f2, 0x00000000, 0x03000065, 0x001020f2, 0x00000000, 0x05000036, 0x001020f2, + 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, + }; + + D3D10_VIEWPORT tmp_viewport[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + ID3D10ShaderResourceView *tmp_srv[D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]; + ID3D10ShaderResourceView *srv[D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT]; + ID3D10RenderTargetView *tmp_rtv[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT]; + RECT tmp_rect[D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE]; + ID3D10SamplerState *tmp_sampler[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + ID3D10RenderTargetView *rtv[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT]; + ID3D10Texture2D *rt_texture[D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT]; + ID3D10Buffer *cb[D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT]; + ID3D10Buffer *tmp_buffer[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; + ID3D10SamplerState *sampler[D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT]; + ID3D10Buffer *buffer[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; + UINT offset[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; + UINT stride[D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT]; + ID3D10Buffer *so_buffer[D3D10_SO_BUFFER_SLOT_COUNT]; + ID3D10InputLayout *tmp_input_layout, *input_layout; + ID3D10DepthStencilState *tmp_ds_state, *ds_state; + ID3D10BlendState *tmp_blend_state, *blend_state; + ID3D10RasterizerState *tmp_rs_state, *rs_state; + ID3D10Predicate *tmp_predicate, *predicate; + D3D10_SHADER_RESOURCE_VIEW_DESC srv_desc; + ID3D10DepthStencilView *tmp_dsv, *dsv; + D3D10_PRIMITIVE_TOPOLOGY topology; + D3D10_TEXTURE2D_DESC texture_desc; + ID3D10GeometryShader *tmp_gs, *gs; + D3D10_DEPTH_STENCIL_DESC ds_desc; + ID3D10VertexShader *tmp_vs, *vs; + D3D10_SAMPLER_DESC sampler_desc; + D3D10_QUERY_DESC predicate_desc; + ID3D10PixelShader *tmp_ps, *ps; + D3D10_RASTERIZER_DESC rs_desc; + D3D10_BUFFER_DESC buffer_desc; + D3D10_BLEND_DESC blend_desc; + ID3D10Texture2D *ds_texture; + float blend_factor[4]; + ID3D10Device *device; + BOOL predicate_value; + DXGI_FORMAT format; + UINT sample_mask; + UINT stencil_ref; + ULONG refcount; + UINT count, i; + HRESULT hr; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + + /* Verify the initial state after device creation. */ + + ID3D10Device_VSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected constant buffer %p in slot %u.\n", tmp_buffer[i], i); + } + ID3D10Device_VSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_srv[i], "Got unexpected shader resource view %p in slot %u.\n", tmp_srv[i], i); + } + ID3D10Device_VSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } + ID3D10Device_VSGetShader(device, &tmp_vs); + ok(!tmp_vs, "Got unexpected vertex shader %p.\n", tmp_vs); + + ID3D10Device_GSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected constant buffer %p in slot %u.\n", tmp_buffer[i], i); + } + ID3D10Device_GSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_srv[i], "Got unexpected shader resource view %p in slot %u.\n", tmp_srv[i], i); + } + ID3D10Device_GSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } + ID3D10Device_GSGetShader(device, &tmp_gs); + ok(!tmp_gs, "Got unexpected geometry shader %p.\n", tmp_gs); + + ID3D10Device_PSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected constant buffer %p in slot %u.\n", tmp_buffer[i], i); + } + ID3D10Device_PSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_srv[i], "Got unexpected shader resource view %p in slot %u.\n", tmp_srv[i], i); + } + ID3D10Device_PSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } + ID3D10Device_PSGetShader(device, &tmp_ps); + ok(!tmp_ps, "Got unexpected pixel shader %p.\n", tmp_ps); + + ID3D10Device_IAGetVertexBuffers(device, 0, D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, tmp_buffer, stride, offset); + for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i); + ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i); + ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i); + } + ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset); + ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]); + ok(format == DXGI_FORMAT_UNKNOWN, "Got unexpected index buffer format %#x.\n", format); + ok(!offset[0], "Got unexpected index buffer offset %u.\n", offset[0]); + ID3D10Device_IAGetInputLayout(device, &tmp_input_layout); + ok(!tmp_input_layout, "Got unexpected input layout %p.\n", tmp_input_layout); + ID3D10Device_IAGetPrimitiveTopology(device, &topology); + ok(topology == D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED, "Got unexpected primitive topology %#x.\n", topology); + + ID3D10Device_OMGetBlendState(device, &tmp_blend_state, blend_factor, &sample_mask); + ok(!tmp_blend_state, "Got unexpected blend state %p.\n", tmp_blend_state); + ok(blend_factor[0] == 1.0f && blend_factor[1] == 1.0f + && blend_factor[2] == 1.0f && blend_factor[3] == 1.0f, + "Got unexpected blend factor {%.8e, %.8e, %.8e, %.8e}.\n", + blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3]); + ok(sample_mask == D3D10_DEFAULT_SAMPLE_MASK, "Got unexpected sample mask %#x.\n", sample_mask); + ID3D10Device_OMGetDepthStencilState(device, &tmp_ds_state, &stencil_ref); + ok(!tmp_ds_state, "Got unexpected depth stencil state %p.\n", tmp_ds_state); + ok(!stencil_ref, "Got unexpected stencil ref %u.\n", stencil_ref); + ID3D10Device_OMGetRenderTargets(device, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT, tmp_rtv, &tmp_dsv); + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + ok(!tmp_rtv[i], "Got unexpected render target view %p in slot %u.\n", tmp_rtv[i], i); + } + ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv); + + ID3D10Device_RSGetScissorRects(device, &count, NULL); + todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count); + memset(tmp_rect, 0x55, sizeof(tmp_rect)); + count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; + ID3D10Device_RSGetScissorRects(device, &count, tmp_rect); + for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) + { + ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom, + "Got unexpected scissor rect {%d, %d, %d, %d} in slot %u.\n", + tmp_rect[i].left, tmp_rect[i].top, tmp_rect[i].right, tmp_rect[i].bottom, i); + } + ID3D10Device_RSGetViewports(device, &count, NULL); + todo_wine ok(!count, "Got unexpected viewport count %u.\n", count); + memset(tmp_viewport, 0x55, sizeof(tmp_viewport)); + count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; + ID3D10Device_RSGetViewports(device, &count, tmp_viewport); + for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) + { + ok(!tmp_viewport[i].TopLeftX && !tmp_viewport[i].TopLeftY && !tmp_viewport[i].Width + && !tmp_viewport[i].Height && !tmp_viewport[i].MinDepth && !tmp_viewport[i].MaxDepth, + "Got unexpected viewport {%d, %d, %u, %u, %.8e, %.8e} in slot %u.\n", + tmp_viewport[i].TopLeftX, tmp_viewport[i].TopLeftY, tmp_viewport[i].Width, + tmp_viewport[i].Height, tmp_viewport[i].MinDepth, tmp_viewport[i].MaxDepth, i); + } + ID3D10Device_RSGetState(device, &tmp_rs_state); + ok(!tmp_rs_state, "Got unexpected rasterizer state %p.\n", tmp_rs_state); + + ID3D10Device_SOGetTargets(device, D3D10_SO_BUFFER_SLOT_COUNT, tmp_buffer, offset); + for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected stream output %p in slot %u.\n", tmp_buffer[i], i); + ok(!offset[i], "Got unexpected stream output offset %u in slot %u.\n", offset[i], i); + } + + ID3D10Device_GetPredication(device, &tmp_predicate, &predicate_value); + ok(!tmp_predicate, "Got unexpected predicate %p.\n", tmp_predicate); + ok(!predicate_value, "Got unexpected predicate value %#x.\n", predicate_value); + + /* Create resources. */ + + buffer_desc.ByteWidth = 1024; + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = 0; + + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &cb[i]); + ok(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr); + } + + buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER | D3D10_BIND_INDEX_BUFFER | D3D10_BIND_SHADER_RESOURCE; + + for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &buffer[i]); + ok(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr); + + stride[i] = (i + 1) * 4; + offset[i] = (i + 1) * 16; + } + + buffer_desc.BindFlags = D3D10_BIND_STREAM_OUTPUT; + + for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) + { + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, NULL, &so_buffer[i]); + ok(SUCCEEDED(hr), "Failed to create buffer, hr %#x.\n", hr); + } + + srv_desc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT; + srv_desc.ViewDimension = D3D10_SRV_DIMENSION_BUFFER; + U(srv_desc).Buffer.ElementOffset = 0; + U(srv_desc).Buffer.ElementWidth = 64; + + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + hr = ID3D10Device_CreateShaderResourceView(device, + (ID3D10Resource *)buffer[i % D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT], &srv_desc, &srv[i]); + ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr); + } + + sampler_desc.Filter = D3D10_FILTER_MIN_MAG_MIP_LINEAR; + sampler_desc.AddressU = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressV = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.AddressW = D3D10_TEXTURE_ADDRESS_CLAMP; + sampler_desc.MipLODBias = 0.0f; + sampler_desc.MaxAnisotropy = 16; + sampler_desc.ComparisonFunc = D3D10_COMPARISON_NEVER; + sampler_desc.BorderColor[0] = 0.0f; + sampler_desc.BorderColor[1] = 0.0f; + sampler_desc.BorderColor[2] = 0.0f; + sampler_desc.BorderColor[3] = 0.0f; + sampler_desc.MinLOD = 0.0f; + sampler_desc.MaxLOD = 16.0f; + + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + sampler_desc.MinLOD = (float)i; + + hr = ID3D10Device_CreateSamplerState(device, &sampler_desc, &sampler[i]); + ok(SUCCEEDED(hr), "Failed to create sampler state, hr %#x.\n", hr); + } + + hr = ID3D10Device_CreateVertexShader(device, simple_vs, sizeof(simple_vs), &vs); + ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); + + hr = ID3D10Device_CreateGeometryShader(device, simple_gs, sizeof(simple_gs), &gs); + ok(SUCCEEDED(hr), "Failed to create geometry shader, hr %#x.\n", hr); + + hr = ID3D10Device_CreatePixelShader(device, simple_ps, sizeof(simple_ps), &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + hr = ID3D10Device_CreateInputLayout(device, layout_desc, sizeof(layout_desc) / sizeof(*layout_desc), + simple_vs, sizeof(simple_vs), &input_layout); + ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); + + blend_desc.AlphaToCoverageEnable = FALSE; + blend_desc.BlendEnable[0] = FALSE; + blend_desc.BlendEnable[1] = FALSE; + blend_desc.BlendEnable[2] = FALSE; + blend_desc.BlendEnable[3] = FALSE; + blend_desc.BlendEnable[4] = FALSE; + blend_desc.BlendEnable[5] = FALSE; + blend_desc.BlendEnable[6] = FALSE; + blend_desc.BlendEnable[7] = FALSE; + blend_desc.SrcBlend = D3D10_BLEND_ONE; + blend_desc.DestBlend = D3D10_BLEND_ZERO; + blend_desc.BlendOp = D3D10_BLEND_OP_ADD; + blend_desc.SrcBlendAlpha = D3D10_BLEND_ONE; + blend_desc.DestBlendAlpha = D3D10_BLEND_ZERO; + blend_desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + blend_desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[1] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[2] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[3] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[4] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[5] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[6] = D3D10_COLOR_WRITE_ENABLE_ALL; + blend_desc.RenderTargetWriteMask[7] = D3D10_COLOR_WRITE_ENABLE_ALL; + + hr = ID3D10Device_CreateBlendState(device, &blend_desc, &blend_state); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + + ds_desc.DepthEnable = TRUE; + ds_desc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL; + ds_desc.DepthFunc = D3D10_COMPARISON_LESS; + ds_desc.StencilEnable = FALSE; + ds_desc.StencilReadMask = D3D10_DEFAULT_STENCIL_READ_MASK; + ds_desc.StencilWriteMask = D3D10_DEFAULT_STENCIL_WRITE_MASK; + ds_desc.FrontFace.StencilFailOp = D3D10_STENCIL_OP_KEEP; + ds_desc.FrontFace.StencilDepthFailOp = D3D10_STENCIL_OP_KEEP; + ds_desc.FrontFace.StencilPassOp = D3D10_STENCIL_OP_KEEP; + ds_desc.FrontFace.StencilFunc = D3D10_COMPARISON_ALWAYS; + ds_desc.BackFace.StencilFailOp = D3D10_STENCIL_OP_KEEP; + ds_desc.BackFace.StencilDepthFailOp = D3D10_STENCIL_OP_KEEP; + ds_desc.BackFace.StencilPassOp = D3D10_STENCIL_OP_KEEP; + ds_desc.BackFace.StencilFunc = D3D10_COMPARISON_ALWAYS; + + hr = ID3D10Device_CreateDepthStencilState(device, &ds_desc, &ds_state); + ok(SUCCEEDED(hr), "Failed to create depthstencil state, hr %#x.\n", hr); + + texture_desc.Width = 512; + texture_desc.Height = 512; + texture_desc.MipLevels = 1; + texture_desc.ArraySize = 1; + texture_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + texture_desc.SampleDesc.Count = 1; + texture_desc.SampleDesc.Quality = 0; + texture_desc.Usage = D3D10_USAGE_DEFAULT; + texture_desc.BindFlags = D3D10_BIND_RENDER_TARGET; + texture_desc.CPUAccessFlags = 0; + texture_desc.MiscFlags = 0; + + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &rt_texture[i]); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + } + + texture_desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT; + texture_desc.BindFlags = D3D10_BIND_DEPTH_STENCIL; + + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &ds_texture); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)rt_texture[i], NULL, &rtv[i]); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + } + + hr = ID3D10Device_CreateDepthStencilView(device, (ID3D10Resource *)ds_texture, NULL, &dsv); + ok(SUCCEEDED(hr), "Failed to create depthstencil view, hr %#x.\n", hr); + + for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) + { + tmp_rect[i].left = i; + tmp_rect[i].top = i * 2; + tmp_rect[i].right = i + 1; + tmp_rect[i].bottom = (i + 1) * 2; + + tmp_viewport[i].TopLeftX = i * 3; + tmp_viewport[i].TopLeftY = i * 4; + tmp_viewport[i].Width = 3; + tmp_viewport[i].Height = 4; + tmp_viewport[i].MinDepth = i * 0.01f; + tmp_viewport[i].MaxDepth = (i + 1) * 0.01f; + } + + rs_desc.FillMode = D3D10_FILL_SOLID; + rs_desc.CullMode = D3D10_CULL_BACK; + rs_desc.FrontCounterClockwise = FALSE; + rs_desc.DepthBias = 0; + rs_desc.DepthBiasClamp = 0.0f; + rs_desc.SlopeScaledDepthBias = 0.0f; + rs_desc.DepthClipEnable = TRUE; + rs_desc.ScissorEnable = FALSE; + rs_desc.MultisampleEnable = FALSE; + rs_desc.AntialiasedLineEnable = FALSE; + + hr = ID3D10Device_CreateRasterizerState(device, &rs_desc, &rs_state); + ok(SUCCEEDED(hr), "Failed to create rasterizer state, hr %#x.\n", hr); + + predicate_desc.Query = D3D10_QUERY_OCCLUSION_PREDICATE; + predicate_desc.MiscFlags = 0; + + hr = ID3D10Device_CreatePredicate(device, &predicate_desc, &predicate); + ok(SUCCEEDED(hr), "Failed to create predicate, hr %#x.\n", hr); + + /* Setup state. */ + ID3D10Device_VSSetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, cb); + ID3D10Device_VSSetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, srv); + ID3D10Device_VSSetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, sampler); + ID3D10Device_VSSetShader(device, vs); + + ID3D10Device_GSSetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, cb); + ID3D10Device_GSSetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, srv); + ID3D10Device_GSSetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, sampler); + ID3D10Device_GSSetShader(device, gs); + + ID3D10Device_PSSetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, cb); + ID3D10Device_PSSetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, srv); + ID3D10Device_PSSetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, sampler); + ID3D10Device_PSSetShader(device, ps); + + ID3D10Device_IASetVertexBuffers(device, 0, D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, buffer, stride, offset); + ID3D10Device_IASetIndexBuffer(device, buffer[0], DXGI_FORMAT_R32_UINT, offset[0]); + ID3D10Device_IASetInputLayout(device, input_layout); + ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + + blend_factor[0] = 0.1f; + blend_factor[1] = 0.2f; + blend_factor[2] = 0.3f; + blend_factor[3] = 0.4f; + ID3D10Device_OMSetBlendState(device, blend_state, blend_factor, 0xff00ff00); + ID3D10Device_OMSetDepthStencilState(device, ds_state, 3); + ID3D10Device_OMSetRenderTargets(device, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT, rtv, dsv); + + ID3D10Device_RSSetScissorRects(device, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, tmp_rect); + ID3D10Device_RSSetViewports(device, D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, tmp_viewport); + ID3D10Device_RSSetState(device, rs_state); + + ID3D10Device_SOSetTargets(device, D3D10_SO_BUFFER_SLOT_COUNT, so_buffer, offset); + + ID3D10Device_SetPredication(device, predicate, TRUE); + + /* Verify the set state. */ + + ID3D10Device_VSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(tmp_buffer[i] == cb[i], "Got unexpected constant buffer %p in slot %u, expected %p.\n", + tmp_buffer[i], i, cb[i]); + ID3D10Buffer_Release(tmp_buffer[i]); + } + ID3D10Device_VSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(tmp_srv[i] == srv[i], "Got unexpected shader resource view %p in slot %u, expected %p.\n", + tmp_srv[i], i, srv[i]); + ID3D10ShaderResourceView_Release(tmp_srv[i]); + } + ID3D10Device_VSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(tmp_sampler[i] == sampler[i], "Got unexpected sampler %p in slot %u, expected %p.\n", + tmp_sampler[i], i, sampler[i]); + ID3D10SamplerState_Release(tmp_sampler[i]); + } + ID3D10Device_VSGetShader(device, &tmp_vs); + ok(tmp_vs == vs, "Got unexpected vertex shader %p, expected %p.\n", tmp_vs, vs); + ID3D10VertexShader_Release(tmp_vs); + + ID3D10Device_GSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(tmp_buffer[i] == cb[i], "Got unexpected constant buffer %p in slot %u, expected %p.\n", + tmp_buffer[i], i, cb[i]); + ID3D10Buffer_Release(tmp_buffer[i]); + } + ID3D10Device_GSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(tmp_srv[i] == srv[i], "Got unexpected shader resource view %p in slot %u, expected %p.\n", + tmp_srv[i], i, srv[i]); + ID3D10ShaderResourceView_Release(tmp_srv[i]); + } + ID3D10Device_GSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(tmp_sampler[i] == sampler[i], "Got unexpected sampler %p in slot %u, expected %p.\n", + tmp_sampler[i], i, sampler[i]); + ID3D10SamplerState_Release(tmp_sampler[i]); + } + ID3D10Device_GSGetShader(device, &tmp_gs); + ok(tmp_gs == gs, "Got unexpected geometry shader %p, expected %p.\n", tmp_gs, gs); + ID3D10GeometryShader_Release(tmp_gs); + + ID3D10Device_PSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(tmp_buffer[i] == cb[i], "Got unexpected constant buffer %p in slot %u, expected %p.\n", + tmp_buffer[i], i, cb[i]); + ID3D10Buffer_Release(tmp_buffer[i]); + } + ID3D10Device_PSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(tmp_srv[i] == srv[i], "Got unexpected shader resource view %p in slot %u, expected %p.\n", + tmp_srv[i], i, srv[i]); + ID3D10ShaderResourceView_Release(tmp_srv[i]); + } + ID3D10Device_PSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(tmp_sampler[i] == sampler[i], "Got unexpected sampler %p in slot %u, expected %p.\n", + tmp_sampler[i], i, sampler[i]); + ID3D10SamplerState_Release(tmp_sampler[i]); + } + ID3D10Device_PSGetShader(device, &tmp_ps); + ok(tmp_ps == ps, "Got unexpected pixel shader %p, expected %p.\n", tmp_ps, ps); + ID3D10PixelShader_Release(tmp_ps); + + ID3D10Device_IAGetVertexBuffers(device, 0, D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, tmp_buffer, stride, offset); + for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(tmp_buffer[i] == buffer[i], "Got unexpected vertex buffer %p in slot %u, expected %p.\n", + tmp_buffer[i], i, buffer[i]); + ok(stride[i] == (i + 1) * 4, "Got unexpected stride %u in slot %u.\n", stride[i], i); + ok(offset[i] == (i + 1) * 16, "Got unexpected offset %u in slot %u.\n", offset[i], i); + ID3D10Buffer_Release(tmp_buffer[i]); + } + ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset); + ok(tmp_buffer[0] == buffer[0], "Got unexpected index buffer %p, expected %p.\n", tmp_buffer[0], buffer[0]); + ID3D10Buffer_Release(tmp_buffer[0]); + ok(format == DXGI_FORMAT_R32_UINT, "Got unexpected index buffer format %#x.\n", format); + todo_wine ok(offset[0] == 16, "Got unexpected index buffer offset %u.\n", offset[0]); + ID3D10Device_IAGetInputLayout(device, &tmp_input_layout); + ok(tmp_input_layout == input_layout, "Got unexpected input layout %p, expected %p.\n", + tmp_input_layout, input_layout); + ID3D10InputLayout_Release(tmp_input_layout); + ID3D10Device_IAGetPrimitiveTopology(device, &topology); + ok(topology == D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, "Got unexpected primitive topology %#x.\n", topology); + + ID3D10Device_OMGetBlendState(device, &tmp_blend_state, blend_factor, &sample_mask); + ok(tmp_blend_state == blend_state, "Got unexpected blend state %p, expected %p.\n", tmp_blend_state, blend_state); + ID3D10BlendState_Release(tmp_blend_state); + ok(blend_factor[0] == 0.1f && blend_factor[1] == 0.2f + && blend_factor[2] == 0.3f && blend_factor[3] == 0.4f, + "Got unexpected blend factor {%.8e, %.8e, %.8e, %.8e}.\n", + blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3]); + ok(sample_mask == 0xff00ff00, "Got unexpected sample mask %#x.\n", sample_mask); + ID3D10Device_OMGetDepthStencilState(device, &tmp_ds_state, &stencil_ref); + ok(tmp_ds_state == ds_state, "Got unexpected depth stencil state %p, expected %p.\n", tmp_ds_state, ds_state); + ID3D10DepthStencilState_Release(tmp_ds_state); + ok(stencil_ref == 3, "Got unexpected stencil ref %u.\n", stencil_ref); + ID3D10Device_OMGetRenderTargets(device, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT, tmp_rtv, &tmp_dsv); + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + ok(tmp_rtv[i] == rtv[i], "Got unexpected render target view %p in slot %u, expected %p.\n", + tmp_rtv[i], i, rtv[i]); + ID3D10RenderTargetView_Release(tmp_rtv[i]); + } + ok(tmp_dsv == dsv, "Got unexpected depth stencil view %p, expected %p.\n", tmp_dsv, dsv); + ID3D10DepthStencilView_Release(tmp_dsv); + + ID3D10Device_RSGetScissorRects(device, &count, NULL); + todo_wine ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, + "Got unexpected scissor rect count %u.\n", count); + memset(tmp_rect, 0x55, sizeof(tmp_rect)); + ID3D10Device_RSGetScissorRects(device, &count, tmp_rect); + for (i = 0; i < count; ++i) + { + ok(tmp_rect[i].left == i + && tmp_rect[i].top == i * 2 + && tmp_rect[i].right == i + 1 + && tmp_rect[i].bottom == (i + 1) * 2, + "Got unexpected scissor rect {%d, %d, %d, %d} in slot %u.\n", + tmp_rect[i].left, tmp_rect[i].top, tmp_rect[i].right, tmp_rect[i].bottom, i); + } + ID3D10Device_RSGetViewports(device, &count, NULL); + todo_wine ok(count == D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE, + "Got unexpected viewport count %u.\n", count); + memset(tmp_viewport, 0x55, sizeof(tmp_viewport)); + ID3D10Device_RSGetViewports(device, &count, tmp_viewport); + for (i = 0; i < count; ++i) + { + ok(tmp_viewport[i].TopLeftX == i * 3 + && tmp_viewport[i].TopLeftY == i * 4 + && tmp_viewport[i].Width == 3 + && tmp_viewport[i].Height == 4 + && compare_float(tmp_viewport[i].MinDepth, i * 0.01f, 16) + && compare_float(tmp_viewport[i].MaxDepth, (i + 1) * 0.01f, 16), + "Got unexpected viewport {%d, %d, %u, %u, %.8e, %.8e} in slot %u.\n", + tmp_viewport[i].TopLeftX, tmp_viewport[i].TopLeftY, tmp_viewport[i].Width, + tmp_viewport[i].Height, tmp_viewport[i].MinDepth, tmp_viewport[i].MaxDepth, i); + } + ID3D10Device_RSGetState(device, &tmp_rs_state); + ok(tmp_rs_state == rs_state, "Got unexpected rasterizer state %p, expected %p.\n", tmp_rs_state, rs_state); + ID3D10RasterizerState_Release(tmp_rs_state); + + ID3D10Device_SOGetTargets(device, D3D10_SO_BUFFER_SLOT_COUNT, tmp_buffer, offset); + for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) + { + ok(tmp_buffer[i] == so_buffer[i], "Got unexpected stream output %p in slot %u, expected %p.\n", + tmp_buffer[i], i, buffer[i]); + ID3D10Buffer_Release(tmp_buffer[i]); + todo_wine ok(offset[i] == ~0u, "Got unexpected stream output offset %u in slot %u.\n", offset[i], i); + } + + ID3D10Device_GetPredication(device, &tmp_predicate, &predicate_value); + ok(tmp_predicate == predicate, "Got unexpected predicate %p, expected %p.\n", tmp_predicate, predicate); + ID3D10Predicate_Release(tmp_predicate); + ok(predicate_value, "Got unexpected predicate value %#x.\n", predicate_value); + + /* Verify ClearState(). */ + + ID3D10Device_ClearState(device); + + ID3D10Device_VSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected constant buffer %p in slot %u.\n", tmp_buffer[i], i); + } + ID3D10Device_VSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_srv[i], "Got unexpected shader resource view %p in slot %u.\n", tmp_srv[i], i); + } + ID3D10Device_VSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } + ID3D10Device_VSGetShader(device, &tmp_vs); + ok(!tmp_vs, "Got unexpected vertex shader %p.\n", tmp_vs); + + ID3D10Device_GSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected constant buffer %p in slot %u.\n", tmp_buffer[i], i); + } + ID3D10Device_GSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_srv[i], "Got unexpected shader resource view %p in slot %u.\n", tmp_srv[i], i); + } + ID3D10Device_GSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } + ID3D10Device_GSGetShader(device, &tmp_gs); + ok(!tmp_gs, "Got unexpected geometry shader %p.\n", tmp_gs); + + ID3D10Device_PSGetConstantBuffers(device, 0, D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT, tmp_buffer); + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected constant buffer %p in slot %u.\n", tmp_buffer[i], i); + } + ID3D10Device_PSGetShaderResources(device, 0, D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT, tmp_srv); + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_srv[i], "Got unexpected shader resource view %p in slot %u.\n", tmp_srv[i], i); + } + ID3D10Device_PSGetSamplers(device, 0, D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT, tmp_sampler); + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ok(!tmp_sampler[i], "Got unexpected sampler %p in slot %u.\n", tmp_sampler[i], i); + } + ID3D10Device_PSGetShader(device, &tmp_ps); + ok(!tmp_ps, "Got unexpected pixel shader %p.\n", tmp_ps); + + ID3D10Device_IAGetVertexBuffers(device, 0, D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT, tmp_buffer, stride, offset); + for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i); + todo_wine ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i); + todo_wine ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i); + } + ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset); + ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]); + ok(format == DXGI_FORMAT_UNKNOWN, "Got unexpected index buffer format %#x.\n", format); + ok(!offset[0], "Got unexpected index buffer offset %u.\n", offset[0]); + ID3D10Device_IAGetInputLayout(device, &tmp_input_layout); + ok(!tmp_input_layout, "Got unexpected input layout %p.\n", tmp_input_layout); + ID3D10Device_IAGetPrimitiveTopology(device, &topology); + ok(topology == D3D10_PRIMITIVE_TOPOLOGY_UNDEFINED, "Got unexpected primitive topology %#x.\n", topology); + + ID3D10Device_OMGetBlendState(device, &tmp_blend_state, blend_factor, &sample_mask); + ok(!tmp_blend_state, "Got unexpected blend state %p.\n", tmp_blend_state); + ok(blend_factor[0] == 1.0f && blend_factor[1] == 1.0f + && blend_factor[2] == 1.0f && blend_factor[3] == 1.0f, + "Got unexpected blend factor {%.8e, %.8e, %.8e, %.8e}.\n", + blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3]); + ok(sample_mask == D3D10_DEFAULT_SAMPLE_MASK, "Got unexpected sample mask %#x.\n", sample_mask); + ID3D10Device_OMGetDepthStencilState(device, &tmp_ds_state, &stencil_ref); + ok(!tmp_ds_state, "Got unexpected depth stencil state %p.\n", tmp_ds_state); + ok(!stencil_ref, "Got unexpected stencil ref %u.\n", stencil_ref); + ID3D10Device_OMGetRenderTargets(device, D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT, tmp_rtv, &tmp_dsv); + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + ok(!tmp_rtv[i], "Got unexpected render target view %p in slot %u.\n", tmp_rtv[i], i); + } + ok(!tmp_dsv, "Got unexpected depth stencil view %p.\n", tmp_dsv); + + ID3D10Device_RSGetScissorRects(device, &count, NULL); + todo_wine ok(!count, "Got unexpected scissor rect count %u.\n", count); + memset(tmp_rect, 0x55, sizeof(tmp_rect)); + count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; + ID3D10Device_RSGetScissorRects(device, &count, tmp_rect); + for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) + { + if (!i) + todo_wine ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom, + "Got unexpected scissor rect {%d, %d, %d, %d} in slot %u.\n", + tmp_rect[i].left, tmp_rect[i].top, tmp_rect[i].right, tmp_rect[i].bottom, i); + else + ok(!tmp_rect[i].left && !tmp_rect[i].top && !tmp_rect[i].right && !tmp_rect[i].bottom, + "Got unexpected scissor rect {%d, %d, %d, %d} in slot %u.\n", + tmp_rect[i].left, tmp_rect[i].top, tmp_rect[i].right, tmp_rect[i].bottom, i); + } + ID3D10Device_RSGetViewports(device, &count, NULL); + todo_wine ok(!count, "Got unexpected viewport count %u.\n", count); + memset(tmp_viewport, 0x55, sizeof(tmp_viewport)); + count = D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; + ID3D10Device_RSGetViewports(device, &count, tmp_viewport); + for (i = 0; i < D3D10_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE; ++i) + { + if (!i) + todo_wine ok(!tmp_viewport[i].TopLeftX && !tmp_viewport[i].TopLeftY && !tmp_viewport[i].Width + && !tmp_viewport[i].Height && !tmp_viewport[i].MinDepth && !tmp_viewport[i].MaxDepth, + "Got unexpected viewport {%d, %d, %u, %u, %.8e, %.8e} in slot %u.\n", + tmp_viewport[i].TopLeftX, tmp_viewport[i].TopLeftY, tmp_viewport[i].Width, + tmp_viewport[i].Height, tmp_viewport[i].MinDepth, tmp_viewport[i].MaxDepth, i); + else + ok(!tmp_viewport[i].TopLeftX && !tmp_viewport[i].TopLeftY && !tmp_viewport[i].Width + && !tmp_viewport[i].Height && !tmp_viewport[i].MinDepth && !tmp_viewport[i].MaxDepth, + "Got unexpected viewport {%d, %d, %u, %u, %.8e, %.8e} in slot %u.\n", + tmp_viewport[i].TopLeftX, tmp_viewport[i].TopLeftY, tmp_viewport[i].Width, + tmp_viewport[i].Height, tmp_viewport[i].MinDepth, tmp_viewport[i].MaxDepth, i); + } + ID3D10Device_RSGetState(device, &tmp_rs_state); + ok(!tmp_rs_state, "Got unexpected rasterizer state %p.\n", tmp_rs_state); + + ID3D10Device_SOGetTargets(device, D3D10_SO_BUFFER_SLOT_COUNT, tmp_buffer, offset); + for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) + { + ok(!tmp_buffer[i], "Got unexpected stream output %p in slot %u.\n", tmp_buffer[i], i); + ok(!offset[i], "Got unexpected stream output offset %u in slot %u.\n", offset[i], i); + } + + ID3D10Device_GetPredication(device, &tmp_predicate, &predicate_value); + ok(!tmp_predicate, "Got unexpected predicate %p.\n", tmp_predicate); + ok(!predicate_value, "Got unexpected predicate value %#x.\n", predicate_value); + + /* Cleanup. */ + + ID3D10Predicate_Release(predicate); + ID3D10RasterizerState_Release(rs_state); + ID3D10DepthStencilView_Release(dsv); + ID3D10Texture2D_Release(ds_texture); + + for (i = 0; i < D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT; ++i) + { + ID3D10RenderTargetView_Release(rtv[i]); + ID3D10Texture2D_Release(rt_texture[i]); + } + + ID3D10DepthStencilState_Release(ds_state); + ID3D10BlendState_Release(blend_state); + ID3D10InputLayout_Release(input_layout); + ID3D10VertexShader_Release(vs); + ID3D10GeometryShader_Release(gs); + ID3D10PixelShader_Release(ps); + + for (i = 0; i < D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT; ++i) + { + ID3D10SamplerState_Release(sampler[i]); + } + + for (i = 0; i < D3D10_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ID3D10ShaderResourceView_Release(srv[i]); + } + + for (i = 0; i < D3D10_SO_BUFFER_SLOT_COUNT; ++i) + { + ID3D10Buffer_Release(so_buffer[i]); + } + + for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i) + { + ID3D10Buffer_Release(buffer[i]); + } + + for (i = 0; i < D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT; ++i) + { + ID3D10Buffer_Release(cb[i]); + } + + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +} + START_TEST(device) { test_create_texture2d(); @@ -1201,4 +2068,5 @@ START_TEST(device) test_create_predicate(); test_device_removed_reason(); test_scissor(); + test_clear_state(); } -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 3 01:59:38 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 3 Nov 2014 08:59:38 +0100 Subject: [PATCH 5/5] d2d1: Implement d2d_gradient_GetGradientStops(). Message-ID: <1415001578-16597-5-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 18 ++++++++++++++++-- dlls/d2d1/d2d1_private.h | 3 ++- dlls/d2d1/render_target.c | 8 +++++++- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 4d7a5ad..99b111f 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -66,7 +66,10 @@ static ULONG STDMETHODCALLTYPE d2d_gradient_Release(ID2D1GradientStopCollection TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) + { + HeapFree(GetProcessHeap(), 0, gradient->stops); HeapFree(GetProcessHeap(), 0, gradient); + } return refcount; } @@ -90,7 +93,13 @@ static UINT32 STDMETHODCALLTYPE d2d_gradient_GetGradientStopCount(ID2D1GradientS static void STDMETHODCALLTYPE d2d_gradient_GetGradientStops(ID2D1GradientStopCollection *iface, D2D1_GRADIENT_STOP *stops, UINT32 stop_count) { - FIXME("iface %p, stops %p, stop_count %u stub!\n", iface, stops, stop_count); + struct d2d_gradient *gradient = impl_from_ID2D1GradientStopCollection(iface); + + TRACE("iface %p, stops %p, stop_count %u.\n", iface, stops, stop_count); + + memcpy(stops, gradient->stops, min(gradient->stop_count, stop_count) * sizeof(*stops)); + if (stop_count > gradient->stop_count) + memset(stops, 0, (stop_count - gradient->stop_count) * sizeof(*stops)); } static D2D1_GAMMA STDMETHODCALLTYPE d2d_gradient_GetColorInterpolationGamma(ID2D1GradientStopCollection *iface) @@ -119,7 +128,7 @@ static const struct ID2D1GradientStopCollectionVtbl d2d_gradient_vtbl = d2d_gradient_GetExtendMode, }; -void d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target, +HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target, const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode) { FIXME("Ignoring gradient properties.\n"); @@ -128,6 +137,11 @@ void d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_ gradient->refcount = 1; gradient->stop_count = stop_count; + if (!(gradient->stops = HeapAlloc(GetProcessHeap(), 0, stop_count * sizeof(*stops)))) + return E_OUTOFMEMORY; + memcpy(gradient->stops, stops, stop_count * sizeof(*stops)); + + return S_OK; } static void d2d_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target, diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 3fd3cdd..294c765 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -86,10 +86,11 @@ struct d2d_gradient ID2D1GradientStopCollection ID2D1GradientStopCollection_iface; LONG refcount; + D2D1_GRADIENT_STOP *stops; UINT32 stop_count; }; -void d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target, +HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *render_target, const D2D1_GRADIENT_STOP *stops, UINT32 stop_count, D2D1_GAMMA gamma, D2D1_EXTEND_MODE extend_mode) DECLSPEC_HIDDEN; diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index a50f473..035df2b 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -335,6 +335,7 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateGradientStopCollect ID2D1GradientStopCollection **gradient) { struct d2d_gradient *object; + HRESULT hr; TRACE("iface %p, stops %p, stop_count %u, gamma %#x, extend_mode %#x, gradient %p.\n", iface, stops, stop_count, gamma, extend_mode, gradient); @@ -342,7 +343,12 @@ static HRESULT STDMETHODCALLTYPE d2d_d3d_render_target_CreateGradientStopCollect if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; - d2d_gradient_init(object, iface, stops, stop_count, gamma, extend_mode); + if (FAILED(hr = d2d_gradient_init(object, iface, stops, stop_count, gamma, extend_mode))) + { + WARN("Failed to initialize gradient, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } TRACE("Created gradient %p.\n", object); *gradient = &object->ID2D1GradientStopCollection_iface; -- 1.7.10.4 From jacek at codeweavers.com Mon Nov 3 05:39:00 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 03 Nov 2014 12:39:00 +0100 Subject: [TOOLS] winegecko.php: Added 2.34 release. Message-ID: <54576954.2040604@codeweavers.com> --- winegecko.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-winegecko.php-Added-2.34-release.patch Type: text/x-patch Size: 395 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 3 05:39:59 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 03 Nov 2014 12:39:59 +0100 Subject: mshtml: Wine Gecko 2.34 release. Message-ID: <5457698F.4030503@codeweavers.com> --- dlls/appwiz.cpl/addons.c | 6 +- dlls/mshtml/binding.h | 1 + dlls/mshtml/htmlanchor.c | 2 +- dlls/mshtml/htmldoc.c | 18 +- dlls/mshtml/htmlevent.c | 2 +- dlls/mshtml/htmlnode.c | 41 ++-- dlls/mshtml/mshtml_private.h | 16 +- dlls/mshtml/mutation.c | 4 +- dlls/mshtml/navigate.c | 2 +- dlls/mshtml/nsembed.c | 1 - dlls/mshtml/nsiface.idl | 571 ++++++++++++++++++++++++------------------- dlls/mshtml/nsio.c | 54 ++++ dlls/mshtml/oleobj.c | 10 +- dlls/mshtml/script.c | 2 +- 14 files changed, 412 insertions(+), 318 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Wine-Gecko-2.34-release.diff Type: text/x-patch Size: 89234 bytes Desc: not available URL: From joachim.priesner at web.de Mon Nov 3 12:55:31 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Mon, 3 Nov 2014 19:55:31 +0100 Subject: [1/2] wined3d: Set D3DPMISCCAPS_FOGVERTEXCLAMPED flag in get_device_caps (resend) Message-ID: <201411031955.32948.joachim.priesner@web.de> Wine clamps the oFog output of vertex shaders. Tests for the flag follow in the second part of this patch. --- dlls/wined3d/directx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d428d94..41bad21 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4148,12 +4148,12 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS | WINED3DPMISCCAPS_MASKZ | WINED3DPMISCCAPS_BLENDOP | + WINED3DPMISCCAPS_FOGVERTEXCLAMPED | WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING; /* TODO: WINED3DPMISCCAPS_NULLREFERENCE WINED3DPMISCCAPS_FOGANDSPECULARALPHA - WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS - WINED3DPMISCCAPS_FOGVERTEXCLAMPED */ + WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS */ if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; -- 1.8.4.5 From joachim.priesner at web.de Mon Nov 3 12:55:46 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Mon, 3 Nov 2014 19:55:46 +0100 Subject: [2/2] wined3d: Take abs() of vertex z coordinate as FFP fog coordinate (try 3) Message-ID: <201411031955.48290.joachim.priesner@web.de> Supersedes 107334. Take the absolute value of vertex.z as fog coordinate instead of just the z coordinate. This fixes e.g. fog for applications that use right-handed projection matrices. Also test the clamp behavior of the oFog vertex shader output. Tested on openSuse 13.1 and Windows 8.1 (VMware Player) Try 3 which fixes the issues pointed out by Henri Verbeet. --- dlls/d3d8/tests/visual.c | 305 +++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 370 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 161 ++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 2 +- 4 files changed, 837 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 163110c..8727d0e 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -696,6 +696,310 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + /* Fill the null-shader entry with the FVF (SetVertexShader is "overloaded" on d3d8). */ + DWORD vertex_shader[3] = {D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, 0, 0}; + DWORD pixel_shader[2] = {0, 0}; + IDirect3D8 *d3d; + IDirect3DDevice8 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support; + unsigned int i, ps, y; + D3DCOLOR color, expected_middle_color; + ULONG refcount; + D3DCAPS8 caps; + HWND window; + HRESULT hr; + + /* All vertex shaders expect the projection matrix in registers c0...c3. */ + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos = mul(Projection, input.Pos) */ + 0x00000005, 0x800f0000, 0x90000000, 0xa0e40000, /* mul r0, v0.x, c0 */ + 0x00000005, 0x800f0001, 0x90550000, 0xa0e40001, /* mul r1, v0.y, c1 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90aa0000, 0xa0e40002, /* mul r1, v0.z, c2 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90ff0000, 0xa0e40003, /* mul r1, v0.w, c3 */ + 0x00000002, 0xc00f0000, 0x80e40000, 0x80e40001, /* add oPos, r0, r1 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos = mul(Projection, input.Pos) */ + 0x00000005, 0x800f0000, 0x90000000, 0xa0e40000, /* mul r0, v0.x, c0 */ + 0x00000005, 0x800f0001, 0x90550000, 0xa0e40001, /* mul r1, v0.y, c1 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90aa0000, 0xa0e40002, /* mul r1, v0.z, c2 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90ff0000, 0xa0e40003, /* mul r1, v0.w, c3 */ + 0x00000002, 0xc00f0000, 0x80e40000, 0x80e40001, /* add oPos, r0, r1 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + + static const struct + { + struct vec3 position; + DWORD diffuse; + DWORD specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const DWORD vertex_decl[] = + { + D3DVSD_STREAM(0), + D3DVSD_REG(0, D3DVSDT_FLOAT3), /* position, v0 */ + D3DVSD_REG(1, D3DVSDT_D3DCOLOR), /* diffuse color, v1 */ + D3DVSD_REG(2, D3DVSDT_D3DCOLOR), /* specular color, v2 */ + D3DVSD_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader with vertex fog computation. + * As drivers inconsistently clamp or don't clamp the oFog output of vertex shaders, + * the special value C_CLAMPED_FOG allows both C_HALF_FOGGED (clamped) and C_FOGGED. */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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"); + goto done; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice8_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 0); + if (has_vs_support) + { + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code1, &vertex_shader[1], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code2, &vertex_shader[2], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + + hr = IDirect3DDevice8_SetVertexShaderConstant(device, 0, &proj_mat, 4); + ok(SUCCEEDED(hr), "SetVertexShaderConstant (projection matrix) failed (%#x)\n", hr); + } + else + { + skip("No vs_1_0 support, skipping some fog tests\n"); + } + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice8_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice8_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + ok(color_match(color, C_HALF_FOGGED, 13) || color_match(color, C_FOGGED, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, " + "expected %08x+-5%% or %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, C_HALF_FOGGED, C_FOGGED); + } + else + { + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + } + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + } + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DDevice8_DeleteVertexShader(device, vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DDevice8_DeletePixelShader(device, pixel_shader[i]); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + /* This tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -5092,6 +5396,7 @@ START_TEST(visual) offscreen_test(); alpha_test(); test_scalar_instructions(); + fog_negative_z_test(); fog_with_shader_test(); cnd_test(); p8_texture_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 117c8eb..d0b73f6 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1825,6 +1825,375 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; + IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + IDirect3DDevice9 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support, is_fog_vertex_clamped; + unsigned int i, ps, y; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color, expected_middle_color; + HWND window; + HRESULT hr; + + /* All vertex shaders expect the projection matrix in registers c0...c3. */ + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos = mul(Projection, input.Pos) */ + 0x00000005, 0x800f0000, 0x90000000, 0xa0e40000, /* mul r0, v0.x, c0 */ + 0x00000005, 0x800f0001, 0x90550000, 0xa0e40001, /* mul r1, v0.y, c1 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90aa0000, 0xa0e40002, /* mul r1, v0.z, c2 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90ff0000, 0xa0e40003, /* mul r1, v0.w, c3 */ + 0x00000002, 0xc00f0000, 0x80e40000, 0x80e40001, /* add oPos, r0, r1 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos = mul(Projection, input.Pos) */ + 0x00000005, 0x800f0000, 0x90000000, 0xa0e40000, /* mul r0, v0.x, c0 */ + 0x00000005, 0x800f0001, 0x90550000, 0xa0e40001, /* mul r1, v0.y, c1 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90aa0000, 0xa0e40002, /* mul r1, v0.z, c2 */ + 0x00000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x00000005, 0x800f0001, 0x90ff0000, 0xa0e40003, /* mul r1, v0.w, c3 */ + 0x00000002, 0xc00f0000, 0x80e40000, 0x80e40001, /* add oPos, r0, r1 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"), vs_2_0 */ + static const DWORD vertex_shader_code3[] = + { + 0xfffe0200, /* vs_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos = mul(Projection, input.Pos) */ + 0x03000005, 0x800f0000, 0x90000000, 0xa0e40000, /* mul r0, v0.x, c0 */ + 0x03000005, 0x800f0001, 0x90550000, 0xa0e40001, /* mul r1, v0.y, c1 */ + 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x03000005, 0x800f0001, 0x90aa0000, 0xa0e40002, /* mul r1, v0.z, c2 */ + 0x03000002, 0x800f0000, 0x80e40000, 0x80e40001, /* add r0, r0, r1 */ + 0x03000005, 0x800f0001, 0x90ff0000, 0xa0e40003, /* mul r1, v0.w, c3 */ + 0x03000002, 0xc00f0000, 0x80e40000, 0x80e40001, /* add oPos, r0, r1 */ + /* output.Color = input.Color */ + 0x02000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x02000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + static const DWORD pixel_shader_code2[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */ + 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ + 0x0000ffff + }; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + + static const D3DVERTEXELEMENT9 decl_elements[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, /* diffuse */ + {0, 16, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1}, /* specular */ + D3DDECL_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED in the right half of the screen. + * + * C_CLAMPED_FOG will be replaced by the correct expected value based on + * the value of D3DPMISCCAPS_FOGVERTEXCLAMPED. If the driver clamps the oFog + * output of vertex shaders, it should be C_HALF_FOGGED, else C_FOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader vs_1_1 with vertex fog computation */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + /* Vertex shader vs_2_0 with vertex fog computation */ + {3, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {3, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 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 (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 1); + if (has_vs_support) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code1, &vertex_shader[1]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code2, &vertex_shader[2]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + + if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code3, &vertex_shader[3]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_2_0 support, skipping some fog tests\n"); + } + + hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, (const float*)&proj_mat, 4); + ok(SUCCEEDED(hr), "SetVertexShaderConstantF (projection matrix) failed (%#x)\n", hr); + } + else + { + skip("No vs_1_1 support, skipping some fog tests\n"); + } + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + + if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code2, &pixel_shader[2]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + is_fog_vertex_clamped = caps.PrimitiveMiscCaps & D3DPMISCCAPS_FOGVERTEXCLAMPED; + + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration); + ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%#x)\n", hr); + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration); + ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%#x)\n", hr); + + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + if (has_vs_support) + { + hr = IDirect3DDevice9_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + } + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice9_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + expected_middle_color = is_fog_vertex_clamped ? C_HALF_FOGGED : C_FOGGED; + } + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + + } + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DVertexShader9_Release(vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DPixelShader9_Release(pixel_shader[i]); + IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + /* This test tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -16729,6 +17098,7 @@ START_TEST(visual) test_vshader_input(); test_vshader_float16(); stream_test(); + fog_negative_z_test(); fog_with_shader_test(); texbem_test(); texdepth_test(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ec50fb8..4e999f7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3384,6 +3384,166 @@ static void test_fog_special(void) DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void test_fog_negative_z(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000 + }; + + D3DCOLOR color, expected_middle_color; + HRESULT hr; + ULONG refcount; + BOOL has_table_fog_support; + unsigned int i, y; + HWND window; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + D3DDEVICEDESC7 caps; + + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + DWORD vertexmode, tablemode; + D3DCOLOR color_left, color_middle_top, color_middle_bottom, color_right; + } + test_data[] = + { + {D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + memset(&caps, 0, sizeof(caps)); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "IDirect3DDevice7_GetCaps failed, hr %#x.\n", hr); + + has_table_fog_support = caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests.\n"); + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Failed to set fog color, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].tablemode != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear render target, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, test_data[i].vertexmode); + ok(SUCCEEDED(hr), "Failed to set fog vertex mode, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, test_data[i].tablemode); + ok(SUCCEEDED(hr), "Failed to set fog table mode, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, top_quad, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_1, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_2, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, i=%d, hr %#x.\n", i, hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = get_surface_color(rt, 2, y); + ok(compare_color(color, test_data[i].color_left, 13), + "fog fvm%i ftm%i y=%i: got left color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, color, y, + test_data[i].color_left); + color = get_surface_color(rt, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + ok(compare_color(color, expected_middle_color, 13), + "fog fvm%i ftm%i y=%i: got middle color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, expected_middle_color); + color = get_surface_color(rt, 638, y); + ok(compare_color(color, test_data[i].color_right, 13), + "fog fvm%i ftm%i y=%i: got right color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, test_data[i].color_right); + } + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_lighting_interface_versions(void) { IDirect3DDevice7 *device; @@ -7671,6 +7831,7 @@ START_TEST(ddraw7) test_clear_rect_count(); test_coop_level_versions(); test_fog_special(); + test_fog_negative_z(); test_lighting_interface_versions(); test_coop_level_activateapp(); test_texturemanage(); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7379ba2..907e895 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5005,7 +5005,7 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); else - shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + shader_addline(buffer, "gl_FogFragCoord = abs(ec_pos.z);\n"); break; default: -- 1.8.4.5 From austinenglish at gmail.com Mon Nov 3 13:18:21 2014 From: austinenglish at gmail.com (Austin English) Date: Mon, 3 Nov 2014 13:18:21 -0600 Subject: ntoskrnl.exe: add a stub for IoRegisterPlugPlayNotification (try 2) Message-ID: -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- From 18605e80cf61655ab43960641717a68fa0d9f5a3 Mon Sep 17 00:00:00 2001 From: Austin English Date: Mon, 3 Nov 2014 13:08:24 -0600 Subject: [PATCH] ntoskrnl.exe: add a stub for IoRegisterPlugPlayNotification (try 2) --- dlls/ntoskrnl.exe/ntoskrnl.c | 11 +++++++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/ntddk.h | 9 +++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 23379b8..a31b186 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -1936,3 +1936,14 @@ NTSTATUS WINAPI ObQueryNameString(PVOID object, POBJECT_NAME_INFORMATION name, U FIXME("(%p %p %u %p) stub\n", object, name, maxlength, returnlength); return STATUS_NOT_IMPLEMENTED; } + +/***************************************************** + * IoRegisterPlugPlayNotification (NTOSKRNL.EXE.@) + */ +NTSTATUS WINAPI IoRegisterPlugPlayNotification(IO_NOTIFICATION_EVENT_CATEGORY category, ULONG flags, PVOID data, + PDRIVER_OBJECT driver, PDRIVER_NOTIFICATION_CALLBACK_ROUTINE callback, + PVOID context, PVOID *notification) +{ + FIXME("(%u %u %p %p %p %p %p) stub\n", category, flags, data, driver, callback, context, notification); + return STATUS_SUCCESS; +} diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 1512cf8..4ead907 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -430,7 +430,7 @@ @ stdcall IoRegisterFileSystem(ptr) @ stub IoRegisterFsRegistrationChange @ stub IoRegisterLastChanceShutdownNotification -@ stub IoRegisterPlugPlayNotification +@ stdcall IoRegisterPlugPlayNotification(long long ptr ptr ptr ptr ptr) @ stdcall IoRegisterShutdownNotification(ptr) @ stdcall IoReleaseCancelSpinLock(ptr) @ stub IoReleaseRemoveLockAndWaitEx diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h index f6aef8f..56f2f35 100644 --- a/include/ddk/ntddk.h +++ b/include/ddk/ntddk.h @@ -127,11 +127,20 @@ typedef struct _IMAGE_INFO ULONG ImageSectionNumber; } IMAGE_INFO, *PIMAGE_INFO; +typedef enum _IO_NOTIFICATION_EVENT_CATEGORY +{ + EventCategoryReserved, + EventCategoryHardwareProfileChange, + EventCategoryDeviceInterfaceChange, + EventCategoryTargetDeviceChange +} IO_NOTIFICATION_EVENT_CATEGORY; + typedef struct _FILE_VALID_DATA_LENGTH_INFORMATION { LARGE_INTEGER ValidDataLength; } FILE_VALID_DATA_LENGTH_INFORMATION, *PFILE_VALID_DATA_LENGTH_INFORMATION; +typedef VOID (WINAPI *PDRIVER_NOTIFICATION_CALLBACK_ROUTINE)(PVOID,PVOID); typedef VOID (WINAPI *PDRIVER_REINITIALIZE)(PDRIVER_OBJECT,PVOID,ULONG); typedef VOID (WINAPI *PLOAD_IMAGE_NOTIFY_ROUTINE)(PUNICODE_STRING,HANDLE,PIMAGE_INFO); typedef NTSTATUS (WINAPI *PIO_QUERY_DEVICE_ROUTINE)(PVOID,PUNICODE_STRING,INTERFACE_TYPE,ULONG, -- 2.0.4 From jnvsor at gmail.com Mon Nov 3 15:10:44 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Mon, 3 Nov 2014 22:10:44 +0100 Subject: [PATCH 1/2] reg/tests: Delete keys manually to prevent timeout on winxp/win2k Message-ID: <1415049045-8534-1-git-send-email-jnvsor@gmail.com> Last test used RegDeleteTree which isn't supported on win2k/xp, and caused a timeout in testbot --- programs/reg/tests/reg.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 3de6f70..cb209a3 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -104,26 +104,39 @@ static void test_add(void) run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest0"); + ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); + run_reg_exe("reg add \\\\HKCU\\" KEY_BASE "\\keytest1 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest1"); + ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); + run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2"); + todo_wine ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), + "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3", 0, KEY_READ, &hkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); RegCloseKey(hkey); + err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3"); + ok(err == ERROR_SUCCESS, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4", 0, KEY_READ, &hkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); RegCloseKey(hkey); + err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4"); + ok(err == ERROR_SUCCESS, "got exit code %d\n", r); - err = RegDeleteTreeA(HKEY_CURRENT_USER, KEY_BASE); - ok(r == REG_EXIT_SUCCESS, "got exit code %d\n", r); + err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); + ok(err == ERROR_SUCCESS, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); -- 2.1.1 From jnvsor at gmail.com Mon Nov 3 15:10:45 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Mon, 3 Nov 2014 22:10:45 +0100 Subject: [PATCH 2/2] reg/tests: Move key format test section below first key creation In-Reply-To: <1415049045-8534-1-git-send-email-jnvsor@gmail.com> References: <1415049045-8534-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415049045-8534-2-git-send-email-jnvsor@gmail.com> Saves an extra delete call, and adds a comment to clearly section the key format tests from the setup lines. --- programs/reg/tests/reg.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index cb209a3..9449429 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -88,7 +88,7 @@ static void verify_reg_(unsigned line, HKEY hkey, const char* value, static void test_add(void) { - HKEY hkey; + HKEY hkey, subkey; LONG err; DWORD r, dword, type, size; char buffer[22]; @@ -102,6 +102,13 @@ static void test_add(void) err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); + + err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); + ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); + + /* Test input key formats */ run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest0"); @@ -121,29 +128,20 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3", 0, KEY_READ, &hkey); + err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3", 0, KEY_READ, &subkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); - RegCloseKey(hkey); + RegCloseKey(subkey); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest3"); ok(err == ERROR_SUCCESS, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4", 0, KEY_READ, &hkey); + err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4", 0, KEY_READ, &subkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); - RegCloseKey(hkey); + RegCloseKey(subkey); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4"); ok(err == ERROR_SUCCESS, "got exit code %d\n", r); - err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); - ok(err == ERROR_SUCCESS, "got exit code %d\n", r); - - run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r); - ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - - err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); - ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); - /* REG_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), -- 2.1.1 From 00cpxxx at gmail.com Mon Nov 3 15:16:14 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Mon, 3 Nov 2014 19:16:14 -0200 Subject: ws2_32: Add tests and implement inet_pton Message-ID: Special thanks to Erich Hoover. Fixes https://bugs.winehq.org/show_bug.cgi?id=36713 -------------- next part -------------- diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 0bcce40..b3db306 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -6911,6 +6911,40 @@ PCSTR WINAPI WS_inet_ntop( INT family, PVOID addr, PSTR buffer, SIZE_T len ) } /*********************************************************************** +* inet_pton (WS2_32.@) +*/ +INT WINAPI WS_inet_pton( INT family, PCSTR addr, PVOID buffer) +{ +#ifdef HAVE_INET_PTON + int unixaf, ret; + + TRACE("family %d, addr '%s', buffer (%p)\n", family, addr ? addr : "(null)", buffer); + + if (!addr || !buffer) + { + SetLastError(WSAEFAULT); + return SOCKET_ERROR; + } + + unixaf = convert_af_w2u(family); + if (unixaf != AF_INET && unixaf != AF_INET6) + { + SetLastError(WSAEAFNOSUPPORT); + return SOCKET_ERROR; + } + + ret = inet_pton(unixaf, addr, buffer); + if (ret == -1) SetLastError(wsaErrno()); + return ret; +#else + FIXME( "not supported on this platform\n" ); + WSASetLastError( WSAEAFNOSUPPORT ); + return SOCKET_ERROR; +#endif +} + + +/*********************************************************************** * WSAStringToAddressA (WS2_32.80) */ INT WINAPI WSAStringToAddressA(LPSTR AddressString, diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 0ad6e8a..0c39545 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -67,6 +67,7 @@ static int (WINAPI *pgetaddrinfo)(LPCSTR,LPCSTR,const struct addrinfo *,struct static void (WINAPI *pFreeAddrInfoW)(PADDRINFOW); static int (WINAPI *pGetAddrInfoW)(LPCWSTR,LPCWSTR,const ADDRINFOW *,PADDRINFOW *); static PCSTR (WINAPI *pInetNtop)(INT,LPVOID,LPSTR,ULONG); +static int (WINAPI *pInetPton)(INT,LPSTR,LPVOID); static int (WINAPI *pWSALookupServiceBeginW)(LPWSAQUERYSETW,DWORD,LPHANDLE); static int (WINAPI *pWSALookupServiceEnd)(HANDLE); static int (WINAPI *pWSALookupServiceNextW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW); @@ -1139,6 +1140,7 @@ static void Init (void) pFreeAddrInfoW = (void *)GetProcAddress(hws2_32, "FreeAddrInfoW"); pGetAddrInfoW = (void *)GetProcAddress(hws2_32, "GetAddrInfoW"); pInetNtop = (void *)GetProcAddress(hws2_32, "inet_ntop"); + pInetPton = (void *)GetProcAddress(hws2_32, "inet_pton"); pWSALookupServiceBeginW = (void *)GetProcAddress(hws2_32, "WSALookupServiceBeginW"); pWSALookupServiceEnd = (void *)GetProcAddress(hws2_32, "WSALookupServiceEnd"); pWSALookupServiceNextW = (void *)GetProcAddress(hws2_32, "WSALookupServiceNextW"); @@ -3987,6 +3989,117 @@ static void test_addr_to_print(void) pdst = pInetNtop(AF_INET6, (void*)&in6.s6_addr, dst6, 18); ok(pdst != NULL, "The pointer should be returned (%p)\n", pdst); } +static void test_inet_pton(void) +{ + struct TEST_DATA + { + int family, ret; + DWORD err; + const char *printable, *collapsed, *raw_data; + } tests[] = { + {AF_UNSPEC, -1, WSAEFAULT, /* Test 0 */ + NULL, NULL, NULL}, + {AF_INET, -1, WSAEFAULT, + NULL, NULL, NULL}, + {AF_INET6, -1, WSAEFAULT, + NULL, NULL, NULL}, + {AF_UNSPEC, -1, WSAEAFNOSUPPORT, + "127.0.0.1", NULL, NULL}, + {AF_INET, 1, 0, + "127.0.0.1", "127.0.0.1", + "\x7f\x00\x00\x01"}, + {AF_INET6, 0, 0, + "127.0.0.1", "127.0.0.1", NULL}, + {AF_INET, 0, 0, + "::1/128", NULL, NULL}, + {AF_INET6, 0, 0, + "::1/128", NULL, NULL}, + {AF_UNSPEC, -1, WSAEAFNOSUPPORT, + "broken", NULL, NULL}, + {AF_INET, 0, 0, + "broken", NULL, NULL}, + {AF_INET6, 0, 0, /* Test 10 */ + "broken", NULL, NULL}, + {AF_UNSPEC, -1, WSAEAFNOSUPPORT, + "177.32.45.20", NULL, NULL}, + {AF_INET, 1, 0, + "177.32.45.20", "177.32.45.20", + "\xb1\x20\x2d\x14"}, + {AF_INET6, 0, 0, + "177.32.45.20", NULL, NULL}, + {AF_INET, 0, 0, + "2607:f0d0:1002:51::4", NULL, NULL}, + {AF_INET6, 1, 0, + "2607:f0d0:1002:51::4", "2607:f0d0:1002:51::4", + "\x26\x07\xf0\xd0\x10\x02\x00\x51\x00\x00\x00\x00\x00\x00\x00\x04"}, + {AF_INET, 0, 0, + "::177.32.45.20", NULL, NULL}, + {AF_INET6, 1, 0, + "::177.32.45.20", "::177.32.45.20", + "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xb1\x20\x2d\x14"}, + {AF_INET, 0, 0, + "fe80::0202:b3ff:fe1e:8329", NULL, NULL}, + {AF_INET6, 1, 0, + "fe80::0202:b3ff:fe1e:8329", "fe80::202:b3ff:fe1e:8329", + "\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x02\xb3\xff\xfe\x1e\x83\x29"}, + {AF_INET6, 1, 0, /* Test 20 */ + "fe80::202:b3ff:fe1e:8329", "fe80::202:b3ff:fe1e:8329", + "\xfe\x80\x00\x00\x00\x00\x00\x00\x02\x02\xb3\xff\xfe\x1e\x83\x29"}, + {AF_INET, 0, 0, + "a", NULL, NULL}, + {AF_INET, 0, 0, + "a.b", NULL, NULL}, + {AF_INET, 0, 0, + "a.b.c", NULL, NULL}, + {AF_INET, 0, 0, + "a.b.c.d", NULL, NULL}, + {AF_INET6, 1, 0, + "2001:cdba:0000:0000:0000:0000:3257:9652", "2001:cdba::3257:9652", + "\x20\x01\xcd\xba\x00\x00\x00\x00\x00\x00\x00\x00\x32\x57\x96\x52"}, + {AF_INET6, 1, 0, + "2001:cdba::3257:9652", "2001:cdba::3257:9652", + "\x20\x01\xcd\xba\x00\x00\x00\x00\x00\x00\x00\x00\x32\x57\x96\x52"}, + {AF_INET6, 1, 0, + "2001:cdba:0:0:0:0:3257:9652", "2001:cdba::3257:9652", + "\x20\x01\xcd\xba\x00\x00\x00\x00\x00\x00\x00\x00\x32\x57\x96\x52"} + }; + int i, ret; + DWORD err; + char buffer[64],str[64]; + const char *ptr; + + /* InetNtop and InetPton became available in Vista and Win2008 */ + if (!pInetNtop || !pInetPton) + { + win_skip("InetNtop and/or InetPton not present, not executing tests\n"); + return; + } + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) + { + WSASetLastError(0xdeadbeef); + ret = pInetPton(tests[i].family, (char *)tests[i].printable, buffer); + ok (ret == tests[i].ret, "Test [%d]: Expected %d, got %d\n", i, tests[i].ret, ret); + if (tests[i].ret == -1) + { + err = WSAGetLastError(); + ok (tests[i].err == err, "Test [%d]: Expected 0x%x, got 0x%x\n", i, tests[i].err, err); + } + if (tests[i].ret != 1) continue; + ok (memcmp(buffer, tests[i].raw_data, + tests[i].family == AF_INET ? sizeof(struct in_addr) : sizeof(struct in6_addr)) == 0, + "Test [%d]: Expected binary data differs\n", i); + + /* Test the result from Pton with Ntop */ + strcpy (str, "deadbeef"); + ptr = pInetNtop(tests[i].family, buffer, str, sizeof(str)); + ok (ptr != NULL, "Test [%d]: Failed with NULL\n", i); + ok (ptr == str, "Test [%d]: Pointers differ (%p != %p)\n", i, ptr, str); + if (!ptr) continue; + ok (strcmp(ptr, tests[i].collapsed) == 0, "Test [%d]: Expected '%s', got '%s'\n", + i, tests[i].collapsed, ptr); + } +} static void test_ioctlsocket(void) { @@ -7739,6 +7852,7 @@ START_TEST( sock ) Init(); test_inet_ntoa(); + test_inet_pton(); test_set_getsockopt(); test_so_reuseaddr(); test_ip_pktinfo(); diff --git a/dlls/ws2_32/ws2_32.spec b/dlls/ws2_32/ws2_32.spec index 0811b74..f7c6c2d 100644 --- a/dlls/ws2_32/ws2_32.spec +++ b/dlls/ws2_32/ws2_32.spec @@ -121,3 +121,4 @@ @ stdcall getaddrinfo(str str ptr ptr) WS_getaddrinfo @ stdcall getnameinfo(ptr long ptr long ptr long long) WS_getnameinfo @ stdcall inet_ntop(long ptr ptr long) WS_inet_ntop +@ stdcall inet_pton(long ptr ptr) WS_inet_pton From stefan at codeweavers.com Mon Nov 3 15:33:58 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 3 Nov 2014 22:33:58 +0100 Subject: [PATCH 1/4] d3d9/tests: Check if the current display settings match the registry settings. Message-ID: <1415050441-5172-1-git-send-email-stefan@codeweavers.com> --- dlls/d3d9/tests/d3d9ex.c | 52 +++++++++++++--------- dlls/d3d9/tests/device.c | 113 ++++++++++++++++++++++++++++------------------- 2 files changed, 98 insertions(+), 67 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index ae4119c..bc60fcc 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -27,7 +27,7 @@ #include static HMODULE d3d9_handle = 0; -static DEVMODEW startup_mode; +static DEVMODEW registry_mode; static HRESULT (WINAPI *pDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex **d3d9ex); @@ -1744,8 +1744,8 @@ static DWORD WINAPI wndproc_thread(void *param) BOOL ret; p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, startup_mode.dmPelsWidth, - startup_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); p->running_in_foreground = SetForegroundWindow(p->dummy_window); ret = SetEvent(p->window_created); @@ -1802,11 +1802,11 @@ static void test_wndproc(void) ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, startup_mode.dmPelsWidth, - startup_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, startup_mode.dmPelsWidth, - startup_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -1839,8 +1839,8 @@ static void test_wndproc(void) expect_messages = messages; device_desc.device_window = device_window; - device_desc.width = startup_mode.dmPelsWidth; - device_desc.height = startup_mode.dmPelsHeight; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(focus_window, &device_desc))) { @@ -1944,11 +1944,11 @@ static void test_wndproc_windowed(void) ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, startup_mode.dmPelsWidth, - startup_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, startup_mode.dmPelsWidth, - startup_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -2143,14 +2143,14 @@ static void test_window_style(void) }; unsigned int i; - SetRect(&fullscreen_rect, 0, 0, startup_mode.dmPelsWidth, startup_mode.dmPelsHeight); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, - 0, 0, startup_mode.dmPelsWidth / 2, startup_mode.dmPelsHeight / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, - 0, 0, startup_mode.dmPelsWidth / 2, startup_mode.dmPelsHeight / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); device_style = GetWindowLongA(device_window, GWL_STYLE); device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE); @@ -2161,8 +2161,8 @@ static void test_window_style(void) GetWindowRect(device_window, &device_rect); device_desc.device_window = device_window; - device_desc.width = startup_mode.dmPelsWidth; - device_desc.height = startup_mode.dmPelsHeight; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].device_flags; if (!(device = create_device(focus_window, &device_desc))) { @@ -2233,6 +2233,8 @@ static void test_window_style(void) START_TEST(d3d9ex) { + DEVMODEW current_mode; + d3d9_handle = LoadLibraryA("d3d9.dll"); if (!d3d9_handle) { @@ -2246,9 +2248,17 @@ START_TEST(d3d9ex) return; } - startup_mode.dmSize = sizeof(startup_mode); - ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &startup_mode), - "Failed to get display mode.\n"); + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (current_mode.dmPelsWidth != registry_mode.dmPelsWidth + || current_mode.dmPelsHeight != registry_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } test_qi_base_to_ex(); test_qi_ex_to_base(); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 2b7edd7..8d99a9d 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -47,8 +47,7 @@ struct device_desc #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) -static INT screen_width; -static INT screen_height; +static DEVMODEW registry_mode; static const DWORD simple_vs[] = { @@ -186,8 +185,8 @@ static HRESULT reset_device(IDirect3DDevice9 *device, HWND device_window, BOOL w present_parameters.Windowed = windowed; present_parameters.hDeviceWindow = device_window; present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - present_parameters.BackBufferWidth = screen_width; - present_parameters.BackBufferHeight = screen_height; + present_parameters.BackBufferWidth = registry_mode.dmPelsWidth; + present_parameters.BackBufferHeight = registry_mode.dmPelsHeight; present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; @@ -2983,8 +2982,8 @@ static void test_scissor_size(void) if (!scts[i].window) { - scts[i].backx = screen_width; - scts[i].backy = screen_height; + scts[i].backx = registry_mode.dmPelsWidth; + scts[i].backy = registry_mode.dmPelsHeight; } device_desc.device_window = hwnd; @@ -3001,7 +3000,10 @@ static void test_scissor_size(void) /* Check for the default scissor rect size */ hr = IDirect3DDevice9_GetScissorRect(device_ptr, &scissorrect); ok(hr == D3D_OK, "IDirect3DDevice9_GetScissorRect failed with: %08x\n", hr); - ok(scissorrect.right == scts[i].backx && scissorrect.bottom == scts[i].backy && scissorrect.top == 0 && scissorrect.left == 0, "Scissorrect missmatch (%d, %d) should be (%d, %d)\n", scissorrect.right, scissorrect.bottom, scts[i].backx, scts[i].backy); + ok(scissorrect.right == scts[i].backx && scissorrect.bottom == scts[i].backy + && scissorrect.top == 0 && scissorrect.left == 0, + "Scissorrect missmatch (%d, %d) should be (%d, %d)\n", scissorrect.right, scissorrect.bottom, + scts[i].backx, scts[i].backy); /* check the scissorrect values after a reset */ hr = reset_device(device_ptr, hwnd, scts[i].window); @@ -3011,7 +3013,10 @@ static void test_scissor_size(void) hr = IDirect3DDevice9_GetScissorRect(device_ptr, &scissorrect); ok(hr == D3D_OK, "IDirect3DDevice9_GetScissorRect failed with: %08x\n", hr); - ok(scissorrect.right == screen_width && scissorrect.bottom == screen_height && scissorrect.top == 0 && scissorrect.left == 0, "Scissorrect missmatch (%d, %d) should be (%d, %d)\n", scissorrect.right, scissorrect.bottom, screen_width, screen_height); + ok(scissorrect.right == registry_mode.dmPelsWidth && scissorrect.bottom == registry_mode.dmPelsHeight + && scissorrect.top == 0 && scissorrect.left == 0, + "Scissorrect missmatch (%d, %d) should be (%u, %u)\n", scissorrect.right, scissorrect.bottom, + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); if(device_ptr) { ULONG ref; @@ -3128,7 +3133,8 @@ static DWORD WINAPI wndproc_thread(void *param) BOOL ret; p->dummy_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); p->running_in_foreground = SetForegroundWindow(p->dummy_window); ret = SetEvent(p->window_created); @@ -3187,9 +3193,11 @@ static void test_wndproc(void) ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -3222,8 +3230,8 @@ static void test_wndproc(void) expect_messages = messages; device_desc.device_window = device_window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d9, focus_window, &device_desc))) { @@ -3332,9 +3340,11 @@ static void test_wndproc_windowed(void) ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -3530,7 +3540,7 @@ static void test_reset_fullscreen(void) ok(atom, "Failed to register a new window class. GetLastError:%d\n", GetLastError()); device_window = focus_window = CreateWindowExA(0, wc.lpszClassName, "Test Reset Fullscreen", 0, - 0, 0, screen_width, screen_height, NULL, NULL, NULL, NULL); + 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, NULL, NULL, NULL, NULL); ok(device_window != NULL, "Failed to create a window. GetLastError:%d\n", GetLastError()); /* @@ -3600,7 +3610,8 @@ static void test_fpu_setup(void) IDirect3D9 *d3d9; WORD cw; - window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_CAPTION, 0, 0, + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); ok(!!window, "Failed to create a window.\n"); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); @@ -3673,14 +3684,14 @@ static void test_window_style(void) d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); device_style = GetWindowLongA(device_window, GWL_STYLE); device_exstyle = GetWindowLongA(device_window, GWL_EXSTYLE); @@ -3691,8 +3702,8 @@ static void test_window_style(void) GetWindowRect(device_window, &device_rect); device_desc.device_window = device_window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].device_flags; if (!(device = create_device(d3d9, focus_window, &device_desc))) { @@ -3901,18 +3912,18 @@ static void test_mode_change(void) DWORD ret; focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d9, focus_window, &device_desc))) { @@ -3949,8 +3960,8 @@ static void test_mode_change(void) ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DSurface9_GetDesc(backbuffer, &desc); ok(SUCCEEDED(hr), "Failed to get backbuffer desc, hr %#x.\n", hr); - ok(desc.Width == screen_width, "Got unexpected backbuffer width %u.\n", desc.Width); - ok(desc.Height == screen_height, "Got unexpected backbuffer height %u.\n", desc.Height); + ok(desc.Width == registry_mode.dmPelsWidth, "Got unexpected backbuffer width %u.\n", desc.Width); + ok(desc.Height == registry_mode.dmPelsHeight, "Got unexpected backbuffer height %u.\n", desc.Height); IDirect3DSurface9_Release(backbuffer); refcount = IDirect3DDevice9_Release(device); @@ -3960,8 +3971,8 @@ static void test_mode_change(void) devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == screen_width, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == screen_height, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); done: DestroyWindow(device_window); @@ -3972,8 +3983,8 @@ done: devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == screen_width, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == screen_height, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); } static void test_device_window_reset(void) @@ -3992,13 +4003,13 @@ static void test_device_window_reset(void) ok(RegisterClassA(&wc), "Failed to register window class.\n"); focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); GetWindowRect(device_window, &device_rect); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -4009,8 +4020,8 @@ static void test_device_window_reset(void) (LONG_PTR)test_proc, proc); device_desc.device_window = NULL; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d9, focus_window, &device_desc))) { @@ -4605,15 +4616,15 @@ static void test_occlusion_query_states(void) DWORD dword[2]; } data; BOOL broken_occlusion = FALSE; - DWORD expected = screen_width * screen_height; + DWORD expected = registry_mode.dmPelsWidth * registry_mode.dmPelsHeight; window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, 0, 0, 0, 0); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); device_desc.device_window = window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d9, window, &device_desc))) { @@ -9213,8 +9224,8 @@ static void test_lost_device(void) d3d = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d, "Failed to create a D3D object.\n"); device_desc.device_window = window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d, window, &device_desc))) { @@ -9420,6 +9431,19 @@ START_TEST(device) { WNDCLASSA wc = {0}; IDirect3D9 *d3d9; + DEVMODEW current_mode; + + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (registry_mode.dmPelsWidth != current_mode.dmPelsWidth + || registry_mode.dmPelsHeight != current_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } if (!(d3d9 = Direct3DCreate9(D3D_SDK_VERSION))) { @@ -9432,9 +9456,6 @@ START_TEST(device) wc.lpszClassName = "d3d9_test_wc"; RegisterClassA(&wc); - screen_width = GetSystemMetrics(SM_CXSCREEN); - screen_height = GetSystemMetrics(SM_CYSCREEN); - test_get_set_vertex_declaration(); test_get_declaration(); test_fvf_decl_conversion(); -- 2.0.4 From stefan at codeweavers.com Mon Nov 3 15:33:59 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 3 Nov 2014 22:33:59 +0100 Subject: [PATCH 2/4] d3d9/tests: The device restores the mode settings from the registry (v3). Message-ID: <1415050441-5172-2-git-send-email-stefan@codeweavers.com> Version 3: Simplify the mode selection code and hardcode D3DFMT_X8R8G8B8. Retain the test for mode reset when the device was originally created with the registry size. Version 2: Make sure the mode set with ChangeDisplaySettings is bigger than the device's mode. Otherwise Windows shrinks the window to the new mode + 12 pixels. Testing this behavior is not the purpose of this test. Implementing this behavior is complicated because ddraw destroys and recreates swapchains in SetCooperativeLevel. --- dlls/d3d9/tests/device.c | 153 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 117 insertions(+), 36 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 8d99a9d..16daa97 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3900,56 +3900,116 @@ done: static void test_mode_change(void) { - RECT fullscreen_rect, focus_rect, r; + RECT d3d_rect, focus_rect, r; struct device_desc device_desc; IDirect3DSurface9 *backbuffer; IDirect3DDevice9 *device; D3DSURFACE_DESC desc; IDirect3D9 *d3d9; DEVMODEW devmode; - UINT refcount; + ULONG refcount; + UINT adapter_mode_count, i; HRESULT hr; DWORD ret; + LONG change_ret; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; - focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + adapter_mode_count = IDirect3D9_GetAdapterModeCount(d3d9, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D9_EnumAdapterModes(d3d9, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D9_Release(d3d9); + return; + } + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + + SetRect(&d3d_rect, 0, 0, d3d_width, d3d_height); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d9, focus_window, &device_desc))) { skip("Failed to create a D3D device, skipping tests.\n"); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); goto done; } - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; - devmode.dmPelsWidth = 640; - devmode.dmPelsHeight = 480; - - ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); - ok(ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", ret); + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == 640, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == 480, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == user32_width, "Got unexpect width %u, expected %u.\n", + devmode.dmPelsWidth, user32_width); + ok(devmode.dmPelsHeight == user32_height, "Got unexpect height %u, expected %u.\n", + devmode.dmPelsHeight, user32_height); GetWindowRect(device_window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, &d3d_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + d3d_rect.left, d3d_rect.top, d3d_rect.right, d3d_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(focus_window, &r); ok(EqualRect(&r, &focus_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", @@ -3960,31 +4020,52 @@ static void test_mode_change(void) ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DSurface9_GetDesc(backbuffer, &desc); ok(SUCCEEDED(hr), "Failed to get backbuffer desc, hr %#x.\n", hr); - ok(desc.Width == registry_mode.dmPelsWidth, "Got unexpected backbuffer width %u.\n", desc.Width); - ok(desc.Height == registry_mode.dmPelsHeight, "Got unexpected backbuffer height %u.\n", desc.Height); + ok(desc.Width == d3d_width, "Got unexpected backbuffer width %u, expected %u.\n", + desc.Width, d3d_width); + ok(desc.Height == d3d_height, "Got unexpected backbuffer height %u, expected %u.\n", + desc.Height, d3d_height); IDirect3DSurface9_Release(backbuffer); refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u, expected %u.\n", + devmode.dmPelsWidth, registry_mode.dmPelsWidth); + todo_wine ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u, expected %u.\n", + devmode.dmPelsHeight, registry_mode.dmPelsHeight); + + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + /* The mode restore also happens when the device was created at the original screen size. */ + + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + ok(!!(device = create_device(d3d9, focus_window, &device_desc)), "Failed to create a D3D device.\n"); + + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u, expected %u.\n", + devmode.dmPelsWidth, registry_mode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u, expected %u.\n", + devmode.dmPelsHeight, registry_mode.dmPelsHeight); done: DestroyWindow(device_window); DestroyWindow(focus_window); IDirect3D9_Release(d3d9); - - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); - ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); } static void test_device_window_reset(void) -- 2.0.4 From stefan at codeweavers.com Mon Nov 3 15:34:00 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 3 Nov 2014 22:34:00 +0100 Subject: [PATCH 3/4] d3d8/tests: Check if the current display settings match the registry settings. Message-ID: <1415050441-5172-3-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 91 ++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 38 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 5f8f52a..23abbff 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -46,8 +46,7 @@ struct device_desc #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp)) #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp)) -static INT screen_width; -static INT screen_height; +static DEVMODEW registry_mode; static HRESULT (WINAPI *ValidateVertexShader)(DWORD *, DWORD *, DWORD *, int, DWORD *); static HRESULT (WINAPI *ValidatePixelShader)(DWORD *, DWORD *, int, DWORD *); @@ -144,8 +143,8 @@ static HRESULT reset_device(IDirect3DDevice8 *device, HWND device_window, BOOL w present_parameters.Windowed = windowed; present_parameters.hDeviceWindow = device_window; present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - present_parameters.BackBufferWidth = screen_width; - present_parameters.BackBufferHeight = screen_height; + present_parameters.BackBufferWidth = registry_mode.dmPelsWidth; + present_parameters.BackBufferHeight = registry_mode.dmPelsHeight; present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; @@ -2182,7 +2181,8 @@ static DWORD WINAPI wndproc_thread(void *param) BOOL ret; p->dummy_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); p->running_in_foreground = SetForegroundWindow(p->dummy_window); ret = SetEvent(p->window_created); @@ -2244,9 +2244,11 @@ static void test_wndproc(void) ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); focus_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -2279,8 +2281,8 @@ static void test_wndproc(void) expect_messages = messages; device_desc.device_window = device_window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { @@ -2389,9 +2391,11 @@ static void test_wndproc_windowed(void) ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); focus_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -2600,7 +2604,8 @@ static void test_fpu_setup(void) HRESULT hr; WORD cw; - window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_CAPTION, 0, 0, screen_width, screen_height, 0, 0, 0, 0); + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_CAPTION, 0, 0, + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, 0, 0, 0, 0); ok(!!window, "Failed to create a window.\n"); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); @@ -2779,9 +2784,9 @@ static void test_window_style(void) ULONG ref; focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 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); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); @@ -2790,12 +2795,12 @@ static void test_window_style(void) focus_style = GetWindowLongA(focus_window, GWL_STYLE); focus_exstyle = GetWindowLongA(focus_window, GWL_EXSTYLE); - SetRect(&fullscreen_rect, 0, 0, screen_width, screen_height); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { @@ -2989,18 +2994,18 @@ static void test_mode_change(void) DWORD ret; focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 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); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 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); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { @@ -3037,8 +3042,8 @@ static void test_mode_change(void) ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DSurface8_GetDesc(backbuffer, &desc); ok(SUCCEEDED(hr), "Failed to get backbuffer desc, hr %#x.\n", hr); - ok(desc.Width == screen_width, "Got unexpected backbuffer width %u.\n", desc.Width); - ok(desc.Height == screen_height, "Got unexpected backbuffer height %u.\n", desc.Height); + ok(desc.Width == registry_mode.dmPelsWidth, "Got unexpected backbuffer width %u.\n", desc.Width); + ok(desc.Height == registry_mode.dmPelsHeight, "Got unexpected backbuffer height %u.\n", desc.Height); IDirect3DSurface8_Release(backbuffer); refcount = IDirect3DDevice8_Release(device); @@ -3048,8 +3053,8 @@ static void test_mode_change(void) devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == screen_width, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == screen_height, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); done: DestroyWindow(device_window); @@ -3060,8 +3065,8 @@ done: devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == screen_width, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == screen_height, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); } static void test_device_window_reset(void) @@ -3080,13 +3085,13 @@ static void test_device_window_reset(void) ok(RegisterClassA(&wc), "Failed to register window class.\n"); focus_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, screen_width / 2, screen_height / 2, 0, 0, 0, 0); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 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); + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 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); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); GetWindowRect(device_window, &device_rect); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3097,8 +3102,8 @@ static void test_device_window_reset(void) (LONG_PTR)test_proc, proc); device_desc.device_window = NULL; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { @@ -6374,8 +6379,8 @@ static void test_lost_device(void) d3d = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d, "Failed to create a D3D object.\n"); device_desc.device_window = window; - device_desc.width = screen_width; - device_desc.height = screen_height; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d, window, &device_desc))) { @@ -6546,6 +6551,7 @@ START_TEST(device) HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" ); WNDCLASSA wc = {0}; IDirect3D8 *d3d8; + DEVMODEW current_mode; if (!d3d8_handle) { @@ -6553,6 +6559,18 @@ START_TEST(device) return; } + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (current_mode.dmPelsWidth != registry_mode.dmPelsWidth + || current_mode.dmPelsHeight != registry_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } + wc.lpfnWndProc = DefWindowProcA; wc.lpszClassName = "d3d8_test_wc"; RegisterClassA(&wc); @@ -6567,9 +6585,6 @@ START_TEST(device) } IDirect3D8_Release(d3d8); - screen_width = GetSystemMetrics(SM_CXSCREEN); - screen_height = GetSystemMetrics(SM_CYSCREEN); - test_fpu_setup(); test_display_formats(); test_display_modes(); -- 2.0.4 From stefan at codeweavers.com Mon Nov 3 15:34:01 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 3 Nov 2014 22:34:01 +0100 Subject: [PATCH 4/4] d3d8/tests: The device restores the mode settings from the registry (v4). Message-ID: <1415050441-5172-4-git-send-email-stefan@codeweavers.com> v4: Simplify the mode selection code and (via previous patch) use EnumDisplaySettingsW(ENUM_REGISTRY_SETTINGS) instead of GetSystemMetrics(SM_C?SCREEN). Retain the test for mode reset when the device was originally created with the registry size. v3: Make the window visible. This works around the failure of 107263 on the W8 testbot. The testbot failure (device::release does not restore the mode) happens on Vista too. This problem only happens if the application is not in foreground *and* the windows are hidden. If the application is in foreground, the device properly restores the mode even with (manually) hidden windows. This is a preexisting condition, see the failure in line 3051 here: http://test.winehq.org/data/4bb80afedcca6bdc510574488258ef1a16e4167f/win8_newtb-w8/d3d8:device.html This patch changes the previous resolution, thus the testbot did not filter it out. --- dlls/d3d8/tests/device.c | 159 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 122 insertions(+), 37 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 23abbff..ab4a13c 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2982,56 +2982,120 @@ static void test_unsupported_shaders(void) static void test_mode_change(void) { - RECT fullscreen_rect, focus_rect, r; + RECT d3d_rect, focus_rect, r; struct device_desc device_desc; IDirect3DSurface8 *backbuffer; IDirect3DDevice8 *device; D3DSURFACE_DESC desc; IDirect3D8 *d3d8; DEVMODEW devmode; - UINT refcount; + ULONG refcount; + UINT adapter_mode_count, i; HRESULT hr; - DWORD ret; + BOOL ret; + LONG change_ret; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; - focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); - device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + adapter_mode_count = IDirect3D8_GetAdapterModeCount(d3d8, D3DADAPTER_DEFAULT); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D8_EnumAdapterModes(d3d8, D3DADAPTER_DEFAULT, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Format != D3DFMT_X8R8G8B8) + continue; + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D8_Release(d3d8); + return; + } + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + /* Make the windows visible, otherwise device::release does not restore the mode if + * the application is not in foreground like on the testbot. */ + focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + + SetRect(&d3d_rect, 0, 0, d3d_width, d3d_height); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { skip("Failed to create a D3D device, skipping tests.\n"); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); goto done; } - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; - devmode.dmPelsWidth = 640; - devmode.dmPelsHeight = 480; - - ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); - ok(ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", ret); + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == 640, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == 480, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == user32_width, "Got unexpect width %u, expected %u.\n", + devmode.dmPelsWidth, user32_width); + ok(devmode.dmPelsHeight == user32_height, "Got unexpect height %u, expected %u.\n", + devmode.dmPelsHeight, user32_height); GetWindowRect(device_window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, &d3d_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + d3d_rect.left, d3d_rect.top, d3d_rect.right, d3d_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(focus_window, &r); ok(EqualRect(&r, &focus_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", @@ -3042,31 +3106,52 @@ static void test_mode_change(void) ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DSurface8_GetDesc(backbuffer, &desc); ok(SUCCEEDED(hr), "Failed to get backbuffer desc, hr %#x.\n", hr); - ok(desc.Width == registry_mode.dmPelsWidth, "Got unexpected backbuffer width %u.\n", desc.Width); - ok(desc.Height == registry_mode.dmPelsHeight, "Got unexpected backbuffer height %u.\n", desc.Height); + ok(desc.Width == d3d_width, "Got unexpected backbuffer width %u, expected %u.\n", + desc.Width, d3d_width); + ok(desc.Height == d3d_height, "Got unexpected backbuffer height %u, expected %u.\n", + desc.Height, d3d_height); IDirect3DSurface8_Release(backbuffer); refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u, expected %u.\n", + devmode.dmPelsWidth, registry_mode.dmPelsWidth); + todo_wine ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u, expected %u.\n", + devmode.dmPelsHeight, registry_mode.dmPelsHeight); + + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + /* The mode restore also happens when the device was created at the original screen size. */ + + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + ok(!!(device = create_device(d3d8, focus_window, &device_desc)), "Failed to create a D3D device.\n"); + + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u, expected %u.\n", + devmode.dmPelsWidth, registry_mode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u, expected %u.\n", + devmode.dmPelsHeight, registry_mode.dmPelsHeight); done: DestroyWindow(device_window); DestroyWindow(focus_window); IDirect3D8_Release(d3d8); - - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); - ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); } static void test_device_window_reset(void) -- 2.0.4 From mbruni at codeweavers.com Mon Nov 3 15:38:26 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 3 Nov 2014 22:38:26 +0100 Subject: [PATCH 1/6] wined3d: Add ATI1N texture format support. Message-ID: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> I opted for replicating the AMD version (see test) since I think it's more likely for older games to expect the AMD behavior, if it ever matters. It fixes terrain shadows appearence in the Ground Target Assault training lesson in World of Warplanes. --- dlls/wined3d/utils.c | 13 +++++++++++++ include/wine/wined3d.h | 1 + 2 files changed, 14 insertions(+) diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index b9d60de..d3fb1d6 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -129,6 +129,7 @@ static const struct wined3d_format_channels formats[] = {WINED3DFMT_R32G32B32A32_UINT, 32, 32, 32, 32, 0, 32, 64, 96, 16, 0, 0}, {WINED3DFMT_R16G16B16A16_SNORM, 16, 16, 16, 16, 0, 16, 32, 48, 8, 0, 0}, /* Vendor-specific formats */ + {WINED3DFMT_ATI1N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_ATI2N, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0}, {WINED3DFMT_NVDB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {WINED3DFMT_INST, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, @@ -175,6 +176,7 @@ static const struct wined3d_format_base_flags format_base_flags[] = {WINED3DFMT_B4G4R4X4_UNORM, WINED3DFMT_FLAG_GETDC}, {WINED3DFMT_R8G8B8A8_UNORM, WINED3DFMT_FLAG_GETDC}, {WINED3DFMT_R8G8B8X8_UNORM, WINED3DFMT_FLAG_GETDC}, + {WINED3DFMT_ATI1N, WINED3DFMT_FLAG_BROKEN_PITCH}, {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_BROKEN_PITCH}, {WINED3DFMT_R32_FLOAT, WINED3DFMT_FLAG_FLOAT}, {WINED3DFMT_R32G32_FLOAT, WINED3DFMT_FLAG_FLOAT}, @@ -203,6 +205,7 @@ static const struct wined3d_format_block_info format_block_info[] = {WINED3DFMT_DXT3, 4, 4, 16, TRUE}, {WINED3DFMT_DXT4, 4, 4, 16, TRUE}, {WINED3DFMT_DXT5, 4, 4, 16, TRUE}, + {WINED3DFMT_ATI1N, 4, 4, 8, FALSE}, {WINED3DFMT_ATI2N, 4, 4, 16, FALSE}, {WINED3DFMT_YUY2, 2, 1, 4, FALSE}, {WINED3DFMT_UYVY, 2, 1, 4, FALSE}, @@ -1184,6 +1187,11 @@ static const struct wined3d_format_texture_info format_texture_info[] = WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL | WINED3DFMT_FLAG_SHADOW, ARB_DEPTH_BUFFER_FLOAT, convert_s8_uint_d24_float}, /* Vendor-specific formats */ + {WINED3DFMT_ATI1N, GL_COMPRESSED_RED_RGTC1, GL_COMPRESSED_RED_RGTC1, 0, + GL_RED, GL_UNSIGNED_BYTE, 0, + WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING + | WINED3DFMT_FLAG_COMPRESSED, + ARB_TEXTURE_COMPRESSION_RGTC, NULL}, {WINED3DFMT_ATI2N, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, GL_COMPRESSED_LUMINANCE_ALPHA_3DC_ATI, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING @@ -2020,6 +2028,10 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_ if (gl_info->supported[ARB_TEXTURE_COMPRESSION_RGTC]) { + idx = getFmtIdx(WINED3DFMT_ATI1N); + gl_info->formats[idx].color_fixup = create_color_fixup_desc( + 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_X); + idx = getFmtIdx(WINED3DFMT_ATI2N); gl_info->formats[idx].color_fixup = create_color_fixup_desc( 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE); @@ -2316,6 +2328,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) FMT_TO_STR(WINED3DFMT_S8_UINT_D24_FLOAT); FMT_TO_STR(WINED3DFMT_VERTEXDATA); FMT_TO_STR(WINED3DFMT_R8G8_SNORM_Cx); + FMT_TO_STR(WINED3DFMT_ATI1N); FMT_TO_STR(WINED3DFMT_ATI2N); FMT_TO_STR(WINED3DFMT_NVDB); FMT_TO_STR(WINED3DFMT_NVHU); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 30b597d..1b8f145 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -241,6 +241,7 @@ enum wined3d_format_id WINED3DFMT_MULTI2_ARGB8 = WINEMAKEFOURCC('M','E','T','1'), WINED3DFMT_G8R8_G8B8 = WINEMAKEFOURCC('G','R','G','B'), WINED3DFMT_R8G8_B8G8 = WINEMAKEFOURCC('R','G','B','G'), + WINED3DFMT_ATI1N = WINEMAKEFOURCC('A','T','I','1'), WINED3DFMT_ATI2N = WINEMAKEFOURCC('A','T','I','2'), WINED3DFMT_INST = WINEMAKEFOURCC('I','N','S','T'), WINED3DFMT_NVDB = WINEMAKEFOURCC('N','V','D','B'), -- 2.0.4 From mbruni at codeweavers.com Mon Nov 3 15:38:27 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 3 Nov 2014 22:38:27 +0100 Subject: [PATCH 2/6] wined3d: Dirtify pixel shader on texture format change. In-Reply-To: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> References: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415050711-29205-2-git-send-email-mbruni@codeweavers.com> The following 3Dc test (in its current form) fails without this, because we fail to update the color fixup between the ATI1N and the ATI2N texture test. v2: Only dirtify on color fixup or color / shadow sampler changes. --- dlls/wined3d/cs.c | 7 ++++++- dlls/wined3d/wined3d_private.h | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index bdd86c8..b8a32e5 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -636,10 +636,15 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data) if (op->texture) { + const struct wined3d_format *new_format = op->texture->resource.format; + const struct wined3d_format *old_format = prev ? prev->resource.format : NULL; + if (InterlockedIncrement(&op->texture->resource.bind_count) == 1) op->texture->sampler = op->stage; - if (!prev || op->texture->target != prev->target) + if (!prev || op->texture->target != prev->target + || !is_same_fixup(new_format->color_fixup, old_format->color_fixup) + || (new_format->flags & WINED3DFMT_FLAG_SHADOW) != (old_format->flags & WINED3DFMT_FLAG_SHADOW)) device_invalidate_state(cs->device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL)); if (!prev && op->stage < d3d_info->limits.ffp_blend_stages) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f4ded4f..179fafe 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -141,6 +141,14 @@ static inline BOOL is_complex_fixup(struct color_fixup_desc fixup) return fixup.x_source == CHANNEL_SOURCE_COMPLEX0 || fixup.x_source == CHANNEL_SOURCE_COMPLEX1; } +static inline BOOL is_same_fixup(struct color_fixup_desc f1, struct color_fixup_desc f2) +{ + return f1.x_sign_fixup == f2.x_sign_fixup && f1.x_source == f2.x_source + && f1.y_sign_fixup == f2.y_sign_fixup && f1.y_source == f2.y_source + && f1.z_sign_fixup == f2.z_sign_fixup && f1.z_source == f2.z_source + && f1.w_sign_fixup == f2.w_sign_fixup && f1.w_source == f2.w_source; +} + static inline enum complex_fixup get_complex_fixup(struct color_fixup_desc fixup) { enum complex_fixup complex_fixup = 0; -- 2.0.4 From mbruni at codeweavers.com Mon Nov 3 15:38:28 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 3 Nov 2014 22:38:28 +0100 Subject: [PATCH 3/6] d3d9/tests: Add a test for ATI1N and ATI2N texture formats. In-Reply-To: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> References: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415050711-29205-3-git-send-email-mbruni@codeweavers.com> v2: Add the ATI1N format to a couple other relevant tests in device.c, small cleanup of the expected results arrays, remove debug trace. --- dlls/d3d9/tests/device.c | 6 +- dlls/d3d9/tests/visual.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 2 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 2b7edd7..a523e14 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -6145,6 +6145,7 @@ static void test_lockrect_offset(void) {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, 16}, {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, 16}, {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 16}, + {MAKEFOURCC('A','T','I','1'), "ATI1N", 1, 1, 1}, {MAKEFOURCC('A','T','I','2'), "ATI2N", 1, 1, 1}, }; unsigned int expected_offset, offset, i; @@ -6812,9 +6813,10 @@ static void test_surface_blocks(void) {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, FALSE, TRUE, TRUE }, {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, FALSE, TRUE, TRUE }, {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, FALSE, TRUE, TRUE }, - /* ATI2N has 2x2 blocks on all AMD cards and Geforce 7 cards, + /* ATI1N and ATI2N have 2x2 blocks on all AMD cards and Geforce 7 cards, * which doesn't match the format spec. On newer Nvidia cards - * it has the correct 4x4 block size */ + * they have the correct 4x4 block size */ + {MAKEFOURCC('A','T','I','1'), "ATI1N", 4, 4, TRUE, FALSE, FALSE}, {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, TRUE, FALSE, FALSE}, {D3DFMT_YUY2, "D3DFMT_YUY2", 2, 1, FALSE, FALSE, TRUE }, {D3DFMT_UYVY, "D3DFMT_UYVY", 2, 1, FALSE, FALSE, TRUE }, diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 117c8eb..d1d7447 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16660,6 +16660,166 @@ done: DestroyWindow(window); } +static void test_3dc_formats(void) +{ + static const char ati1n_data[] = + { + /* A 4x4 texture with the color component at 50%. */ + 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + static const char ati2n_data[] = + { + /* A 8x4 texture consisting of 2 4x4 blocks. The first block has 50% first color component, + * 0% second component. Second block is the opposite. */ + 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + static const struct + { + struct vec3 position; + struct vec2 texcoord; + } + quads[] = + { + {{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, + {{-1.0f, 1.0f, 0.0f}, {0.0f, 1.0f}}, + {{ 0.0f, -1.0f, 1.0f}, {1.0f, 0.0f}}, + {{ 0.0f, 1.0f, 1.0f}, {1.0f, 1.0f}}, + + {{ 0.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, + {{ 0.0f, 1.0f, 0.0f}, {0.0f, 1.0f}}, + {{ 1.0f, -1.0f, 1.0f}, {1.0f, 0.0f}}, + {{ 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f}}, + }; + static const DWORD ati1n_fourcc = MAKEFOURCC('A','T','I','1'); + static const DWORD ati2n_fourcc = MAKEFOURCC('A','T','I','2'); + static const struct + { + struct vec2 position; + D3DCOLOR amd; + D3DCOLOR nvidia; + } + expected_colors[] = + { + {{ 80, 240}, 0x003f3f3f, 0x007f0000}, + {{240, 240}, 0x003f3f3f, 0x007f0000}, + {{400, 240}, 0x00007fff, 0x00007fff}, + {{560, 240}, 0x007f00ff, 0x007f00ff}, + }; + IDirect3D9 *d3d; + IDirect3DDevice9 *device; + IDirect3DTexture9 *ati1n_texture, *ati2n_texture; + D3DCAPS9 caps; + D3DLOCKED_RECT rect; + D3DCOLOR color; + ULONG refcount; + HWND window; + HRESULT hr; + unsigned int 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, 0, D3DRTYPE_TEXTURE, ati1n_fourcc))) + { + skip("ATI1N textures are not supported, skipping test.\n"); + goto done; + } + if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, ati2n_fourcc))) + { + skip("ATI2N 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_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.PrimitiveMiscCaps & D3DPMISCCAPS_TSSARGTEMP)) + { + skip("D3DTA_TEMP not supported, skipping tests.\n"); + IDirect3DDevice9_Release(device); + goto done; + } + + hr = IDirect3DDevice9_CreateTexture(device, 4, 4, 1, 0, ati1n_fourcc, + D3DPOOL_MANAGED, &ati1n_texture, NULL); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + + hr = IDirect3DTexture9_LockRect(ati1n_texture, 0, &rect, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock texture, hr %#x.\n", hr); + memcpy(rect.pBits, ati1n_data, sizeof(ati1n_data)); + hr = IDirect3DTexture9_UnlockRect(ati1n_texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr); + + hr = IDirect3DDevice9_CreateTexture(device, 8, 4, 1, 0, ati2n_fourcc, + D3DPOOL_MANAGED, &ati2n_texture, NULL); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + + hr = IDirect3DTexture9_LockRect(ati2n_texture, 0, &rect, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock texture, hr %#x.\n", hr); + memcpy(rect.pBits, ati2n_data, sizeof(ati2n_data)); + hr = IDirect3DTexture9_UnlockRect(ati2n_texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); + ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA); + ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); + ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr); + /* The temporary register is initialized to 0. */ + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG2, D3DTA_TEMP); + ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); + ok(SUCCEEDED(hr), "Failed to set alpha op, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); + ok(SUCCEEDED(hr), "Failed to set alpha arg, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); + ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); + 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 | 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); + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)ati1n_texture); + ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)ati2n_texture); + ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads)); + ok(SUCCEEDED(hr), "Failed to draw, 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(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + for (i = 0; i < 4; ++i) + { + color = getPixelColor(device, expected_colors[i].position.x, expected_colors[i].position.y); + ok (color_match(color, expected_colors[i].amd, 1) || color_match(color, expected_colors[i].nvidia, 1), + "Expected color 0x%08x or 0x%08x, got 0x%08x, case %u.\n", + expected_colors[i].amd, expected_colors[i].nvidia, color, i); + } + + IDirect3DTexture9_Release(ati2n_texture); + IDirect3DTexture9_Release(ati1n_texture); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -16767,4 +16927,5 @@ START_TEST(visual) resz_test(); stencil_cull_test(); test_per_stage_constant(); + test_3dc_formats(); } -- 2.0.4 From mbruni at codeweavers.com Mon Nov 3 15:38:29 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 3 Nov 2014 22:38:29 +0100 Subject: [PATCH 4/6] d3d8/tests: Add a test for ATI1N and ATI2N texture formats. In-Reply-To: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> References: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415050711-29205-4-git-send-email-mbruni@codeweavers.com> v2: Add the ATI1N format to a relevant test in device.c, small cleanup of the expected results arrays, remove debug trace. --- dlls/d3d8/tests/device.c | 5 +- dlls/d3d8/tests/visual.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 163 insertions(+), 2 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 5f8f52a..9d498dc 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -4367,9 +4367,10 @@ static void test_surface_blocks(void) {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, FALSE, TRUE, TRUE }, {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, FALSE, TRUE, TRUE }, {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, FALSE, TRUE, TRUE }, - /* ATI2N has 2x2 blocks on all AMD cards and Geforce 7 cards, + /* ATI1N and ATI2N have 2x2 blocks on all AMD cards and Geforce 7 cards, * which doesn't match the format spec. On newer Nvidia cards - * it has the correct 4x4 block size */ + * they have the correct 4x4 block size */ + {MAKEFOURCC('A','T','I','1'), "ATI1N", 4, 4, TRUE, FALSE, FALSE}, {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, TRUE, FALSE, FALSE}, /* Windows drivers generally enforce block-aligned locks for * YUY2 and UYVY. The notable exception is the AMD r500 driver diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 163110c..9895a73 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5058,6 +5058,165 @@ done: DestroyWindow(window); } +static void test_3dc_formats(void) +{ + static const char ati1n_data[] = + { + /* A 4x4 texture with the color component at 50%. */ + 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + static const char ati2n_data[] = + { + /* A 8x4 texture consisting of 2 4x4 blocks. The first block has 50% first color component, + * 0% second component. Second block is the opposite. */ + 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + static const struct + { + struct vec3 position; + struct vec2 texcoord; + } + quads[] = + { + {{-1.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, + {{-1.0f, 1.0f, 0.0f}, {0.0f, 1.0f}}, + {{ 0.0f, -1.0f, 1.0f}, {1.0f, 0.0f}}, + {{ 0.0f, 1.0f, 1.0f}, {1.0f, 1.0f}}, + + {{ 0.0f, -1.0f, 0.0f}, {0.0f, 0.0f}}, + {{ 0.0f, 1.0f, 0.0f}, {0.0f, 1.0f}}, + {{ 1.0f, -1.0f, 1.0f}, {1.0f, 0.0f}}, + {{ 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f}}, + }; + static const DWORD ati1n_fourcc = MAKEFOURCC('A','T','I','1'); + static const DWORD ati2n_fourcc = MAKEFOURCC('A','T','I','2'); + static const struct + { + struct vec2 position; + D3DCOLOR amd; + D3DCOLOR nvidia; + } + expected_colors[] = + { + {{ 80, 240}, 0x003f3f3f, 0x007f0000}, + {{240, 240}, 0x003f3f3f, 0x007f0000}, + {{400, 240}, 0x00007fff, 0x00007fff}, + {{560, 240}, 0x007f00ff, 0x007f00ff}, + }; + IDirect3D8 *d3d; + IDirect3DDevice8 *device; + IDirect3DTexture8 *ati1n_texture, *ati2n_texture; + D3DCAPS8 caps; + D3DLOCKED_RECT rect; + D3DCOLOR color; + ULONG refcount; + HWND window; + HRESULT hr; + unsigned int i; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (FAILED(IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, ati1n_fourcc))) + { + skip("ATI1N textures are not supported, skipping test.\n"); + goto done; + } + if (FAILED(IDirect3D8_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, + D3DFMT_X8R8G8B8, 0, D3DRTYPE_TEXTURE, ati2n_fourcc))) + { + skip("ATI2N 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 = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.PrimitiveMiscCaps & D3DPMISCCAPS_TSSARGTEMP)) + { + skip("D3DTA_TEMP not supported, skipping tests.\n"); + IDirect3DDevice8_Release(device); + goto done; + } + + hr = IDirect3DDevice8_CreateTexture(device, 4, 4, 1, 0, ati1n_fourcc, + D3DPOOL_MANAGED, &ati1n_texture); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + + hr = IDirect3DTexture8_LockRect(ati1n_texture, 0, &rect, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock texture, hr %#x.\n", hr); + memcpy(rect.pBits, ati1n_data, sizeof(ati1n_data)); + hr = IDirect3DTexture8_UnlockRect(ati1n_texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr); + + hr = IDirect3DDevice8_CreateTexture(device, 8, 4, 1, 0, ati2n_fourcc, + D3DPOOL_MANAGED, &ati2n_texture); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + + hr = IDirect3DTexture8_LockRect(ati2n_texture, 0, &rect, NULL, 0); + ok(SUCCEEDED(hr), "Failed to lock texture, hr %#x.\n", hr); + memcpy(rect.pBits, ati2n_data, sizeof(ati2n_data)); + hr = IDirect3DTexture8_UnlockRect(ati2n_texture, 0); + ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE2(0)); + ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA); + ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE); + ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG2, D3DTA_TEMP); + ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1); + ok(SUCCEEDED(hr), "Failed to set alpha op, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); + ok(SUCCEEDED(hr), "Failed to set alpha arg, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE); + ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_MAGFILTER, D3DTEXF_POINT); + ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)ati1n_texture); + ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTexture(device, 0, (IDirect3DBaseTexture8 *)ati2n_texture); + ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + for (i = 0; i < 4; ++i) + { + color = getPixelColor(device, expected_colors[i].position.x, expected_colors[i].position.y); + ok (color_match(color, expected_colors[i].amd, 1) || color_match(color, expected_colors[i].nvidia, 1), + "Expected color 0x%08x or 0x%08x, got 0x%08x, case %u.\n", + expected_colors[i].amd, expected_colors[i].nvidia, color, i); + } + + IDirect3DTexture8_Release(ati2n_texture); + IDirect3DTexture8_Release(ati1n_texture); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -5107,4 +5266,5 @@ START_TEST(visual) volume_dxt5_test(); volume_v16u16_test(); add_dirty_rect_test(); + test_3dc_formats(); } -- 2.0.4 From mbruni at codeweavers.com Mon Nov 3 15:38:30 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 3 Nov 2014 22:38:30 +0100 Subject: [PATCH 5/6] d3d9/tests: Add an ATI1N entry to the test_volume_blocks test. In-Reply-To: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> References: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415050711-29205-5-git-send-email-mbruni@codeweavers.com> --- dlls/d3d9/tests/device.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index a523e14..009b474 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -7790,25 +7790,28 @@ static void test_volume_blocks(void) unsigned int block_height; unsigned int block_depth; unsigned int block_size; - BOOL broken; + unsigned int broken; BOOL create_size_checked, core_fmt; } formats[] = { /* Scratch volumes enforce DXTn block locks, unlike their surface counterparts. * ATI2N and YUV blocks are not enforced on any tested card (r200, gtx 460). */ - {D3DFMT_DXT1, "D3DFMT_DXT1", 4, 4, 1, 8, FALSE, TRUE, TRUE }, - {D3DFMT_DXT2, "D3DFMT_DXT2", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, FALSE, TRUE, TRUE }, + {D3DFMT_DXT1, "D3DFMT_DXT1", 4, 4, 1, 8, 0, TRUE, TRUE }, + {D3DFMT_DXT2, "D3DFMT_DXT2", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, 0, TRUE, TRUE }, /* ATI2N has 2x2 blocks on all AMD cards and Geforce 7 cards, * which doesn't match the format spec. On newer Nvidia cards - * it has the correct 4x4 block size */ - {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, 1, 16, TRUE, FALSE, FALSE}, - {D3DFMT_YUY2, "D3DFMT_YUY2", 2, 1, 1, 4, TRUE, FALSE, TRUE }, - {D3DFMT_UYVY, "D3DFMT_UYVY", 2, 1, 1, 4, TRUE, FALSE, TRUE }, + * it has the correct 4x4 block size. + * ATI1N volume textures are only supported by AMD GPUs right + * now and locking offsets seem just wrong. */ + {MAKEFOURCC('A','T','I','1'), "ATI1N", 4, 4, 1, 8, 2, FALSE, FALSE}, + {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, 1, 16, 1, FALSE, FALSE}, + {D3DFMT_YUY2, "D3DFMT_YUY2", 2, 1, 1, 4, 1, FALSE, TRUE }, + {D3DFMT_UYVY, "D3DFMT_UYVY", 2, 1, 1, 4, 1, FALSE, TRUE }, }; static const struct { @@ -7956,10 +7959,14 @@ static void test_volume_blocks(void) ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); base = locked_box.pBits; - if (formats[i].broken) + if (formats[i].broken == 1) { expected_row_pitch = bytes_per_pixel * 24; } + else if (formats[i].broken == 2) + { + expected_row_pitch = 24; + } else { expected_row_pitch = (24 /* tex width */ + formats[i].block_height - 1) / formats[i].block_width @@ -7994,12 +8001,18 @@ static void test_volume_blocks(void) ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x, j %u.\n", hr, j); offset = (BYTE *)locked_box.pBits - base; - if (formats[i].broken) + if (formats[i].broken == 1) { expected_offset = box.Front * expected_slice_pitch + box.Top * expected_row_pitch + box.Left * bytes_per_pixel; } + else if (formats[i].broken == 2) + { + expected_offset = box.Front * expected_slice_pitch + + box.Top * expected_row_pitch + + box.Left; + } else { expected_offset = (box.Front / formats[i].block_depth) * expected_slice_pitch -- 2.0.4 From mbruni at codeweavers.com Mon Nov 3 15:38:31 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 3 Nov 2014 22:38:31 +0100 Subject: [PATCH 6/6] d3d8/tests: Add an ATI1N entry to the test_volume_blocks test. In-Reply-To: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> References: <1415050711-29205-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415050711-29205-6-git-send-email-mbruni@codeweavers.com> --- dlls/d3d8/tests/device.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 9d498dc..a7b87a2 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -5255,25 +5255,28 @@ static void test_volume_blocks(void) unsigned int block_height; unsigned int block_depth; unsigned int block_size; - BOOL broken; + unsigned int broken; BOOL create_size_checked, core_fmt; } formats[] = { /* Scratch volumes enforce DXTn block locks, unlike their surface counterparts. * ATI2N and YUV blocks are not enforced on any tested card (r200, gtx 460). */ - {D3DFMT_DXT1, "D3DFMT_DXT1", 4, 4, 1, 8, FALSE, TRUE, TRUE }, - {D3DFMT_DXT2, "D3DFMT_DXT2", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, FALSE, TRUE, TRUE }, - {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, FALSE, TRUE, TRUE }, + {D3DFMT_DXT1, "D3DFMT_DXT1", 4, 4, 1, 8, 0, TRUE, TRUE }, + {D3DFMT_DXT2, "D3DFMT_DXT2", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT3, "D3DFMT_DXT3", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT4, "D3DFMT_DXT4", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, 0, TRUE, TRUE }, + {D3DFMT_DXT5, "D3DFMT_DXT5", 4, 4, 1, 16, 0, TRUE, TRUE }, /* ATI2N has 2x2 blocks on all AMD cards and Geforce 7 cards, * which doesn't match the format spec. On newer Nvidia cards - * it has the correct 4x4 block size */ - {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, 1, 16, TRUE, FALSE, FALSE}, - {D3DFMT_YUY2, "D3DFMT_YUY2", 2, 1, 1, 4, TRUE, FALSE, TRUE }, - {D3DFMT_UYVY, "D3DFMT_UYVY", 2, 1, 1, 4, TRUE, FALSE, TRUE }, + * it has the correct 4x4 block size. + * ATI1N volume textures are only supported by AMD GPUs right + * now and locking offsets seem just wrong. */ + {MAKEFOURCC('A','T','I','1'), "ATI1N", 4, 4, 1, 8, 2, FALSE, FALSE}, + {MAKEFOURCC('A','T','I','2'), "ATI2N", 4, 4, 1, 16, 1, FALSE, FALSE}, + {D3DFMT_YUY2, "D3DFMT_YUY2", 2, 1, 1, 4, 1, FALSE, TRUE }, + {D3DFMT_UYVY, "D3DFMT_UYVY", 2, 1, 1, 4, 1, FALSE, TRUE }, }; static const struct { @@ -5421,10 +5424,14 @@ static void test_volume_blocks(void) ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); base = locked_box.pBits; - if (formats[i].broken) + if (formats[i].broken == 1) { expected_row_pitch = bytes_per_pixel * 24; } + else if (formats[i].broken == 2) + { + expected_row_pitch = 24; + } else { expected_row_pitch = (24 /* tex width */ + formats[i].block_height - 1) / formats[i].block_width @@ -5459,12 +5466,18 @@ static void test_volume_blocks(void) ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x, j %u.\n", hr, j); offset = (BYTE *)locked_box.pBits - base; - if (formats[i].broken) + if (formats[i].broken == 1) { expected_offset = box.Front * expected_slice_pitch + box.Top * expected_row_pitch + box.Left * bytes_per_pixel; } + else if (formats[i].broken == 2) + { + expected_offset = box.Front * expected_slice_pitch + + box.Top * expected_row_pitch + + box.Left; + } else { expected_offset = (box.Front / formats[i].block_depth) * expected_slice_pitch -- 2.0.4 From matellanesivan at gmail.com Mon Nov 3 15:40:45 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Mon, 03 Nov 2014 22:40:45 +0100 Subject: msvcrt: Avoid locking the file in _fclose_nolock (resend) Message-ID: <5457F65D.4000101@gmail.com> Supersedes 107293 --- dlls/msvcrt/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 89d0fa0..fefab94 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3428,7 +3428,7 @@ int CDECL MSVCRT__fclose_nolock(MSVCRT_FILE* file) file->_tmpfname = NULL; /* flush stdio buffers */ if(file->_flag & MSVCRT__IOWRT) - MSVCRT_fflush(file); + MSVCRT__fflush_nolock(file); if(file->_flag & MSVCRT__IOMYBUF) MSVCRT_free(file->_base); -- 1.9.1 From matellanesivan at gmail.com Mon Nov 3 15:40:53 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Mon, 03 Nov 2014 22:40:53 +0100 Subject: msvcrt: Use correct type for fread and fwrite return values (resend) Message-ID: <5457F665.7010104@gmail.com> Supersedes 107294 --- dlls/msvcrt/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index fe3525c..89d0fa0 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3755,7 +3755,7 @@ int CDECL MSVCRT__flsbuf(int c, MSVCRT_FILE* file) */ MSVCRT_size_t CDECL MSVCRT_fwrite(const void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file) { - int ret; + MSVCRT_size_t ret; MSVCRT__lock_file(file); ret = MSVCRT__fwrite_nolock(ptr, size, nmemb, file); @@ -4016,7 +4016,7 @@ int CDECL MSVCRT__fputchar(int c) */ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nmemb, MSVCRT_FILE* file) { - int ret; + MSVCRT_size_t ret; MSVCRT__lock_file(file); ret = MSVCRT__fread_nolock(ptr, size, nmemb, file); -- 1.9.1 From mstefani at redhat.de Mon Nov 3 16:06:05 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 3 Nov 2014 23:06:05 +0100 Subject: advapi32/tests: Simplify empty string check (PVS-Studio). Message-ID: <20141103220605.GA12842@redhat.com> --- dlls/advapi32/tests/registry.c | 11 +++++------ dlls/advapi32/tests/service.c | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 1445f6f..382d8cc 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1546,7 +1546,7 @@ static void test_reg_query_value(void) ret = RegQueryValueA(hkey_main, "subkey", val, NULL); ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); - ok(lstrlenA(val) == 0, "Expected val to be untouched, got %s\n", val); + ok(!val[0], "Expected val to be untouched, got %s\n", val); /* try a NULL value and size */ ret = RegQueryValueA(hkey_main, "subkey", NULL, NULL); @@ -1559,7 +1559,7 @@ static void test_reg_query_value(void) ret = RegQueryValueA(hkey_main, "subkey", val, &size); ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", ret); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); - ok(lstrlenA(val) == 0, "Expected val to be untouched, got %s\n", val); + ok(!val[0], "Expected val to be untouched, got %s\n", val); ok(size == 5, "Expected 5, got %d\n", size); /* successfully read the value using 'subkey' */ @@ -1588,7 +1588,7 @@ static void test_reg_query_value(void) } ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", ret); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); - ok(lstrlenW(valW) == 0, "Expected valW to be untouched\n"); + ok(!valW[0], "Expected valW to be untouched\n"); ok(size == sizeof(expected), "Got wrong size: %d\n", size); /* unicode - try size in WCHARS */ @@ -1597,7 +1597,7 @@ static void test_reg_query_value(void) ret = RegQueryValueW(subkey, NULL, valW, &size); ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", ret); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); - ok(lstrlenW(valW) == 0, "Expected valW to be untouched\n"); + ok(!valW[0], "Expected valW to be untouched\n"); ok(size == sizeof(expected), "Got wrong size: %d\n", size); /* unicode - successfully read the value */ @@ -1764,8 +1764,7 @@ static void test_reg_delete_tree(void) ret = RegQueryValueA(subkey, NULL, buffer, &size); ok(ret == ERROR_SUCCESS, "Default value of subkey is not present\n"); - ok(!lstrlenA(buffer), - "Expected length 0 got length %u(%s)\n", lstrlenA(buffer), buffer); + ok(!buffer[0], "Expected length 0 got length %u(%s)\n", lstrlenA(buffer), buffer); size = MAX_PATH; ok(RegQueryValueA(subkey, "value", buffer, &size), "Value is still present\n"); diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index beb589d..ad81a25 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -1398,8 +1398,8 @@ static void test_enum_svc(void) SERVICE_STATUS status = services[i].ServiceStatus; /* lpServiceName and lpDisplayName should always be filled */ - ok(lstrlenA(services[i].lpServiceName) > 0, "Expected a service name\n"); - ok(lstrlenA(services[i].lpDisplayName) > 0, "Expected a display name\n"); + ok(services[i].lpServiceName[0], "Expected a service name\n"); + ok(services[i].lpDisplayName[0], "Expected a display name\n"); /* Decrement the counters to see if the functions calls return the same * numbers as the contents of these structures. @@ -1701,8 +1701,8 @@ static void test_enum_svc(void) SERVICE_STATUS_PROCESS status = exservices[i].ServiceStatusProcess; /* lpServiceName and lpDisplayName should always be filled */ - ok(lstrlenA(exservices[i].lpServiceName) > 0, "Expected a service name\n"); - ok(lstrlenA(exservices[i].lpDisplayName) > 0, "Expected a display name\n"); + ok(exservices[i].lpServiceName[0], "Expected a service name\n"); + ok(exservices[i].lpDisplayName[0], "Expected a display name\n"); /* Decrement the counters to see if the functions calls return the * same numbers as the contents of these structures. -- 1.8.3.1 From mstefani at redhat.de Mon Nov 3 16:21:35 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 3 Nov 2014 23:21:35 +0100 Subject: shlwapi/tests: Simplify empty string check (PVS-Studio) Message-ID: <20141103222135.GB12842@redhat.com> --- dlls/shlwapi/tests/path.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/dlls/shlwapi/tests/path.c b/dlls/shlwapi/tests/path.c index 1edb31e..7ffa000 100644 --- a/dlls/shlwapi/tests/path.c +++ b/dlls/shlwapi/tests/path.c @@ -634,8 +634,7 @@ static void test_PathCombineA(void) ok(str == NULL || broken(str != NULL), /* Win95 and some W2K */ "Expected str == NULL, got %p\n", str); - ok(lstrlenA(dest) == 0 || - broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ + ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ "Expected 0 length, got %i\n", lstrlenA(dest)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -724,8 +723,7 @@ static void test_PathCombineA(void) lstrcpyA(dest, "control"); str = PathCombineA(dest, "C:\\", too_long); ok(str == NULL, "Expected str == NULL, got %p\n", str); - ok(lstrlenA(dest) == 0 || - broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ + ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ "Expected 0 length, got %i\n", lstrlenA(dest)); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -734,8 +732,7 @@ static void test_PathCombineA(void) lstrcpyA(dest, "control"); str = PathCombineA(dest, too_long, "one\\two\\three"); ok(str == NULL, "Expected str == NULL, got %p\n", str); - ok(lstrlenA(dest) == 0 || - broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ + ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ "Expected 0 length, got %i\n", lstrlenA(dest)); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -749,8 +746,7 @@ static void test_PathCombineA(void) lstrcpyA(dest, "control"); str = PathCombineA(dest, one, two); ok(str == NULL, "Expected str == NULL, got %p\n", str); - ok(lstrlenA(dest) == 0 || - broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ + ok(!dest[0] || broken(!lstrcmpA(dest, "control")), /* Win95 and some W2K */ "Expected 0 length, got %i\n", lstrlenA(dest)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); } @@ -772,7 +768,7 @@ static void test_PathAddBackslash(void) SetLastError(0xdeadbeef); str = PathAddBackslashA(path); ok(str == (path + lstrlenA(path)), "Expected str to point to end of path, got %p\n", str); - ok(lstrlenA(path) == 0, "Expected empty string, got %i\n", lstrlenA(path)); + ok(!path[0], "Expected empty string, got %i\n", lstrlenA(path)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); /* try a relative path */ @@ -917,8 +913,7 @@ static void test_PathAppendA(void) res = PathAppendA(too_long, "two\\three"); ok(!res, "Expected failure\n"); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); - ok(lstrlenA(too_long) == 0 || - broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */ + ok(!too_long[0] || broken(lstrlenA(too_long) == (LONG_LEN - 1)), /* Win95 and some W2K */ "Expected length of too_long to be zero, got %i\n", lstrlenA(too_long)); /* pszMore is too long */ @@ -929,8 +924,7 @@ static void test_PathAppendA(void) res = PathAppendA(path, too_long); ok(!res, "Expected failure\n"); todo_wine ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); - ok(lstrlenA(path) == 0 || - broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */ + ok(!path[0] || broken(!lstrcmpA(path, "C:\\one")), /* Win95 and some W2K */ "Expected length of path to be zero, got %i\n", lstrlenA(path)); /* both params combined are too long */ @@ -941,8 +935,7 @@ static void test_PathAppendA(void) SetLastError(0xdeadbeef); res = PathAppendA(path, half); ok(!res, "Expected failure\n"); - ok(lstrlenA(path) == 0 || - broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */ + ok(!path[0] || broken(lstrlenA(path) == (HALF_LEN - 1)), /* Win95 and some W2K */ "Expected length of path to be zero, got %i\n", lstrlenA(path)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); } @@ -1092,7 +1085,7 @@ static void test_PathFindExtensionA(void) SetLastError(0xdeadbeef); ext = PathFindExtensionA(path); ok(ext == path, "Expected ext == path, got %p\n", ext); - ok(lstrlenA(ext) == 0, "Expected length 0, got %i\n", lstrlenA(ext)); + ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); /* try a path without an extension */ @@ -1100,7 +1093,7 @@ static void test_PathFindExtensionA(void) SetLastError(0xdeadbeef); ext = PathFindExtensionA(path); ok(ext == path + lstrlenA(path), "Expected ext == path, got %p\n", ext); - ok(lstrlenA(ext) == 0, "Expected length 0, got %i\n", lstrlenA(ext)); + ok(!ext[0], "Expected length 0, got %i\n", lstrlenA(ext)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); /* try a path with an extension */ @@ -1169,8 +1162,7 @@ static void test_PathBuildRootA(void) lstrcpyA(path, "aaaaaaaaa"); root = PathBuildRootA(path, -1); ok(root == path, "Expected root == path, got %p\n", root); - ok(!lstrcmpA(path, "aaaaaaaaa") || - lstrlenA(path) == 0, /* Vista */ + ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */ "Expected aaaaaaaaa or empty string, got %s\n", path); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -1179,8 +1171,7 @@ static void test_PathBuildRootA(void) lstrcpyA(path, "aaaaaaaaa"); root = PathBuildRootA(path, 26); ok(root == path, "Expected root == path, got %p\n", root); - ok(!lstrcmpA(path, "aaaaaaaaa") || - lstrlenA(path) == 0, /* Vista */ + ok(!lstrcmpA(path, "aaaaaaaaa") || !path[0], /* Vista */ "Expected aaaaaaaaa or empty string, got %s\n", path); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -1238,8 +1229,8 @@ static void test_PathCommonPrefixA(void) lstrcpyA(out, "aaa"); count = PathCommonPrefixA(path1, path2, out); ok(count == 0, "Expected 0, got %i\n", count); - ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out)); - ok(lstrlenA(path1) == 0, "Expected 0 length path1, got %i\n", lstrlenA(path1)); + ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out)); + ok(!path1[0], "Expected 0 length path1, got %i\n", lstrlenA(path1)); ok(!lstrcmpA(path2, "C:\\"), "Expected C:\\, got %s\n", path2); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -1250,8 +1241,8 @@ static void test_PathCommonPrefixA(void) lstrcpyA(out, "aaa"); count = PathCommonPrefixA(path1, path2, out); ok(count == 0, "Expected 0, got %i\n", count); - ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out)); - ok(lstrlenA(path2) == 0, "Expected 0 length path2, got %i\n", lstrlenA(path2)); + ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out)); + ok(!path2[0], "Expected 0 length path2, got %i\n", lstrlenA(path2)); ok(!lstrcmpA(path1, "C:\\"), "Expected C:\\, got %s\n", path1); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); @@ -1406,7 +1397,7 @@ static void test_PathCommonPrefixA(void) ok(count == 0, "Expected 0, got %i\n", count); ok(!lstrcmpA(path1, "one\\..\\two"), "Expected one\\..\\two, got %s\n", path1); ok(!lstrcmpA(path2, "two"), "Expected two, got %s\n", path2); - ok(lstrlenA(out) == 0, "Expected 0 length out, got %i\n", lstrlenA(out)); + ok(!out[0], "Expected 0 length out, got %i\n", lstrlenA(out)); ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); } -- 1.8.3.1 From 00cpxxx at gmail.com Mon Nov 3 16:23:02 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Mon, 3 Nov 2014 20:23:02 -0200 Subject: dinput: Ensure variable is initialized when #define is not found (Cppcheck) Message-ID: -------------- next part -------------- diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c index ce04986..4d40124 100644 --- a/dlls/dinput/joystick_linux.c +++ b/dlls/dinput/joystick_linux.c @@ -169,6 +169,9 @@ static INT find_joystick_devices(void) WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", joydev.device, strerror(errno)); joydev.axis_count = 2; } +#else + WARN("reading number of joystick axes unsupported in this platform, defaulting to 2\n"); + joydev.axis_count = 2; #endif #ifdef JSIOCGBUTTONS if (ioctl(fd, JSIOCGBUTTONS, &joydev.button_count) < 0) @@ -176,6 +179,9 @@ static INT find_joystick_devices(void) WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", joydev.device, strerror(errno)); joydev.button_count = 2; } +#else + WARN("reading number of joystick buttons unsupported in this platform, defaulting to 2\n"); + joydev.button_count = 2; #endif if (ioctl(fd, JSIOCGAXMAP, axes_map) < 0) From 00cpxxx at gmail.com Mon Nov 3 16:35:05 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Mon, 3 Nov 2014 20:35:05 -0200 Subject: po: Update Brazilian Portuguese translation Message-ID: -------------- next part -------------- diff --git a/po/pt_BR.po b/po/pt_BR.po index 9b537f0..628abf2 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -1043,10 +1043,8 @@ msgid "Open File" msgstr "Abrir Arquivo" #: comdlg32.rc:147 -#, fuzzy -#| msgid "New Folder" msgid "Select Folder" -msgstr "Nova Pasta" +msgstr "Selecionar pasta" #: comdlg32.rc:83 oleview.rc:98 msgid "Ready" @@ -3554,16 +3552,12 @@ msgid "Expected ')'" msgstr "')' esperado" #: jscript.rc:40 -#, fuzzy -#| msgid "Subject Key Identifier" msgid "Expected identifier" -msgstr "Identificador da Chave" +msgstr "Identificador esperado" #: jscript.rc:41 -#, fuzzy -#| msgid "Expected ';'" msgid "Expected '='" -msgstr "';' esperado" +msgstr "'=' esperado" #: jscript.rc:42 msgid "Invalid character" @@ -3594,20 +3588,16 @@ msgid "Label not found" msgstr "R?tulo n?o encontrado" #: jscript.rc:49 -#, fuzzy -#| msgid "Expected ';'" msgid "Expected '@end'" -msgstr "';' esperado" +msgstr "'@end' esperado" #: jscript.rc:50 msgid "Conditional compilation is turned off" msgstr "Compila??o condicional est? desligada" #: jscript.rc:51 -#, fuzzy -#| msgid "Expected ';'" msgid "Expected '@'" -msgstr "';' esperado" +msgstr "'@' esperado" #: jscript.rc:54 msgid "Number expected" @@ -6635,10 +6625,8 @@ msgid "This network connection does not exist.\n" msgstr "Esta conex?o de rede n?o existe.\n" #: winerror.mc:3746 -#, fuzzy -#| msgid "Connection refused.\n" msgid "Connection reset by peer.\n" -msgstr "Conex?o recusada.\n" +msgstr "Conex?o redefinida pelo cliente.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -7173,39 +7161,29 @@ msgid "outline button" msgstr "bot?o de contorno" #: oleacc.rc:97 -#, fuzzy -#| msgid "Normal" msgctxt "object state" msgid "normal" -msgstr "Normal" +msgstr "normal" #: oleacc.rc:98 -#, fuzzy -#| msgid "Unavailable" msgctxt "object state" msgid "unavailable" -msgstr "Indispon?vel" +msgstr "indispon?vel" #: oleacc.rc:99 -#, fuzzy -#| msgid "Select" msgctxt "object state" msgid "selected" -msgstr "Selecionar" +msgstr "selecionado" #: oleacc.rc:100 -#, fuzzy -#| msgid "Paused" msgctxt "object state" msgid "focused" -msgstr "Pausado" +msgstr "focado" #: oleacc.rc:101 -#, fuzzy -#| msgid "&Compressed" msgctxt "object state" msgid "pressed" -msgstr "&Comprimido" +msgstr "pressionado" #: oleacc.rc:102 msgctxt "object state" @@ -7213,32 +7191,24 @@ msgid "checked" msgstr "" #: oleacc.rc:103 -#, fuzzy -#| msgid "Mixed" msgctxt "object state" msgid "mixed" -msgstr "Misturado" +msgstr "misturado" #: oleacc.rc:104 -#, fuzzy -#| msgid "&Read Only" msgctxt "object state" msgid "read only" -msgstr "&Apenas leitura" +msgstr "somente leitura" #: oleacc.rc:105 -#, fuzzy -#| msgid "Hot Tracked Item" msgctxt "object state" msgid "hot tracked" -msgstr "Elemento Ativo" +msgstr "elemento ativo" #: oleacc.rc:106 -#, fuzzy -#| msgid "Defaults" msgctxt "object state" msgid "default" -msgstr "Dispositivos Padr?es" +msgstr "padr?o" #: oleacc.rc:107 msgctxt "object state" @@ -7266,11 +7236,9 @@ msgid "marqueed" msgstr "" #: oleacc.rc:112 -#, fuzzy -#| msgid "animation" msgctxt "object state" msgid "animated" -msgstr "anima??o" +msgstr "animado" #: oleacc.rc:113 msgctxt "object state" @@ -7283,18 +7251,14 @@ msgid "offscreen" msgstr "" #: oleacc.rc:115 -#, fuzzy -#| msgid "&enable" msgctxt "object state" msgid "sizeable" -msgstr "&habilitar" +msgstr "expans?vel" #: oleacc.rc:116 -#, fuzzy -#| msgid "&enable" msgctxt "object state" msgid "moveable" -msgstr "&habilitar" +msgstr "mov?vel" #: oleacc.rc:117 msgctxt "object state" @@ -7302,25 +7266,19 @@ msgid "self voicing" msgstr "" #: oleacc.rc:118 -#, fuzzy -#| msgid "Paused" msgctxt "object state" msgid "focusable" -msgstr "Pausado" +msgstr "foc?vel" #: oleacc.rc:119 -#, fuzzy -#| msgid "table" msgctxt "object state" msgid "selectable" -msgstr "tabela" +msgstr "selecion?vel" #: oleacc.rc:120 -#, fuzzy -#| msgid "link" msgctxt "object state" msgid "linked" -msgstr "atalho" +msgstr "ligado" #: oleacc.rc:121 msgctxt "object state" @@ -7328,46 +7286,34 @@ msgid "traversed" msgstr "" #: oleacc.rc:122 -#, fuzzy -#| msgid "table" msgctxt "object state" msgid "multi selectable" -msgstr "tabela" +msgstr "multi selecion?vel" #: oleacc.rc:123 -#, fuzzy -#| msgid "Please select a file." msgctxt "object state" msgid "extended selectable" -msgstr "Por favor, selecione um arquivo." +msgstr "sele??o estend?vel" #: oleacc.rc:124 -#, fuzzy -#| msgid "alert" msgctxt "object state" msgid "alert low" -msgstr "alerta" +msgstr "alerta baixo" #: oleacc.rc:125 -#, fuzzy -#| msgid "alert" msgctxt "object state" msgid "alert medium" -msgstr "alerta" +msgstr "alerta m?dio" #: oleacc.rc:126 -#, fuzzy -#| msgid "alert" msgctxt "object state" msgid "alert high" -msgstr "alerta" +msgstr "alerta alto" #: oleacc.rc:127 -#, fuzzy -#| msgid "Write protected.\n" msgctxt "object state" msgid "protected" -msgstr "Protegido contra escrita.\n" +msgstr "protegido" #: oleacc.rc:128 msgctxt "object state" From gzhuangwei at corp.netease.com Mon Nov 3 20:44:34 2014 From: gzhuangwei at corp.netease.com (=?UTF-8?B?6buE5beN?=) Date: Tue, 4 Nov 2014 10:44:34 +0800 Subject: user32: Fix unicode multi-byte message convert Message-ID: <760194684.21037325.1415069076156.JavaMail.gzhuangwei@corp.netease.com> Bug 35592 - Chinese input encoding error in multi-byte character set exe with mac driver --- dlls/user32/message.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/user32/message.c b/dlls/user32/message.c index b75c7e9..a55ee0e 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -588,9 +588,8 @@ DWORD get_input_codepage( void ) { DWORD cp; int ret; - HKL hkl = GetKeyboardLayout( 0 ); - ret = GetLocaleInfoW( LOWORD(hkl), LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, + ret = GetLocaleInfoW( LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, (WCHAR *)&cp, sizeof(cp) / sizeof(WCHAR) ); if (!ret) cp = CP_ACP; return cp; -- 1.9.3 (Apple Git-50) From gzhuangwei at corp.netease.com Mon Nov 3 20:52:57 2014 From: gzhuangwei at corp.netease.com (=?UTF-8?B?6buE5beN?=) Date: Tue, 4 Nov 2014 10:52:57 +0800 Subject: imm: Fix switching to Chinese IEM after typing some English will fail Message-ID: <195217085.21038687.1415069578179.JavaMail.gzhuangwei@corp.netease.com> Bug 35896 - Switching to Chinese input method after typing some English will fail. https://bugs.winehq.org/show_bug.cgi?id=35896 --- dlls/imm32/imm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index 7ed1fe6..47c7ea8 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2901,6 +2901,8 @@ BOOL WINAPI ImmProcessKey(HWND hwnd, HKL hKL, UINT vKey, LPARAM lKeyData, DWORD else return FALSE; + data->immKbd = IMM_GetImmHkl(hKL); + if (!data->immKbd->hIME || !data->immKbd->pImeProcessKey) return FALSE; -- 1.9.3 (Apple Git-50) From sebastian at fds-team.de Mon Nov 3 22:07:53 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 05:07:53 +0100 Subject: winealsa.drv: Avoid endless loop if registry keys are not accessible. Message-ID: <54585119.2080507@fds-team.de> The lines inbetween use 'continue' if the key cannot be opened, which results in an endless loop. --- dlls/winealsa.drv/mmdevdrv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-winealsa.drv-Avoid-endless-loop-if-registry-keys-are.patch Type: text/x-patch Size: 1119 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 3 23:02:58 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 06:02:58 +0100 Subject: [1/2] d3dx9_36: Implement D3DXCreatePolygon. (try 2) Message-ID: <54585E02.2010501@fds-team.de> Changes in try 2: * Lot of style cleanups - hopefully I didn't miss anything. ;) * Fix condition for 'sides' argument (should be >= 3, not just != 0) * Added test to check if *mesh is cleared on error - tests show that this is not the case. I only kept a single test for that to avoid making the test code too ugly. Based on a patch by David Adam. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ include/d3dx9shape.h | 2 ++ 3 files changed, 91 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-Implement-D3DXCreatePolygon.patch Type: text/x-patch Size: 4953 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 3 23:03:01 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 06:03:01 +0100 Subject: [2/2] d3dx9_36/tests: Add tests for D3DXCreatePolygon. (try 2) Message-ID: <54585E05.6080000@fds-team.de> Based on a patch by David Adam. --- dlls/d3dx9_36/tests/mesh.c | 163 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch Type: text/x-patch Size: 6055 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 4 00:40:36 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 07:40:36 +0100 Subject: [1/2] kernel32: Implement FindFirstFileExW level FindExInfoBasic. Message-ID: <545874E4.3070509@fds-team.de> FindExInfoBasic avoids returning cAlternateFileName when the application doesn't need it. This patch implements the correct behaviour, but (in contrary to native) has no speed inprovements so far. --- dlls/kernel32/file.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-kernel32-Implement-FindFirstFileExW-level-FindExInfo.patch Type: text/x-patch Size: 2504 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 4 00:40:44 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 07:40:44 +0100 Subject: [2/2] kernel32/tests: Add tests for FindFirstFileExW level FindExInfoBasic. Message-ID: <545874EC.70001@fds-team.de> The following test failure on Vista64 is unrelated to this patch: file.c:367: Test failed: attributes of file "testfile.xxx" are 0x0820 --- dlls/kernel32/tests/file.c | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-kernel32-tests-Add-tests-for-FindFirstFileExW-level-.patch Type: text/x-patch Size: 6890 bytes Desc: not available URL: From penghao at linuxdeepin.com Tue Nov 4 01:16:49 2014 From: penghao at linuxdeepin.com (=?utf-8?B?SGFvIFBlbmc=?=) Date: Tue, 4 Nov 2014 15:16:49 +0800 Subject: [PATCH] iphlpapi: call SetLastError in NotifyAddrChange/NotifyRouteChange(try 2) Message-ID: call SetLastError in NotifyAddrChange/NotifyRouteChange, to make apps can get WSA_IO_PENDING error code after async operation through GetLastError. Thanks to Sebastian Lackner for comments. superseded patch 107390. --- dlls/iphlpapi/iphlpapi_main.c | 18 ++++++++++++++++-- dlls/iphlpapi/tests/iphlpapi.c | 39 +++++++++++++++++++++++---------------- 2 files changed, 39 insertions(+), 18 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-iphlpapi-call-SetLastError-in-NotifyAddrChange-NotifyR.txt Type: application/octet-stream Size: 7677 bytes Desc: not available URL: From hverbeet at codeweavers.com Tue Nov 4 01:47:42 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Tue, 4 Nov 2014 08:47:42 +0100 Subject: [PATCH 1/5] wined3d: Make a copy of shader signature string data. Message-ID: <1415087266-14740-1-git-send-email-hverbeet@codeweavers.com> --- dlls/wined3d/shader.c | 33 ++++++++++++++++++++++++++++++++- dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 5ae4abc..230b82c 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1603,6 +1603,7 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe static void shader_cleanup(struct wined3d_shader *shader) { + HeapFree(GetProcessHeap(), 0, shader->signature_strings); shader->device->shader_backend->shader_destroy(shader); HeapFree(GetProcessHeap(), 0, shader->reg_maps.constf); HeapFree(GetProcessHeap(), 0, shader->function); @@ -2011,11 +2012,41 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d if (output_signature) { + struct wined3d_shader_signature_element *e; + SIZE_T total, len; + char *ptr; + + total = 0; for (i = 0; i < output_signature->element_count; ++i) { - struct wined3d_shader_signature_element *e = &output_signature->elements[i]; + e = &output_signature->elements[i]; + len = strlen(e->semantic_name); + if (len >= ~(SIZE_T)0 - total) + { + shader_cleanup(shader); + return E_OUTOFMEMORY; + } + + total += len + 1; + } + + if (!(shader->signature_strings = HeapAlloc(GetProcessHeap(), 0, total))) + { + shader_cleanup(shader); + return E_OUTOFMEMORY; + } + ptr = shader->signature_strings; + + for (i = 0; i < output_signature->element_count; ++i) + { + e = &output_signature->elements[i]; reg_maps->output_registers |= 1 << e->register_idx; shader->output_signature[e->register_idx] = *e; + + len = strlen(e->semantic_name); + memcpy(ptr, e->semantic_name, len + 1); + shader->output_signature[e->register_idx].semantic_name = ptr; + ptr += len + 1; } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index f4ded4f..e5154d3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2879,6 +2879,7 @@ struct wined3d_shader struct wined3d_shader_signature_element input_signature[max(MAX_ATTRIBS, MAX_REG_INPUT)]; struct wined3d_shader_signature_element output_signature[MAX_REG_OUTPUT]; + char *signature_strings; /* Pointer to the parent device */ struct wined3d_device *device; -- 1.7.10.4 From hverbeet at codeweavers.com Tue Nov 4 01:47:43 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Tue, 4 Nov 2014 08:47:43 +0100 Subject: [PATCH 2/5] wined3d: Calculate the SM4 output mapping in shader_sm4_init(). Message-ID: <1415087266-14740-2-git-send-email-hverbeet@codeweavers.com> --- dlls/wined3d/directx.c | 4 --- dlls/wined3d/shader_sm4.c | 67 ++++++++++++++++++++++------------------ dlls/wined3d/wined3d_private.h | 4 +++ 3 files changed, 41 insertions(+), 34 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d428d94..5327949 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -36,10 +36,6 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag); #define WINE_DEFAULT_VIDMEM (64 * 1024 * 1024) #define DEFAULT_REFRESH_RATE 0 -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) -#endif - /* The driver names reflect the lowest GPU supported * by a certain driver, so DRIVER_AMD_R300 supports * R3xx, R4xx and R5xx GPUs. */ diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index f10969b..cba55ad 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -176,7 +176,12 @@ struct wined3d_sm4_data { struct wined3d_shader_version shader_version; const DWORD *end; - const struct wined3d_shader_signature *output_signature; + + struct + { + enum wined3d_shader_register_type register_type; + UINT register_idx; + } output_map[MAX_REG_OUTPUT]; struct wined3d_shader_src_param src_param[5]; struct wined3d_shader_dst_param dst_param[2]; @@ -331,20 +336,6 @@ static const struct wined3d_sm4_opcode_info *get_opcode_info(enum wined3d_sm4_op return NULL; } -static void map_sysval(enum wined3d_sysval_semantic sysval, struct wined3d_shader_register *reg) -{ - unsigned int i; - - for (i = 0; i < sizeof(sysval_map) / sizeof(*sysval_map); ++i) - { - if (sysval == sysval_map[i].sysval) - { - reg->type = sysval_map[i].register_type; - reg->idx[0].offset = sysval_map[i].register_idx; - } - } -} - static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_shader_register *reg) { switch (priv->shader_version.type) @@ -352,23 +343,16 @@ static void map_register(const struct wined3d_sm4_data *priv, struct wined3d_sha case WINED3D_SHADER_TYPE_PIXEL: if (reg->type == WINED3DSPR_OUTPUT) { - unsigned int i; - const struct wined3d_shader_signature *s = priv->output_signature; + unsigned int reg_idx = reg->idx[0].offset; - if (!s) + if (reg_idx >= ARRAY_SIZE(priv->output_map)) { - ERR("Shader has no output signature, unable to map register.\n"); + ERR("Invalid output index %u.\n", reg_idx); break; } - for (i = 0; i < s->element_count; ++i) - { - if (s->elements[i].register_idx == reg->idx[0].offset) - { - map_sysval(s->elements[i].sysval_semantic, reg); - break; - } - } + reg->type = priv->output_map[reg_idx].register_type; + reg->idx[0].offset = priv->output_map[reg_idx].register_idx; } break; @@ -399,14 +383,37 @@ static enum wined3d_data_type map_data_type(char t) static void *shader_sm4_init(const DWORD *byte_code, const struct wined3d_shader_signature *output_signature) { - struct wined3d_sm4_data *priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)); - if (!priv) + struct wined3d_sm4_data *priv; + unsigned int i, j; + + if (!(priv = HeapAlloc(GetProcessHeap(), 0, sizeof(*priv)))) { ERR("Failed to allocate private data\n"); return NULL; } - priv->output_signature = output_signature; + memset(priv->output_map, 0xff, sizeof(priv->output_map)); + for (i = 0; i < output_signature->element_count; ++i) + { + struct wined3d_shader_signature_element *e = &output_signature->elements[i]; + + if (e->register_idx >= ARRAY_SIZE(priv->output_map)) + { + WARN("Invalid output index %u.\n", e->register_idx); + continue; + } + + for (j = 0; j < ARRAY_SIZE(sysval_map); ++j) + { + if (e->sysval_semantic == sysval_map[j].sysval) + { + priv->output_map[e->register_idx].register_type = sysval_map[j].register_type; + priv->output_map[e->register_idx].register_idx = sysval_map[j].register_idx; + break; + } + } + } + list_init(&priv->src_free); list_init(&priv->src); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e5154d3..9cbd18d 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -52,6 +52,10 @@ #include "wine/rbtree.h" #include "wine/wgl_driver.h" +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) +#endif + /* Driver quirks */ #define WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT 0x00000001 #define WINED3D_QUIRK_SET_TEXCOORD_W 0x00000002 -- 1.7.10.4 From hverbeet at codeweavers.com Tue Nov 4 01:47:44 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Tue, 4 Nov 2014 08:47:44 +0100 Subject: [PATCH 3/5] d3d10core: Free the output signature after creating the wined3d shader. Message-ID: <1415087266-14740-3-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/d3d10core_private.h | 3 -- dlls/d3d10core/shader.c | 61 +++++++++++------------------------- include/wine/wined3d.h | 1 - 3 files changed, 19 insertions(+), 46 deletions(-) diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 30ae928..80eafe2 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -190,7 +190,6 @@ struct d3d10_vertex_shader LONG refcount; struct wined3d_shader *wined3d_shader; - struct wined3d_shader_signature output_signature; ID3D10Device1 *device; }; @@ -205,7 +204,6 @@ struct d3d10_geometry_shader LONG refcount; struct wined3d_shader *wined3d_shader; - struct wined3d_shader_signature output_signature; }; HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct d3d10_device *device, @@ -219,7 +217,6 @@ struct d3d10_pixel_shader LONG refcount; struct wined3d_shader *wined3d_shader; - struct wined3d_shader_signature output_signature; ID3D10Device1 *device; }; diff --git a/dlls/d3d10core/shader.c b/dlls/d3d10core/shader.c index 007dfc2..62f1e97 100644 --- a/dlls/d3d10core/shader.c +++ b/dlls/d3d10core/shader.c @@ -70,10 +70,7 @@ static HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length, st HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d_shader_signature *s) { struct wined3d_shader_signature_element *e; - unsigned int string_data_offset; - unsigned int string_data_size; const char *ptr = data; - char *string_data; unsigned int i; DWORD count; @@ -89,24 +86,12 @@ HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d return E_OUTOFMEMORY; } - /* 2 DWORDs for the header, 6 for each element. */ - string_data_offset = 2 * sizeof(DWORD) + count * 6 * sizeof(DWORD); - string_data_size = data_size - string_data_offset; - string_data = HeapAlloc(GetProcessHeap(), 0, string_data_size); - if (!string_data) - { - ERR("Failed to allocate string data memory.\n"); - HeapFree(GetProcessHeap(), 0, e); - return E_OUTOFMEMORY; - } - memcpy(string_data, data + string_data_offset, string_data_size); - for (i = 0; i < count; ++i) { UINT name_offset; read_dword(&ptr, &name_offset); - e[i].semantic_name = string_data + (name_offset - string_data_offset); + e[i].semantic_name = data + name_offset; read_dword(&ptr, &e[i].semantic_idx); read_dword(&ptr, &e[i].sysval_semantic); read_dword(&ptr, &e[i].component_type); @@ -121,14 +106,12 @@ HRESULT shader_parse_signature(const char *data, DWORD data_size, struct wined3d s->elements = e; s->element_count = count; - s->string_data = string_data; return S_OK; } void shader_free_signature(struct wined3d_shader_signature *s) { - HeapFree(GetProcessHeap(), 0, s->string_data); HeapFree(GetProcessHeap(), 0, s->elements); } @@ -248,9 +231,7 @@ static const struct ID3D10VertexShaderVtbl d3d10_vertex_shader_vtbl = static void STDMETHODCALLTYPE d3d10_vertex_shader_wined3d_object_destroyed(void *parent) { - struct d3d10_vertex_shader *shader = parent; - shader_free_signature(&shader->output_signature); - HeapFree(GetProcessHeap(), 0, shader); + HeapFree(GetProcessHeap(), 0, parent); } static const struct wined3d_parent_ops d3d10_vertex_shader_wined3d_parent_ops = @@ -261,13 +242,14 @@ static const struct wined3d_parent_ops d3d10_vertex_shader_wined3d_parent_ops = HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d10_device *device, const void *byte_code, SIZE_T byte_code_length) { + struct wined3d_shader_signature output_signature; struct d3d10_shader_info shader_info; HRESULT hr; shader->ID3D10VertexShader_iface.lpVtbl = &d3d10_vertex_shader_vtbl; shader->refcount = 1; - shader_info.output_signature = &shader->output_signature; + shader_info.output_signature = &output_signature; hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info); if (FAILED(hr)) { @@ -276,13 +258,12 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1 } hr = wined3d_shader_create_vs(device->wined3d_device, shader_info.shader_code, - &shader->output_signature, shader, &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + &output_signature, shader, &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + shader_free_signature(&output_signature); if (FAILED(hr)) { WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr); - shader_free_signature(&shader->output_signature); - hr = E_INVALIDARG; - return hr; + return E_INVALIDARG; } shader->device = &device->ID3D10Device1_iface; @@ -398,9 +379,7 @@ static const struct ID3D10GeometryShaderVtbl d3d10_geometry_shader_vtbl = static void STDMETHODCALLTYPE d3d10_geometry_shader_wined3d_object_destroyed(void *parent) { - struct d3d10_geometry_shader *shader = parent; - shader_free_signature(&shader->output_signature); - HeapFree(GetProcessHeap(), 0, shader); + HeapFree(GetProcessHeap(), 0, parent); } static const struct wined3d_parent_ops d3d10_geometry_shader_wined3d_parent_ops = @@ -411,13 +390,14 @@ static const struct wined3d_parent_ops d3d10_geometry_shader_wined3d_parent_ops HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct d3d10_device *device, const void *byte_code, SIZE_T byte_code_length) { + struct wined3d_shader_signature output_signature; struct d3d10_shader_info shader_info; HRESULT hr; shader->ID3D10GeometryShader_iface.lpVtbl = &d3d10_geometry_shader_vtbl; shader->refcount = 1; - shader_info.output_signature = &shader->output_signature; + shader_info.output_signature = &output_signature; hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info); if (FAILED(hr)) { @@ -426,13 +406,12 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct } hr = wined3d_shader_create_gs(device->wined3d_device, shader_info.shader_code, - &shader->output_signature, shader, &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + &output_signature, shader, &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + shader_free_signature(&output_signature); if (FAILED(hr)) { WARN("Failed to create wined3d geometry shader, hr %#x.\n", hr); - shader_free_signature(&shader->output_signature); - hr = E_INVALIDARG; - return hr; + return E_INVALIDARG; } return S_OK; @@ -563,9 +542,7 @@ static const struct ID3D10PixelShaderVtbl d3d10_pixel_shader_vtbl = static void STDMETHODCALLTYPE d3d10_pixel_shader_wined3d_object_destroyed(void *parent) { - struct d3d10_pixel_shader *shader = parent; - shader_free_signature(&shader->output_signature); - HeapFree(GetProcessHeap(), 0, shader); + HeapFree(GetProcessHeap(), 0, parent); } static const struct wined3d_parent_ops d3d10_pixel_shader_wined3d_parent_ops = @@ -576,13 +553,14 @@ static const struct wined3d_parent_ops d3d10_pixel_shader_wined3d_parent_ops = HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_device *device, const void *byte_code, SIZE_T byte_code_length) { + struct wined3d_shader_signature output_signature; struct d3d10_shader_info shader_info; HRESULT hr; shader->ID3D10PixelShader_iface.lpVtbl = &d3d10_pixel_shader_vtbl; shader->refcount = 1; - shader_info.output_signature = &shader->output_signature; + shader_info.output_signature = &output_signature; hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info); if (FAILED(hr)) { @@ -591,13 +569,12 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_ } hr = wined3d_shader_create_ps(device->wined3d_device, shader_info.shader_code, - &shader->output_signature, shader, &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + &output_signature, shader, &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + shader_free_signature(&output_signature); if (FAILED(hr)) { WARN("Failed to create wined3d pixel shader, hr %#x.\n", hr); - shader_free_signature(&shader->output_signature); - hr = E_INVALIDARG; - return hr; + return E_INVALIDARG; } shader->device = &device->ID3D10Device1_iface; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 30b597d..e765224 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1970,7 +1970,6 @@ struct wined3d_shader_signature { UINT element_count; struct wined3d_shader_signature_element *elements; - char *string_data; }; struct wined3d_parent_ops -- 1.7.10.4 From hverbeet at codeweavers.com Tue Nov 4 01:47:46 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Tue, 4 Nov 2014 08:47:46 +0100 Subject: [PATCH 5/5] d3d10core: Set wined3d state in d3d10_device_OMSetBlendState(). Message-ID: <1415087266-14740-5-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/d3d10core_private.h | 1 - dlls/d3d10core/device.c | 49 ++++++++++++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 845ddab..29f5653 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -325,7 +325,6 @@ struct d3d10_device struct d3d10_blend_state *blend_state; float blend_factor[4]; - UINT sample_mask; struct d3d10_depthstencil_state *depth_stencil_state; UINT stencil_ref; struct d3d10_rasterizer_state *rasterizer_state; diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c index 05639b9..ad6bc4d 100644 --- a/dlls/d3d10core/device.c +++ b/dlls/d3d10core/device.c @@ -462,13 +462,53 @@ static void STDMETHODCALLTYPE d3d10_device_OMSetBlendState(ID3D10Device1 *iface, ID3D10BlendState *blend_state, const FLOAT blend_factor[4], UINT sample_mask) { struct d3d10_device *device = impl_from_ID3D10Device(iface); + const D3D10_BLEND_DESC *desc; - TRACE("iface %p, blend_state %p, blend_factor [%f %f %f %f], sample_mask 0x%08x.\n", + TRACE("iface %p, blend_state %p, blend_factor {%.8e %.8e %.8e %.8e}, sample_mask 0x%08x.\n", iface, blend_state, blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3], sample_mask); - device->blend_state = unsafe_impl_from_ID3D10BlendState(blend_state); + if (blend_factor[0] != 1.0f || blend_factor[1] != 1.0f || blend_factor[2] != 1.0f || blend_factor[3] != 1.0f) + FIXME("Ignoring blend factor {%.8e %.8e %.8e %.8e}.\n", + blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3]); memcpy(device->blend_factor, blend_factor, 4 * sizeof(*blend_factor)); - device->sample_mask = sample_mask; + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK, sample_mask); + if (!(device->blend_state = unsafe_impl_from_ID3D10BlendState(blend_state))) + { + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ALPHABLENDENABLE, FALSE); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE, D3D10_COLOR_WRITE_ENABLE_ALL); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE1, D3D10_COLOR_WRITE_ENABLE_ALL); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE2, D3D10_COLOR_WRITE_ENABLE_ALL); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE3, D3D10_COLOR_WRITE_ENABLE_ALL); + return; + } + + desc = &device->blend_state->desc; + /* glSampleCoverage() */ + if (desc->AlphaToCoverageEnable) + FIXME("Ignoring AlphaToCoverageEnable %#x.\n", desc->AlphaToCoverageEnable); + /* glEnableIndexedEXT(GL_BLEND, ...) */ + FIXME("Per-rendertarget blend enable not implemented.\n"); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_ALPHABLENDENABLE, desc->BlendEnable[0]); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SRCBLEND, desc->SrcBlend); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DESTBLEND, desc->DestBlend); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOP, desc->BlendOp); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SEPARATEALPHABLENDENABLE, TRUE); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_SRCBLENDALPHA, desc->SrcBlendAlpha); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_DESTBLENDALPHA, desc->DestBlendAlpha); + wined3d_device_set_render_state(device->wined3d_device, WINED3D_RS_BLENDOPALPHA, desc->BlendOpAlpha); + FIXME("Color mask > 3 not implemented.\n"); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE, desc->RenderTargetWriteMask[0]); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE1, desc->RenderTargetWriteMask[1]); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE2, desc->RenderTargetWriteMask[2]); + wined3d_device_set_render_state(device->wined3d_device, + WINED3D_RS_COLORWRITEENABLE3, desc->RenderTargetWriteMask[3]); } static void STDMETHODCALLTYPE d3d10_device_OMSetDepthStencilState(ID3D10Device1 *iface, @@ -1105,7 +1145,7 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device1 *iface, if ((*blend_state = device->blend_state ? &device->blend_state->ID3D10BlendState_iface : NULL)) ID3D10BlendState_AddRef(*blend_state); memcpy(blend_factor, device->blend_factor, 4 * sizeof(*blend_factor)); - *sample_mask = device->sample_mask; + *sample_mask = wined3d_device_get_render_state(device->wined3d_device, WINED3D_RS_MULTISAMPLEMASK); } static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device1 *iface, @@ -2414,7 +2454,6 @@ HRESULT d3d10_device_init(struct d3d10_device *device, void *outer_unknown) device->blend_factor[1] = 1.0f; device->blend_factor[2] = 1.0f; device->blend_factor[3] = 1.0f; - device->sample_mask = D3D10_DEFAULT_SAMPLE_MASK; if (wine_rb_init(&device->depthstencil_states, &d3d10_depthstencil_state_rb_ops) == -1) { -- 1.7.10.4 From hverbeet at codeweavers.com Tue Nov 4 01:47:45 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Tue, 4 Nov 2014 08:47:45 +0100 Subject: [PATCH 4/5] wined3d: Use the input signature to setup SM4 pixel shader input semantics. Message-ID: <1415087266-14740-4-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/d3d10core_private.h | 1 + dlls/d3d10core/shader.c | 61 ++++++++++++++----- dlls/d3d8/shader.c | 24 ++++++-- dlls/d3d9/shader.c | 20 +++++-- dlls/wined3d/shader.c | 116 +++++++++++++++++++++++------------- include/wine/wined3d.h | 23 ++++--- 6 files changed, 169 insertions(+), 76 deletions(-) diff --git a/dlls/d3d10core/d3d10core_private.h b/dlls/d3d10core/d3d10core_private.h index 80eafe2..845ddab 100644 --- a/dlls/d3d10core/d3d10core_private.h +++ b/dlls/d3d10core/d3d10core_private.h @@ -50,6 +50,7 @@ struct d3d10_device; struct d3d10_shader_info { const DWORD *shader_code; + struct wined3d_shader_signature *input_signature; struct wined3d_shader_signature *output_signature; }; diff --git a/dlls/d3d10core/shader.c b/dlls/d3d10core/shader.c index 62f1e97..1000054 100644 --- a/dlls/d3d10core/shader.c +++ b/dlls/d3d10core/shader.c @@ -29,11 +29,16 @@ static HRESULT shdr_handler(const char *data, DWORD data_size, DWORD tag, void * struct d3d10_shader_info *shader_info = ctx; HRESULT hr; - switch(tag) + switch (tag) { + case TAG_ISGN: + if (FAILED(hr = shader_parse_signature(data, data_size, shader_info->input_signature))) + return hr; + break; + case TAG_OSGN: - hr = shader_parse_signature(data, data_size, shader_info->output_signature); - if (FAILED(hr)) return hr; + if (FAILED(hr = shader_parse_signature(data, data_size, shader_info->output_signature))) + return hr; break; case TAG_SHDR: @@ -53,6 +58,7 @@ static HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length, st HRESULT hr; shader_info->shader_code = NULL; + memset(shader_info->input_signature, 0, sizeof(*shader_info->input_signature)); memset(shader_info->output_signature, 0, sizeof(*shader_info->output_signature)); hr = parse_dxbc(dxbc, dxbc_length, shdr_handler, shader_info); @@ -61,6 +67,7 @@ static HRESULT shader_extract_from_dxbc(const void *dxbc, SIZE_T dxbc_length, st if (FAILED(hr)) { ERR("Failed to parse shader, hr %#x\n", hr); + shader_free_signature(shader_info->input_signature); shader_free_signature(shader_info->output_signature); } @@ -243,22 +250,30 @@ HRESULT d3d10_vertex_shader_init(struct d3d10_vertex_shader *shader, struct d3d1 const void *byte_code, SIZE_T byte_code_length) { struct wined3d_shader_signature output_signature; + struct wined3d_shader_signature input_signature; struct d3d10_shader_info shader_info; + struct wined3d_shader_desc desc; HRESULT hr; shader->ID3D10VertexShader_iface.lpVtbl = &d3d10_vertex_shader_vtbl; shader->refcount = 1; + shader_info.input_signature = &input_signature; shader_info.output_signature = &output_signature; - hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info); - if (FAILED(hr)) + if (FAILED(hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info))) { ERR("Failed to extract shader, hr %#x.\n", hr); return hr; } - hr = wined3d_shader_create_vs(device->wined3d_device, shader_info.shader_code, - &output_signature, shader, &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + desc.byte_code = shader_info.shader_code; + desc.input_signature = &input_signature; + desc.output_signature = &output_signature; + desc.max_version = 4; + + hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader, + &d3d10_vertex_shader_wined3d_parent_ops, &shader->wined3d_shader); + shader_free_signature(&input_signature); shader_free_signature(&output_signature); if (FAILED(hr)) { @@ -391,22 +406,30 @@ HRESULT d3d10_geometry_shader_init(struct d3d10_geometry_shader *shader, struct const void *byte_code, SIZE_T byte_code_length) { struct wined3d_shader_signature output_signature; + struct wined3d_shader_signature input_signature; struct d3d10_shader_info shader_info; + struct wined3d_shader_desc desc; HRESULT hr; shader->ID3D10GeometryShader_iface.lpVtbl = &d3d10_geometry_shader_vtbl; shader->refcount = 1; + shader_info.input_signature = &input_signature; shader_info.output_signature = &output_signature; - hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info); - if (FAILED(hr)) + if (FAILED(hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info))) { ERR("Failed to extract shader, hr %#x.\n", hr); return hr; } - hr = wined3d_shader_create_gs(device->wined3d_device, shader_info.shader_code, - &output_signature, shader, &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + desc.byte_code = shader_info.shader_code; + desc.input_signature = &input_signature; + desc.output_signature = &output_signature; + desc.max_version = 4; + + hr = wined3d_shader_create_gs(device->wined3d_device, &desc, shader, + &d3d10_geometry_shader_wined3d_parent_ops, &shader->wined3d_shader); + shader_free_signature(&input_signature); shader_free_signature(&output_signature); if (FAILED(hr)) { @@ -554,22 +577,30 @@ HRESULT d3d10_pixel_shader_init(struct d3d10_pixel_shader *shader, struct d3d10_ const void *byte_code, SIZE_T byte_code_length) { struct wined3d_shader_signature output_signature; + struct wined3d_shader_signature input_signature; struct d3d10_shader_info shader_info; + struct wined3d_shader_desc desc; HRESULT hr; shader->ID3D10PixelShader_iface.lpVtbl = &d3d10_pixel_shader_vtbl; shader->refcount = 1; + shader_info.input_signature = &input_signature; shader_info.output_signature = &output_signature; - hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info); - if (FAILED(hr)) + if (FAILED(hr = shader_extract_from_dxbc(byte_code, byte_code_length, &shader_info))) { ERR("Failed to extract shader, hr %#x.\n", hr); return hr; } - hr = wined3d_shader_create_ps(device->wined3d_device, shader_info.shader_code, - &output_signature, shader, &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader, 4); + desc.byte_code = shader_info.shader_code; + desc.input_signature = &input_signature; + desc.output_signature = &output_signature; + desc.max_version = 4; + + hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader, + &d3d10_pixel_shader_wined3d_parent_ops, &shader->wined3d_shader); + shader_free_signature(&input_signature); shader_free_signature(&output_signature); if (FAILED(hr)) { diff --git a/dlls/d3d8/shader.c b/dlls/d3d8/shader.c index 7d61fd6..a0bb317 100644 --- a/dlls/d3d8/shader.c +++ b/dlls/d3d8/shader.c @@ -111,11 +111,19 @@ HRESULT d3d8_vertex_shader_init(struct d3d8_vertex_shader *shader, struct d3d8_d if (byte_code) { - if (usage) FIXME("Usage %#x not implemented.\n", usage); + struct wined3d_shader_desc desc; + + if (usage) + FIXME("Usage %#x not implemented.\n", usage); + + desc.byte_code = byte_code; + desc.input_signature = NULL; + desc.output_signature = NULL; + desc.max_version = 1; wined3d_mutex_lock(); - hr = wined3d_shader_create_vs(device->wined3d_device, byte_code, NULL /* output signature */, - shader, &d3d8_vertexshader_wined3d_parent_ops, &shader->wined3d_shader, 1); + hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader, + &d3d8_vertexshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -152,13 +160,19 @@ static const struct wined3d_parent_ops d3d8_pixelshader_wined3d_parent_ops = HRESULT d3d8_pixel_shader_init(struct d3d8_pixel_shader *shader, struct d3d8_device *device, const DWORD *byte_code, DWORD shader_handle) { + struct wined3d_shader_desc desc; HRESULT hr; shader->handle = shader_handle; + desc.byte_code = byte_code; + desc.input_signature = NULL; + desc.output_signature = NULL; + desc.max_version = 1; + wined3d_mutex_lock(); - hr = wined3d_shader_create_ps(device->wined3d_device, byte_code, NULL, shader, - &d3d8_pixelshader_wined3d_parent_ops, &shader->wined3d_shader, 1); + hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader, + &d3d8_pixelshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { diff --git a/dlls/d3d9/shader.c b/dlls/d3d9/shader.c index e65f485..0c2c881 100644 --- a/dlls/d3d9/shader.c +++ b/dlls/d3d9/shader.c @@ -136,14 +136,20 @@ static const struct wined3d_parent_ops d3d9_vertexshader_wined3d_parent_ops = HRESULT vertexshader_init(struct d3d9_vertexshader *shader, struct d3d9_device *device, const DWORD *byte_code) { + struct wined3d_shader_desc desc; HRESULT hr; shader->refcount = 1; shader->IDirect3DVertexShader9_iface.lpVtbl = &d3d9_vertexshader_vtbl; + desc.byte_code = byte_code; + desc.input_signature = NULL; + desc.output_signature = NULL; + desc.max_version = 3; + wined3d_mutex_lock(); - hr = wined3d_shader_create_vs(device->wined3d_device, byte_code, NULL, - shader, &d3d9_vertexshader_wined3d_parent_ops, &shader->wined3d_shader, 3); + hr = wined3d_shader_create_vs(device->wined3d_device, &desc, shader, + &d3d9_vertexshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -280,14 +286,20 @@ static const struct wined3d_parent_ops d3d9_pixelshader_wined3d_parent_ops = HRESULT pixelshader_init(struct d3d9_pixelshader *shader, struct d3d9_device *device, const DWORD *byte_code) { + struct wined3d_shader_desc desc; HRESULT hr; shader->refcount = 1; shader->IDirect3DPixelShader9_iface.lpVtbl = &d3d9_pixelshader_vtbl; + desc.byte_code = byte_code; + desc.input_signature = NULL; + desc.output_signature = NULL; + desc.max_version = 3; + wined3d_mutex_lock(); - hr = wined3d_shader_create_ps(device->wined3d_device, byte_code, NULL, shader, - &d3d9_pixelshader_wined3d_parent_ops, &shader->wined3d_shader, 3); + hr = wined3d_shader_create_ps(device->wined3d_device, &desc, shader, + &d3d9_pixelshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 230b82c..7a98dd8 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1978,8 +1978,7 @@ BOOL vshader_get_input(const struct wined3d_shader *shader, } static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_device *device, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops, unsigned int max_version) + const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; unsigned int i; @@ -1987,12 +1986,12 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d WORD map; const DWORD vs_uniform_count = device->adapter->d3d_info.limits.vs_uniform_count; - if (!byte_code) return WINED3DERR_INVALIDCALL; + if (!desc->byte_code) + return WINED3DERR_INVALIDCALL; shader_init(shader, device, parent, parent_ops); - hr = shader_set_function(shader, byte_code, output_signature, vs_uniform_count, - WINED3D_SHADER_TYPE_VERTEX, max_version); - if (FAILED(hr)) + if (FAILED(hr = shader_set_function(shader, desc->byte_code, desc->output_signature, + vs_uniform_count, WINED3D_SHADER_TYPE_VERTEX, desc->max_version))) { WARN("Failed to set function, hr %#x.\n", hr); shader_cleanup(shader); @@ -2010,16 +2009,16 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d shader->u.vs.attributes[i].usage_idx = shader->input_signature[i].semantic_idx; } - if (output_signature) + if (desc->output_signature) { struct wined3d_shader_signature_element *e; SIZE_T total, len; char *ptr; total = 0; - for (i = 0; i < output_signature->element_count; ++i) + for (i = 0; i < desc->output_signature->element_count; ++i) { - e = &output_signature->elements[i]; + e = &desc->output_signature->elements[i]; len = strlen(e->semantic_name); if (len >= ~(SIZE_T)0 - total) { @@ -2037,9 +2036,9 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d } ptr = shader->signature_strings; - for (i = 0; i < output_signature->element_count; ++i) + for (i = 0; i < desc->output_signature->element_count; ++i) { - e = &output_signature->elements[i]; + e = &desc->output_signature->elements[i]; reg_maps->output_registers |= 1 << e->register_idx; shader->output_signature[e->register_idx] = *e; @@ -2057,15 +2056,13 @@ static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_d } static HRESULT geometryshader_init(struct wined3d_shader *shader, struct wined3d_device *device, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops, unsigned int max_version) + const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { HRESULT hr; shader_init(shader, device, parent, parent_ops); - hr = shader_set_function(shader, byte_code, output_signature, 0, - WINED3D_SHADER_TYPE_GEOMETRY, max_version); - if (FAILED(hr)) + if (FAILED(hr = shader_set_function(shader, desc->byte_code, desc->output_signature, + 0, WINED3D_SHADER_TYPE_GEOMETRY, desc->max_version))) { WARN("Failed to set function, hr %#x.\n", hr); shader_cleanup(shader); @@ -2252,20 +2249,19 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3 } static HRESULT pixelshader_init(struct wined3d_shader *shader, struct wined3d_device *device, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops, unsigned int max_version) + const struct wined3d_shader_desc *desc, void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; unsigned int i, highest_reg_used = 0, num_regs_used = 0; HRESULT hr; const DWORD ps_uniform_count = device->adapter->d3d_info.limits.ps_uniform_count; - if (!byte_code) return WINED3DERR_INVALIDCALL; + if (!desc->byte_code) + return WINED3DERR_INVALIDCALL; shader_init(shader, device, parent, parent_ops); - hr = shader_set_function(shader, byte_code, output_signature, ps_uniform_count, - WINED3D_SHADER_TYPE_PIXEL, max_version); - if (FAILED(hr)) + if (FAILED(hr = shader_set_function(shader, desc->byte_code, desc->output_signature, + ps_uniform_count, WINED3D_SHADER_TYPE_PIXEL, desc->max_version))) { WARN("Failed to set function, hr %#x.\n", hr); shader_cleanup(shader); @@ -2314,6 +2310,46 @@ static HRESULT pixelshader_init(struct wined3d_shader *shader, struct wined3d_de shader->load_local_constsF = shader->lconst_inf_or_nan; + if (desc->input_signature) + { + struct wined3d_shader_signature_element *e; + SIZE_T total, len; + char *ptr; + + total = 0; + for (i = 0; i < desc->input_signature->element_count; ++i) + { + e = &desc->input_signature->elements[i]; + len = strlen(e->semantic_name); + if (len >= ~(SIZE_T)0 - total) + { + shader_cleanup(shader); + return E_OUTOFMEMORY; + } + + total += len + 1; + } + + if (!(shader->signature_strings = HeapAlloc(GetProcessHeap(), 0, total))) + { + shader_cleanup(shader); + return E_OUTOFMEMORY; + } + ptr = shader->signature_strings; + + for (i = 0; i < desc->input_signature->element_count; ++i) + { + e = &desc->input_signature->elements[i]; + shader->reg_maps.input_registers |= 1 << e->register_idx; + shader->input_signature[e->register_idx] = *e; + + len = strlen(e->semantic_name); + memcpy(ptr, e->semantic_name, len + 1); + shader->output_signature[e->register_idx].semantic_name = ptr; + ptr += len + 1; + } + } + return WINED3D_OK; } @@ -2347,22 +2383,20 @@ void pixelshader_update_samplers(struct wined3d_shader *shader, WORD tex_types) } } -HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const DWORD *byte_code, - const struct wined3d_shader_signature *output_signature, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version) +HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const struct wined3d_shader_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader) { struct wined3d_shader *object; HRESULT hr; - TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", - device, byte_code, output_signature, parent, parent_ops, shader); + TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n", + device, desc, parent, parent_ops, shader); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) return E_OUTOFMEMORY; - hr = geometryshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version); - if (FAILED(hr)) + if (FAILED(hr = geometryshader_init(object, device, desc, parent, parent_ops))) { WARN("Failed to initialize geometry shader, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); @@ -2375,22 +2409,20 @@ HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const DWOR return WINED3D_OK; } -HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const DWORD *byte_code, - const struct wined3d_shader_signature *output_signature, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version) +HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const struct wined3d_shader_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader) { struct wined3d_shader *object; HRESULT hr; - TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", - device, byte_code, output_signature, parent, parent_ops, shader); + TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n", + device, desc, parent, parent_ops, shader); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) return E_OUTOFMEMORY; - hr = pixelshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version); - if (FAILED(hr)) + if (FAILED(hr = pixelshader_init(object, device, desc, parent, parent_ops))) { WARN("Failed to initialize pixel shader, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); @@ -2403,22 +2435,20 @@ HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const DWOR return WINED3D_OK; } -HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const DWORD *byte_code, - const struct wined3d_shader_signature *output_signature, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version) +HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const struct wined3d_shader_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader) { struct wined3d_shader *object; HRESULT hr; - TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", - device, byte_code, output_signature, parent, parent_ops, shader); + TRACE("device %p, desc %p, parent %p, parent_ops %p, shader %p.\n", + device, desc, parent, parent_ops, shader); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) return E_OUTOFMEMORY; - hr = vertexshader_init(object, device, byte_code, output_signature, parent, parent_ops, max_version); - if (FAILED(hr)) + if (FAILED(hr = vertexshader_init(object, device, desc, parent, parent_ops))) { WARN("Failed to initialize vertex shader, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index e765224..9785277 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1972,6 +1972,14 @@ struct wined3d_shader_signature struct wined3d_shader_signature_element *elements; }; +struct wined3d_shader_desc +{ + const DWORD *byte_code; + const struct wined3d_shader_signature *input_signature; + const struct wined3d_shader_signature *output_signature; + unsigned int max_version; +}; + struct wined3d_parent_ops { void (__stdcall *wined3d_object_destroyed)(void *parent); @@ -2411,15 +2419,12 @@ ULONG __cdecl wined3d_sampler_decref(struct wined3d_sampler *sampler); void * __cdecl wined3d_sampler_get_parent(const struct wined3d_sampler *sampler); ULONG __cdecl wined3d_sampler_incref(struct wined3d_sampler *sampler); -HRESULT __cdecl wined3d_shader_create_gs(struct wined3d_device *device, const DWORD *byte_code, - const struct wined3d_shader_signature *output_signature, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version); -HRESULT __cdecl wined3d_shader_create_ps(struct wined3d_device *device, const DWORD *byte_code, - const struct wined3d_shader_signature *output_signature, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version); -HRESULT __cdecl wined3d_shader_create_vs(struct wined3d_device *device, const DWORD *byte_code, - const struct wined3d_shader_signature *output_signature, void *parent, - const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader, unsigned int max_version); +HRESULT __cdecl wined3d_shader_create_gs(struct wined3d_device *device, const struct wined3d_shader_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader); +HRESULT __cdecl wined3d_shader_create_ps(struct wined3d_device *device, const struct wined3d_shader_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader); +HRESULT __cdecl wined3d_shader_create_vs(struct wined3d_device *device, const struct wined3d_shader_desc *desc, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader); ULONG __cdecl wined3d_shader_decref(struct wined3d_shader *shader); HRESULT __cdecl wined3d_shader_get_byte_code(const struct wined3d_shader *shader, void *byte_code, UINT *byte_code_size); -- 1.7.10.4 From hans at codeweavers.com Tue Nov 4 03:57:13 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Tue, 04 Nov 2014 10:57:13 +0100 Subject: [1/3] msi: Pass a database pointer to msi_clone_properties instead of a package pointer. Message-ID: <1415095033.16234.0.camel@codeweavers.com> --- dlls/msi/action.c | 2 +- dlls/msi/msipriv.h | 2 +- dlls/msi/package.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msi-Pass-a-database-pointer-to-msi_clone_properties-in.txt Type: text/x-patch Size: 3648 bytes Desc: not available URL: From hans at codeweavers.com Tue Nov 4 03:57:40 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Tue, 04 Nov 2014 10:57:40 +0100 Subject: [2/3] msi: Update properties after each transform that affects the property table. Message-ID: <1415095060.16234.1.camel@codeweavers.com> --- dlls/msi/action.c | 3 --- dlls/msi/dialog.c | 1 - dlls/msi/msipriv.h | 1 + dlls/msi/package.c | 7 ++----- dlls/msi/table.c | 6 ++++++ 5 files changed, 9 insertions(+), 9 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-msi-Update-properties-after-each-transform-that-affect.txt Type: text/x-patch Size: 3606 bytes Desc: not available URL: From hans at codeweavers.com Tue Nov 4 03:58:04 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Tue, 04 Nov 2014 10:58:04 +0100 Subject: [3/3] msi: Call execute_script directly in InstallFinalize. Message-ID: <1415095084.16234.2.camel@codeweavers.com> --- dlls/msi/action.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-msi-Call-execute_script-directly-in-InstallFinalize.txt Type: text/x-patch Size: 424 bytes Desc: not available URL: From hans at codeweavers.com Tue Nov 4 03:58:32 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Tue, 04 Nov 2014 10:58:32 +0100 Subject: advapi32: Return success from LsaAddAccountRights. Message-ID: <1415095112.16234.3.camel@codeweavers.com> --- dlls/advapi32/lsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-advapi32-Return-success-from-LsaAddAccountRights.txt Type: text/x-patch Size: 439 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 07:10:35 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 04 Nov 2014 16:10:35 +0300 Subject: [PATCH] msvcrt: Added VS2013 CRT dll Message-ID: <5458D04B.1060607@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcrt-Added-VS2013-CRT-dll.patch Type: text/x-patch Size: 123608 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 07:40:56 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 04 Nov 2014 16:40:56 +0300 Subject: [PATCH 1/3] dwrite: Map Mac language id to locale name (try2) Message-ID: <5458D768.7020207@codeweavers.com> try2: langid used as index is not stored now -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Map-Mac-language-id-to-locale-name.patch Type: text/x-patch Size: 9039 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 07:41:06 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 04 Nov 2014 16:41:06 +0300 Subject: [PATCH 2/3] dwrite: Remove null checks for family and collection pointers, those are always set now (resend) Message-ID: <5458D772.6030001@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Remove-null-checks-for-family-and-collection-.patch Type: text/x-patch Size: 7147 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 07:41:18 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 04 Nov 2014 16:41:18 +0300 Subject: [PATCH 3/3] dwrite/tests: Some tests for custom font collections (resend) Message-ID: <5458D77E.5050005@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-tests-Some-tests-for-custom-font-collections.patch Type: text/x-patch Size: 14221 bytes Desc: not available URL: From huddsinyuan2014 at gmail.com Tue Nov 4 11:13:20 2014 From: huddsinyuan2014 at gmail.com (Chen Yuan) Date: Wed, 05 Nov 2014 01:13:20 +0800 Subject: [PATCH 1/2] mshtml: Add IHTMLStyle5::maxWidth property implementation. Message-ID: <54590930.6030602@gmail.com> --- dlls/mshtml/htmlstyle.c | 3 +++ dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/htmlstyle3.c | 12 ++++++++---- dlls/mshtml/tests/style.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Add-IHTMLStyle5-maxWidth-property-implementatio.txt Type: text/x-patch Size: 4083 bytes Desc: not available URL: From huddsinyuan2014 at gmail.com Tue Nov 4 11:14:04 2014 From: huddsinyuan2014 at gmail.com (Chen Yuan) Date: Wed, 05 Nov 2014 01:14:04 +0800 Subject: [PATCH 2/2] mshtml: Add IHTMLStyle5::maxWidth property implementation. Message-ID: <5459095C.4040505@gmail.com> --- dlls/mshtml/htmlstyle.c | 3 +++ dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/htmlstyle3.c | 12 ++++++++---- dlls/mshtml/tests/style.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Add-IHTMLStyle5-maxWidth-property-implementatio.txt Type: text/x-patch Size: 4639 bytes Desc: not available URL: From huddsinyuan2014 at gmail.com Tue Nov 4 11:32:42 2014 From: huddsinyuan2014 at gmail.com (Chen Yuan) Date: Wed, 05 Nov 2014 01:32:42 +0800 Subject: [PATCH 1/2] mshtml: Add IHTMLStyle5::maxWidth property implementation.(resend) Message-ID: <54590DBA.4020200@gmail.com> --- dlls/mshtml/htmlstyle.c | 3 +++ dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/htmlstyle3.c | 12 ++++++++---- dlls/mshtml/tests/style.c | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Add-IHTMLStyle5-maxWidth-property-implementatio.txt Type: text/x-patch Size: 4083 bytes Desc: not available URL: From huddsinyuan2014 at gmail.com Tue Nov 4 11:36:10 2014 From: huddsinyuan2014 at gmail.com (Chen Yuan) Date: Wed, 05 Nov 2014 01:36:10 +0800 Subject: [PATCH 2/2] mshtml: Add IHTMLStyle5::maxHeight property implementation.(resend) Message-ID: <54590E8A.8000307@gmail.com> --- dlls/mshtml/htmlstyle.c | 3 +++ dlls/mshtml/htmlstyle.h | 1 + dlls/mshtml/htmlstyle3.c | 12 ++++++++---- dlls/mshtml/tests/style.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Add-IHTMLStyle5-maxHeight-property-implementati.txt Type: text/x-patch Size: 4639 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 4 12:56:54 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 19:56:54 +0100 Subject: [1/2] d3dx9_36: Implement D3DXCreatePolygon. (try 3) Message-ID: <54592176.9010004@fds-team.de> Changes in try 3: * Replace ~0 -> ~0U. Changes in try 2: * Lot of style cleanups - hopefully I didn't miss anything. * Fix condition for 'sides' argument (should be >= 3, not just != 0) * Added test to check if *mesh is cleared on error - tests show that this is not the case. I only kept a single test for that to avoid making the test code too ugly. Based on a patch by David Adam. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ include/d3dx9shape.h | 2 ++ 3 files changed, 91 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-Implement-D3DXCreatePolygon.patch Type: text/x-patch Size: 4954 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 4 12:57:01 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 19:57:01 +0100 Subject: [2/2] d3dx9_36/tests: Add tests for D3DXCreatePolygon. (try 3) Message-ID: <5459217D.30301@fds-team.de> Based on a patch by David Adam. --- dlls/d3dx9_36/tests/mesh.c | 163 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch Type: text/x-patch Size: 6056 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 4 13:13:29 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 04 Nov 2014 20:13:29 +0100 Subject: winecoreaudio.drv: Avoid endless loop if registry keys are not accessible. Message-ID: <54592559.4040702@fds-team.de> --- dlls/winecoreaudio.drv/mmdevdrv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-winecoreaudio.drv-Avoid-endless-loop-if-registry-key.patch Type: text/x-patch Size: 1136 bytes Desc: not available URL: From jnvsor at gmail.com Tue Nov 4 14:15:08 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:08 +0100 Subject: [PATCH 1/7] reg: Add system error printing function Message-ID: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 35 +++++++++++++++++++++++++++++++---- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index d299cbf..905b484 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -67,6 +67,33 @@ static int reg_message(int msg) return reg_printfW(formatW, msg_buffer); } +static int reg_print_error(LONG error_code) +{ + switch (error_code) + { + case ERROR_SUCCESS: + return 0; + case ERROR_FILE_NOT_FOUND: + return reg_message(STRING_CANNOT_FIND); + case ERROR_BADKEY: + return reg_message(STRING_INVALID_KEY); + case ERROR_BAD_COMMAND: + return reg_message(STRING_INVALID_CMDLINE); + default: + { + static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; + WCHAR *message = NULL; + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, + error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *)&message, 0, NULL); + + reg_message(STRING_ERROR); + reg_printfW(error_string, error_code, message); + HeapFree(GetProcessHeap(), 0, message); + return 0; + } + } +} + static HKEY get_rootkey(LPWSTR key) { static const WCHAR szHKLM[] = {'H','K','L','M',0}; @@ -397,7 +424,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -433,7 +460,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -464,7 +491,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -488,7 +515,7 @@ int wmain(int argc, WCHAR *argvW[]) } else { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 2221647..1c2ae83 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -30,3 +30,4 @@ #define STRING_INVALID_CMDLINE 107 #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 +#define STRING_ERROR 110 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 479912b..52fd386 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -35,4 +35,5 @@ STRINGTABLE STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" + STRING_ERROR, "Error: " } -- 2.1.1 From jnvsor at gmail.com Tue Nov 4 14:15:09 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:09 +0100 Subject: [PATCH 2/7] reg: Check key paths in main In-Reply-To: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> References: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415132114-23009-2-git-send-email-jnvsor@gmail.com> Checks against backslashes at the start and end of a key. --- programs/reg/reg.c | 44 ++++++++++++++++++++++++++++++++------------ programs/reg/reg.rc | 2 +- programs/reg/tests/reg.c | 4 ++-- 3 files changed, 35 insertions(+), 15 deletions(-) mode change 100644 => 100755 programs/reg/reg.c diff --git a/programs/reg/reg.c b/programs/reg/reg.c old mode 100644 new mode 100755 index 905b484..cfaa62b --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,6 +20,8 @@ #include #include "reg.h" +#define ERROR_NO_REMOTE 20000 + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -79,6 +81,8 @@ static int reg_print_error(LONG error_code) return reg_message(STRING_INVALID_KEY); case ERROR_BAD_COMMAND: return reg_message(STRING_INVALID_CMDLINE); + case ERROR_NO_REMOTE: + return reg_message(STRING_NO_REMOTE); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -200,12 +204,6 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - if (key_name[0]=='\\' && key_name[1]=='\\') - { - reg_message(STRING_NO_REMOTE); - return 1; - } - p = strchrW(key_name,'\\'); if (!p) { @@ -273,12 +271,6 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ,0}; reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - if (key_name[0]=='\\' && key_name[1]=='\\') - { - reg_message(STRING_NO_REMOTE); - return 1; - } - p = strchrW(key_name,'\\'); if (!p) { @@ -393,6 +385,25 @@ static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } +static BOOL sane_path(const WCHAR *key) +{ + int i = strlenW(key); + + if (i < 3 || (key[i - 1] == '\\' && key[i - 2] == '\\')) + { + reg_print_error(ERROR_BADKEY); + return FALSE; + } + + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') + { + reg_print_error(ERROR_NO_REMOTE); + return FALSE; + } + + return TRUE; +} + int wmain(int argc, WCHAR *argvW[]) { int i; @@ -435,6 +446,9 @@ int wmain(int argc, WCHAR *argvW[]) } key_name = argvW[2]; + if (!sane_path(key_name)) + return 1; + for (i = 1; i < argc; i++) { if (!lstrcmpiW(argvW[i], slashVW)) @@ -471,6 +485,9 @@ int wmain(int argc, WCHAR *argvW[]) } key_name = argvW[2]; + if (!sane_path(key_name)) + return 1; + for (i = 1; i < argc; i++) { if (!lstrcmpiW(argvW[i], slashVW)) @@ -502,6 +519,9 @@ int wmain(int argc, WCHAR *argvW[]) } key_name = argvW[2]; + if (!sane_path(key_name)) + return 1; + for (i = 1; i < argc; i++) { if (!lstrcmpiW(argvW[i], slashVW)) diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 52fd386..74ef32e 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -33,7 +33,7 @@ STRINGTABLE STRING_SUCCESS, "The operation completed successfully\n" STRING_INVALID_KEY, "Error: Invalid key name\n" STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" - STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" + STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Error: " } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 9449429..dbc8731 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -120,10 +120,10 @@ static void test_add(void) ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2"); - todo_wine ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), + ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); -- 2.1.1 From jnvsor at gmail.com Tue Nov 4 14:15:10 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:10 +0100 Subject: [PATCH 3/7] reg: Add path/key conversion functions In-Reply-To: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> References: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415132114-23009-3-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 137 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 85 insertions(+), 52 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index cfaa62b..453dbc4 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,8 +20,37 @@ #include #include "reg.h" +#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) + #define ERROR_NO_REMOTE 20000 +typedef struct +{ + HKEY key; + const WCHAR *short_name; + const WCHAR *long_name; +} hkey_rel; + +static const WCHAR short_hklm[] = {'H','K','L','M',0}; +static const WCHAR short_hkcu[] = {'H','K','C','U',0}; +static const WCHAR short_hkcr[] = {'H','K','C','R',0}; +static const WCHAR short_hku[] = {'H','K','U',0}; +static const WCHAR short_hkcc[] = {'H','K','C','C',0}; +static const WCHAR long_hklm[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; +static const WCHAR long_hkcu[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; +static const WCHAR long_hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; +static const WCHAR long_hku[] = {'H','K','E','Y','_','U','S','E','R','S',0}; +static const WCHAR long_hkcc[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; + +static const hkey_rel root_rels[] = +{ + {HKEY_LOCAL_MACHINE, short_hklm, long_hklm}, + {HKEY_CURRENT_USER, short_hkcu, long_hkcu}, + {HKEY_CLASSES_ROOT, short_hkcr, long_hkcr}, + {HKEY_USERS, short_hku, long_hku}, + {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -98,35 +127,48 @@ static int reg_print_error(LONG error_code) } } -static HKEY get_rootkey(LPWSTR key) +static inline BOOL path_rootname_cmp(const WCHAR *input_path, const WCHAR *rootkey_name) +{ + DWORD length = strlenW(rootkey_name); + + return (!strncmpiW(input_path, rootkey_name, length) && + (input_path[length] == 0 || input_path[length] == '\\')); +} + +static LSTATUS path_get_rootkey(const WCHAR *path, HKEY *out) { - static const WCHAR szHKLM[] = {'H','K','L','M',0}; - static const WCHAR szHKEY_LOCAL_MACHINE[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; - static const WCHAR szHKCU[] = {'H','K','C','U',0}; - static const WCHAR szHKEY_CURRENT_USER[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; - static const WCHAR szHKCR[] = {'H','K','C','R',0}; - static const WCHAR szHKEY_CLASSES_ROOT[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; - static const WCHAR szHKU[] = {'H','K','U',0}; - static const WCHAR szHKEY_USERS[] = {'H','K','E','Y','_','U','S','E','R','S',0}; - static const WCHAR szHKCC[] = {'H','K','C','C',0}; - static const WCHAR szHKEY_CURRENT_CONFIG[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; - - if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKLM,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,18,szHKEY_LOCAL_MACHINE,18)==CSTR_EQUAL) - return HKEY_LOCAL_MACHINE; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCU,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CURRENT_USER,17)==CSTR_EQUAL) - return HKEY_CURRENT_USER; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCR,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CLASSES_ROOT,17)==CSTR_EQUAL) - return HKEY_CLASSES_ROOT; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,3,szHKU,3)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,10,szHKEY_USERS,10)==CSTR_EQUAL) - return HKEY_USERS; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCC,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,19,szHKEY_CURRENT_CONFIG,19)==CSTR_EQUAL) - return HKEY_CURRENT_CONFIG; - else return NULL; + DWORD i; + + for (i = 0; i < ARRAY_SIZE(root_rels); i++) + { + if (path_rootname_cmp(path, root_rels[i].short_name) || + path_rootname_cmp(path, root_rels[i].long_name)) + { + *out = root_rels[i].key; + return ERROR_SUCCESS; + } + } + + return ERROR_BADKEY; +} + +static LSTATUS path_get_key(const WCHAR *path, HKEY *out) +{ + HKEY k; + LONG err = path_get_rootkey(path, &k); + if (err != ERROR_SUCCESS) + return err; + + path = strchrW(path, '\\'); + if (path) + path++; + + err = RegOpenKeyW(k, path, &k); + if (err != ERROR_SUCCESS) + return err; + + *out = k; + return ERROR_SUCCESS; } static DWORD get_regtype(LPWSTR type) @@ -201,6 +243,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; LPWSTR p; HKEY root,subkey; + LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); @@ -212,10 +255,10 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } p++; - root = get_rootkey(key_name); - if (!root) + err = path_get_rootkey(key_name, &root); + if (err != ERROR_SUCCESS) { - reg_message(STRING_INVALID_KEY); + reg_print_error(err); return 1; } @@ -263,26 +306,18 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL value_all, BOOL force) { - LPWSTR p; - HKEY root,subkey; + HKEY subkey; + LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' ,0}; reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - p = strchrW(key_name,'\\'); - if (!p) + err = path_get_key(key_name, &subkey); + if (err != ERROR_SUCCESS) { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) - { - reg_message(STRING_INVALID_KEY); + reg_print_error(err); return 1; } @@ -306,21 +341,19 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, /* Delete subtree only if no /v* option is given */ if (!value_name && !value_empty && !value_all) { - if (RegDeleteTreeW(root,p)!=ERROR_SUCCESS) + HKEY root; + err = path_get_rootkey(key_name, &root); + err = RegDeleteTreeW(root, strchrW(key_name, '\\') + 1); + if (err != ERROR_SUCCESS) { - reg_message(STRING_CANNOT_FIND); + reg_print_error(err); return 1; } + reg_message(STRING_SUCCESS); return 0; } - if(RegOpenKeyW(root,p,&subkey)!=ERROR_SUCCESS) - { - reg_message(STRING_CANNOT_FIND); - return 1; - } - if (value_all) { LPWSTR szValue; -- 2.1.1 From jnvsor at gmail.com Tue Nov 4 14:15:11 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:11 +0100 Subject: [PATCH 4/7] reg: Add wchar/type conversion functions In-Reply-To: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> References: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415132114-23009-4-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 90 +++++++++++++++++++++++++++++++++++++---------------- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 66 insertions(+), 26 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 453dbc4..7b7d297 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -23,6 +23,7 @@ #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) #define ERROR_NO_REMOTE 20000 +#define ERROR_INVALID_TYPE 20001 typedef struct { @@ -31,6 +32,12 @@ typedef struct const WCHAR *long_name; } hkey_rel; +typedef struct +{ + DWORD type; + const WCHAR *name; +} type_rel; + static const WCHAR short_hklm[] = {'H','K','L','M',0}; static const WCHAR short_hkcu[] = {'H','K','C','U',0}; static const WCHAR short_hkcr[] = {'H','K','C','R',0}; @@ -51,6 +58,39 @@ static const hkey_rel root_rels[] = {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, }; +static const WCHAR type_none[] = {'R','E','G','_','N','O','N','E',0}; +static const WCHAR type_sz[] = {'R','E','G','_','S','Z',0}; +static const WCHAR type_expand_sz[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; +static const WCHAR type_binary[] = {'R','E','G','_','B','I','N','A','R','Y',0}; +static const WCHAR type_dword[] = {'R','E','G','_','D','W','O','R','D',0}; +static const WCHAR type_dword_le[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; +static const WCHAR type_dword_be[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; +static const WCHAR type_link[] = {'R','E','G','_','L','I','N','K',0}; +static const WCHAR type_multi_sz[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; +static const WCHAR type_resource_list[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','L','I','S','T',0}; +static const WCHAR type_full_resource_descriptor[] = {'R','E','G','_','F','U','L','L','_','R','E','S','O','U','R','C','E','_','D','E','S','C','R','I','P','T','O','R',0}; +static const WCHAR type_resource_requirements_list[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','R','E','Q','U','I','R','E','M','E','N','T','S','_','L','I','S','T',0}; +static const WCHAR type_qword[] = {'R','E','G','_','Q','W','O','R','D',0}; +static const WCHAR type_qword_le[] = {'R','E','G','_','Q','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; + +static const type_rel type_rels[] = +{ + {REG_NONE, type_none}, + {REG_SZ, type_sz}, + {REG_EXPAND_SZ, type_expand_sz}, + {REG_BINARY, type_binary}, + {REG_DWORD, type_dword}, + {REG_DWORD_LITTLE_ENDIAN, type_dword_le}, + {REG_DWORD_BIG_ENDIAN, type_dword_be}, + {REG_LINK, type_link}, + {REG_MULTI_SZ, type_multi_sz}, + {REG_RESOURCE_LIST, type_resource_list}, + {REG_FULL_RESOURCE_DESCRIPTOR, type_full_resource_descriptor}, + {REG_RESOURCE_REQUIREMENTS_LIST, type_resource_requirements_list}, + {REG_QWORD, type_qword}, + {REG_QWORD_LITTLE_ENDIAN, type_qword_le}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -112,6 +152,8 @@ static int reg_print_error(LONG error_code) return reg_message(STRING_INVALID_CMDLINE); case ERROR_NO_REMOTE: return reg_message(STRING_NO_REMOTE); + case ERROR_INVALID_TYPE: + return reg_message(STRING_INVALID_TYPE); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -171,30 +213,26 @@ static LSTATUS path_get_key(const WCHAR *path, HKEY *out) return ERROR_SUCCESS; } -static DWORD get_regtype(LPWSTR type) +static LSTATUS wchar_get_type(const WCHAR *type_name, DWORD *out) { - static const WCHAR szREG_SZ[] = {'R','E','G','_','S','Z',0}; - static const WCHAR szREG_MULTI_SZ[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; - static const WCHAR szREG_DWORD_BIG_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_DWORD[] = {'R','E','G','_','D','W','O','R','D',0}; - static const WCHAR szREG_BINARY[] = {'R','E','G','_','B','I','N','A','R','Y',0}; - static const WCHAR szREG_DWORD_LITTLE_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_NONE[] = {'R','E','G','_','N','O','N','E',0}; - static const WCHAR szREG_EXPAND_SZ[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; - - if (!type) - return REG_SZ; - - if (lstrcmpiW(type,szREG_SZ)==0) return REG_SZ; - if (lstrcmpiW(type,szREG_DWORD)==0) return REG_DWORD; - if (lstrcmpiW(type,szREG_MULTI_SZ)==0) return REG_MULTI_SZ; - if (lstrcmpiW(type,szREG_EXPAND_SZ)==0) return REG_EXPAND_SZ; - if (lstrcmpiW(type,szREG_DWORD_BIG_ENDIAN)==0) return REG_DWORD_BIG_ENDIAN; - if (lstrcmpiW(type,szREG_DWORD_LITTLE_ENDIAN)==0) return REG_DWORD_LITTLE_ENDIAN; - if (lstrcmpiW(type,szREG_BINARY)==0) return REG_BINARY; - if (lstrcmpiW(type,szREG_NONE)==0) return REG_NONE; - - return -1; + DWORD i; + + if (!type_name) + { + *out = REG_SZ; + return ERROR_SUCCESS; + } + + for (i = 0; i < ARRAY_SIZE(type_rels); i++) + { + if (!strcmpiW(type_rels[i].name, type_name)) + { + *out = type_rels[i].type; + return ERROR_SUCCESS; + } + } + + return ERROR_INVALID_TYPE; } static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) @@ -282,11 +320,11 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } } - reg_type = get_regtype(type); - if (reg_type == -1) + err = wchar_get_type(type, ®_type); + if (err != ERROR_SUCCESS) { RegCloseKey(subkey); - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(err); return 1; } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 1c2ae83..d49d3d8 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -31,3 +31,4 @@ #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 +#define STRING_INVALID_TYPE 111 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 74ef32e..9892b53 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -36,4 +36,5 @@ STRINGTABLE STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Error: " + STRING_INVALID_TYPE, "Error: Invalid type\n" } -- 2.1.1 From jnvsor at gmail.com Tue Nov 4 14:15:12 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:12 +0100 Subject: [PATCH 5/7] reg: Add wchar/raw data conversion functions In-Reply-To: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> References: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415132114-23009-5-git-send-email-jnvsor@gmail.com> In the case of REG_SZ and the like, it may seem like the functions perform an unncessary copy of the strings which should already be in memory ripe for the taking. However because these functions handle more than one type of data the calling function needs to be able to free the data afterwards. Simply returning the input string would result in a function freeing one of it's own parameters, so we make sure to return new memory by making a copy. --- programs/reg/reg.c | 163 +++++++++++++++++++++++++++++++++++++++-------- programs/reg/reg.h | 2 + programs/reg/reg.rc | 2 + programs/reg/tests/reg.c | 55 ++++++++-------- 4 files changed, 169 insertions(+), 53 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 7b7d297..45e0d64c 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -24,6 +24,7 @@ #define ERROR_NO_REMOTE 20000 #define ERROR_INVALID_TYPE 20001 +#define ERROR_NAN 20002 typedef struct { @@ -154,6 +155,10 @@ static int reg_print_error(LONG error_code) return reg_message(STRING_NO_REMOTE); case ERROR_INVALID_TYPE: return reg_message(STRING_INVALID_TYPE); + case ERROR_UNSUPPORTED_TYPE: + return reg_message(STRING_UNSUPPORTED_TYPE); + case ERROR_NAN: + return reg_message(STRING_NAN); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -235,43 +240,143 @@ static LSTATUS wchar_get_type(const WCHAR *type_name, DWORD *out) return ERROR_INVALID_TYPE; } -static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) +static LSTATUS data_default(const DWORD type, DWORD *size_out, BYTE **out) { - LPBYTE out_data = NULL; - *reg_count = 0; + switch (type) + { + case REG_SZ: + case REG_EXPAND_SZ: + case REG_MULTI_SZ: + { + *out = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)); + ** (WCHAR **) out = 0; + *size_out = sizeof(WCHAR); + return ERROR_SUCCESS; + } + case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: + { + return ERROR_NAN; + } + case REG_BINARY: + { + *out = NULL; + *size_out = 0; + return ERROR_SUCCESS; + } + default: + return ERROR_UNSUPPORTED_TYPE; + } +} + +static LSTATUS wchar_get_data( const WCHAR *input, const DWORD type, + const WCHAR separator, DWORD *size_out, BYTE **out) +{ + DWORD i; - switch (reg_type) + if (!input) + return data_default(type, size_out, out); + + switch (type) { case REG_SZ: + case REG_EXPAND_SZ: { - *reg_count = (lstrlenW(data) + 1) * sizeof(WCHAR); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - lstrcpyW((LPWSTR)out_data,data); - break; + i = (strlenW(input) + 1) * sizeof(WCHAR); + *out = HeapAlloc(GetProcessHeap(), 0, i); + memcpy(*out, input, i); + *size_out = i; + return ERROR_SUCCESS; } case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: + { + WCHAR *temp; + + if (input[0] == '0' && (input[1] == 'x' || input[1] == 'X')) + i = strtoulW(input, &temp, 16); + else + i = strtoulW(input, &temp, 10); + + if (input[0] == '-' || temp[0] || temp == input) + return ERROR_NAN; + + *out = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)); + ** (DWORD **) out = i; + *size_out = sizeof(DWORD); + return ERROR_SUCCESS; + } + case REG_MULTI_SZ: { - LPWSTR rest; - DWORD val; - val = strtolW(data, &rest, 0); - if (rest == data) { - static const WCHAR nonnumber[] = {'E','r','r','o','r',':',' ','/','d',' ','r','e','q','u','i','r','e','s',' ','n','u','m','b','e','r','.','\n',0}; - reg_printfW(nonnumber); - break; + WCHAR *temp = HeapAlloc(GetProcessHeap(), 0, (strlenW(input) + 1) * sizeof(WCHAR)); + DWORD p; + + for (i = 0, p = 0; i <= strlenW(input); i++, p++) + { + /* If this character is the separator, or no separator has been given and these + * characters are "\\0", then add a 0 indicating the end of this string */ + if ( (separator && input[i] == separator) || + (!separator && input[i] == '\\' && input[i + 1] == '0') ) + { + /* If it's the first character or the previous one was a separator */ + if (!p || temp[p - 1] == 0) + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + temp[p] = 0; + + if (!separator) + i++; + } + else + temp[p] = input[i]; } - *reg_count = sizeof(DWORD); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - ((LPDWORD)out_data)[0] = val; - break; + + /* Add a 0 to the end if the string wasn't "", and it wasn't + * double-0-terminated already (In the case of a trailing separator) */ + if(p > 1 && temp[p - 2]) + temp[p++] = 0; + + *size_out = p * sizeof(WCHAR); + *out = HeapReAlloc(GetProcessHeap(), 0, temp, p * sizeof(WCHAR)); + return ERROR_SUCCESS; } - default: + case REG_BINARY: { - static const WCHAR unhandled[] = {'U','n','h','a','n','d','l','e','d',' ','T','y','p','e',' ','0','x','%','x',' ',' ','d','a','t','a',' ','%','s','\n',0}; - reg_printfW(unhandled, reg_type,data); + BYTE * temp = HeapAlloc(GetProcessHeap(), 0, strlenW(input)); + DWORD p, odd; + + for (i = 0, p = 0; i < strlenW(input); i++, p++) + { + if (input[i] >= '0' && input[i] <= '9') + temp[p] = input[i] - '0'; + else if (input[i] >= 'a' && input[i] <= 'f') + temp[p] = input[i] - 'a' + 10; + else if (input[i] >= 'A' && input[i] <= 'F') + temp[p] = input[i] - 'A' + 10; + else + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + } + + odd = p & 1; + temp += odd; + p /= 2; + + for (i = 0; i < p; i++) + temp[i] = (temp[i * 2] << 4) | temp[i * 2 + 1]; + + p += odd; + *size_out = p; + *out = HeapReAlloc(GetProcessHeap(), 0, temp-odd, p); + return ERROR_SUCCESS; } + default: + return ERROR_UNSUPPORTED_TYPE; } - - return out_data; } static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, @@ -329,7 +434,15 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } if (data) - reg_data = get_regdata(data,reg_type,separator,®_count); + { + err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); + if (err != ERROR_SUCCESS) + { + RegCloseKey(subkey); + reg_print_error(err); + return 1; + } + } RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); HeapFree(GetProcessHeap(),0,reg_data); diff --git a/programs/reg/reg.h b/programs/reg/reg.h index d49d3d8..334e7ad 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -32,3 +32,5 @@ #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 #define STRING_INVALID_TYPE 111 +#define STRING_UNSUPPORTED_TYPE 112 +#define STRING_NAN 113 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 9892b53..a53013c 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -37,4 +37,6 @@ STRINGTABLE STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Error: " STRING_INVALID_TYPE, "Error: Invalid type\n" + STRING_UNSUPPORTED_TYPE, "Error: Unsupported type\n" + STRING_NAN, "Error: This type requires /d to be a positive number\n" } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index dbc8731..5215a15 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -174,11 +174,11 @@ static void test_add(void) /* REG_EXPAND_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, TODO_REG_SIZE); + verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, TODO_REG_SIZE); + verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -186,11 +186,11 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, TODO_REG_SIZE); + verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0); /* REG_BINARY */ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); @@ -200,14 +200,14 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 0xefbeadde; - verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), TODO_REG_SIZE); + verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin2 /f /d x01", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin3 /f /d 01x", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -221,8 +221,8 @@ static void test_add(void) err = RegQueryValueExA(hkey, "bin4", NULL, &type, (void *) (buffer+12), &size); ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_BINARY, "got wrong type %u\n", type); - todo_wine ok(size == 6, "got wrong size %u\n", size); - todo_wine ok(memcmp(buffer, buffer+12, 6) == 0 || + ok(size == 6, "got wrong size %u\n", size); + ok(memcmp(buffer, buffer+12, 6) == 0 || broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n"); /* REG_DWORD */ @@ -239,11 +239,11 @@ static void test_add(void) todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -257,22 +257,21 @@ static void test_add(void) ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD); ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD)); - todo_wine ok(dword == 123 || broken(dword == 0123 /* WinXP */), + ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected %d\n", dword, 123); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); dword = 0xdeadbeef; - verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), - (sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA); + verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); /* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r); @@ -284,7 +283,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 456; - verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), TODO_REG_SIZE); + verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0); /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like * an ordinary REG_DWORD - that is little endian. GG */ @@ -292,15 +291,15 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); memcpy(buffer, "three\0little\0strings\0", 22); - verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -308,7 +307,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, TODO_REG_SIZE); + verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); @@ -317,16 +316,16 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); buffer[0]='a'; buffer[1]=0; buffer[2]=0; - verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, TODO_REG_SIZE); + verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, 0); RegCloseKey(hkey); -- 2.1.1 From jnvsor at gmail.com Tue Nov 4 14:15:13 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:13 +0100 Subject: [PATCH 6/7] reg: Clean up reg_add In-Reply-To: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> References: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415132114-23009-6-git-send-email-jnvsor@gmail.com> You'll notice that bad value input leaves a zombie key after this call, but this is consistant with native. --- programs/reg/reg.c | 97 ++++++++++++++++++++++++------------------------ programs/reg/tests/reg.c | 16 ++++---- 2 files changed, 57 insertions(+), 56 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 45e0d64c..d92853c 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -18,6 +18,7 @@ #include #include +#include #include "reg.h" #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) @@ -26,6 +27,8 @@ #define ERROR_INVALID_TYPE 20001 #define ERROR_NAN 20002 +WINE_DEFAULT_DEBUG_CHANNEL(reg); + typedef struct { HKEY key; @@ -379,79 +382,70 @@ static LSTATUS wchar_get_data( const WCHAR *input, const DWORD type, } } -static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) +static int reg_add( const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const WCHAR *type, const WCHAR separator, const WCHAR *data, + const BOOL force) { - static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', - ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - LPWSTR p; - HKEY root,subkey; LONG err; + HKEY key = NULL; - reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - - p = strchrW(key_name,'\\'); - if (!p) + if (value_name && value_empty) { - reg_message(STRING_INVALID_KEY); + reg_print_error(ERROR_BAD_COMMAND); return 1; } - p++; - err = path_get_rootkey(key_name, &root); + err = path_get_rootkey(key_name, &key); if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } + goto error; - if(RegCreateKeyW(root,p,&subkey)!=ERROR_SUCCESS) + key_name = strchrW(key_name, '\\'); + if (key_name) { - reg_message(STRING_INVALID_KEY); - return 1; + err = RegCreateKeyW(key, key_name + 1, &key); + if (err != ERROR_SUCCESS) + goto error; } if (value_name || data) { - DWORD reg_type; - DWORD reg_count = 0; - BYTE* reg_data = NULL; + DWORD size, reg_type; + BYTE *data_out; + + if (value_name && !value_name[0]) + value_name = NULL; - if (!force) + if (!force && RegQueryValueExW(key, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - if (RegQueryValueW(subkey,value_name,NULL,NULL)==ERROR_SUCCESS) - { - /* FIXME: Prompt for overwrite */ - } + FIXME("Prompt for overwrite\n"); } err = wchar_get_type(type, ®_type); if (err != ERROR_SUCCESS) - { - RegCloseKey(subkey); - reg_print_error(err); - return 1; - } + goto error; - if (data) - { - err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); - if (err != ERROR_SUCCESS) - { - RegCloseKey(subkey); - reg_print_error(err); - return 1; - } - } + err = wchar_get_data(data, reg_type, separator, &size, &data_out); + if (err != ERROR_SUCCESS) + goto error; - RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); - HeapFree(GetProcessHeap(),0,reg_data); + err = RegSetValueExW(key, value_name, 0, reg_type, data_out, size); + + HeapFree(GetProcessHeap(), 0, data_out); + + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); - return 0; + +error: + if (key) + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, @@ -642,7 +636,14 @@ int wmain(int argc, WCHAR *argvW[]) else if (!lstrcmpiW(argvW[i], slashTW)) type = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashSW)) - separator = argvW[++i][0]; + { + if (argvW[++i][1]) + { + reg_print_error(ERROR_BAD_COMMAND); + return 1; + } + separator = argvW[i][0]; + } else if (!lstrcmpiW(argvW[i], slashDW)) data = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashFW)) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 5215a15..0e9ad74 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -157,7 +157,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v test /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test", REG_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -165,7 +165,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test2", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test2", REG_SZ, "", 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -182,7 +182,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -236,7 +236,7 @@ static void test_add(void) win_skip("broken reg.exe detected\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -303,18 +303,18 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); -- 2.1.1 From jnvsor at gmail.com Tue Nov 4 14:15:14 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Tue, 4 Nov 2014 21:15:14 +0100 Subject: [PATCH 7/7] reg: Clean up reg_delete In-Reply-To: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> References: <1415132114-23009-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415132114-23009-7-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 147 ++++++++++++++++++++++++----------------------- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + programs/reg/tests/reg.c | 2 +- 4 files changed, 78 insertions(+), 73 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index d92853c..4035649 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -23,9 +23,12 @@ #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) +#define MAX_VALUE_NAME 16384 + #define ERROR_NO_REMOTE 20000 #define ERROR_INVALID_TYPE 20001 #define ERROR_NAN 20002 +#define ERROR_NO_DELETE_ROOTKEY 20003 WINE_DEFAULT_DEBUG_CHANNEL(reg); @@ -162,6 +165,8 @@ static int reg_print_error(LONG error_code) return reg_message(STRING_UNSUPPORTED_TYPE); case ERROR_NAN: return reg_message(STRING_NAN); + case ERROR_NO_DELETE_ROOTKEY: + return reg_message(STRING_NO_DEL_ROOT); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -448,109 +453,107 @@ error: return 1; } -static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - BOOL value_all, BOOL force) +static int reg_delete(const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const BOOL value_all, const BOOL force) { - HKEY subkey; - LONG err; - - static const WCHAR stubW[] = {'D','E','L','E','T','E', - ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' - ,0}; - reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); + HKEY key = NULL; + LONG err = path_get_key(key_name, &key); - err = path_get_key(key_name, &subkey); if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } + goto error; - if (value_name && value_empty) + /* Mutually exclusive options */ + if ((!!value_name + !!value_empty + !!value_all) > 1) { - reg_message(STRING_INVALID_CMDLINE); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } - if (value_empty && value_all) + if (!force) { - reg_message(STRING_INVALID_CMDLINE); - return 1; + FIXME("Prompt for delete\n"); } - if (!force) + if (value_empty || value_name) { - /* FIXME: Prompt for delete */ - } + if (value_name && value_name[0]) + err = RegDeleteValueW(key, value_name); + else + err = RegDeleteValueW(key, NULL); - /* Delete subtree only if no /v* option is given */ - if (!value_name && !value_empty && !value_all) + if (err != ERROR_SUCCESS) + goto error; + } + else if (value_all) { - HKEY root; - err = path_get_rootkey(key_name, &root); - err = RegDeleteTreeW(root, strchrW(key_name, '\\') + 1); + WCHAR enum_v_name[MAX_VALUE_NAME]; + DWORD count, max_size, i = 0, errors = 0; + + err = RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, NULL, NULL, + &count, NULL, NULL, NULL, NULL); if (err != ERROR_SUCCESS) + goto error; + + while (i < count) { - reg_print_error(err); - return 1; - } + max_size = MAX_VALUE_NAME; - reg_message(STRING_SUCCESS); - return 0; - } + err = RegEnumValueW(key, i, enum_v_name, &max_size, + NULL, NULL, NULL, NULL); - if (value_all) - { - LPWSTR szValue; - DWORD maxValue; - DWORD count; - LONG rc; - - rc = RegQueryInfoKeyW(subkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &maxValue, NULL, NULL, NULL); - if (rc != ERROR_SUCCESS) - { - /* FIXME: failure */ - RegCloseKey(subkey); - return 1; - } - maxValue++; - szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR)); + if (err != ERROR_SUCCESS) + { + i++; + errors++; + reg_print_error(err); + continue; + } - while (1) - { - count = maxValue; - rc = RegEnumValueW(subkey, 0, szValue, &count, NULL, NULL, NULL, NULL); - if (rc == ERROR_SUCCESS) + err = RegDeleteValueW(key, enum_v_name); + if (err != ERROR_SUCCESS) { - rc = RegDeleteValueW(subkey, szValue); - if (rc != ERROR_SUCCESS) - break; + i++; + errors++; + reg_print_error(err); + continue; } - else break; + + count--; } - if (rc != ERROR_SUCCESS) + + if (errors) { - /* FIXME delete failed */ + RegCloseKey(key); + return 1; } } - else if (value_name) + /* Delete subtree only if no /v* option is given */ + else { - if (RegDeleteValueW(subkey,value_name) != ERROR_SUCCESS) + HKEY root; + + err = path_get_rootkey(key_name, &root); + if (key == root) { - RegCloseKey(subkey); - reg_message(STRING_CANNOT_FIND); - return 1; + err = ERROR_NO_DELETE_ROOTKEY; + goto error; } - } - else if (value_empty) - { - RegSetValueExW(subkey,NULL,0,REG_SZ,NULL,0); + + err = RegDeleteTreeW(root, strchrW(key_name, '\\') + 1); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); return 0; + +error: + if (key) + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 334e7ad..88356d1 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -34,3 +34,4 @@ #define STRING_INVALID_TYPE 111 #define STRING_UNSUPPORTED_TYPE 112 #define STRING_NAN 113 +#define STRING_NO_DEL_ROOT 114 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index a53013c..4675d35 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -39,4 +39,5 @@ STRINGTABLE STRING_INVALID_TYPE, "Error: Invalid type\n" STRING_UNSUPPORTED_TYPE, "Error: Unsupported type\n" STRING_NAN, "Error: This type requires /d to be a positive number\n" + STRING_NO_DEL_ROOT, "Error: Cannot delete root key\n" } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 0e9ad74..8a88ecf 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -367,7 +367,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); - todo_wine ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); -- 2.1.1 From matellanesivan at gmail.com Tue Nov 4 15:51:43 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Tue, 04 Nov 2014 22:51:43 +0100 Subject: [1/4] msvcrt: Added _fputc_nolock implementation Message-ID: <54594A6F.4010405@gmail.com> --- dlls/msvcr100/msvcr100.spec | 1 + dlls/msvcr110/msvcr110.spec | 1 + dlls/msvcr120/msvcr120.spec | 1 + dlls/msvcr80/msvcr80.spec | 1 + dlls/msvcr90/msvcr90.spec | 1 + dlls/msvcrt/file.c | 18 ++++++++++++++---- dlls/msvcrt/msvcrt.h | 1 + include/msvcrt/stdio.h | 1 + 8 files changed, 21 insertions(+), 4 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 80d5bc9..9ad987d 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -830,6 +830,7 @@ @ stub _fprintf_p @ stub _fprintf_p_l @ stub _fprintf_s_l +@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar @ stub _fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 283f5fd..a17d0d0 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1178,6 +1178,7 @@ @ stub _fprintf_p @ stub _fprintf_p_l @ stub _fprintf_s_l +@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar @ stub _fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 46a5268..88753eb 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1176,6 +1176,7 @@ @ stub _fprintf_p @ stub _fprintf_p_l @ stub _fprintf_s_l +@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar @ stub _fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index a48e42b..ee50c4f 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -497,6 +497,7 @@ @ stub _fprintf_p @ stub _fprintf_p_l @ stub _fprintf_s_l +@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar @ stub _fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index e9abf00..acce962 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -479,6 +479,7 @@ @ stub _fprintf_p @ stub _fprintf_p_l @ stub _fprintf_s_l +@ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar @ stub _fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index fefab94..bf00fbc 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3980,25 +3980,35 @@ int CDECL MSVCRT__wfopen_s(MSVCRT_FILE** pFile, const MSVCRT_wchar_t *filename, */ int CDECL MSVCRT_fputc(int c, MSVCRT_FILE* file) { + int ret; + + MSVCRT__lock_file(file); + ret = MSVCRT__fputc_nolock(c, file); + MSVCRT__unlock_file(file); + + return ret; +} + +/********************************************************************* + * _fputc_nolock (MSVCRT.@) + */ +int CDECL MSVCRT__fputc_nolock(int c, MSVCRT_FILE* file) +{ int res; - MSVCRT__lock_file(file); if(file->_cnt>0) { *file->_ptr++=c; file->_cnt--; if (c == '\n') { res = msvcrt_flush_buffer(file); - MSVCRT__unlock_file(file); return res ? res : c; } else { - MSVCRT__unlock_file(file); return c & 0xff; } } else { res = MSVCRT__flsbuf(c, file); - MSVCRT__unlock_file(file); return res; } } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 256a90c..289c5bc 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -917,6 +917,7 @@ void __cdecl MSVCRT__lock_file(MSVCRT_FILE*); void __cdecl MSVCRT__unlock_file(MSVCRT_FILE*); int __cdecl MSVCRT_fgetc(MSVCRT_FILE*); int __cdecl MSVCRT__fgetc_nolock(MSVCRT_FILE*); +int __cdecl MSVCRT__fputc_nolock(int,MSVCRT_FILE*); int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*); diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 768b3a0..71e642a 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -132,6 +132,7 @@ size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*); int __cdecl _fclose_nolock(FILE*); int __cdecl _fflush_nolock(FILE*); int __cdecl _fgetc_nolock(FILE*); +int __cdecl _fputc_nolock(int,FILE*); int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int); int __cdecl _fseeki64_nolock(FILE*,__int64,int); __msvcrt_long __cdecl _ftell_nolock(FILE*); -- 1.9.1 From matellanesivan at gmail.com Tue Nov 4 15:51:52 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Tue, 04 Nov 2014 22:51:52 +0100 Subject: [2/4] msvcrt: Added _fputwc_nolock implementation Message-ID: <54594A78.5040908@gmail.com> --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/file.c | 20 ++++++++++++++++---- dlls/msvcrt/msvcrt.h | 1 + include/msvcrt/stdio.h | 1 + 8 files changed, 23 insertions(+), 9 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 9ad987d..3f6a920 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -832,7 +832,7 @@ @ stub _fprintf_s_l @ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar -@ stub _fputwc_nolock +@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock @ stub _fread_nolock_s diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index a17d0d0..a61f7eb 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1180,7 +1180,7 @@ @ stub _fprintf_s_l @ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar -@ stub _fputwc_nolock +@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock @ stub _fread_nolock_s diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 88753eb..c9853ca 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1178,7 +1178,7 @@ @ stub _fprintf_s_l @ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar -@ stub _fputwc_nolock +@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock @ stub _fread_nolock_s diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index ee50c4f..700ce57 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -499,7 +499,7 @@ @ stub _fprintf_s_l @ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar -@ stub _fputwc_nolock +@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock @ stub _fread_nolock_s diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index acce962..94ffa30 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -481,7 +481,7 @@ @ stub _fprintf_s_l @ cdecl _fputc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _fputchar(long) MSVCRT__fputchar -@ stub _fputwc_nolock +@ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock @ stub _fread_nolock_s diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index bf00fbc..4fcd74f 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3829,11 +3829,24 @@ MSVCRT_size_t CDECL MSVCRT__fwrite_nolock(const void *ptr, MSVCRT_size_t size, M */ MSVCRT_wint_t CDECL MSVCRT_fputwc(MSVCRT_wint_t wc, MSVCRT_FILE* file) { + MSVCRT_wint_t ret; + + MSVCRT__lock_file(file); + ret = MSVCRT__fputwc_nolock(wc, file); + MSVCRT__unlock_file(file); + + return ret; +} + +/********************************************************************* + * _fputwc_nolock (MSVCRT.@) + */ +MSVCRT_wint_t CDECL MSVCRT__fputwc_nolock(MSVCRT_wint_t wc, MSVCRT_FILE* file) +{ MSVCRT_wchar_t mwc=wc; ioinfo *fdinfo; MSVCRT_wint_t ret; - MSVCRT__lock_file(file); fdinfo = msvcrt_get_ioinfo(file->_file); if((fdinfo->wxflag&WX_TEXT) && !(fdinfo->exflag&(EF_UTF8|EF_UTF16))) { @@ -3841,17 +3854,16 @@ MSVCRT_wint_t CDECL MSVCRT_fputwc(MSVCRT_wint_t wc, MSVCRT_FILE* file) int char_len; char_len = MSVCRT_wctomb(buf, mwc); - if(char_len!=-1 && MSVCRT_fwrite(buf, char_len, 1, file)==1) + if(char_len!=-1 && MSVCRT__fwrite_nolock(buf, char_len, 1, file)==1) ret = wc; else ret = MSVCRT_WEOF; - }else if(MSVCRT_fwrite(&mwc, sizeof(mwc), 1, file) == 1) { + }else if(MSVCRT__fwrite_nolock(&mwc, sizeof(mwc), 1, file) == 1) { ret = wc; }else { ret = MSVCRT_WEOF; } - MSVCRT__unlock_file(file); return ret; } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 289c5bc..d780f1b 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -921,6 +921,7 @@ int __cdecl MSVCRT__fputc_nolock(int,MSVCRT_FILE*); int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*); +MSVCRT_wint_t __cdecl MSVCRT__fputwc_nolock(MSVCRT_wint_t,MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*); int __cdecl MSVCRT__fseeki64_nolock(MSVCRT_FILE*,__int64,int); __int64 __cdecl MSVCRT__ftelli64(MSVCRT_FILE* file); diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 71e642a..d4839cd 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -199,6 +199,7 @@ unsigned int __cdecl _set_output_format(void); #define _WSTDIO_DEFINED wint_t __cdecl _fgetwc_nolock(FILE*); wint_t __cdecl _fgetwchar(void); +wint_t __cdecl _fputwc_nolock(wint_t,FILE*); wint_t __cdecl _fputwchar(wint_t); wchar_t* __cdecl _getws(wchar_t*); int __cdecl _putws(const wchar_t*); -- 1.9.1 From matellanesivan at gmail.com Tue Nov 4 15:52:03 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Tue, 04 Nov 2014 22:52:03 +0100 Subject: [3/4] msvcrt: Added _ungetc_nolock implementation Message-ID: <54594A83.6000609@gmail.com> Attempt to fix https://bugs.winehq.org/show_bug.cgi?id=37381 --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/file.c | 22 +++++++++++++++++----- dlls/msvcrt/msvcrt.h | 1 + include/msvcrt/stdio.h | 1 + 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 3f6a920..21d380e 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1405,7 +1405,7 @@ @ cdecl _ultow_s(long ptr long long) MSVCRT__ultow_s @ cdecl _umask(long) MSVCRT__umask @ stub _umask_s -@ stub _ungetc_nolock +@ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock @ stub _ungetwc_nolock diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index a61f7eb..c33ce06 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1763,7 +1763,7 @@ @ cdecl _ultow_s(long ptr long long) MSVCRT__ultow_s @ cdecl _umask(long) MSVCRT__umask @ stub _umask_s -@ stub _ungetc_nolock +@ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock @ stub _ungetwc_nolock diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index c9853ca..49d47e6 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1777,7 +1777,7 @@ @ cdecl _ultow_s(long ptr long long) MSVCRT__ultow_s @ cdecl _umask(long) MSVCRT__umask @ stub _umask_s -@ stub _ungetc_nolock +@ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock @ stub _ungetwc_nolock diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 700ce57..b9fa3cd 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1084,7 +1084,7 @@ @ cdecl _ultow_s(long ptr long long) MSVCRT__ultow_s @ cdecl _umask(long) MSVCRT__umask @ stub _umask_s -@ stub _ungetc_nolock +@ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock @ stub _ungetwc_nolock diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 94ffa30..24302c3 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1060,7 +1060,7 @@ @ cdecl _ultow_s(long ptr long long) MSVCRT__ultow_s @ cdecl _umask(long) MSVCRT__umask @ stub _umask_s -@ stub _ungetc_nolock +@ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock @ stub _ungetwc_nolock diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 4fcd74f..9fc2652 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -5002,13 +5002,28 @@ int CDECL MSVCRT_printf_s(const char *format, ...) */ int CDECL MSVCRT_ungetc(int c, MSVCRT_FILE * file) { + int ret; + + if(!MSVCRT_CHECK_PMT(file != NULL)) return MSVCRT_EOF; + + MSVCRT__lock_file(file); + ret = MSVCRT__ungetc_nolock(c, file); + MSVCRT__unlock_file(file); + + return ret; +} + +/********************************************************************* + * _ungetc_nolock (MSVCRT.@) + */ +int CDECL MSVCRT__ungetc_nolock(int c, MSVCRT_FILE * file) +{ if(!MSVCRT_CHECK_PMT(file != NULL)) return MSVCRT_EOF; if (c == MSVCRT_EOF || !(file->_flag&MSVCRT__IOREAD || (file->_flag&MSVCRT__IORW && !(file->_flag&MSVCRT__IOWRT)))) return MSVCRT_EOF; - MSVCRT__lock_file(file); if((!(file->_flag & (MSVCRT__IONBF | MSVCRT__IOMYBUF | MSVCRT__USERBUF)) && msvcrt_alloc_buffer(file)) || (!file->_cnt && file->_ptr==file->_base)) @@ -5019,20 +5034,17 @@ int CDECL MSVCRT_ungetc(int c, MSVCRT_FILE * file) if(file->_flag & MSVCRT__IOSTRG) { if(*file->_ptr != c) { file->_ptr++; - MSVCRT__unlock_file(file); return MSVCRT_EOF; } }else { *file->_ptr = c; } file->_cnt++; - MSVCRT_clearerr(file); + file->_flag &= ~(MSVCRT__IOERR | MSVCRT__IOEOF); file->_flag |= MSVCRT__IOREAD; - MSVCRT__unlock_file(file); return c; } - MSVCRT__unlock_file(file); return MSVCRT_EOF; } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index d780f1b..e19928b 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -919,6 +919,7 @@ int __cdecl MSVCRT_fgetc(MSVCRT_FILE*); int __cdecl MSVCRT__fgetc_nolock(MSVCRT_FILE*); int __cdecl MSVCRT__fputc_nolock(int,MSVCRT_FILE*); int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*); +int __cdecl MSVCRT__ungetc_nolock(int,MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fputwc_nolock(MSVCRT_wint_t,MSVCRT_FILE*); diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index d4839cd..19fda94 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -137,6 +137,7 @@ int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int); int __cdecl _fseeki64_nolock(FILE*,__int64,int); __msvcrt_long __cdecl _ftell_nolock(FILE*); __int64 __cdecl _ftelli64_nolock(FILE*); +int __cdecl _ungetc_nolock(int,FILE*); void __cdecl clearerr(FILE*); int __cdecl fclose(FILE*); -- 1.9.1 From matellanesivan at gmail.com Tue Nov 4 15:52:11 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Tue, 04 Nov 2014 22:52:11 +0100 Subject: [4/4] msvcrt: Added _ungetwc_nolock implementation Message-ID: <54594A8B.2080605@gmail.com> --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/file.c | 32 ++++++++++++++++++++------------ dlls/msvcrt/msvcrt.h | 1 + include/msvcrt/stdio.h | 1 + 8 files changed, 27 insertions(+), 17 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 21d380e..45a04cf 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1408,7 +1408,7 @@ @ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock -@ stub _ungetwc_nolock +@ cdecl _ungetwc_nolock(long ptr) MSVCRT__ungetwc_nolock @ stub _ungetwch @ stub _ungetwch_nolock @ cdecl _unlink(str) MSVCRT__unlink diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index c33ce06..5fc4ee5 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1766,7 +1766,7 @@ @ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock -@ stub _ungetwc_nolock +@ cdecl _ungetwc_nolock(long ptr) MSVCRT__ungetwc_nolock @ stub _ungetwch @ stub _ungetwch_nolock @ cdecl _unlink(str) MSVCRT__unlink diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 49d47e6..c3edd61 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1780,7 +1780,7 @@ @ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock -@ stub _ungetwc_nolock +@ cdecl _ungetwc_nolock(long ptr) MSVCRT__ungetwc_nolock @ stub _ungetwch @ stub _ungetwch_nolock @ cdecl _unlink(str) MSVCRT__unlink diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index b9fa3cd..9877784 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1087,7 +1087,7 @@ @ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock -@ stub _ungetwc_nolock +@ cdecl _ungetwc_nolock(long ptr) MSVCRT__ungetwc_nolock @ stub _ungetwch @ stub _ungetwch_nolock @ cdecl _unlink(str) MSVCRT__unlink diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 24302c3..4df9203 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1063,7 +1063,7 @@ @ cdecl _ungetc_nolock(long ptr) MSVCRT__ungetc_nolock @ cdecl _ungetch(long) @ stub _ungetch_nolock -@ stub _ungetwc_nolock +@ cdecl _ungetwc_nolock(long ptr) MSVCRT__ungetwc_nolock @ stub _ungetwch @ stub _ungetwch_nolock @ cdecl _unlink(str) MSVCRT__unlink diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 9fc2652..491942d 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -5053,43 +5053,51 @@ int CDECL MSVCRT__ungetc_nolock(int c, MSVCRT_FILE * file) */ MSVCRT_wint_t CDECL MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file) { + MSVCRT_wint_t ret; + + if(!MSVCRT_CHECK_PMT(file != NULL)) return MSVCRT_WEOF; + + MSVCRT__lock_file(file); + ret = MSVCRT__ungetwc_nolock(wc, file); + MSVCRT__unlock_file(file); + + return ret; +} + +/********************************************************************* + * _ungetwc_nolock (MSVCRT.@) + */ +MSVCRT_wint_t CDECL MSVCRT__ungetwc_nolock(MSVCRT_wint_t wc, MSVCRT_FILE * file) +{ MSVCRT_wchar_t mwc = wc; + if(!MSVCRT_CHECK_PMT(file != NULL)) return MSVCRT_WEOF; if (wc == MSVCRT_WEOF) return MSVCRT_WEOF; - MSVCRT__lock_file(file); - if((msvcrt_get_ioinfo(file->_file)->exflag & (EF_UTF8 | EF_UTF16)) || !(msvcrt_get_ioinfo(file->_file)->wxflag & WX_TEXT)) { unsigned char * pp = (unsigned char *)&mwc; int i; for(i=sizeof(MSVCRT_wchar_t)-1;i>=0;i--) { - if(pp[i] != MSVCRT_ungetc(pp[i],file)) { - MSVCRT__unlock_file(file); + if(pp[i] != MSVCRT__ungetc_nolock(pp[i],file)) return MSVCRT_WEOF; - } } }else { char mbs[MSVCRT_MB_LEN_MAX]; int len; len = MSVCRT_wctomb(mbs, mwc); - if(len == -1) { - MSVCRT__unlock_file(file); + if(len == -1) return MSVCRT_WEOF; - } for(len--; len>=0; len--) { - if(mbs[len] != MSVCRT_ungetc(mbs[len], file)) { - MSVCRT__unlock_file(file); + if(mbs[len] != MSVCRT__ungetc_nolock(mbs[len], file)) return MSVCRT_WEOF; - } } } - MSVCRT__unlock_file(file); return mwc; } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index e19928b..70ac68b 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -924,6 +924,7 @@ MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fgetwc_nolock(MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT__fputwc_nolock(MSVCRT_wint_t,MSVCRT_FILE*); MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*); +MSVCRT_wint_t __cdecl MSVCRT__ungetwc_nolock(MSVCRT_wint_t, MSVCRT_FILE*); int __cdecl MSVCRT__fseeki64_nolock(MSVCRT_FILE*,__int64,int); __int64 __cdecl MSVCRT__ftelli64(MSVCRT_FILE* file); __int64 __cdecl MSVCRT__ftelli64_nolock(MSVCRT_FILE*); diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 19fda94..7512efc 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -207,6 +207,7 @@ int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); int __cdecl _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...); int __cdecl _scwprintf(const wchar_t*,...); +wint_t __cdecl _ungetwc_nolock(wint_t,FILE*); int __cdecl _vscwprintf(const wchar_t*,__ms_va_list); int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list); int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list); -- 1.9.1 From austinenglish at gmail.com Tue Nov 4 18:29:11 2014 From: austinenglish at gmail.com (Austin English) Date: Tue, 4 Nov 2014 18:29:11 -0600 Subject: ntoskrnl.exe: add a stub for IoCsqInitialize Message-ID: https://bugs.winehq.org/show_bug.cgi?id=36777 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- From 22d189a104fadd80a2139af2079314827493c323 Mon Sep 17 00:00:00 2001 From: Austin English Date: Tue, 4 Nov 2014 18:24:24 -0600 Subject: [PATCH] ntoskrnl.exe: add a stub for IoCsqInitialize --- dlls/ntoskrnl.exe/ntoskrnl.c | 10 +++++++ dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- include/ddk/csq.h | 59 +++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 include/ddk/csq.h diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index a31b186..f932421 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -33,6 +33,7 @@ #include "winternl.h" #include "excpt.h" #include "winioctl.h" +#include "ddk/csq.h" #include "ddk/ntddk.h" #include "ddk/ntifs.h" #include "wine/unicode.h" @@ -1947,3 +1948,12 @@ NTSTATUS WINAPI IoRegisterPlugPlayNotification(IO_NOTIFICATION_EVENT_CATEGORY ca FIXME("(%u %u %p %p %p %p %p) stub\n", category, flags, data, driver, callback, context, notification); return STATUS_SUCCESS; } + +/***************************************************** + * IoCsqInitialize (NTOSKRNL.EXE.@) + */ +NTSTATUS WINAPI IoCsqInitialize(PIO_CSQ csq, PIO_CSQ_INSERT_IRP insert_irp, PIO_CSQ_REMOVE_IRP remove_irp, PIO_CSQ_PEEK_NEXT_IRP peek_irp, PIO_CSQ_ACQUIRE_LOCK acquire_lock, PIO_CSQ_RELEASE_LOCK release_lock, PIO_CSQ_COMPLETE_CANCELED_IRP complete_irp) +{ + FIXME("(%p %p %p %p %p %p %p) stub\n", csq, insert_irp, remove_irp, peek_irp, acquire_lock, release_lock, complete_irp); + return STATUS_NOT_IMPLEMENTED; +} diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 4ead907..ddb6b72 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -348,7 +348,7 @@ @ stdcall IoCreateSymbolicLink(ptr ptr) @ stdcall IoCreateSynchronizationEvent(ptr ptr) @ stub IoCreateUnprotectedSymbolicLink -@ stub IoCsqInitialize +@ stdcall IoCsqInitialize(ptr ptr ptr ptr ptr ptr ptr) @ stub IoCsqInsertIrp @ stub IoCsqRemoveIrp @ stub IoCsqRemoveNextIrp diff --git a/include/ddk/csq.h b/include/ddk/csq.h new file mode 100644 index 0000000..3a5d8a0 --- /dev/null +++ b/include/ddk/csq.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) the Wine project + * + * 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 "ddk/ntddk.h" + +#ifndef __WINE_CSQ_H +#define __WINE_CSQ_H + +typedef struct _IO_CSQ IO_CSQ, *PIO_CSQ; + +typedef VOID (*PIO_CSQ_ACQUIRE_LOCK)( + PIO_CSQ Csq, + PKIRQL Irql +); + +typedef VOID (*PIO_CSQ_COMPLETE_CANCELED_IRP)( + PIO_CSQ Csq, + PIRP Irp +); + +typedef VOID (*PIO_CSQ_INSERT_IRP)( + struct _IO_CSQ *Csq, + PIRP Irp +); + +typedef PIRP (*PIO_CSQ_PEEK_NEXT_IRP)( + PIO_CSQ Csq, + PIRP Irp, + PVOID PeekContext +); + +typedef VOID (*PIO_CSQ_RELEASE_LOCK)( + PIO_CSQ Csq, + KIRQL Irql +); + +typedef VOID +(*PIO_CSQ_REMOVE_IRP)( + PIO_CSQ Csq, + PIRP Irp +); + + +#endif /* __WINE_CSQ_H */ -- 2.1.1 From austinenglish at gmail.com Tue Nov 4 18:38:22 2014 From: austinenglish at gmail.com (Austin English) Date: Tue, 4 Nov 2014 18:38:22 -0600 Subject: ntdll: add NtSetLdtEntries/ZwSetLdtEntries stub (try 2) (resend) Message-ID: Other patch dropped off the tracker without comment. Fixes https://bugs.winehq.org/show_bug.cgi?id=26268 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- From 246b78f82c47c2b604daab8fdbdbc47602c3c295 Mon Sep 17 00:00:00 2001 From: Austin English Date: Tue, 4 Nov 2014 18:35:38 -0600 Subject: [PATCH] ntdll: add NtSetLdtEntries/ZwSetLdtEntries stub (try 2) (resend) --- dlls/ntdll/nt.c | 12 ++++++++++++ dlls/ntdll/ntdll.spec | 4 ++-- include/ddk/wdm.h | 1 + include/winternl.h | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index 73d9383..0d11037 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -2446,3 +2446,15 @@ NTSTATUS WINAPI NtSystemDebugControl(SYSDBG_COMMAND command, PVOID inbuffer, ULO return STATUS_NOT_IMPLEMENTED; } + +/****************************************************************************** + * NtSetLdtEntries (NTDLL.@) + * ZwSetLdtEntries (NTDLL.@) + */ +NTSTATUS WINAPI NtSetLdtEntries(ULONG selector1, ULONG entry1_low, ULONG entry1_high, + ULONG selector2, ULONG entry2_low, ULONG entry2_high) +{ + FIXME("(%u, %u, %u, %u, %u, %u): stub\n", selector1, entry1_low, entry1_high, selector2, entry2_low, entry2_high); + + return STATUS_NOT_IMPLEMENTED; +} diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 5bac269..f1dafc8 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -332,7 +332,7 @@ @ stdcall NtSetInformationToken(long long ptr long) @ stdcall NtSetIntervalProfile(long long) @ stdcall NtSetIoCompletion(ptr long ptr long long) -@ stub NtSetLdtEntries +@ stdcall NtSetLdtEntries(long long long long long long) @ stub NtSetLowEventPair @ stub NtSetLowWaitHighEventPair @ stub NtSetLowWaitHighThread @@ -1209,7 +1209,7 @@ @ stdcall ZwSetInformationToken(long long ptr long) NtSetInformationToken @ stdcall ZwSetIntervalProfile(long long) NtSetIntervalProfile @ stdcall ZwSetIoCompletion(ptr long ptr long long) NtSetIoCompletion -@ stub ZwSetLdtEntries +@ stdcall ZwSetLdtEntries(long long long long long long) NtSetLdtEntries @ stub ZwSetLowEventPair @ stub ZwSetLowWaitHighEventPair @ stub ZwSetLowWaitHighThread diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 29b24e7..ef4fa80 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1333,6 +1333,7 @@ NTSTATUS WINAPI ZwSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, NTSTATUS WINAPI ZwSetInformationProcess(HANDLE,PROCESS_INFORMATION_CLASS,PVOID,ULONG); NTSTATUS WINAPI ZwSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID,ULONG); NTSTATUS WINAPI ZwSetIoCompletion(HANDLE,ULONG,ULONG,NTSTATUS,ULONG); +NTSTATUS WINAPI ZwSetLdtEntries(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG); NTSTATUS WINAPI ZwSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR); NTSTATUS WINAPI ZwSetSystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG); NTSTATUS WINAPI ZwSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*); diff --git a/include/winternl.h b/include/winternl.h index 5a27f94..ddc7c18 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2228,7 +2228,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID, NTSYSAPI NTSTATUS WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetIntervalProfile(ULONG,KPROFILE_SOURCE); NTSYSAPI NTSTATUS WINAPI NtSetIoCompletion(HANDLE,ULONG_PTR,ULONG_PTR,NTSTATUS,SIZE_T); -NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,LDT_ENTRY,ULONG,LDT_ENTRY); +NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetLowEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighThread(VOID); -- 2.1.1 From nsivov at codeweavers.com Tue Nov 4 23:52:53 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 05 Nov 2014 08:52:53 +0300 Subject: [PATCH 1/4] dwrite: Fix setting oblique simulation on font creation Message-ID: <5459BB35.7060005@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Fix-setting-oblique-simulation-on-font-creati.patch Type: text/x-patch Size: 3948 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 23:53:04 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 05 Nov 2014 08:53:04 +0300 Subject: [PATCH 2/4] dwrite: Fix compiler warning regarding unsigned type of enum member Message-ID: <5459BB40.6080008@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Fix-compiler-warning-regarding-unsigned-type-.patch Type: text/x-patch Size: 932 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 23:53:14 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 05 Nov 2014 08:53:14 +0300 Subject: [PATCH 3/4] dwrite: Implement GetFaceNames() Message-ID: <5459BB4A.5000309@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-Implement-GetFaceNames.patch Type: text/x-patch Size: 5173 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 4 23:53:25 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 05 Nov 2014 08:53:25 +0300 Subject: [PATCH 4/4] dwrite: Implement remaining methods of IDWriteLocalizedStrings Message-ID: <5459BB55.3030605@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-dwrite-Implement-remaining-methods-of-IDWriteLocaliz.patch Type: text/x-patch Size: 4417 bytes Desc: not available URL: From alexhenrie24 at gmail.com Wed Nov 5 00:49:29 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Tue, 4 Nov 2014 23:49:29 -0700 Subject: [PATCH 1/2] kernel32/tests: Add UTF-7 non-encoded surrounding characters tests. Message-ID: <1415170170-28572-1-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 76 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 8423c75..febabc6 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -20,6 +20,7 @@ */ #include +#include #include #include "wine/test.h" @@ -412,6 +413,79 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); } +static void test_utf7_encoding(void) +{ + WCHAR input[16]; + char output[16], expected[16]; + int i, len, expected_len; + + static const BOOL directly_encodable_table[] = + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, /* 0x00 - 0x0F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1F */ + 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* 0x20 - 0x2F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 0x30 - 0x3F */ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x50 - 0x5F */ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 /* 0x70 - 0x7F */ + }; + static const char base64_encoding_table[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + if (WideCharToMultiByte(CP_UTF7, 0, foobarW, -1, NULL, 0, NULL, NULL) == 0 && + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + skip("UTF-7 encoding not implemented\n"); + return; + } + + /* test which characters are encoded if surrounded by non-encoded characters */ + for (i = 0; i <= 0xFFFF; i++) + { + input[0] = ' '; + input[1] = i; + input[2] = ' '; + input[3] = 0; + + memset(output, '#', sizeof(output) - 1); + output[sizeof(output) - 1] = 0; + + SetLastError(0xdeadbeef); + len = WideCharToMultiByte(CP_UTF7, 0, input, 4, output, sizeof(output) - 1, NULL, NULL); + ok(GetLastError() == 0xdeadbeef, + "i=0x%04x: expected error=0xdeadbeef, got error=0x%x\n", i, GetLastError()); + + if (i == '+') + { + /* '+' is a special case and is encoded as "+-" */ + expected_len = 5; + strcpy(expected, " +- "); + } + else if (i <= 0x7F && directly_encodable_table[i]) + { + /* encodes directly */ + expected_len = 4; + sprintf(expected, " %c ", i); + } + else + { + /* base64-encodes */ + expected_len = 8; + sprintf(expected, " +%c%c%c- ", + base64_encoding_table[(i & 0xFC00) >> 10], + base64_encoding_table[(i & 0x03F0) >> 4], + base64_encoding_table[(i & 0x000F) << 2]); + } + + ok(len == expected_len, "i=0x%04x: expected len=%i, got len=%i\n", i, expected_len, len); + ok(memcmp(output, expected, expected_len) == 0, + "i=0x%04x: expected output='%s', got output='%s'\n", i, expected, output); + ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", + i, expected_len, expected_len, output[expected_len]); + } +} + static void test_undefined_byte_char(void) { static const struct tag_testset { @@ -618,6 +692,8 @@ START_TEST(codepage) test_string_conversion(NULL); test_string_conversion(&bUsedDefaultChar); + test_utf7_encoding(); + test_undefined_byte_char(); test_threadcp(); } -- 2.1.3 From alexhenrie24 at gmail.com Wed Nov 5 00:49:30 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Tue, 4 Nov 2014 23:49:30 -0700 Subject: [PATCH 2/2] kernel32/tests: Add UTF-7 encoded surrounding characters tests. In-Reply-To: <1415170170-28572-1-git-send-email-alexhenrie24@gmail.com> References: <1415170170-28572-1-git-send-email-alexhenrie24@gmail.com> Message-ID: <1415170170-28572-2-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index febabc6..14a1348 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -484,6 +484,53 @@ static void test_utf7_encoding(void) ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", i, expected_len, expected_len, output[expected_len]); } + + /* test which one-byte characters are absorbed into surrounding base64 blocks + * (Windows always ends the base64 block when it encounters a directly encodable character) */ + for (i = 0; i <= 0xFFFF; i++) + { + input[0] = 0x2672; + input[1] = i; + input[2] = 0x2672; + input[3] = 0; + + memset(output, '#', sizeof(output) - 1); + output[sizeof(output) - 1] = 0; + + SetLastError(0xdeadbeef); + len = WideCharToMultiByte(CP_UTF7, 0, input, 4, output, sizeof(output) - 1, NULL, NULL); + ok(GetLastError() == 0xdeadbeef, + "i=%x04x: expected error=0xdeadbeef, got error=0x%x\n", i, GetLastError()); + + if (i == '+') + { + /* '+' is a special case and is encoded as "+-" */ + expected_len = 13; + strcpy(expected, "+JnI-+-+JnI-"); + } + else if (i <= 0x7F && directly_encodable_table[i]) + { + /* encodes directly */ + expected_len = 12; + sprintf(expected, "+JnI-%c+JnI-", i); + } + else + { + /* base64-encodes */ + expected_len = 11; + sprintf(expected, "+Jn%c%c%c%cZy-", + base64_encoding_table[8 | ((i & 0xC000) >> 14)], + base64_encoding_table[(i & 0x3F00) >> 8], + base64_encoding_table[(i & 0x00FC) >> 2], + base64_encoding_table[((i & 0x0003) << 4) | 2]); + } + + ok(len == expected_len, "i=0x%04x: expected len=%i, got len=%i\n", i, expected_len, len); + ok(memcmp(output, expected, expected_len) == 0, + "i=0x%04x: expected output='%s', got output='%s'\n", i, expected, output); + ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", + i, expected_len, expected_len, output[expected_len]); + } } static void test_undefined_byte_char(void) -- 2.1.3 From mstefani at redhat.de Wed Nov 5 03:53:56 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 5 Nov 2014 10:53:56 +0100 Subject: msi: Simplify check for an empty string (PVS-Studio) Message-ID: <20141105095356.GA17928@redhat.com> --- dlls/msi/dialog.c | 2 +- dlls/msi/script.c | 2 +- dlls/msi/tests/action.c | 2 +- dlls/msi/tests/db.c | 4 ++-- dlls/msi/tests/package.c | 4 ++-- dlls/msi/tests/source.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/msi/dialog.c b/dlls/msi/dialog.c index 4e1052e..4380879 100644 --- a/dlls/msi/dialog.c +++ b/dlls/msi/dialog.c @@ -2171,7 +2171,7 @@ static void msi_dialog_update_pathedit( msi_dialog *dialog, msi_control *control /* FIXME: test when this should fail */ static BOOL msi_dialog_verify_path( LPWSTR path ) { - if ( !lstrlenW( path ) ) + if ( !path[0] ) return FALSE; if ( PathIsRelativeW( path ) ) diff --git a/dlls/msi/script.c b/dlls/msi/script.c index 0fec716..c70790f 100644 --- a/dlls/msi/script.c +++ b/dlls/msi/script.c @@ -356,7 +356,7 @@ DWORD call_script(MSIHANDLE hPackage, INT type, LPCWSTR script, LPCWSTR function if (FAILED(hr)) goto done; /* Call a function if necessary through the IDispatch interface */ - if (function != NULL && strlenW(function) > 0) { + if (function && function[0]) { TRACE("Calling function %s\n", debugstr_w(function)); hr = IActiveScript_GetScriptDispatch(pActiveScript, NULL, &pDispatch); diff --git a/dlls/msi/tests/action.c b/dlls/msi/tests/action.c index a8903d9..bd074a2 100644 --- a/dlls/msi/tests/action.c +++ b/dlls/msi/tests/action.c @@ -2715,7 +2715,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase } if (!expected) - ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val); + ok_(__FILE__, line)(!val[0], "Expected empty string, got %s\n", val); else { if (bcase) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index af8ac8c..5ac9035 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -4534,7 +4534,7 @@ static void test_update(void) size = MAX_PATH; r = MsiRecordGetStringA(rec, 1, result, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrlenA(result), "Expected an empty string, got %s\n", result); + ok(!result[0], "Expected an empty string, got %s\n", result); MsiCloseHandle(rec); @@ -4580,7 +4580,7 @@ static void test_update(void) size = MAX_PATH; r = MsiRecordGetStringA(rec, 1, result, &size); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(!lstrlenA(result), "Expected an empty string, got %s\n", result); + ok(!result[0], "Expected an empty string, got %s\n", result); MsiCloseHandle(rec); diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index 1a5935d..28d3e54 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -2194,7 +2194,7 @@ static void test_props(void) sz = 6; r = MsiGetPropertyA(hpkg, "property", buffer, &sz); ok( r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok( !strlen(buffer), "Expected empty string, got %s\n", buffer); + ok(!buffer[0], "Expected empty string, got %s\n", buffer); MsiCloseHandle( hpkg ); DeleteFileA(msifile); @@ -2347,7 +2347,7 @@ static void test_property_table(void) lstrcpyA(buffer, "aaa"); r = MsiGetPropertyA(hpkg, "dantes", buffer, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); - ok(lstrlenA(buffer) == 0, "Expected empty string, got %s\n", buffer); + ok(!buffer[0], "Expected empty string, got %s\n", buffer); r = MsiSetPropertyA(hpkg, "dantes", "mercedes"); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); diff --git a/dlls/msi/tests/source.c b/dlls/msi/tests/source.c index 9fddd90..1ef3c9d 100644 --- a/dlls/msi/tests/source.c +++ b/dlls/msi/tests/source.c @@ -176,7 +176,7 @@ static void check_reg_str(HKEY prodkey, LPCSTR name, LPCSTR expected, BOOL bcase } if (!expected) - ok_(__FILE__, line)(lstrlenA(val) == 0, "Expected empty string, got %s\n", val); + ok_(__FILE__, line)(!val[0], "Expected empty string, got %s\n", val); else { if (bcase) -- 1.9.3 From nsivov at codeweavers.com Wed Nov 5 05:36:13 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 05 Nov 2014 14:36:13 +0300 Subject: [PATCH] dpnet/tests: Fix a test failure caused by uninitialized argument Message-ID: <545A0BAD.8030808@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dpnet-tests-Fix-a-test-failure-caused-by-uninitializ.patch Type: text/x-patch Size: 1573 bytes Desc: not available URL: From jacek at codeweavers.com Wed Nov 5 05:57:36 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Wed, 05 Nov 2014 12:57:36 +0100 Subject: urlmon: Update existing session if user agent changes. Message-ID: <545A10B0.2080306@codeweavers.com> --- dlls/urlmon/protocol.c | 6 ++++++ dlls/urlmon/session.c | 1 + dlls/urlmon/urlmon_main.h | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-urlmon-Update-existing-session-if-user-agent-changes.diff Type: text/x-patch Size: 1733 bytes Desc: not available URL: From meissner at suse.de Wed Nov 5 05:58:10 2014 From: meissner at suse.de (Marcus Meissner) Date: Wed, 5 Nov 2014 12:58:10 +0100 Subject: PATCH: website: download: adjust opensuse versions Message-ID: <20141105115810.GF31945@suse.de> >From 0586097160c99cf27a8a0ffb986440a0232c526b Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 5 Nov 2014 12:57:03 +0100 Subject: [PATCH] website: download: adjusted openSUSE versions --- templates/de/download.template | 2 +- templates/en/download.template | 2 +- templates/fr/download.template | 2 +- templates/he/download.template | 2 +- templates/pl/download.template | 2 +- templates/pt/download.template | 2 +- templates/tr/download.template | 2 +- templates/uk/download.template | 2 +- templates/zh-cn/download.template | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/templates/de/download.template b/templates/de/download.template index fbf449e..bc7717e 100644 --- a/templates/de/download.template +++ b/templates/de/download.template @@ -94,7 +94,7 @@ erbeten hat, dass sie die Wine-Website hosten.

SUSE Linux SUSE - stellt binär und Quellcode .rpms und tägliche snapshot RPMs für alle openSUSE Versionen (derzeit 11.4 bis 13.1) sowie SUSE Linux Enterprise 11 bereit.
+ stellt binär und Quellcode .rpms und tägliche snapshot RPMs für alle openSUSE Versionen (derzeit 12.3 bis 13.2) sowie SUSE Linux Enterprise 11 bereit.
Marcus Meissner diff --git a/templates/en/download.template b/templates/en/download.template index 275fd05..ca13e58 100644 --- a/templates/en/download.template +++ b/templates/en/download.template @@ -93,7 +93,7 @@ requested in exchange for hosting the Wine web site.

SUSE Linux Download SUSE packages - - release binary and source .rpms and daily snapshot RPMs for all openSUSE versions (11.4 up to 13.1) and SUSE Linux Enterprise 11.
+ - release binary and source .rpms and daily snapshot RPMs for all openSUSE versions (12.3 up to 13.2) and SUSE Linux Enterprise 11.
Marcus Meissner diff --git a/templates/fr/download.template b/templates/fr/download.template index 893c88f..4f7384e 100644 --- a/templates/fr/download.template +++ b/templates/fr/download.template @@ -99,7 +99,7 @@ center;">Voyez la Paquets SUSE - .rpm binaires et sources et instantan?s quotidiens pour openSUSE - 11.4 - 13.1 ainsi que SUSE Linux Enterprise 11.
+ 12.3 - 13.2 ainsi que SUSE Linux Enterprise 11.
Marcus Meissner diff --git a/templates/he/download.template b/templates/he/download.template index 1573b95..d17ea6f 100644 --- a/templates/he/download.template +++ b/templates/he/download.template @@ -93,7 +93,7 @@ SUSE Linux ????? ?????? SUSE - - release binary and source .rpms and daily snapshot RPMs for openSUSE 11.4 - 13.1 and SUSE Linux Enterprise 11.
+ - release binary and source .rpms and daily snapshot RPMs for openSUSE 12.3 - 13.2 and SUSE Linux Enterprise 11.
Marcus Meissner diff --git a/templates/pl/download.template b/templates/pl/download.template index 929f1c3..f3a4d00 100644 --- a/templates/pl/download.template +++ b/templates/pl/download.template @@ -92,7 +92,7 @@ SUSE Linux Pobierz paczki dla SUSE - - binarne i ?r?d?owe paczki .rpm oraz dzienne zrzuty dla openSUSE 11.4 - 13.1 i SUSE Linux Enterprise 11.
+ - binarne i ?r?d?owe paczki .rpm oraz dzienne zrzuty dla openSUSE 12.3 - 13.2 i SUSE Linux Enterprise 11.
Marcus Meissner diff --git a/templates/pt/download.template b/templates/pt/download.template index ba1b076..32055f0 100644 --- a/templates/pt/download.template +++ b/templates/pt/download.template @@ -90,7 +90,7 @@ SUSE Linux Descarregar pacotes para SUSE - - .rpms bin?rios e do c?digo fonte e RPMs com snapshots di?rios para openSUSE 11.4 - 13.1 e SUSE Linux Enterprise 11.
+ - .rpms bin?rios e do c?digo fonte e RPMs com snapshots di?rios para openSUSE 12.3 - 13.2 e SUSE Linux Enterprise 11.
Marcus Meissner diff --git a/templates/tr/download.template b/templates/tr/download.template index 77b7efe..d689dff 100644 --- a/templates/tr/download.template +++ b/templates/tr/download.template @@ -89,7 +89,7 @@ SUSE Linux SUSE paketleri indirin - - s?r?m ikili ve kaynak .rpm dosyalar? ve g?nl?k RPM derlemeleri. openSUSE 11.4 - 13.1 ve SUSE Linux Enterprise 11 i?in.
+ - s?r?m ikili ve kaynak .rpm dosyalar? ve g?nl?k RPM derlemeleri. openSUSE 12.3 - 13.2 ve SUSE Linux Enterprise 11 i?in.
Marcus Meissner diff --git a/templates/uk/download.template b/templates/uk/download.template index 42350c1..fd2fae6 100644 --- a/templates/uk/download.template +++ b/templates/uk/download.template @@ -92,7 +92,7 @@ SUSE Linux ??????????? ??????? SUSE - - ??????? ?? ??????? .rpm ????? ?? ??????? RPM ?????? ??? ???? ?????? openSUSE (??? 11.4 ?? 13.1) ?? SUSE Linux Enterprise 11.
+ - ??????? ?? ??????? .rpm ????? ?? ??????? RPM ?????? ??? ???? ?????? openSUSE (??? 12.3 ?? 13.2) ?? SUSE Linux Enterprise 11.
Marcus Meissner diff --git a/templates/zh-cn/download.template b/templates/zh-cn/download.template index 41eaffb..1b70cd7 100644 --- a/templates/zh-cn/download.template +++ b/templates/zh-cn/download.template @@ -91,7 +91,7 @@ requested in exchange for hosting the Wine web site.

SUSE Linux ?? SUSE ??? - - ????? openSUSE ?11.4 ? 13.1?? SUSE Linux Enterprise 11 ????????? .rpms ????? RPMs?
+ - ????? openSUSE ?12.3 ? 13.2?? SUSE Linux Enterprise 11 ????????? .rpms ????? RPMs?
Marcus Meissner -- 2.1.2 From mstefani at redhat.de Wed Nov 5 07:13:23 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 5 Nov 2014 14:13:23 +0100 Subject: advapi32/tests: Avoid a crash on some linux hosts. Message-ID: <20141105131323.GA18181@redhat.com> --- While researching the w7u timeout for this tests stumbled upon some Linux hosts that crash. This should fix it and provide further troubleshooting info. dlls/advapi32/tests/service.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/advapi32/tests/service.c b/dlls/advapi32/tests/service.c index ad81a25..1d2c4a7 100644 --- a/dlls/advapi32/tests/service.c +++ b/dlls/advapi32/tests/service.c @@ -1399,7 +1399,8 @@ static void test_enum_svc(void) /* lpServiceName and lpDisplayName should always be filled */ ok(services[i].lpServiceName[0], "Expected a service name\n"); - ok(services[i].lpDisplayName[0], "Expected a display name\n"); + ok(services[i].lpDisplayName && services[i].lpDisplayName[0], + "Expected a display name for service '%s'\n", services[i].lpServiceName); /* Decrement the counters to see if the functions calls return the same * numbers as the contents of these structures. -- 1.8.3.1 From piotr at codeweavers.com Wed Nov 5 08:23:15 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Wed, 05 Nov 2014 15:23:15 +0100 Subject: user32: Move IME Window Procedure to user32 Message-ID: <545A32D3.90708@codeweavers.com> --- dlls/imm32/imm.c | 104 +++++----------------------------------- dlls/user32/class.c | 1 + dlls/user32/controls.h | 4 ++ dlls/user32/misc.c | 120 ++++++++++++++++++++++++++++++++++++++++++++-- dlls/user32/tests/class.c | 11 ++--- dlls/user32/user_main.c | 5 ++ dlls/user32/winproc.c | 1 + 7 files changed, 144 insertions(+), 102 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-Move-IME-Window-Procedure-to-user32.txt Type: text/x-patch Size: 15022 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 5 11:25:28 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 05 Nov 2014 18:25:28 +0100 Subject: [1/2] d3dx9_36: Implement D3DXCreatePolygon. (resend) Message-ID: <545A5D88.2020803@fds-team.de> Based on a patch by David Adam. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ include/d3dx9shape.h | 2 ++ 3 files changed, 91 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-Implement-D3DXCreatePolygon.patch Type: text/x-patch Size: 4953 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 5 11:25:38 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 05 Nov 2014 18:25:38 +0100 Subject: [2/2] d3dx9_36/tests: Add tests for D3DXCreatePolygon. (try 4) Message-ID: <545A5D92.4050802@fds-team.de> Changes in try 4: * Use smaller buffer * Fix typo * Remove error checking & goto Changes in try 3: * Replace ~0 -> ~0U. Changes in try 2: * Lot of style cleanups - hopefully I didn't miss anything. * Fix condition for 'sides' argument (should be >= 3, not just != 0) * Added test to check if *mesh is cleared on error - tests show that this is not the case. I only kept a single test for that to avoid making the test code too ugly. Based on a patch by David Adam. --- dlls/d3dx9_36/tests/mesh.c | 155 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch Type: text/x-patch Size: 5927 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 5 11:47:34 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 05 Nov 2014 18:47:34 +0100 Subject: [1/2] d3dx9_36: Implement D3DXCreatePolygon. (try 5) Message-ID: <545A62B6.5010701@fds-team.de> Argh, head->wall - accidentially made the changes to v2 instead of v3. ;) Again replace ~0 -> ~0U. Based on a patch by David Adam. --- dlls/d3dx9_36/d3dx9_36.spec | 2 +- dlls/d3dx9_36/mesh.c | 88 +++++++++++++++++++++++++++++++++++++++++++++ include/d3dx9shape.h | 2 ++ 3 files changed, 91 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-Implement-D3DXCreatePolygon.patch Type: text/x-patch Size: 4954 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 5 11:47:37 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 05 Nov 2014 18:47:37 +0100 Subject: [2/2] d3dx9_36/tests: Add tests for D3DXCreatePolygon. (try 5) Message-ID: <545A62B9.8070005@fds-team.de> Based on a patch by David Adam. --- dlls/d3dx9_36/tests/mesh.c | 155 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-d3dx9_36-tests-Add-tests-for-D3DXCreatePolygon.patch Type: text/x-patch Size: 5928 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 5 11:54:02 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 05 Nov 2014 18:54:02 +0100 Subject: d3dx9_36/tests: Remove code to skip test which should never fail. Message-ID: <545A643A.1090203@fds-team.de> --- dlls/d3dx9_36/tests/mesh.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-tests-Remove-code-to-skip-test-which-should.patch Type: text/x-patch Size: 1250 bytes Desc: not available URL: From matellanesivan at gmail.com Wed Nov 5 15:55:44 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Wed, 05 Nov 2014 22:55:44 +0100 Subject: [1/4] msvcrt: Added _getc_nolock implementation Message-ID: <545A9CE0.7010904@gmail.com> The following patches implement the getc/putc_nolock functions associating them with their counterpart fgetc/fputc_nolock functions. --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr80/msvcr80.spec | 1 + dlls/msvcr90/msvcr90.spec | 2 +- include/msvcrt/stdio.h | 1 + 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 45a04cf..931d826 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -888,7 +888,7 @@ @ cdecl _get_tzname(ptr str long long) MSVCRT__get_tzname @ cdecl _get_unexpected() MSVCRT__get_unexpected @ cdecl _get_wpgmptr(ptr) -@ stub _getc_nolock +@ cdecl _getc_nolock(ptr) MSVCRT__fgetc_nolock @ cdecl _getch() @ stub _getch_nolock @ cdecl _getche() diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 5fc4ee5..3939ccf 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1236,7 +1236,7 @@ @ cdecl _get_tzname(ptr str long long) MSVCRT__get_tzname @ cdecl _get_unexpected() MSVCRT__get_unexpected @ cdecl _get_wpgmptr(ptr) -@ stub _getc_nolock +@ cdecl _getc_nolock(ptr) MSVCRT__fgetc_nolock @ cdecl _getch() @ stub _getch_nolock @ cdecl _getche() diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index c3edd61..2ee3800 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1234,7 +1234,7 @@ @ cdecl _get_tzname(ptr str long long) MSVCRT__get_tzname @ cdecl _get_unexpected() MSVCRT__get_unexpected @ cdecl _get_wpgmptr(ptr) -@ stub _getc_nolock +@ cdecl _getc_nolock(ptr) MSVCRT__fgetc_nolock @ cdecl _getch() @ stub _getch_nolock @ cdecl _getche() diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 9877784..36421f3 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -562,6 +562,7 @@ @ stub _get_winminor @ stub _get_winver @ cdecl _get_wpgmptr(ptr) +@ cdecl _getc_nolock(ptr) MSVCRT__fgetc_nolock @ cdecl _getch() @ stub _getch_nolock @ cdecl _getche() diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 4df9203..e9790be 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -539,7 +539,7 @@ @ cdecl _get_tzname(ptr str long long) MSVCRT__get_tzname @ cdecl _get_unexpected() MSVCRT__get_unexpected @ cdecl _get_wpgmptr(ptr) -@ stub _getc_nolock +@ cdecl _getc_nolock(ptr) MSVCRT__fgetc_nolock @ cdecl _getch() @ stub _getch_nolock @ cdecl _getche() diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 7512efc..9a2f338 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -137,6 +137,7 @@ int __cdecl _fseek_nolock(FILE*,__msvcrt_long,int); int __cdecl _fseeki64_nolock(FILE*,__int64,int); __msvcrt_long __cdecl _ftell_nolock(FILE*); __int64 __cdecl _ftelli64_nolock(FILE*); +int __cdecl _getc_nolock(FILE*); int __cdecl _ungetc_nolock(int,FILE*); void __cdecl clearerr(FILE*); -- 1.9.1 From matellanesivan at gmail.com Wed Nov 5 15:55:50 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Wed, 05 Nov 2014 22:55:50 +0100 Subject: [2/4] msvcrt: Added _getwc_nolock implementation Message-ID: <545A9CE6.4090608@gmail.com> --- dlls/msvcr100/msvcr100.spec | 1 + dlls/msvcr110/msvcr110.spec | 1 + dlls/msvcr120/msvcr120.spec | 1 + dlls/msvcr80/msvcr80.spec | 1 + dlls/msvcr90/msvcr90.spec | 1 + include/msvcrt/stdio.h | 1 + 6 files changed, 6 insertions(+) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 931d826..0fbe506 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -906,6 +906,7 @@ @ cdecl _getptd() @ stub _getsystime(ptr) @ cdecl _getw(ptr) MSVCRT__getw +@ cdecl _getwc_nolock(ptr) MSVCRT__fgetwc_nolock @ stub _getwch @ stub _getwch_nolock @ stub _getwche diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 3939ccf..368ca37 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1253,6 +1253,7 @@ @ cdecl _getptd() @ stub _getsystime(ptr) @ cdecl _getw(ptr) MSVCRT__getw +@ cdecl _getwc_nolock(ptr) MSVCRT__fgetwc_nolock @ stub _getwch @ stub _getwch_nolock @ stub _getwche diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 2ee3800..2b647b8 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1251,6 +1251,7 @@ @ cdecl _getptd() @ stub _getsystime(ptr) @ cdecl _getw(ptr) MSVCRT__getw +@ cdecl _getwc_nolock(ptr) MSVCRT__fgetwc_nolock @ stub _getwch @ stub _getwch_nolock @ stub _getwche diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 36421f3..0137ac4 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -580,6 +580,7 @@ @ cdecl _getptd() @ stub _getsystime(ptr) @ cdecl _getw(ptr) MSVCRT__getw +@ cdecl _getwc_nolock(ptr) MSVCRT__fgetwc_nolock @ stub _getwch @ stub _getwch_nolock @ stub _getwche diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index e9790be..c028cba 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -557,6 +557,7 @@ @ cdecl _getptd() @ stub _getsystime(ptr) @ cdecl _getw(ptr) MSVCRT__getw +@ cdecl _getwc_nolock(ptr) MSVCRT__fgetwc_nolock @ stub _getwch @ stub _getwch_nolock @ stub _getwche diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 9a2f338..8b23def 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -203,6 +203,7 @@ wint_t __cdecl _fgetwc_nolock(FILE*); wint_t __cdecl _fgetwchar(void); wint_t __cdecl _fputwc_nolock(wint_t,FILE*); wint_t __cdecl _fputwchar(wint_t); +wint_t __cdecl _getwc_nolock(FILE*); wchar_t* __cdecl _getws(wchar_t*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); -- 1.9.1 From matellanesivan at gmail.com Wed Nov 5 15:55:57 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Wed, 05 Nov 2014 22:55:57 +0100 Subject: [3/4] msvcrt: Added _putc_nolock implementation Message-ID: <545A9CED.4080802@gmail.com> --- dlls/msvcr100/msvcr100.spec | 1 + dlls/msvcr110/msvcr110.spec | 1 + dlls/msvcr120/msvcr120.spec | 1 + dlls/msvcr80/msvcr80.spec | 1 + dlls/msvcr90/msvcr90.spec | 1 + include/msvcrt/stdio.h | 1 + 6 files changed, 6 insertions(+) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 0fbe506..0e1ec19 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1232,6 +1232,7 @@ @ stub _printf_p_l @ stub _printf_s_l @ cdecl _purecall() +@ cdecl _putc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _putch(long) @ stub _putch_nolock @ cdecl _putenv(str) diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 368ca37..609e7ba 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1590,6 +1590,7 @@ @ stub _printf_p_l @ stub _printf_s_l @ cdecl _purecall() +@ cdecl _putc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _putch(long) @ stub _putch_nolock @ cdecl _putenv(str) diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 2b647b8..1afacf5 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1598,6 +1598,7 @@ @ stub _printf_p_l @ stub _printf_s_l @ cdecl _purecall() +@ cdecl _putc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _putch(long) @ stub _putch_nolock @ cdecl _putenv(str) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 0137ac4..960a23c 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -907,6 +907,7 @@ @ stub _printf_p_l @ stub _printf_s_l @ cdecl _purecall() +@ cdecl _putc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _putch(long) @ stub _putch_nolock @ cdecl _putenv(str) diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index c028cba..8b74dea 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -882,6 +882,7 @@ @ stub _printf_p_l @ stub _printf_s_l @ cdecl _purecall() +@ cdecl _putc_nolock(long ptr) MSVCRT__fputc_nolock @ cdecl _putch(long) @ stub _putch_nolock @ cdecl _putenv(str) diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 8b23def..d7316b5 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -138,6 +138,7 @@ int __cdecl _fseeki64_nolock(FILE*,__int64,int); __msvcrt_long __cdecl _ftell_nolock(FILE*); __int64 __cdecl _ftelli64_nolock(FILE*); int __cdecl _getc_nolock(FILE*); +int __cdecl _putc_nolock(int,FILE*); int __cdecl _ungetc_nolock(int,FILE*); void __cdecl clearerr(FILE*); -- 1.9.1 From matellanesivan at gmail.com Wed Nov 5 15:56:11 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Wed, 05 Nov 2014 22:56:11 +0100 Subject: [4/4] msvcrt: Added _putwc_nolock implementation Message-ID: <545A9CFB.6020500@gmail.com> --- dlls/msvcr100/msvcr100.spec | 1 + dlls/msvcr110/msvcr110.spec | 1 + dlls/msvcr120/msvcr120.spec | 1 + dlls/msvcr80/msvcr80.spec | 1 + dlls/msvcr90/msvcr90.spec | 1 + include/msvcrt/stdio.h | 1 + 6 files changed, 6 insertions(+) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 0e1ec19..cb45506 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1238,6 +1238,7 @@ @ cdecl _putenv(str) @ cdecl _putenv_s(str str) @ cdecl _putw(long ptr) MSVCRT__putw +@ cdecl _putwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _putwch(long) MSVCRT__putwch @ stub _putwch_nolock @ cdecl _putws(wstr) MSVCRT__putws diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index 609e7ba..d41699d 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1596,6 +1596,7 @@ @ cdecl _putenv(str) @ cdecl _putenv_s(str str) @ cdecl _putw(long ptr) MSVCRT__putw +@ cdecl _putwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _putwch(long) MSVCRT__putwch @ stub _putwch_nolock @ cdecl _putws(wstr) MSVCRT__putws diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index 1afacf5..fbf688e 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1604,6 +1604,7 @@ @ cdecl _putenv(str) @ cdecl _putenv_s(str str) @ cdecl _putw(long ptr) MSVCRT__putw +@ cdecl _putwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _putwch(long) MSVCRT__putwch @ stub _putwch_nolock @ cdecl _putws(wstr) MSVCRT__putws diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 960a23c..efb4539 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -913,6 +913,7 @@ @ cdecl _putenv(str) @ cdecl _putenv_s(str str) @ cdecl _putw(long ptr) MSVCRT__putw +@ cdecl _putwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _putwch(long) MSVCRT__putwch @ stub _putwch_nolock @ cdecl _putws(wstr) MSVCRT__putws diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 8b74dea..fa62366 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -888,6 +888,7 @@ @ cdecl _putenv(str) @ cdecl _putenv_s(str str) @ cdecl _putw(long ptr) MSVCRT__putw +@ cdecl _putwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _putwch(long) MSVCRT__putwch @ stub _putwch_nolock @ cdecl _putws(wstr) MSVCRT__putws diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index d7316b5..eda89e6 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -206,6 +206,7 @@ wint_t __cdecl _fputwc_nolock(wint_t,FILE*); wint_t __cdecl _fputwchar(wint_t); wint_t __cdecl _getwc_nolock(FILE*); wchar_t* __cdecl _getws(wchar_t*); +wint_t __cdecl _putwc_nolock(wint_t,FILE*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); int __cdecl _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...); -- 1.9.1 From dimesio at earthlink.net Wed Nov 5 20:41:20 2014 From: dimesio at earthlink.net (Rosanne DiMesio) Date: Wed, 5 Nov 2014 20:41:20 -0600 Subject: [website] Add a disclaimer to the Downloads page Message-ID: <20141105204120.0b968b6c6bc18a99e2254398@earthlink.net> Needed to make it clear to users that packages listed are not "official" and may contain unsupported patches. --- templates/en/download.template | 2 ++ 1 file changed, 2 insertions(+) -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Website-Add-a-disclaimer-to-the-Downloads-page.txt URL: From nsivov at codeweavers.com Wed Nov 5 23:54:08 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 06 Nov 2014 08:54:08 +0300 Subject: [PATCH] user32/tests: Use win_skip() where appropriate Message-ID: <545B0D00.5060201@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-tests-Use-win_skip-where-appropriate.patch Type: text/x-patch Size: 1929 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 5 23:58:44 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 06 Nov 2014 08:58:44 +0300 Subject: [PATCH 1/5] dwrite: Don't cache fontface instance in font data Message-ID: <545B0E14.9090902@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Don-t-cache-fontface-instance-in-font-data.patch Type: text/x-patch Size: 5459 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 5 23:58:58 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 06 Nov 2014 08:58:58 +0300 Subject: [PATCH 2/5] dwrite: File and factory are always set now for all collections Message-ID: <545B0E22.7010606@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-File-and-factory-are-always-set-now-for-all-c.patch Type: text/x-patch Size: 1002 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 5 23:59:15 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 06 Nov 2014 08:59:15 +0300 Subject: [PATCH 3/5] dwrite: Added a separate helper to fill font metrics structure Message-ID: <545B0E33.4040500@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-Added-a-separate-helper-to-fill-font-metrics-.patch Type: text/x-patch Size: 6485 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 5 23:59:32 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 06 Nov 2014 08:59:32 +0300 Subject: [PATCH 4/5] dwrite: Use public APIs to get file streams from fontface Message-ID: <545B0E44.6000702@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-dwrite-Use-public-APIs-to-get-file-streams-from-font.patch Type: text/x-patch Size: 6414 bytes Desc: not available URL: From nsivov at codeweavers.com Thu Nov 6 00:00:02 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 06 Nov 2014 09:00:02 +0300 Subject: [PATCH 5/5] dwrite: Implement GetMetrics() for fontface Message-ID: <545B0E62.6070000@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-dwrite-Implement-GetMetrics-for-fontface.patch Type: text/x-patch Size: 4742 bytes Desc: not available URL: From christopherwuy at gmail.com Tue Nov 4 02:22:06 2014 From: christopherwuy at gmail.com (YongHao Hu) Date: Tue, 04 Nov 2014 16:22:06 +0800 Subject: msvcp90: Add std_Ctraits::Isnan implementation. Message-ID: <54588CAE.6040805@gmail.com> --- dlls/msvcp90/math.c | 9 +++++++++ dlls/msvcp90/msvcp90.spec | 6 +++--- dlls/msvcp90/tests/misc.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0058-msvcp90-Add-std_Ctraits-Isnan-implementation.txt Type: text/x-patch Size: 5563 bytes Desc: not available URL: From christopherwuy at gmail.com Wed Nov 5 22:07:59 2014 From: christopherwuy at gmail.com (YongHao Hu) Date: Thu, 06 Nov 2014 12:07:59 +0800 Subject: msvcp90: Add std_Ctraits::Isnan implementation. (resend) Message-ID: <545AF41F.3010208@gmail.com> --- dlls/msvcp90/math.c | 9 +++++++++ dlls/msvcp90/msvcp90.spec | 6 +++--- dlls/msvcp90/tests/misc.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0058-msvcp90-Add-std_Ctraits-Isnan-implementation.txt Type: text/x-patch Size: 5564 bytes Desc: not available URL: From alexhenrie24 at gmail.com Thu Nov 6 01:11:24 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Thu, 6 Nov 2014 00:11:24 -0700 Subject: [PATCH (try 2) 1/2] kernel32/tests: Add UTF-7 non-encoded surrounding characters tests. Message-ID: <1415257885-7337-1-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 73 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 8423c75..89bbd60 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -20,6 +20,7 @@ */ #include +#include #include #include "wine/test.h" @@ -412,6 +413,76 @@ static void test_string_conversion(LPBOOL bUsedDefaultChar) ok(GetLastError() == 0xdeadbeef, "GetLastError() is %u\n", GetLastError()); } +static void test_utf7_encoding(void) +{ + WCHAR input[16]; + char output[16], expected[16]; + int i, len, expected_len; + + static const BOOL directly_encodable_table[] = + { + 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, /* 0x00 - 0x0F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 - 0x1F */ + 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* 0x20 - 0x2F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 0x30 - 0x3F */ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 0x50 - 0x5F */ + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 /* 0x70 - 0x7F */ + }; + static const char base64_encoding_table[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + if (WideCharToMultiByte(CP_UTF7, 0, foobarW, -1, NULL, 0, NULL, NULL) == 0 && + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + skip("UTF-7 encoding not implemented\n"); + return; + } + + /* test which characters are encoded if surrounded by non-encoded characters */ + for (i = 0; i <= 0xFFFF; i++) + { + input[0] = ' '; + input[1] = i; + input[2] = ' '; + input[3] = 0; + + memset(output, '#', sizeof(output) - 1); + output[sizeof(output) - 1] = 0; + + len = WideCharToMultiByte(CP_UTF7, 0, input, 4, output, sizeof(output) - 1, NULL, NULL); + + if (i == '+') + { + /* '+' is a special case and is encoded as "+-" */ + expected_len = 5; + strcpy(expected, " +- "); + } + else if (i <= 0x7F && directly_encodable_table[i]) + { + /* encodes directly */ + expected_len = 4; + sprintf(expected, " %c ", i); + } + else + { + /* base64-encodes */ + expected_len = 8; + sprintf(expected, " +%c%c%c- ", + base64_encoding_table[(i & 0xFC00) >> 10], + base64_encoding_table[(i & 0x03F0) >> 4], + base64_encoding_table[(i & 0x000F) << 2]); + } + + ok(len == expected_len, "i=0x%04x: expected len=%i, got len=%i\n", i, expected_len, len); + ok(memcmp(output, expected, expected_len) == 0, + "i=0x%04x: expected output='%s', got output='%s'\n", i, expected, output); + ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", + i, expected_len, expected_len, output[expected_len]); + } +} + static void test_undefined_byte_char(void) { static const struct tag_testset { @@ -618,6 +689,8 @@ START_TEST(codepage) test_string_conversion(NULL); test_string_conversion(&bUsedDefaultChar); + test_utf7_encoding(); + test_undefined_byte_char(); test_threadcp(); } -- 2.1.3 From alexhenrie24 at gmail.com Thu Nov 6 01:11:25 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Thu, 6 Nov 2014 00:11:25 -0700 Subject: [PATCH (try 2) 2/2] kernel32/tests: Add UTF-7 encoded surrounding characters tests. In-Reply-To: <1415257885-7337-1-git-send-email-alexhenrie24@gmail.com> References: <1415257885-7337-1-git-send-email-alexhenrie24@gmail.com> Message-ID: <1415257885-7337-2-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 89bbd60..147989b 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -481,6 +481,50 @@ static void test_utf7_encoding(void) ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", i, expected_len, expected_len, output[expected_len]); } + + /* test which one-byte characters are absorbed into surrounding base64 blocks + * (Windows always ends the base64 block when it encounters a directly encodable character) */ + for (i = 0; i <= 0xFFFF; i++) + { + input[0] = 0x2672; + input[1] = i; + input[2] = 0x2672; + input[3] = 0; + + memset(output, '#', sizeof(output) - 1); + output[sizeof(output) - 1] = 0; + + len = WideCharToMultiByte(CP_UTF7, 0, input, 4, output, sizeof(output) - 1, NULL, NULL); + + if (i == '+') + { + /* '+' is a special case and is encoded as "+-" */ + expected_len = 13; + strcpy(expected, "+JnI-+-+JnI-"); + } + else if (i <= 0x7F && directly_encodable_table[i]) + { + /* encodes directly */ + expected_len = 12; + sprintf(expected, "+JnI-%c+JnI-", i); + } + else + { + /* base64-encodes */ + expected_len = 11; + sprintf(expected, "+Jn%c%c%c%cZy-", + base64_encoding_table[8 | ((i & 0xC000) >> 14)], + base64_encoding_table[(i & 0x3F00) >> 8], + base64_encoding_table[(i & 0x00FC) >> 2], + base64_encoding_table[((i & 0x0003) << 4) | 2]); + } + + ok(len == expected_len, "i=0x%04x: expected len=%i, got len=%i\n", i, expected_len, len); + ok(memcmp(output, expected, expected_len) == 0, + "i=0x%04x: expected output='%s', got output='%s'\n", i, expected, output); + ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", + i, expected_len, expected_len, output[expected_len]); + } } static void test_undefined_byte_char(void) -- 2.1.3 From hverbeet at codeweavers.com Thu Nov 6 01:20:13 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Thu, 6 Nov 2014 08:20:13 +0100 Subject: [PATCH 1/5] d3d10core/tests: Port alpha_test() to d3d10core. Message-ID: <1415258417-14414-1-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/tests/device.c | 247 +++++++++++++++++++++++++++++++++++++++++ dlls/d3d8/tests/visual.c | 4 +- dlls/d3d9/tests/visual.c | 4 +- dlls/ddraw/tests/visual.c | 4 +- 4 files changed, 253 insertions(+), 6 deletions(-) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 7387231..2d0bcc0 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -22,6 +22,11 @@ #include "wine/test.h" #include +struct vec3 +{ + float x, y, z; +}; + static ULONG get_refcount(IUnknown *iface) { IUnknown_AddRef(iface); @@ -2053,6 +2058,247 @@ float4 main(float4 color : COLOR) : SV_TARGET ok(!refcount, "Device has %u references left.\n", refcount); } +static void test_blend(void) +{ + ID3D10RenderTargetView *backbuffer_rtv, *offscreen_rtv; + ID3D10BlendState *src_blend, *dst_blend; + ID3D10Texture2D *backbuffer, *offscreen; + D3D10_SUBRESOURCE_DATA buffer_data; + D3D10_TEXTURE2D_DESC texture_desc; + ID3D10InputLayout *input_layout; + D3D10_BUFFER_DESC buffer_desc; + D3D10_BLEND_DESC blend_desc; + unsigned int stride, offset; + IDXGISwapChain *swapchain; + ID3D10VertexShader *vs; + ID3D10PixelShader *ps; + ID3D10Device *device; + D3D10_VIEWPORT vp; + ID3D10Buffer *vb; + ULONG refcount; + DWORD color; + HWND window; + HRESULT hr; + + static const DWORD vs_code[] = + { +#if 0 + struct vs_out + { + float4 position : SV_POSITION; + float4 color : COLOR; + }; + + struct vs_out main(float4 position : POSITION, float4 color : COLOR) + { + struct vs_out o; + + o.position = position; + o.color = color; + + return o; + } +#endif + 0x43425844, 0x5c73b061, 0x5c71125f, 0x3f8b345f, 0xce04b9ab, 0x00000001, 0x00000140, 0x00000003, + 0x0000002c, 0x0000007c, 0x000000d0, 0x4e475349, 0x00000048, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000004c, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, + 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x505f5653, + 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, 0x52444853, 0x00000068, 0x00010040, 0x0000001a, + 0x0300005f, 0x001010f2, 0x00000000, 0x0300005f, 0x001010f2, 0x00000001, 0x04000067, 0x001020f2, + 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, + 0x00101e46, 0x00000000, 0x05000036, 0x001020f2, 0x00000001, 0x00101e46, 0x00000001, 0x0100003e, + }; + static const DWORD ps_code[] = + { +#if 0 + struct vs_out + { + float4 position : SV_POSITION; + float4 color : COLOR; + }; + + float4 main(struct vs_out i) : SV_TARGET + { + return i.color; + } +#endif + 0x43425844, 0xe2087fa6, 0xa35fbd95, 0x8e585b3f, 0x67890f54, 0x00000001, 0x000000f4, 0x00000003, + 0x0000002c, 0x00000080, 0x000000b4, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x05000036, + 0x001020f2, 0x00000000, 0x00101e46, 0x00000001, 0x0100003e, + }; + static const struct + { + struct vec3 position; + DWORD diffuse; + } + quads[] = + { + /* quad1 */ + {{-1.0f, -1.0f, 0.1f}, 0x4000ff00}, + {{-1.0f, 0.0f, 0.1f}, 0x4000ff00}, + {{ 1.0f, -1.0f, 0.1f}, 0x4000ff00}, + {{ 1.0f, 0.0f, 0.1f}, 0x4000ff00}, + /* quad2 */ + {{-1.0f, 0.0f, 0.1f}, 0xc00000ff}, + {{-1.0f, 1.0f, 0.1f}, 0xc00000ff}, + {{ 1.0f, 0.0f, 0.1f}, 0xc00000ff}, + {{ 1.0f, 1.0f, 0.1f}, 0xc00000ff}, + }; + static const D3D10_INPUT_ELEMENT_DESC layout_desc[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_B8G8R8A8_UNORM, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0}, + }; + static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float red[] = {1.0f, 0.0f, 0.0f, 0.5f}; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + window = CreateWindowA("static", "d3d10core_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + swapchain = create_swapchain(device, window, TRUE); + hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D10Texture2D, (void **)&backbuffer); + ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr); + + hr = ID3D10Device_CreateInputLayout(device, layout_desc, sizeof(layout_desc) / sizeof(*layout_desc), + vs_code, sizeof(vs_code), &input_layout); + ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); + + buffer_desc.ByteWidth = sizeof(quads); + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = 0; + + buffer_data.pSysMem = quads; + buffer_data.SysMemPitch = 0; + buffer_data.SysMemSlicePitch = 0; + + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &buffer_data, &vb); + ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#x.\n", hr); + hr = ID3D10Device_CreateVertexShader(device, vs_code, sizeof(vs_code), &vs); + ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); + hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)backbuffer, NULL, &backbuffer_rtv); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + + texture_desc.Width = 128; + texture_desc.Height = 128; + texture_desc.MipLevels = 1; + texture_desc.ArraySize = 1; + texture_desc.Format = DXGI_FORMAT_B8G8R8X8_UNORM; + texture_desc.SampleDesc.Count = 1; + texture_desc.SampleDesc.Quality = 0; + texture_desc.Usage = D3D10_USAGE_DEFAULT; + texture_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET; + texture_desc.CPUAccessFlags = 0; + texture_desc.MiscFlags = 0; + + hr = ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &offscreen); + ok(SUCCEEDED(hr), "Failed to create texture, hr %#x.\n", hr); + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)offscreen, NULL, &offscreen_rtv); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + + memset(&blend_desc, 0, sizeof(blend_desc)); + blend_desc.BlendEnable[0] = TRUE; + blend_desc.SrcBlend = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOp = D3D10_BLEND_OP_ADD; + blend_desc.SrcBlendAlpha = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + blend_desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; + + hr = ID3D10Device_CreateBlendState(device, &blend_desc, &src_blend); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + + blend_desc.SrcBlend = D3D10_BLEND_DEST_ALPHA; + blend_desc.DestBlend = D3D10_BLEND_INV_DEST_ALPHA; + blend_desc.SrcBlendAlpha = D3D10_BLEND_DEST_ALPHA; + blend_desc.DestBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA; + + hr = ID3D10Device_CreateBlendState(device, &blend_desc, &dst_blend); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + + ID3D10Device_OMSetRenderTargets(device, 1, &backbuffer_rtv, NULL); + ID3D10Device_IASetInputLayout(device, input_layout); + ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + stride = sizeof(*quads); + offset = 0; + ID3D10Device_IASetVertexBuffers(device, 0, 1, &vb, &stride, &offset); + ID3D10Device_VSSetShader(device, vs); + ID3D10Device_PSSetShader(device, ps); + + vp.TopLeftX = 0; + vp.TopLeftY = 0; + vp.Width = 640; + vp.Height = 480; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + ID3D10Device_RSSetViewports(device, 1, &vp); + + ID3D10Device_ClearRenderTargetView(device, backbuffer_rtv, red); + + ID3D10Device_OMSetBlendState(device, src_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 0); + ID3D10Device_OMSetBlendState(device, dst_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 4); + + color = get_texture_color(backbuffer, 320, 360); + ok(compare_color(color, 0x700040bf, 1), "Got unexpected color 0x%08x.\n", color); + color = get_texture_color(backbuffer, 320, 120); + ok(compare_color(color, 0xa080007f, 1), "Got unexpected color 0x%08x.\n", color); + + ID3D10Device_OMSetRenderTargets(device, 1, &offscreen_rtv, NULL); + + vp.TopLeftX = 0; + vp.TopLeftY = 0; + vp.Width = 128; + vp.Height = 128; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + ID3D10Device_RSSetViewports(device, 1, &vp); + + ID3D10Device_ClearRenderTargetView(device, offscreen_rtv, red); + + ID3D10Device_OMSetBlendState(device, src_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 0); + ID3D10Device_OMSetBlendState(device, dst_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 4); + + color = get_texture_color(offscreen, 64, 96) & 0x00ffffff; + ok(compare_color(color, 0x00bf4000, 1), "Got unexpected color 0x%08x.\n", color); + color = get_texture_color(offscreen, 64, 32) & 0x00ffffff; + ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); + + ID3D10BlendState_Release(dst_blend); + ID3D10BlendState_Release(src_blend); + ID3D10PixelShader_Release(ps); + ID3D10VertexShader_Release(vs); + ID3D10Buffer_Release(vb); + ID3D10InputLayout_Release(input_layout); + ID3D10RenderTargetView_Release(offscreen_rtv); + ID3D10Texture2D_Release(offscreen); + ID3D10RenderTargetView_Release(backbuffer_rtv); + ID3D10Texture2D_Release(backbuffer); + IDXGISwapChain_Release(swapchain); + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(device) { test_create_texture2d(); @@ -2069,4 +2315,5 @@ START_TEST(device) test_device_removed_reason(); test_scissor(); test_clear_state(); + test_blend(); } diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 9895a73..1b9c107 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -2104,7 +2104,7 @@ done: DestroyWindow(window); } -static void alpha_test(void) +static void test_blend(void) { IDirect3DSurface8 *backbuffer, *offscreen, *depthstencil; IDirect3DTexture8 *offscreenTexture; @@ -5249,7 +5249,7 @@ START_TEST(visual) fog_test(); z_range_test(); offscreen_test(); - alpha_test(); + test_blend(); test_scalar_instructions(); fog_with_shader_test(); cnd_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index d1d7447..77291e9 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -7776,7 +7776,7 @@ done: DestroyWindow(window); } -static void alpha_test(void) +static void test_blend(void) { IDirect3DSurface9 *backbuffer, *offscreen; IDirect3DTexture9 *offscreenTexture; @@ -16859,7 +16859,7 @@ START_TEST(visual) maxmip_test(); offscreen_test(); ds_size_test(); - alpha_test(); + test_blend(); shademode_test(); srgbtexture_test(); release_buffer_test(); diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c index 0385044..94d6984 100644 --- a/dlls/ddraw/tests/visual.c +++ b/dlls/ddraw/tests/visual.c @@ -929,7 +929,7 @@ out: } } -static void alpha_test(IDirect3DDevice7 *device) +static void test_blend(IDirect3DDevice7 *device) { HRESULT hr; IDirectDrawSurface7 *backbuffer = NULL, *offscreen = NULL; @@ -3277,7 +3277,7 @@ START_TEST(visual) clear_test(Direct3DDevice); fog_test(Direct3DDevice); offscreen_test(Direct3DDevice); - alpha_test(Direct3DDevice); + test_blend(Direct3DDevice); rhw_zero_test(Direct3DDevice); cubemap_test(Direct3DDevice); -- 1.7.10.4 From hverbeet at codeweavers.com Thu Nov 6 01:20:15 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Thu, 6 Nov 2014 08:20:15 +0100 Subject: [PATCH 3/5] d2d1: Implement d2d_solid_color_brush_SetColor(). Message-ID: <1415258417-14414-3-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index b2a1664..04b273a 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -243,7 +243,11 @@ static void STDMETHODCALLTYPE d2d_solid_color_brush_GetTransform(ID2D1SolidColor static void STDMETHODCALLTYPE d2d_solid_color_brush_SetColor(ID2D1SolidColorBrush *iface, const D2D1_COLOR_F *color) { - FIXME("iface %p, color %p stub!\n", iface, color); + struct d2d_brush *brush = impl_from_ID2D1SolidColorBrush(iface); + + TRACE("iface %p, color %p.\n", iface, color); + + brush->u.solid.color = *color; } static D2D1_COLOR_F * STDMETHODCALLTYPE d2d_solid_color_brush_GetColor(ID2D1SolidColorBrush *iface, D2D1_COLOR_F *color) -- 1.7.10.4 From hverbeet at codeweavers.com Thu Nov 6 01:20:14 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Thu, 6 Nov 2014 08:20:14 +0100 Subject: [PATCH 2/5] d2d1: Add an initial d2d_d3d_render_target_FillRectangle() implementation. Message-ID: <1415258417-14414-2-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 19 ++- dlls/d2d1/d2d1_private.h | 30 +++- dlls/d2d1/render_target.c | 348 +++++++++++++++++++++++++++++---------------- 3 files changed, 269 insertions(+), 128 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 99b111f..b2a1664 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -145,10 +145,11 @@ HRESULT d2d_gradient_init(struct d2d_gradient *gradient, ID2D1RenderTarget *rend } static void d2d_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target, - const D2D1_BRUSH_PROPERTIES *desc, const struct ID2D1BrushVtbl *vtbl) + enum d2d_brush_type type, const D2D1_BRUSH_PROPERTIES *desc, const struct ID2D1BrushVtbl *vtbl) { brush->ID2D1Brush_iface.lpVtbl = vtbl; brush->refcount = 1; + brush->type = type; } static inline struct d2d_brush *impl_from_ID2D1SolidColorBrush(ID2D1SolidColorBrush *iface) @@ -274,7 +275,9 @@ void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *rend { FIXME("Ignoring brush properties.\n"); - d2d_brush_init(brush, render_target, desc, (ID2D1BrushVtbl *)&d2d_solid_color_brush_vtbl); + d2d_brush_init(brush, render_target, D2D_BRUSH_TYPE_SOLID, desc, + (ID2D1BrushVtbl *)&d2d_solid_color_brush_vtbl); + brush->u.solid.color = *color; } static inline struct d2d_brush *impl_from_ID2D1LinearGradientBrush(ID2D1LinearGradientBrush *iface) @@ -430,5 +433,15 @@ void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1RenderTarget * { FIXME("Ignoring brush properties.\n"); - d2d_brush_init(brush, render_target, brush_desc, (ID2D1BrushVtbl *)&d2d_linear_gradient_brush_vtbl); + d2d_brush_init(brush, render_target, D2D_BRUSH_TYPE_LINEAR, brush_desc, + (ID2D1BrushVtbl *)&d2d_linear_gradient_brush_vtbl); +} + +struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) +{ + if (!iface) + return NULL; + assert(iface->lpVtbl == (const ID2D1BrushVtbl *)&d2d_solid_color_brush_vtbl + || iface->lpVtbl == (const ID2D1BrushVtbl *)&d2d_linear_gradient_brush_vtbl); + return CONTAINING_RECORD(iface, struct d2d_brush, ID2D1Brush_iface); } diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 294c765..0a99633 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -21,6 +21,7 @@ #include "wine/debug.h" +#include #include #define COBJMACROS #include "d2d1.h" @@ -29,6 +30,12 @@ #endif #include "dwrite.h" +enum d2d_brush_type +{ + D2D_BRUSH_TYPE_SOLID, + D2D_BRUSH_TYPE_LINEAR, +}; + struct d2d_clip_stack { D2D1_RECT_F *stack; @@ -45,13 +52,14 @@ struct d2d_d3d_render_target ID3D10Device *device; ID3D10RenderTargetView *view; ID3D10StateBlock *stateblock; + ID3D10InputLayout *il; + unsigned int vb_stride; + ID3D10Buffer *vb; + ID3D10VertexShader *vs; + ID3D10RasterizerState *rs; + ID3D10BlendState *bs; - ID3D10InputLayout *clear_il; - unsigned int clear_vb_stride; - ID3D10Buffer *clear_vb; - ID3D10VertexShader *clear_vs; - ID3D10PixelShader *clear_ps; - ID3D10RasterizerState *clear_rs; + ID3D10PixelShader *rect_solid_ps; D2D1_SIZE_U pixel_size; D2D1_MATRIX_3X2_F transform; @@ -98,6 +106,15 @@ struct d2d_brush { ID2D1Brush ID2D1Brush_iface; LONG refcount; + + enum d2d_brush_type type; + union + { + struct + { + D2D1_COLOR_F color; + } solid; + } u; }; void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target, @@ -105,6 +122,7 @@ void d2d_solid_color_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *rend void d2d_linear_gradient_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_target, const D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES *gradient_brush_desc, const D2D1_BRUSH_PROPERTIES *brush_desc, ID2D1GradientStopCollection *gradient) DECLSPEC_HIDDEN; +struct d2d_brush *unsafe_impl_from_ID2D1Brush(ID2D1Brush *iface) DECLSPEC_HIDDEN; struct d2d_stroke_style { diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 035df2b..1dd5122 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -121,6 +121,63 @@ static void d2d_clip_stack_pop(struct d2d_clip_stack *stack) --stack->count; } +static void d2d_draw(struct d2d_d3d_render_target *render_target, ID3D10Buffer *vs_cb, + ID3D10PixelShader *ps, ID3D10Buffer *ps_cb, BOOL blend) +{ + ID3D10Device *device = render_target->device; + unsigned int offset; + D3D10_VIEWPORT vp; + HRESULT hr; + static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f}; + + vp.TopLeftX = 0; + vp.TopLeftY = 0; + vp.Width = render_target->pixel_size.width; + vp.Height = render_target->pixel_size.height; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + + if (FAILED(hr = render_target->stateblock->lpVtbl->Capture(render_target->stateblock))) + { + WARN("Failed to capture stateblock, hr %#x.\n", hr); + return; + } + + ID3D10Device_ClearState(device); + + ID3D10Device_IASetInputLayout(device, render_target->il); + ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + offset = 0; + ID3D10Device_IASetVertexBuffers(device, 0, 1, &render_target->vb, + &render_target->vb_stride, &offset); + ID3D10Device_VSSetConstantBuffers(device, 0, 1, &vs_cb); + ID3D10Device_VSSetShader(device, render_target->vs); + ID3D10Device_PSSetConstantBuffers(device, 0, 1, &ps_cb); + ID3D10Device_PSSetShader(device, ps); + ID3D10Device_RSSetViewports(device, 1, &vp); + if (render_target->clip_stack.count) + { + const D2D1_RECT_F *clip_rect; + D3D10_RECT scissor_rect; + + clip_rect = &render_target->clip_stack.stack[render_target->clip_stack.count - 1]; + scissor_rect.left = clip_rect->left + 0.5f; + scissor_rect.top = clip_rect->top + 0.5f; + scissor_rect.right = clip_rect->right + 0.5f; + scissor_rect.bottom = clip_rect->bottom + 0.5f; + ID3D10Device_RSSetScissorRects(device, 1, &scissor_rect); + ID3D10Device_RSSetState(device, render_target->rs); + } + ID3D10Device_OMSetRenderTargets(device, 1, &render_target->view, NULL); + if (blend) + ID3D10Device_OMSetBlendState(device, render_target->bs, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + + ID3D10Device_Draw(device, 4, 0); + + if (FAILED(hr = render_target->stateblock->lpVtbl->Apply(render_target->stateblock))) + WARN("Failed to apply stateblock, hr %#x.\n", hr); +} + static inline struct d2d_d3d_render_target *impl_from_ID2D1RenderTarget(ID2D1RenderTarget *iface) { return CONTAINING_RECORD(iface, struct d2d_d3d_render_target, ID2D1RenderTarget_iface); @@ -165,13 +222,14 @@ static ULONG STDMETHODCALLTYPE d2d_d3d_render_target_Release(ID2D1RenderTarget * if (!refcount) { d2d_clip_stack_cleanup(&render_target->clip_stack); - ID3D10RenderTargetView_Release(render_target->view); - ID3D10RasterizerState_Release(render_target->clear_rs); - ID3D10PixelShader_Release(render_target->clear_ps); - ID3D10VertexShader_Release(render_target->clear_vs); - ID3D10Buffer_Release(render_target->clear_vb); - ID3D10InputLayout_Release(render_target->clear_il); + ID3D10PixelShader_Release(render_target->rect_solid_ps); + ID3D10BlendState_Release(render_target->bs); + ID3D10RasterizerState_Release(render_target->rs); + ID3D10VertexShader_Release(render_target->vs); + ID3D10Buffer_Release(render_target->vb); + ID3D10InputLayout_Release(render_target->il); render_target->stateblock->lpVtbl->Release(render_target->stateblock); + ID3D10RenderTargetView_Release(render_target->view); ID3D10Device_Release(render_target->device); HeapFree(GetProcessHeap(), 0, render_target); } @@ -438,7 +496,82 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawRectangle(ID2D1RenderTar static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTarget *iface, const D2D1_RECT_F *rect, ID2D1Brush *brush) { - FIXME("iface %p, rect %p, brush %p stub!\n", iface, rect, brush); + struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface); + struct d2d_brush *brush_impl = unsafe_impl_from_ID2D1Brush(brush); + D3D10_SUBRESOURCE_DATA buffer_data; + D3D10_BUFFER_DESC buffer_desc; + ID3D10Buffer *vs_cb, *ps_cb; + float tmp_x, tmp_y; + HRESULT hr; + struct + { + float _11, _21, _31, pad0; + float _12, _22, _32, pad1; + } transform; + + TRACE("iface %p, rect %p, brush %p.\n", iface, rect, brush); + + if (brush_impl->type != D2D_BRUSH_TYPE_SOLID) + { + FIXME("Unhandled brush type %#x.\n", brush_impl->type); + return; + } + + /* Translate from clip space to world (D2D rendertarget) space, taking the + * dpi and rendertarget transform into account. */ + tmp_x = (2.0f * render_target->dpi_x) / (96.0f * render_target->pixel_size.width); + tmp_y = -(2.0f * render_target->dpi_y) / (96.0f * render_target->pixel_size.height); + transform._11 = render_target->transform._11 * tmp_x; + transform._21 = render_target->transform._21 * tmp_x; + transform._31 = render_target->transform._31 * tmp_x - 1.0f; + transform.pad0 = 0.0f; + transform._12 = render_target->transform._12 * tmp_y; + transform._22 = render_target->transform._22 * tmp_y; + transform._32 = render_target->transform._32 * tmp_y + 1.0f; + transform.pad1 = 0.0f; + + /* Translate from world space to object space. */ + tmp_x = rect->left + (rect->right - rect->left) / 2.0f; + tmp_y = rect->top + (rect->bottom - rect->top) / 2.0f; + transform._31 += tmp_x * transform._11 + tmp_y * transform._21; + transform._32 += tmp_x * transform._12 + tmp_y * transform._22; + tmp_x = (rect->right - rect->left) / 2.0f; + tmp_y = (rect->bottom - rect->top) / 2.0f; + transform._11 *= tmp_x; + transform._12 *= tmp_x; + transform._21 *= tmp_y; + transform._22 *= tmp_y; + + buffer_desc.ByteWidth = sizeof(transform); + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = 0; + + buffer_data.pSysMem = &transform; + buffer_data.SysMemPitch = 0; + buffer_data.SysMemSlicePitch = 0; + + if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &vs_cb))) + { + WARN("Failed to create constant buffer, hr %#x.\n", hr); + return; + } + + buffer_desc.ByteWidth = sizeof(brush_impl->u.solid.color); + buffer_data.pSysMem = &brush_impl->u.solid.color; + + if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &ps_cb))) + { + WARN("Failed to create constant buffer, hr %#x.\n", hr); + ID3D10Buffer_Release(vs_cb); + return; + } + + d2d_draw(render_target, vs_cb, render_target->rect_solid_ps, ps_cb, TRUE); + + ID3D10Buffer_Release(ps_cb); + ID3D10Buffer_Release(vs_cb); } static void STDMETHODCALLTYPE d2d_d3d_render_target_DrawRoundedRectangle(ID2D1RenderTarget *iface, @@ -683,75 +816,47 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_Clear(ID2D1RenderTarget *ifa struct d2d_d3d_render_target *render_target = impl_from_ID2D1RenderTarget(iface); D3D10_SUBRESOURCE_DATA buffer_data; D3D10_BUFFER_DESC buffer_desc; - unsigned int offset; - D3D10_VIEWPORT vp; - ID3D10Buffer *cb; + ID3D10Buffer *vs_cb, *ps_cb; HRESULT hr; + static float transform[] = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, 0.0f, + }; + TRACE("iface %p, color %p.\n", iface, color); - buffer_desc.ByteWidth = sizeof(*color); + buffer_desc.ByteWidth = sizeof(transform); buffer_desc.Usage = D3D10_USAGE_DEFAULT; buffer_desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0; - buffer_data.pSysMem = color; + buffer_data.pSysMem = transform; buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0; - if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &cb))) + if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &vs_cb))) { WARN("Failed to create constant buffer, hr %#x.\n", hr); return; } - vp.TopLeftX = 0; - vp.TopLeftY = 0; - vp.Width = render_target->pixel_size.width; - vp.Height = render_target->pixel_size.height; - vp.MinDepth = 0.0f; - vp.MaxDepth = 1.0f; + buffer_desc.ByteWidth = sizeof(*color); + buffer_data.pSysMem = color; - if (FAILED(hr = render_target->stateblock->lpVtbl->Capture(render_target->stateblock))) + if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &ps_cb))) { - WARN("Failed to capture stateblock, hr %#x.\n", hr); - ID3D10Buffer_Release(cb); + WARN("Failed to create constant buffer, hr %#x.\n", hr); + ID3D10Buffer_Release(vs_cb); return; } - ID3D10Device_ClearState(render_target->device); - - ID3D10Device_IASetInputLayout(render_target->device, render_target->clear_il); - ID3D10Device_IASetPrimitiveTopology(render_target->device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); - offset = 0; - ID3D10Device_IASetVertexBuffers(render_target->device, 0, 1, - &render_target->clear_vb, &render_target->clear_vb_stride, &offset); - ID3D10Device_VSSetShader(render_target->device, render_target->clear_vs); - ID3D10Device_PSSetConstantBuffers(render_target->device, 0, 1, &cb); - ID3D10Device_PSSetShader(render_target->device, render_target->clear_ps); - ID3D10Device_RSSetViewports(render_target->device, 1, &vp); - if (render_target->clip_stack.count) - { - const D2D1_RECT_F *clip_rect; - D3D10_RECT scissor_rect; + d2d_draw(render_target, vs_cb, render_target->rect_solid_ps, ps_cb, FALSE); - clip_rect = &render_target->clip_stack.stack[render_target->clip_stack.count - 1]; - scissor_rect.left = clip_rect->left + 0.5f; - scissor_rect.top = clip_rect->top + 0.5f; - scissor_rect.right = clip_rect->right + 0.5f; - scissor_rect.bottom = clip_rect->bottom + 0.5f; - ID3D10Device_RSSetScissorRects(render_target->device, 1, &scissor_rect); - ID3D10Device_RSSetState(render_target->device, render_target->clear_rs); - } - ID3D10Device_OMSetRenderTargets(render_target->device, 1, &render_target->view, NULL); - - ID3D10Device_Draw(render_target->device, 4, 0); - - if (FAILED(hr = render_target->stateblock->lpVtbl->Apply(render_target->stateblock))) - WARN("Failed to apply stateblock, hr %#x.\n", hr); - - ID3D10Buffer_Release(cb); + ID3D10Buffer_Release(ps_cb); + ID3D10Buffer_Release(vs_cb); } static void STDMETHODCALLTYPE d2d_d3d_render_target_BeginDraw(ID2D1RenderTarget *iface) @@ -1032,35 +1137,34 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, DXGI_SURFACE_DESC surface_desc; D3D10_RASTERIZER_DESC rs_desc; D3D10_BUFFER_DESC buffer_desc; + D3D10_BLEND_DESC blend_desc; ID3D10Resource *resource; HRESULT hr; - static const D3D10_INPUT_ELEMENT_DESC clear_il_desc[] = + static const D3D10_INPUT_ELEMENT_DESC il_desc[] = { {"POSITION", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, }; - static const DWORD clear_vs_code[] = + static const DWORD vs_code[] = { - /* float4 main(float4 position : POSITION) : SV_POSITION + /* float3x2 transform; + * + * float4 main(float4 position : POSITION) : SV_POSITION * { - * return position; + * return float4(mul(position.xyw, transform), position.zw); * } */ - 0x43425844, 0x1fa8c27f, 0x52d2f21d, 0xc196fdb7, 0x376f283a, 0x00000001, 0x000001b4, 0x00000005, - 0x00000034, 0x0000008c, 0x000000c0, 0x000000f4, 0x00000138, 0x46454452, 0x00000050, 0x00000000, - 0x00000000, 0x00000000, 0x0000001c, 0xfffe0400, 0x00000100, 0x0000001c, 0x7263694d, 0x666f736f, - 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e30332e, - 0x30303239, 0x3336312e, 0xab003438, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x43425844, 0x0add3194, 0x205f74ec, 0xab527fe7, 0xbe6ad704, 0x00000001, 0x00000128, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0xababab00, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x0000003c, 0x00010040, - 0x0000000f, 0x0300005f, 0x001010f2, 0x00000000, 0x04000067, 0x001020f2, 0x00000000, 0x00000001, - 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, - 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x52444853, 0x0000008c, 0x00010040, + 0x00000023, 0x04000059, 0x00208e46, 0x00000000, 0x00000002, 0x0300005f, 0x001010f2, 0x00000000, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x08000010, 0x00102012, 0x00000000, 0x00101346, + 0x00000000, 0x00208246, 0x00000000, 0x00000000, 0x08000010, 0x00102022, 0x00000000, 0x00101346, + 0x00000000, 0x00208246, 0x00000000, 0x00000001, 0x05000036, 0x001020c2, 0x00000000, 0x00101ea6, + 0x00000000, 0x0100003e, }; - static const DWORD clear_ps_code[] = + static const DWORD rect_solid_ps_code[] = { /* float4 color; * @@ -1068,35 +1172,24 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, * { * return color; * } */ - 0x43425844, 0xecd3cc9d, 0x0025bc77, 0x7a333165, 0x5b04c7e4, 0x00000001, 0x0000022c, 0x00000005, - 0x00000034, 0x00000100, 0x00000134, 0x00000168, 0x000001b0, 0x46454452, 0x000000c4, 0x00000001, - 0x00000048, 0x00000001, 0x0000001c, 0xffff0400, 0x00000100, 0x00000090, 0x0000003c, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x6f6c4724, 0x736c6162, - 0xababab00, 0x0000003c, 0x00000001, 0x00000060, 0x00000010, 0x00000000, 0x00000000, 0x00000078, - 0x00000000, 0x00000010, 0x00000002, 0x00000080, 0x00000000, 0x6f6c6f63, 0xabab0072, 0x00030001, - 0x00040001, 0x00000000, 0x00000000, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, - 0x65646168, 0x6f432072, 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000001, 0x00000003, - 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4e47534f, 0x0000002c, 0x00000001, - 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x65677261, 0xabab0074, 0x52444853, 0x00000040, 0x00000040, 0x00000010, 0x04000059, 0x00208e46, - 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x06000036, 0x001020f2, 0x00000000, - 0x00208e46, 0x00000000, 0x00000000, 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, + 0x43425844, 0x88eefcfd, 0x93d6fd47, 0x173c242f, 0x0106d07a, 0x00000001, 0x000000dc, 0x00000003, + 0x0000002c, 0x00000060, 0x00000094, 0x4e475349, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x52444853, 0x00000040, 0x00000040, + 0x00000010, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, + 0x06000036, 0x001020f2, 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x0100003e, }; static const struct { float x, y; } - clear_quad[] = + quad[] = { - {-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 D2D1_MATRIX_3X2_F identity = { @@ -1143,46 +1236,39 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, goto err; } - if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->device, clear_il_desc, - sizeof(clear_il_desc) / sizeof(*clear_il_desc), clear_vs_code, sizeof(clear_vs_code), - &render_target->clear_il))) + if (FAILED(hr = ID3D10Device_CreateInputLayout(render_target->device, il_desc, + sizeof(il_desc) / sizeof(*il_desc), vs_code, sizeof(vs_code), + &render_target->il))) { WARN("Failed to create clear input layout, hr %#x.\n", hr); goto err; } - buffer_desc.ByteWidth = sizeof(clear_quad); + buffer_desc.ByteWidth = sizeof(quad); buffer_desc.Usage = D3D10_USAGE_DEFAULT; buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; buffer_desc.CPUAccessFlags = 0; buffer_desc.MiscFlags = 0; - buffer_data.pSysMem = clear_quad; + buffer_data.pSysMem = quad; buffer_data.SysMemPitch = 0; buffer_data.SysMemSlicePitch = 0; - render_target->clear_vb_stride = sizeof(*clear_quad); + render_target->vb_stride = sizeof(*quad); if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, - &buffer_desc, &buffer_data, &render_target->clear_vb))) + &buffer_desc, &buffer_data, &render_target->vb))) { WARN("Failed to create clear vertex buffer, hr %#x.\n", hr); goto err; } if (FAILED(hr = ID3D10Device_CreateVertexShader(render_target->device, - clear_vs_code, sizeof(clear_vs_code), &render_target->clear_vs))) + vs_code, sizeof(vs_code), &render_target->vs))) { WARN("Failed to create clear vertex shader, hr %#x.\n", hr); goto err; } - if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->device, - clear_ps_code, sizeof(clear_ps_code), &render_target->clear_ps))) - { - WARN("Failed to create clear pixel shader, hr %#x.\n", hr); - goto err; - } - rs_desc.FillMode = D3D10_FILL_SOLID; rs_desc.CullMode = D3D10_CULL_BACK; rs_desc.FrontCounterClockwise = FALSE; @@ -1193,12 +1279,34 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, rs_desc.ScissorEnable = TRUE; rs_desc.MultisampleEnable = FALSE; rs_desc.AntialiasedLineEnable = FALSE; - if (FAILED(hr = ID3D10Device_CreateRasterizerState(render_target->device, &rs_desc, &render_target->clear_rs))) + if (FAILED(hr = ID3D10Device_CreateRasterizerState(render_target->device, &rs_desc, &render_target->rs))) { WARN("Failed to create clear rasterizer state, hr %#x.\n", hr); goto err; } + memset(&blend_desc, 0, sizeof(blend_desc)); + blend_desc.BlendEnable[0] = TRUE; + blend_desc.SrcBlend = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOp = D3D10_BLEND_OP_ADD; + blend_desc.SrcBlendAlpha = D3D10_BLEND_ZERO; + blend_desc.DestBlendAlpha = D3D10_BLEND_ONE; + blend_desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + blend_desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; + if (FAILED(hr = ID3D10Device_CreateBlendState(render_target->device, &blend_desc, &render_target->bs))) + { + WARN("Failed to create blend state, hr %#x.\n", hr); + goto err; + } + + if (FAILED(hr = ID3D10Device_CreatePixelShader(render_target->device, + rect_solid_ps_code, sizeof(rect_solid_ps_code), &render_target->rect_solid_ps))) + { + WARN("Failed to create clear pixel shader, hr %#x.\n", hr); + goto err; + } + if (FAILED(hr = IDXGISurface_GetDesc(surface, &surface_desc))) { WARN("Failed to get surface desc, hr %#x.\n", hr); @@ -1228,20 +1336,22 @@ HRESULT d2d_d3d_render_target_init(struct d2d_d3d_render_target *render_target, return S_OK; err: - if (render_target->view) - ID3D10RenderTargetView_Release(render_target->view); - if (render_target->clear_rs) - ID3D10RasterizerState_Release(render_target->clear_rs); - if (render_target->clear_ps) - ID3D10PixelShader_Release(render_target->clear_ps); - if (render_target->clear_vs) - ID3D10VertexShader_Release(render_target->clear_vs); - if (render_target->clear_vb) - ID3D10Buffer_Release(render_target->clear_vb); - if (render_target->clear_il) - ID3D10InputLayout_Release(render_target->clear_il); + if (render_target->rect_solid_ps) + ID3D10PixelShader_Release(render_target->rect_solid_ps); + if (render_target->bs) + ID3D10BlendState_Release(render_target->bs); + if (render_target->rs) + ID3D10RasterizerState_Release(render_target->rs); + if (render_target->vs) + ID3D10VertexShader_Release(render_target->vs); + if (render_target->vb) + ID3D10Buffer_Release(render_target->vb); + if (render_target->il) + ID3D10InputLayout_Release(render_target->il); if (render_target->stateblock) render_target->stateblock->lpVtbl->Release(render_target->stateblock); + if (render_target->view) + ID3D10RenderTargetView_Release(render_target->view); if (render_target->device) ID3D10Device_Release(render_target->device); return hr; -- 1.7.10.4 From hverbeet at codeweavers.com Thu Nov 6 01:20:16 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Thu, 6 Nov 2014 08:20:16 +0100 Subject: [PATCH 4/5] d2d1: Implement d2d_solid_color_brush_GetColor(). Message-ID: <1415258417-14414-4-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 04b273a..eacbebb 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -252,11 +252,11 @@ static void STDMETHODCALLTYPE d2d_solid_color_brush_SetColor(ID2D1SolidColorBrus static D2D1_COLOR_F * STDMETHODCALLTYPE d2d_solid_color_brush_GetColor(ID2D1SolidColorBrush *iface, D2D1_COLOR_F *color) { - static const D2D1_COLOR_F black = {0.0f, 0.0f, 0.0f, 1.0f}; + struct d2d_brush *brush = impl_from_ID2D1SolidColorBrush(iface); - FIXME("iface %p, color %p stub!\n", iface, color); + TRACE("iface %p, color %p.\n", iface, color); - *color = black; + *color = brush->u.solid.color; return color; } -- 1.7.10.4 From hverbeet at codeweavers.com Thu Nov 6 01:20:17 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Thu, 6 Nov 2014 08:20:17 +0100 Subject: [PATCH 5/5] d2d1: Implement d2d_solid_color_brush_SetOpacity(). Message-ID: <1415258417-14414-5-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 7 ++++++- dlls/d2d1/d2d1_private.h | 2 ++ dlls/d2d1/render_target.c | 11 +++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index eacbebb..8837cee 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -149,6 +149,7 @@ static void d2d_brush_init(struct d2d_brush *brush, ID2D1RenderTarget *render_ta { brush->ID2D1Brush_iface.lpVtbl = vtbl; brush->refcount = 1; + brush->opacity = desc ? desc->opacity : 1.0f; brush->type = type; } @@ -210,7 +211,11 @@ static void STDMETHODCALLTYPE d2d_solid_color_brush_GetFactory(ID2D1SolidColorBr static void STDMETHODCALLTYPE d2d_solid_color_brush_SetOpacity(ID2D1SolidColorBrush *iface, float opacity) { - FIXME("iface %p, opacity %.8e stub!\n", iface, opacity); + struct d2d_brush *brush = impl_from_ID2D1SolidColorBrush(iface); + + TRACE("iface %p, opacity %.8e.\n", iface, opacity); + + brush->opacity = opacity; } static void STDMETHODCALLTYPE d2d_solid_color_brush_SetTransform(ID2D1SolidColorBrush *iface, diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index 0a99633..8504e68 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -107,6 +107,8 @@ struct d2d_brush ID2D1Brush ID2D1Brush_iface; LONG refcount; + float opacity; + enum d2d_brush_type type; union { diff --git a/dlls/d2d1/render_target.c b/dlls/d2d1/render_target.c index 1dd5122..0f5907f 100644 --- a/dlls/d2d1/render_target.c +++ b/dlls/d2d1/render_target.c @@ -501,6 +501,7 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTar D3D10_SUBRESOURCE_DATA buffer_data; D3D10_BUFFER_DESC buffer_desc; ID3D10Buffer *vs_cb, *ps_cb; + D2D1_COLOR_F color; float tmp_x, tmp_y; HRESULT hr; struct @@ -558,8 +559,14 @@ static void STDMETHODCALLTYPE d2d_d3d_render_target_FillRectangle(ID2D1RenderTar return; } - buffer_desc.ByteWidth = sizeof(brush_impl->u.solid.color); - buffer_data.pSysMem = &brush_impl->u.solid.color; + color = brush_impl->u.solid.color; + color.r *= brush_impl->opacity; + color.g *= brush_impl->opacity; + color.b *= brush_impl->opacity; + color.a *= brush_impl->opacity; + + buffer_desc.ByteWidth = sizeof(color); + buffer_data.pSysMem = &color; if (FAILED(hr = ID3D10Device_CreateBuffer(render_target->device, &buffer_desc, &buffer_data, &ps_cb))) { -- 1.7.10.4 From sebastian at fds-team.de Thu Nov 6 01:34:27 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 06 Nov 2014 08:34:27 +0100 Subject: user32/tests: Add tests for MsgWaitForMultipleObjectsEx. Message-ID: <545B2483.6070002@fds-team.de> Shows that MsgWaitForMultipleObjectsEx is working correctly, and only CoWaitForMultipleHandles suffers from bug 32568 (should prefer APC calls over window messages). Test failures on w7u and w8 are also present with a noop patch: http://newtestbot.winehq.org/JobDetails.pl?Key=10052 --- dlls/user32/tests/msg.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-tests-Add-tests-for-MsgWaitForMultipleObjects.patch Type: text/x-patch Size: 2752 bytes Desc: not available URL: From jnvsor at gmail.com Thu Nov 6 02:13:11 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 09:13:11 +0100 Subject: [PATCH] reg/tests: Test for empty type and empty binary input Message-ID: <1415261591-1849-1-git-send-email-jnvsor@gmail.com> --- programs/reg/tests/reg.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 9449429..240a795 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -108,6 +108,11 @@ static void test_add(void) err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); + /* Test empty type */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); + verify_reg(hkey, "emptyType", REG_SZ, "WineTest", 9, 0); + /* Test input key formats */ run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); @@ -225,6 +230,10 @@ static void test_add(void) todo_wine ok(memcmp(buffer, buffer+12, 6) == 0 || broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n"); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); + verify_reg(hkey, "bin5", REG_BINARY, buffer, 0, 0); + /* REG_DWORD */ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 04:07:26 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 11:07:26 +0100 Subject: [fixed] reg/tests: Test for empty type and empty binary input Message-ID: <1415268446-9442-1-git-send-email-jnvsor@gmail.com> --- programs/reg/tests/reg.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 9449429..81394c0 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -108,6 +108,15 @@ static void test_add(void) err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err); + /* Test empty type */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r); + todo_wine ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), + "got exit code %u\n", r); + if (r == REG_EXIT_SUCCESS) + todo_wine verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); + else + todo_wine win_skip("broken reg.exe detected\n"); + /* Test input key formats */ run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); @@ -225,6 +234,10 @@ static void test_add(void) todo_wine ok(memcmp(buffer, buffer+12, 6) == 0 || broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n"); + run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r); + ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); + verify_reg(hkey, "bin5", REG_BINARY, buffer, 0, 0); + /* REG_DWORD */ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), -- 2.1.1 From sebastian at fds-team.de Thu Nov 6 04:30:40 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 06 Nov 2014 11:30:40 +0100 Subject: usp10: Silence repeated GSUB_apply_ChainContext[Subst|Pos] FIXMEs. Message-ID: <545B4DD0.3000305@fds-team.de> A lot of installers are spamming those FIXMEs. --- dlls/usp10/opentype.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-usp10-Silence-repeated-GSUB_apply_ChainContext-Subst.patch Type: text/x-patch Size: 2226 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 6 04:42:45 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 06 Nov 2014 11:42:45 +0100 Subject: mshtml: Added IHTMLTable:cellPadding property implementation. Message-ID: <545B50A5.4070601@codeweavers.com> --- dlls/mshtml/htmltable.c | 30 ++++++++++++++++++++++++++---- dlls/mshtml/mshtml_private.h | 7 +++++++ dlls/mshtml/tests/dom.c | 39 ++++++++++++++++++++++++++++++++++++++- 3 files changed, 71 insertions(+), 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLTable-cellPadding-property-implemen.diff Type: text/x-patch Size: 4682 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 6 05:09:54 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 06 Nov 2014 12:09:54 +0100 Subject: mshtml: Added IHTMLScriptElement:onerror property semi-stub implementation. Message-ID: <545B5702.6040707@codeweavers.com> --- dlls/mshtml/htmlscript.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLScriptElement-onerror-property-semi.diff Type: text/x-patch Size: 1066 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 6 05:21:47 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 06 Nov 2014 12:21:47 +0100 Subject: [PATCH try2] mshtml: Added IHTMLScriptElement:onerror property semi-stub implementation. Message-ID: <545B59CB.1080201@codeweavers.com> --- dlls/mshtml/htmlscript.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLScriptElement-onerror-property-semi.diff Type: text/x-patch Size: 1228 bytes Desc: not available URL: From huw at codeweavers.com Thu Nov 6 09:55:39 2014 From: huw at codeweavers.com (Huw Davies) Date: Thu, 6 Nov 2014 15:55:39 +0000 Subject: mlang: Accept "ascii" as an alias for "us-ascii". Message-ID: <1415289339-9166-1-git-send-email-huw@codeweavers.com> --- dlls/mlang/mlang.c | 13 ++++++++++++- dlls/mlang/tests/mlang.c | 12 ++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index e44e862..8a4e78f 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -65,6 +65,7 @@ typedef struct const char *web_charset; const char *header_charset; const char *body_charset; + const WCHAR *alias; } MIME_CP_INFO; /* These data are based on the codepage info in libs/unicode/cpmap.pl */ @@ -363,6 +364,9 @@ static const MIME_CP_INFO vietnamese_cp[] = MIMECONTF_MIME_LATEST, "windows-1258", "windows-1258", "windows-1258" } }; + +static const WCHAR asciiW[] = {'a','s','c','i','i',0}; + static const MIME_CP_INFO western_cp[] = { { "IBM EBCDIC (US-Canada)", @@ -415,7 +419,7 @@ static const MIME_CP_INFO western_cp[] = 20127, MIMECONTF_MAILNEWS | MIMECONTF_IMPORT | MIMECONTF_EXPORT | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_VALID | MIMECONTF_VALID_NLS | MIMECONTF_MIME_LATEST, - "us-ascii", "us-ascii", "us-ascii" }, + "us-ascii", "us-ascii", "us-ascii", asciiW }, { "Western European (ISO)", 28591, MIMECONTF_MAILNEWS | MIMECONTF_BROWSER | MIMECONTF_IMPORT | MIMECONTF_SAVABLE_MAILNEWS | MIMECONTF_SAVABLE_BROWSER | @@ -2600,6 +2604,13 @@ static HRESULT WINAPI fnIMultiLanguage3_GetCharsetInfo( strcpyW(pCharsetInfo->wszCharset, csetW); return S_OK; } + if (mlang_data[i].mime_cp_info[n].alias && !lstrcmpiW(Charset, mlang_data[i].mime_cp_info[n].alias)) + { + pCharsetInfo->uiCodePage = mlang_data[i].family_codepage; + pCharsetInfo->uiInternetEncoding = mlang_data[i].mime_cp_info[n].cp; + strcpyW(pCharsetInfo->wszCharset, mlang_data[i].mime_cp_info[n].alias); + return S_OK; + } } } diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index 1d52af6..a840b4a 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -696,6 +696,17 @@ static void test_EnumCodePages(IMultiLanguage2 *iML2, DWORD flags) IEnumCodePage_Release(iEnumCP); } +static void test_GetCharsetInfo_alias(IMultiLanguage *ml) +{ + WCHAR asciiW[] = {'a','s','c','i','i',0}; + MIMECSETINFO info; + HRESULT hr; + + hr = IMultiLanguage_GetCharsetInfo(ml, asciiW, &info); + ok(hr == S_OK, "got %08x\n", hr); + ok(!lstrcmpW(info.wszCharset, asciiW), "got %s\n", wine_dbgstr_w(info.wszCharset)); +} + static void scriptinfo_cmp(SCRIPTINFO *sinfo1, SCRIPTINFO *sinfo2) { ok(sinfo1->ScriptId == sinfo2->ScriptId, "ScriptId mismatch: %d != %d\n", sinfo1->ScriptId, sinfo2->ScriptId); @@ -2000,6 +2011,7 @@ START_TEST(mlang) test_GetNumberOfCodePageInfo((IMultiLanguage2 *)iML); test_IMLangConvertCharset(iML); + test_GetCharsetInfo_alias(iML); IMultiLanguage_Release(iML); -- 1.8.0 From madewokherd at gmail.com Thu Nov 6 11:40:39 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Thu, 6 Nov 2014 11:40:39 -0600 Subject: windowscodecs: Fix race condition loading libpng. Message-ID: -------------- next part -------------- From 715e26aa786028f9b78e00755c4fbb7e801397f9 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 6 Nov 2014 11:37:46 -0600 Subject: [PATCH] windowscodecs: Fix race condition loading libpng. --- dlls/windowscodecs/pngformat.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c index a8ecb73..b3e6cc6 100644 --- a/dlls/windowscodecs/pngformat.c +++ b/dlls/windowscodecs/pngformat.c @@ -200,13 +200,28 @@ MAKE_FUNCPTR(png_write_info); MAKE_FUNCPTR(png_write_rows); #undef MAKE_FUNCPTR +static CRITICAL_SECTION init_png_cs; +static CRITICAL_SECTION_DEBUG init_png_cs_debug = +{ + 0, 0, &init_png_cs, + { &init_png_cs_debug.ProcessLocksList, + &init_png_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": init_png_cs") } +}; +static CRITICAL_SECTION init_png_cs = { &init_png_cs_debug, -1, 0, 0, 0, 0 }; + static void *load_libpng(void) { - if((libpng_handle = wine_dlopen(SONAME_LIBPNG, RTLD_NOW, NULL, 0)) != NULL) { + void *result; + + EnterCriticalSection(&init_png_cs); + + if(!libpng_handle && (libpng_handle = wine_dlopen(SONAME_LIBPNG, RTLD_NOW, NULL, 0)) != NULL) { #define LOAD_FUNCPTR(f) \ if((p##f = wine_dlsym(libpng_handle, #f, NULL, 0)) == NULL) { \ libpng_handle = NULL; \ + LeaveCriticalSection(&init_png_cs); \ return NULL; \ } LOAD_FUNCPTR(png_create_read_struct); @@ -251,7 +266,12 @@ static void *load_libpng(void) #undef LOAD_FUNCPTR } - return libpng_handle; + + result = libpng_handle; + + LeaveCriticalSection(&init_png_cs); + + return result; } static void user_error_fn(png_structp png_ptr, png_const_charp error_message) @@ -997,7 +1017,7 @@ HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) *ppv = NULL; - if (!libpng_handle && !load_libpng()) + if (!load_libpng()) { ERR("Failed reading PNG because unable to find %s\n",SONAME_LIBPNG); return E_FAIL; @@ -1726,7 +1746,7 @@ HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) *ppv = NULL; - if (!libpng_handle && !load_libpng()) + if (!load_libpng()) { ERR("Failed writing PNG because unable to find %s\n",SONAME_LIBPNG); return E_FAIL; -- 2.1.0 From jnvsor at gmail.com Thu Nov 6 12:03:53 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 19:03:53 +0100 Subject: [PATCH 1/3] advapi32/tests: Add trailing slashes tests for RegOpen/CreateKey Message-ID: <1415297035-6992-1-git-send-email-jnvsor@gmail.com> --- dlls/advapi32/tests/registry.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 382d8cc..3aff541 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -953,6 +953,11 @@ static void test_reg_open_key(void) ok(hkResult != NULL, "hkResult != NULL\n"); RegCloseKey(hkResult); + /* trailing slashes */ + ret = RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Test\\\\", &hkResult); + ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret); + RegCloseKey(hkResult); + /* open nonexistent key * check that hkResult is set to NULL */ @@ -1218,6 +1223,12 @@ static void test_reg_create_key(void) RegCloseKey(hkey1); } + /* trailing backslash characters */ + ret = RegCreateKeyExA(hkey_main, "Subkey4\\\\", 0, NULL, 0, KEY_NOTIFY, NULL, &hkey1, NULL); + ok(ret == ERROR_SUCCESS, "RegCreateKeyExA failed with error %d\n", ret); + RegDeleteKeyA(hkey1, ""); + RegCloseKey(hkey1); + /* WOW64 flags - open an existing key */ hkey1 = NULL; ret = RegCreateKeyExA(HKEY_LOCAL_MACHINE, "Software", 0, NULL, 0, KEY_READ|KEY_WOW64_32KEY, NULL, &hkey1, NULL); -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 12:03:55 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 19:03:55 +0100 Subject: [PATCH 3/3] advapi32/tests: Test RegDeleteKey with empty string parameter In-Reply-To: <1415297035-6992-1-git-send-email-jnvsor@gmail.com> References: <1415297035-6992-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415297035-6992-3-git-send-email-jnvsor@gmail.com> --- dlls/advapi32/tests/registry.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 23eafab..4f311cd 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1372,6 +1372,7 @@ static void test_reg_close_key(void) static void test_reg_delete_key(void) { DWORD ret; + HKEY key; ret = RegDeleteKeyA(hkey_main, NULL); @@ -1390,6 +1391,11 @@ static void test_reg_delete_key(void) ret == ERROR_ACCESS_DENIED || ret == ERROR_BADKEY, /* Win95 */ "ret=%d\n", ret); + + ret = RegCreateKeyExA(hkey_main, "deleteme", 0, NULL, 0, NULL, NULL, &key, NULL); + ret = RegDeleteKeyA(key, ""); + ok(ret == ERROR_SUCCESS, "RegDeleteKeyA failed, got %d\n", ret); + RegCloseKey(key); } static void test_reg_save_key(void) -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 12:03:54 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 19:03:54 +0100 Subject: [PATCH 2/3] advapi32/tests: Fix bad cleanup in test_reg_create_key In-Reply-To: <1415297035-6992-1-git-send-email-jnvsor@gmail.com> References: <1415297035-6992-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415297035-6992-2-git-send-email-jnvsor@gmail.com> --- dlls/advapi32/tests/registry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 3aff541..23eafab 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1219,7 +1219,7 @@ static void test_reg_create_key(void) ok(ret == ERROR_BAD_PATHNAME, "expected ERROR_BAD_PATHNAME, got %d\n", ret); else { ok(!ret, "RegCreateKeyExA failed with error %d\n", ret); - RegDeleteKeyA(hkey1, NULL); + RegDeleteKeyA(hkey1, ""); RegCloseKey(hkey1); } -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 12:18:23 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 19:18:23 +0100 Subject: [PATCH] advapi32/tests: Test RegDeleteKey with empty string parameter Message-ID: <1415297903-11758-1-git-send-email-jnvsor@gmail.com> --- dlls/advapi32/tests/registry.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 23eafab..55a74f6 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -1372,6 +1372,7 @@ static void test_reg_close_key(void) static void test_reg_delete_key(void) { DWORD ret; + HKEY key; ret = RegDeleteKeyA(hkey_main, NULL); @@ -1390,6 +1391,15 @@ static void test_reg_delete_key(void) ret == ERROR_ACCESS_DENIED || ret == ERROR_BADKEY, /* Win95 */ "ret=%d\n", ret); + + ret = RegCreateKeyA(hkey_main, "deleteme", &key); + ok(ret == ERROR_SUCCESS, "Could not create key, got %d\n", ret); + ret = RegDeleteKeyA(key, ""); + ok(ret == ERROR_SUCCESS, "RegDeleteKeyA failed, got %d\n", ret); + RegCloseKey(key); + ret = RegOpenKeyA(hkey_main, "deleteme", &key); + ok(ret == ERROR_FILE_NOT_FOUND, "Key was not deleted, got %d\n", ret); + RegCloseKey(key); } static void test_reg_save_key(void) -- 2.1.1 From joachim.priesner at web.de Thu Nov 6 13:04:39 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Thu, 6 Nov 2014 20:04:39 +0100 Subject: [1/2] wined3d: Set D3DPMISCCAPS_FOGVERTEXCLAMPED flag in get_device_caps (resend) Message-ID: <201411062004.42071.joachim.priesner@web.de> Wine clamps the oFog output of vertex shaders. Tests for the flag follow in the second part of this patch. --- dlls/wined3d/directx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d428d94..41bad21 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4148,12 +4148,12 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS | WINED3DPMISCCAPS_MASKZ | WINED3DPMISCCAPS_BLENDOP | + WINED3DPMISCCAPS_FOGVERTEXCLAMPED | WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING; /* TODO: WINED3DPMISCCAPS_NULLREFERENCE WINED3DPMISCCAPS_FOGANDSPECULARALPHA - WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS - WINED3DPMISCCAPS_FOGVERTEXCLAMPED */ + WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS */ if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; -- 1.8.4.5 From joachim.priesner at web.de Thu Nov 6 13:04:44 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Thu, 6 Nov 2014 20:04:44 +0100 Subject: [2/2] wined3d: Take abs() of vertex z coordinate as FFP fog coordinate (try 4) Message-ID: <201411062004.45710.joachim.priesner@web.de> Take the absolute value of vertex.z as fog coordinate instead of just the z coordinate. This fixes e.g. fog for applications that use right-handed projection matrices. Also test the clamp behavior of the oFog vertex shader output. Tested on openSuse 13.1 and Windows 8.1 (VMware Player). Try 4 which hard-codes the projection matrix in the vertex shaders. --- dlls/d3d8/tests/visual.c | 297 +++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 360 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 161 ++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 2 +- 4 files changed, 819 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 163110c..af61005 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -696,6 +696,302 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + /* Fill the null-shader entry with the FVF (SetVertexShader is "overloaded" on d3d8). */ + DWORD vertex_shader[3] = {D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, 0, 0}; + DWORD pixel_shader[2] = {0, 0}; + IDirect3D8 *d3d; + IDirect3DDevice8 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support; + unsigned int i, ps, y; + D3DCOLOR color, expected_middle_color; + ULONG refcount; + D3DCAPS8 caps; + HWND window; + HRESULT hr; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0100, /* vs_1_0 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x0000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0100, /* vs_1_0 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x0000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + + static const struct + { + struct vec3 position; + DWORD diffuse; + DWORD specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const DWORD vertex_decl[] = + { + D3DVSD_STREAM(0), + D3DVSD_REG(0, D3DVSDT_FLOAT3), /* position, v0 */ + D3DVSD_REG(1, D3DVSDT_D3DCOLOR), /* diffuse color, v1 */ + D3DVSD_REG(2, D3DVSDT_D3DCOLOR), /* specular color, v2 */ + D3DVSD_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader with vertex fog computation. + * As drivers inconsistently clamp or don't clamp the oFog output of vertex shaders, + * the special value C_CLAMPED_FOG allows both C_HALF_FOGGED (clamped) and C_FOGGED. */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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"); + goto done; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice8_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 0); + if (has_vs_support) + { + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code1, &vertex_shader[1], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code2, &vertex_shader[2], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_1_0 support, skipping some fog tests\n"); + } + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice8_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice8_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + ok(color_match(color, C_HALF_FOGGED, 13) || color_match(color, C_FOGGED, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, " + "expected %08x+-5%% or %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, C_HALF_FOGGED, C_FOGGED); + } + else + { + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + } + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + } + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DDevice8_DeleteVertexShader(device, vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DDevice8_DeletePixelShader(device, pixel_shader[i]); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + /* This tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -5092,6 +5388,7 @@ START_TEST(visual) offscreen_test(); alpha_test(); test_scalar_instructions(); + fog_negative_z_test(); fog_with_shader_test(); cnd_test(); p8_texture_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 117c8eb..28ecff7 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1825,6 +1825,365 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; + IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + IDirect3DDevice9 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support, is_fog_vertex_clamped; + unsigned int i, ps, y; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color, expected_middle_color; + HWND window; + HRESULT hr; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x0000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x0000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"), vs_2_0 */ + static const DWORD vertex_shader_code3[] = + { + 0xfffe0200, /* vs_2_0 */ + 0x05000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x0000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x03000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x03000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x02000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x02000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x02000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + static const DWORD pixel_shader_code2[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */ + 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ + 0x0000ffff + }; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + + static const D3DVERTEXELEMENT9 decl_elements[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, /* diffuse */ + {0, 16, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1}, /* specular */ + D3DDECL_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED in the right half of the screen. + * + * C_CLAMPED_FOG will be replaced by the correct expected value based on + * the value of D3DPMISCCAPS_FOGVERTEXCLAMPED. If the driver clamps the oFog + * output of vertex shaders, it should be C_HALF_FOGGED, else C_FOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader vs_1_1 with vertex fog computation */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + /* Vertex shader vs_2_0 with vertex fog computation */ + {3, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {3, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 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 (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 1); + if (has_vs_support) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code1, &vertex_shader[1]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code2, &vertex_shader[2]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + + if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code3, &vertex_shader[3]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No vs_1_1 support, skipping some fog tests\n"); + } + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + + if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code2, &pixel_shader[2]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + is_fog_vertex_clamped = caps.PrimitiveMiscCaps & D3DPMISCCAPS_FOGVERTEXCLAMPED; + + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration); + ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%#x)\n", hr); + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration); + ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%#x)\n", hr); + + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + if (has_vs_support) + { + hr = IDirect3DDevice9_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + } + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice9_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + expected_middle_color = is_fog_vertex_clamped ? C_HALF_FOGGED : C_FOGGED; + } + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + + } + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DVertexShader9_Release(vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DPixelShader9_Release(pixel_shader[i]); + IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + /* This test tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -16729,6 +17088,7 @@ START_TEST(visual) test_vshader_input(); test_vshader_float16(); stream_test(); + fog_negative_z_test(); fog_with_shader_test(); texbem_test(); texdepth_test(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ec50fb8..4e999f7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3384,6 +3384,166 @@ static void test_fog_special(void) DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void test_fog_negative_z(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000 + }; + + D3DCOLOR color, expected_middle_color; + HRESULT hr; + ULONG refcount; + BOOL has_table_fog_support; + unsigned int i, y; + HWND window; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + D3DDEVICEDESC7 caps; + + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + DWORD vertexmode, tablemode; + D3DCOLOR color_left, color_middle_top, color_middle_bottom, color_right; + } + test_data[] = + { + {D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + memset(&caps, 0, sizeof(caps)); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "IDirect3DDevice7_GetCaps failed, hr %#x.\n", hr); + + has_table_fog_support = caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests.\n"); + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Failed to set fog color, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].tablemode != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear render target, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, test_data[i].vertexmode); + ok(SUCCEEDED(hr), "Failed to set fog vertex mode, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, test_data[i].tablemode); + ok(SUCCEEDED(hr), "Failed to set fog table mode, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, top_quad, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_1, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_2, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, i=%d, hr %#x.\n", i, hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = get_surface_color(rt, 2, y); + ok(compare_color(color, test_data[i].color_left, 13), + "fog fvm%i ftm%i y=%i: got left color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, color, y, + test_data[i].color_left); + color = get_surface_color(rt, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + ok(compare_color(color, expected_middle_color, 13), + "fog fvm%i ftm%i y=%i: got middle color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, expected_middle_color); + color = get_surface_color(rt, 638, y); + ok(compare_color(color, test_data[i].color_right, 13), + "fog fvm%i ftm%i y=%i: got right color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, test_data[i].color_right); + } + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_lighting_interface_versions(void) { IDirect3DDevice7 *device; @@ -7671,6 +7831,7 @@ START_TEST(ddraw7) test_clear_rect_count(); test_coop_level_versions(); test_fog_special(); + test_fog_negative_z(); test_lighting_interface_versions(); test_coop_level_activateapp(); test_texturemanage(); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7379ba2..907e895 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5005,7 +5005,7 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); else - shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + shader_addline(buffer, "gl_FogFragCoord = abs(ec_pos.z);\n"); break; default: -- 1.8.4.5 From joachim.priesner at web.de Thu Nov 6 14:51:37 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Thu, 6 Nov 2014 21:51:37 +0100 Subject: [1/2] wined3d: Set D3DPMISCCAPS_FOGVERTEXCLAMPED flag in get_device_caps (resend) Message-ID: <201411062151.39635.joachim.priesner@web.de> Wine clamps the oFog output of vertex shaders. Tests for the flag follow in the second part of this patch. --- dlls/wined3d/directx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d428d94..41bad21 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4148,12 +4148,12 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS | WINED3DPMISCCAPS_MASKZ | WINED3DPMISCCAPS_BLENDOP | + WINED3DPMISCCAPS_FOGVERTEXCLAMPED | WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING; /* TODO: WINED3DPMISCCAPS_NULLREFERENCE WINED3DPMISCCAPS_FOGANDSPECULARALPHA - WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS - WINED3DPMISCCAPS_FOGVERTEXCLAMPED */ + WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS */ if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; -- 1.8.4.5 From joachim.priesner at web.de Thu Nov 6 14:51:55 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Thu, 6 Nov 2014 21:51:55 +0100 Subject: [2/2] wined3d: Take abs() of vertex z coordinate as FFP fog coordinate (try 5) Message-ID: <201411062151.56812.joachim.priesner@web.de> Take the absolute value of vertex.z as fog coordinate instead of just the z coordinate. This fixes e.g. fog for applications that use right-handed projection matrices. Also test the clamp behavior of the oFog vertex shader output. Tested on openSuse 13.1 and Windows 8.1 (VMware Player). Try 5 that fixes a test failure I overlooked. --- dlls/d3d8/tests/visual.c | 296 +++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 360 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 161 ++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 2 +- 4 files changed, 818 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 163110c..a1eabcd 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -696,6 +696,301 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + /* Fill the null-shader entry with the FVF (SetVertexShader is "overloaded" on d3d8). */ + DWORD vertex_shader[3] = {D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, 0, 0}; + DWORD pixel_shader[2] = {0, 0}; + IDirect3D8 *d3d; + IDirect3DDevice8 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support; + unsigned int i, ps, y; + D3DCOLOR color, expected_middle_color; + ULONG refcount; + D3DCAPS8 caps; + HWND window; + HRESULT hr; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + + static const struct + { + struct vec3 position; + DWORD diffuse; + DWORD specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const DWORD vertex_decl[] = + { + D3DVSD_STREAM(0), + D3DVSD_REG(0, D3DVSDT_FLOAT3), /* position, v0 */ + D3DVSD_REG(1, D3DVSDT_D3DCOLOR), /* diffuse color, v1 */ + D3DVSD_REG(2, D3DVSDT_D3DCOLOR), /* specular color, v2 */ + D3DVSD_CONST(0, 1), 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + D3DVSD_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader with vertex fog computation. + * As drivers inconsistently clamp or don't clamp the oFog output of vertex shaders, + * the special value C_CLAMPED_FOG allows both C_HALF_FOGGED (clamped) and C_FOGGED. */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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"); + goto done; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice8_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 0); + if (has_vs_support) + { + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code1, &vertex_shader[1], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code2, &vertex_shader[2], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_1_0 support, skipping some fog tests\n"); + } + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice8_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice8_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + ok(color_match(color, C_HALF_FOGGED, 13) || color_match(color, C_FOGGED, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, " + "expected %08x+-5%% or %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, C_HALF_FOGGED, C_FOGGED); + } + else + { + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + } + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + } + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DDevice8_DeleteVertexShader(device, vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DDevice8_DeletePixelShader(device, pixel_shader[i]); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + /* This tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -5092,6 +5387,7 @@ START_TEST(visual) offscreen_test(); alpha_test(); test_scalar_instructions(); + fog_negative_z_test(); fog_with_shader_test(); cnd_test(); p8_texture_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 117c8eb..f8ac3a6 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1825,6 +1825,365 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; + IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + IDirect3DDevice9 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support, is_fog_vertex_clamped; + unsigned int i, ps, y; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color, expected_middle_color; + HWND window; + HRESULT hr; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"), vs_2_0 */ + static const DWORD vertex_shader_code3[] = + { + 0xfffe0200, /* vs_2_0 */ + 0x05000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x03000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x03000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x02000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x02000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x02000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + static const DWORD pixel_shader_code2[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */ + 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ + 0x0000ffff + }; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + + static const D3DVERTEXELEMENT9 decl_elements[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, /* diffuse */ + {0, 16, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1}, /* specular */ + D3DDECL_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED in the right half of the screen. + * + * C_CLAMPED_FOG will be replaced by the correct expected value based on + * the value of D3DPMISCCAPS_FOGVERTEXCLAMPED. If the driver clamps the oFog + * output of vertex shaders, it should be C_HALF_FOGGED, else C_FOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader vs_1_1 with vertex fog computation */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + /* Vertex shader vs_2_0 with vertex fog computation */ + {3, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {3, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 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 (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 1); + if (has_vs_support) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code1, &vertex_shader[1]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code2, &vertex_shader[2]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + + if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code3, &vertex_shader[3]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No vs_1_1 support, skipping some fog tests\n"); + } + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + + if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code2, &pixel_shader[2]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + is_fog_vertex_clamped = caps.PrimitiveMiscCaps & D3DPMISCCAPS_FOGVERTEXCLAMPED; + + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration); + ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%#x)\n", hr); + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration); + ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%#x)\n", hr); + + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + if (has_vs_support) + { + hr = IDirect3DDevice9_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + } + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice9_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + expected_middle_color = is_fog_vertex_clamped ? C_HALF_FOGGED : C_FOGGED; + } + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + + } + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DVertexShader9_Release(vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DPixelShader9_Release(pixel_shader[i]); + IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + /* This test tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -16729,6 +17088,7 @@ START_TEST(visual) test_vshader_input(); test_vshader_float16(); stream_test(); + fog_negative_z_test(); fog_with_shader_test(); texbem_test(); texdepth_test(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ec50fb8..4e999f7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3384,6 +3384,166 @@ static void test_fog_special(void) DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void test_fog_negative_z(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000 + }; + + D3DCOLOR color, expected_middle_color; + HRESULT hr; + ULONG refcount; + BOOL has_table_fog_support; + unsigned int i, y; + HWND window; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + D3DDEVICEDESC7 caps; + + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + DWORD vertexmode, tablemode; + D3DCOLOR color_left, color_middle_top, color_middle_bottom, color_right; + } + test_data[] = + { + {D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + memset(&caps, 0, sizeof(caps)); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "IDirect3DDevice7_GetCaps failed, hr %#x.\n", hr); + + has_table_fog_support = caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests.\n"); + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Failed to set fog color, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].tablemode != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear render target, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, test_data[i].vertexmode); + ok(SUCCEEDED(hr), "Failed to set fog vertex mode, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, test_data[i].tablemode); + ok(SUCCEEDED(hr), "Failed to set fog table mode, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, top_quad, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_1, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_2, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, i=%d, hr %#x.\n", i, hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = get_surface_color(rt, 2, y); + ok(compare_color(color, test_data[i].color_left, 13), + "fog fvm%i ftm%i y=%i: got left color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, color, y, + test_data[i].color_left); + color = get_surface_color(rt, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + ok(compare_color(color, expected_middle_color, 13), + "fog fvm%i ftm%i y=%i: got middle color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, expected_middle_color); + color = get_surface_color(rt, 638, y); + ok(compare_color(color, test_data[i].color_right, 13), + "fog fvm%i ftm%i y=%i: got right color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, test_data[i].color_right); + } + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_lighting_interface_versions(void) { IDirect3DDevice7 *device; @@ -7671,6 +7831,7 @@ START_TEST(ddraw7) test_clear_rect_count(); test_coop_level_versions(); test_fog_special(); + test_fog_negative_z(); test_lighting_interface_versions(); test_coop_level_activateapp(); test_texturemanage(); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7379ba2..907e895 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5005,7 +5005,7 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); else - shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + shader_addline(buffer, "gl_FogFragCoord = abs(ec_pos.z);\n"); break; default: -- 1.8.4.5 From jnvsor at gmail.com Thu Nov 6 15:17:13 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:13 +0100 Subject: [PATCH] reg/tests: Test result for deleting key that doesn't exist Message-ID: <1415308633-32616-1-git-send-email-jnvsor@gmail.com> --- programs/reg/tests/reg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 81394c0..f93df55 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -396,6 +396,9 @@ static void test_delete(void) ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + + run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); } static void test_query(void) -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:35 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:35 +0100 Subject: [PATCH 1/8] reg: Add system error printing function Message-ID: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 31 +++++++++++++++++++++++++++---- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index d299cbf..d2fcabc 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -67,6 +67,29 @@ static int reg_message(int msg) return reg_printfW(formatW, msg_buffer); } +static int reg_print_error(LSTATUS error_code) +{ + switch (error_code) + { + case ERROR_SUCCESS: + return 0; + case ERROR_BAD_COMMAND: + return reg_message(STRING_INVALID_CMDLINE); + default: + { + static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; + WCHAR *message = NULL; + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, + error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *)&message, 0, NULL); + + reg_message(STRING_ERROR); + reg_printfW(error_string, error_code, message); + HeapFree(GetProcessHeap(), 0, message); + return 0; + } + } +} + static HKEY get_rootkey(LPWSTR key) { static const WCHAR szHKLM[] = {'H','K','L','M',0}; @@ -397,7 +420,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -433,7 +456,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -464,7 +487,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -488,7 +511,7 @@ int wmain(int argc, WCHAR *argvW[]) } else { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 2221647..1c2ae83 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -30,3 +30,4 @@ #define STRING_INVALID_CMDLINE 107 #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 +#define STRING_ERROR 110 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 479912b..6183aaa 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -35,4 +35,5 @@ STRINGTABLE STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" + STRING_ERROR, "Unexpected error: " } -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:36 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:36 +0100 Subject: [PATCH 2/8] reg: Add sane_path function to do preliniary key validation In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-2-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 26 ++++++++++++++++++++++---- programs/reg/reg.rc | 2 +- programs/reg/tests/reg.c | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) mode change 100644 => 100755 programs/reg/reg.c diff --git a/programs/reg/reg.c b/programs/reg/reg.c old mode 100644 new mode 100755 index d2fcabc..fa7b2df --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,6 +20,8 @@ #include #include "reg.h" +#define ERROR_NO_REMOTE 20000 + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -75,6 +77,8 @@ static int reg_print_error(LSTATUS error_code) return 0; case ERROR_BAD_COMMAND: return reg_message(STRING_INVALID_CMDLINE); + case ERROR_NO_REMOTE: + return reg_message(STRING_NO_REMOTE); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -186,6 +190,16 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r return out_data; } +static LSTATUS sane_path(const WCHAR *key) +{ + int i = strlenW(key); + + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') + return ERROR_NO_REMOTE; + + return ERROR_SUCCESS; +} + static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) { @@ -193,12 +207,14 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; LPWSTR p; HKEY root,subkey; + LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - if (key_name[0]=='\\' && key_name[1]=='\\') + err = sane_path(key_name); + if (err != ERROR_SUCCESS) { - reg_message(STRING_NO_REMOTE); + reg_print_error(err); return 1; } @@ -263,15 +279,17 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, { LPWSTR p; HKEY root,subkey; + LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' ,0}; reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - if (key_name[0]=='\\' && key_name[1]=='\\') + err = sane_path(key_name); + if (err != ERROR_SUCCESS) { - reg_message(STRING_NO_REMOTE); + reg_print_error(err); return 1; } diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 6183aaa..5fc5a76 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -33,7 +33,7 @@ STRINGTABLE STRING_SUCCESS, "The operation completed successfully\n" STRING_INVALID_KEY, "Error: Invalid key name\n" STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" - STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" + STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index f93df55..57e0108 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -129,10 +129,10 @@ static void test_add(void) ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2"); - todo_wine ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), + ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:37 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:37 +0100 Subject: [PATCH 3/8] reg: Add check for multiple backslashes at the end of the key In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-3-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index fa7b2df..186ba47 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -77,6 +77,8 @@ static int reg_print_error(LSTATUS error_code) return 0; case ERROR_BAD_COMMAND: return reg_message(STRING_INVALID_CMDLINE); + case ERROR_INVALID_HANDLE: + return reg_message(STRING_INVALID_KEY); case ERROR_NO_REMOTE: return reg_message(STRING_NO_REMOTE); default: @@ -194,6 +196,9 @@ static LSTATUS sane_path(const WCHAR *key) { int i = strlenW(key); + if (i < 3 || (key[i - 1] == '\\' && key[i - 2] == '\\')) + return ERROR_INVALID_HANDLE; + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') return ERROR_NO_REMOTE; -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:38 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:38 +0100 Subject: [PATCH 4/8] reg: Add path/key conversion functions In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-4-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 145 +++++++++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 66 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 186ba47..f6d4bbc 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,8 +20,36 @@ #include #include "reg.h" +#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) + #define ERROR_NO_REMOTE 20000 +static const WCHAR short_hklm[] = {'H','K','L','M',0}; +static const WCHAR short_hkcu[] = {'H','K','C','U',0}; +static const WCHAR short_hkcr[] = {'H','K','C','R',0}; +static const WCHAR short_hku[] = {'H','K','U',0}; +static const WCHAR short_hkcc[] = {'H','K','C','C',0}; +static const WCHAR long_hklm[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; +static const WCHAR long_hkcu[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; +static const WCHAR long_hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; +static const WCHAR long_hku[] = {'H','K','E','Y','_','U','S','E','R','S',0}; +static const WCHAR long_hkcc[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; + +static const struct +{ + HKEY key; + const WCHAR *short_name; + const WCHAR *long_name; +} +root_rels[] = +{ + {HKEY_LOCAL_MACHINE, short_hklm, long_hklm}, + {HKEY_CURRENT_USER, short_hkcu, long_hkcu}, + {HKEY_CLASSES_ROOT, short_hkcr, long_hkcr}, + {HKEY_USERS, short_hku, long_hku}, + {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -81,6 +109,8 @@ static int reg_print_error(LSTATUS error_code) return reg_message(STRING_INVALID_KEY); case ERROR_NO_REMOTE: return reg_message(STRING_NO_REMOTE); + case ERROR_FILE_NOT_FOUND: + return reg_message(STRING_CANNOT_FIND); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -96,35 +126,40 @@ static int reg_print_error(LSTATUS error_code) } } -static HKEY get_rootkey(LPWSTR key) +static inline BOOL path_rootname_cmp(const WCHAR *input_path, const WCHAR *rootkey_name) +{ + DWORD length = strlenW(rootkey_name); + + return (!strncmpiW(input_path, rootkey_name, length) && + (input_path[length] == 0 || input_path[length] == '\\')); +} + +static HKEY path_get_rootkey(const WCHAR *path) +{ + DWORD i; + + for (i = 0; i < ARRAY_SIZE(root_rels); i++) + { + if (path_rootname_cmp(path, root_rels[i].short_name) || + path_rootname_cmp(path, root_rels[i].long_name)) + return root_rels[i].key; + } + + return NULL; +} + +static LSTATUS path_open(const WCHAR *path, HKEY *out, BOOL create) { - static const WCHAR szHKLM[] = {'H','K','L','M',0}; - static const WCHAR szHKEY_LOCAL_MACHINE[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; - static const WCHAR szHKCU[] = {'H','K','C','U',0}; - static const WCHAR szHKEY_CURRENT_USER[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; - static const WCHAR szHKCR[] = {'H','K','C','R',0}; - static const WCHAR szHKEY_CLASSES_ROOT[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; - static const WCHAR szHKU[] = {'H','K','U',0}; - static const WCHAR szHKEY_USERS[] = {'H','K','E','Y','_','U','S','E','R','S',0}; - static const WCHAR szHKCC[] = {'H','K','C','C',0}; - static const WCHAR szHKEY_CURRENT_CONFIG[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; - - if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKLM,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,18,szHKEY_LOCAL_MACHINE,18)==CSTR_EQUAL) - return HKEY_LOCAL_MACHINE; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCU,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CURRENT_USER,17)==CSTR_EQUAL) - return HKEY_CURRENT_USER; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCR,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CLASSES_ROOT,17)==CSTR_EQUAL) - return HKEY_CLASSES_ROOT; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,3,szHKU,3)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,10,szHKEY_USERS,10)==CSTR_EQUAL) - return HKEY_USERS; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCC,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,19,szHKEY_CURRENT_CONFIG,19)==CSTR_EQUAL) - return HKEY_CURRENT_CONFIG; - else return NULL; + *out = path_get_rootkey(path); + + path = strchrW(path, '\\'); + if (path) + path++; + + if (create) + return RegCreateKeyW(*out, path, out); + else + return RegOpenKeyW(*out, path, out); } static DWORD get_regtype(LPWSTR type) @@ -210,8 +245,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, { static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - LPWSTR p; - HKEY root,subkey; + HKEY subkey; LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); @@ -223,22 +257,8 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } - p = strchrW(key_name,'\\'); - if (!p) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - - if(RegCreateKeyW(root,p,&subkey)!=ERROR_SUCCESS) + err = path_open(key_name, &subkey, TRUE); + if(err != ERROR_SUCCESS) { reg_message(STRING_INVALID_KEY); return 1; @@ -282,8 +302,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL value_all, BOOL force) { - LPWSTR p; - HKEY root,subkey; + HKEY subkey; LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', @@ -298,16 +317,8 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } - p = strchrW(key_name,'\\'); - if (!p) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) + err = path_open(key_name, &subkey, FALSE); + if (err != ERROR_SUCCESS) { reg_message(STRING_INVALID_KEY); return 1; @@ -333,21 +344,23 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, /* Delete subtree only if no /v* option is given */ if (!value_name && !value_empty && !value_all) { - if (RegDeleteTreeW(root,p)!=ERROR_SUCCESS) + err = RegDeleteTreeA(subkey, NULL); + if (err != ERROR_SUCCESS) { - reg_message(STRING_CANNOT_FIND); + reg_print_error(err); + return 1; + } + + err = RegDeleteKeyA(subkey, ""); + if (err != ERROR_SUCCESS) + { + reg_print_error(err); return 1; } reg_message(STRING_SUCCESS); return 0; } - if(RegOpenKeyW(root,p,&subkey)!=ERROR_SUCCESS) - { - reg_message(STRING_CANNOT_FIND); - return 1; - } - if (value_all) { LPWSTR szValue; -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:39 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:39 +0100 Subject: [PATCH 5/8] reg: Add wchar/type conversion functions In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-5-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 72 +++++++++++++++++++++++++++++++++++++---------------- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index f6d4bbc..facd241 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -50,6 +50,44 @@ root_rels[] = {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, }; +static const WCHAR type_none[] = {'R','E','G','_','N','O','N','E',0}; +static const WCHAR type_sz[] = {'R','E','G','_','S','Z',0}; +static const WCHAR type_expand_sz[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; +static const WCHAR type_binary[] = {'R','E','G','_','B','I','N','A','R','Y',0}; +static const WCHAR type_dword[] = {'R','E','G','_','D','W','O','R','D',0}; +static const WCHAR type_dword_le[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; +static const WCHAR type_dword_be[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; +static const WCHAR type_link[] = {'R','E','G','_','L','I','N','K',0}; +static const WCHAR type_multi_sz[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; +static const WCHAR type_resource_list[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','L','I','S','T',0}; +static const WCHAR type_full_resource_descriptor[] = {'R','E','G','_','F','U','L','L','_','R','E','S','O','U','R','C','E','_','D','E','S','C','R','I','P','T','O','R',0}; +static const WCHAR type_resource_requirements_list[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','R','E','Q','U','I','R','E','M','E','N','T','S','_','L','I','S','T',0}; +static const WCHAR type_qword[] = {'R','E','G','_','Q','W','O','R','D',0}; +static const WCHAR type_qword_le[] = {'R','E','G','_','Q','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; + +static const struct +{ + DWORD type; + const WCHAR *name; +} +type_rels[] = +{ + {REG_NONE, type_none}, + {REG_SZ, type_sz}, + {REG_EXPAND_SZ, type_expand_sz}, + {REG_BINARY, type_binary}, + {REG_DWORD, type_dword}, + {REG_DWORD_LITTLE_ENDIAN, type_dword_le}, + {REG_DWORD_BIG_ENDIAN, type_dword_be}, + {REG_LINK, type_link}, + {REG_MULTI_SZ, type_multi_sz}, + {REG_RESOURCE_LIST, type_resource_list}, + {REG_FULL_RESOURCE_DESCRIPTOR, type_full_resource_descriptor}, + {REG_RESOURCE_REQUIREMENTS_LIST, type_resource_requirements_list}, + {REG_QWORD, type_qword}, + {REG_QWORD_LITTLE_ENDIAN, type_qword_le}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -111,6 +149,8 @@ static int reg_print_error(LSTATUS error_code) return reg_message(STRING_NO_REMOTE); case ERROR_FILE_NOT_FOUND: return reg_message(STRING_CANNOT_FIND); + case ERROR_INVALID_DATATYPE: + return reg_message(STRING_INVALID_TYPE); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -162,28 +202,18 @@ static LSTATUS path_open(const WCHAR *path, HKEY *out, BOOL create) return RegOpenKeyW(*out, path, out); } -static DWORD get_regtype(LPWSTR type) +static DWORD wchar_get_type(const WCHAR *type_name) { - static const WCHAR szREG_SZ[] = {'R','E','G','_','S','Z',0}; - static const WCHAR szREG_MULTI_SZ[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; - static const WCHAR szREG_DWORD_BIG_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_DWORD[] = {'R','E','G','_','D','W','O','R','D',0}; - static const WCHAR szREG_BINARY[] = {'R','E','G','_','B','I','N','A','R','Y',0}; - static const WCHAR szREG_DWORD_LITTLE_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_NONE[] = {'R','E','G','_','N','O','N','E',0}; - static const WCHAR szREG_EXPAND_SZ[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; - - if (!type) + DWORD i; + + if (!type_name) return REG_SZ; - if (lstrcmpiW(type,szREG_SZ)==0) return REG_SZ; - if (lstrcmpiW(type,szREG_DWORD)==0) return REG_DWORD; - if (lstrcmpiW(type,szREG_MULTI_SZ)==0) return REG_MULTI_SZ; - if (lstrcmpiW(type,szREG_EXPAND_SZ)==0) return REG_EXPAND_SZ; - if (lstrcmpiW(type,szREG_DWORD_BIG_ENDIAN)==0) return REG_DWORD_BIG_ENDIAN; - if (lstrcmpiW(type,szREG_DWORD_LITTLE_ENDIAN)==0) return REG_DWORD_LITTLE_ENDIAN; - if (lstrcmpiW(type,szREG_BINARY)==0) return REG_BINARY; - if (lstrcmpiW(type,szREG_NONE)==0) return REG_NONE; + for (i = 0; i < ARRAY_SIZE(type_rels); i++) + { + if (!strcmpiW(type_rels[i].name, type_name)) + return type_rels[i].type; + } return -1; } @@ -278,11 +308,11 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } } - reg_type = get_regtype(type); + reg_type = wchar_get_type(type); if (reg_type == -1) { RegCloseKey(subkey); - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_INVALID_DATATYPE); return 1; } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 1c2ae83..d49d3d8 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -31,3 +31,4 @@ #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 +#define STRING_INVALID_TYPE 111 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 5fc5a76..1c19375 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -36,4 +36,5 @@ STRINGTABLE STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " + STRING_INVALID_TYPE, "Error: Invalid type\n" } -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:40 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:40 +0100 Subject: [PATCH 6/8] reg: Add wchar/raw data conversion functions In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-6-git-send-email-jnvsor@gmail.com> In the case of REG_SZ and the like, it may seem like the functions perform an unncessary copy of the strings which should already be in memory ripe for the taking. However because these functions handle more than one type of data the calling function needs to be able to free the data afterwards. Simply returning the input string would result in a function freeing one of it's own parameters, so we make sure to return new memory by making a copy. --- programs/reg/reg.c | 139 +++++++++++++++++++++++++++++++++++++++-------- programs/reg/reg.h | 2 + programs/reg/reg.rc | 2 + programs/reg/tests/reg.c | 55 +++++++++---------- 4 files changed, 146 insertions(+), 52 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index facd241..0c51f8b 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -18,11 +18,15 @@ #include #include +#include #include "reg.h" #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) #define ERROR_NO_REMOTE 20000 +#define ERROR_NOT_INT_OR_NEG 20001 + +WINE_DEFAULT_DEBUG_CHANNEL(reg); static const WCHAR short_hklm[] = {'H','K','L','M',0}; static const WCHAR short_hkcu[] = {'H','K','C','U',0}; @@ -151,6 +155,10 @@ static int reg_print_error(LSTATUS error_code) return reg_message(STRING_CANNOT_FIND); case ERROR_INVALID_DATATYPE: return reg_message(STRING_INVALID_TYPE); + case ERROR_UNSUPPORTED_TYPE: + return reg_message(STRING_UNSUPPORTED_TYPE); + case ERROR_NOT_INT_OR_NEG: + return reg_message(STRING_NOT_INT_OR_NEG); default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -218,43 +226,118 @@ static DWORD wchar_get_type(const WCHAR *type_name) return -1; } -static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) +static LSTATUS wchar_get_data( const WCHAR *input, const DWORD type, + const WCHAR separator, DWORD *size_out, BYTE **out) { - LPBYTE out_data = NULL; - *reg_count = 0; + static const WCHAR empty = 0; + DWORD i; - switch (reg_type) + if (!input) + input = ∅ + + switch (type) { case REG_SZ: + case REG_EXPAND_SZ: { - *reg_count = (lstrlenW(data) + 1) * sizeof(WCHAR); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - lstrcpyW((LPWSTR)out_data,data); - break; + i = (strlenW(input) + 1) * sizeof(WCHAR); + *out = HeapAlloc(GetProcessHeap(), 0, i); + memcpy(*out, input, i); + *size_out = i; + return ERROR_SUCCESS; } case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: { - LPWSTR rest; - DWORD val; - val = strtolW(data, &rest, 0); - if (rest == data) { - static const WCHAR nonnumber[] = {'E','r','r','o','r',':',' ','/','d',' ','r','e','q','u','i','r','e','s',' ','n','u','m','b','e','r','.','\n',0}; - reg_printfW(nonnumber); - break; + WCHAR *temp; + + if (input[0] == '0' && (input[1] == 'x' || input[1] == 'X')) + i = strtoulW(input, &temp, 16); + else + i = strtoulW(input, &temp, 10); + + if (input[0] == '-' || temp[0] || temp == input) + return ERROR_NOT_INT_OR_NEG; + + *out = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)); + ** (DWORD **) out = i; + *size_out = sizeof(DWORD); + return ERROR_SUCCESS; + } + case REG_MULTI_SZ: + { + WCHAR *temp = HeapAlloc(GetProcessHeap(), 0, (strlenW(input) + 1) * sizeof(WCHAR)); + DWORD p; + + for (i = 0, p = 0; i <= strlenW(input); i++, p++) + { + /* If this character is the separator, or no separator has been given and these + * characters are "\\0", then add a 0 indicating the end of this string */ + if ( (separator && input[i] == separator) || + (!separator && input[i] == '\\' && input[i + 1] == '0') ) + { + /* If it's the first character or the previous one was a separator */ + if (!p || temp[p - 1] == 0) + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + temp[p] = 0; + + if (!separator) + i++; + } + else + temp[p] = input[i]; } - *reg_count = sizeof(DWORD); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - ((LPDWORD)out_data)[0] = val; - break; + + /* Add a 0 to the end if the string wasn't "", and it wasn't + * double-0-terminated already (In the case of a trailing separator) */ + if(p > 1 && temp[p - 2]) + temp[p++] = 0; + + *size_out = p * sizeof(WCHAR); + *out = HeapReAlloc(GetProcessHeap(), 0, temp, p * sizeof(WCHAR)); + return ERROR_SUCCESS; + } + case REG_BINARY: + { + BYTE * temp = HeapAlloc(GetProcessHeap(), 0, strlenW(input)); + DWORD p, odd; + + for (i = 0, p = 0; i < strlenW(input); i++, p++) + { + if (input[i] >= '0' && input[i] <= '9') + temp[p] = input[i] - '0'; + else if (input[i] >= 'a' && input[i] <= 'f') + temp[p] = input[i] - 'a' + 10; + else if (input[i] >= 'A' && input[i] <= 'F') + temp[p] = input[i] - 'A' + 10; + else + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + } + + odd = p & 1; + temp += odd; + p >>= 1; + + for (i = 0; i < p; i++) + temp[i] = (temp[i * 2] << 4) | temp[i * 2 + 1]; + + p += odd; + *size_out = p; + *out = HeapReAlloc(GetProcessHeap(), 0, temp-odd, p); + return ERROR_SUCCESS; } default: { - static const WCHAR unhandled[] = {'U','n','h','a','n','d','l','e','d',' ','T','y','p','e',' ','0','x','%','x',' ',' ','d','a','t','a',' ','%','s','\n',0}; - reg_printfW(unhandled, reg_type,data); + FIXME("Add support for registry type: %u\n", type); + return ERROR_UNSUPPORTED_TYPE; } } - - return out_data; } static LSTATUS sane_path(const WCHAR *key) @@ -317,7 +400,15 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } if (data) - reg_data = get_regdata(data,reg_type,separator,®_count); + { + err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); + if (err != ERROR_SUCCESS) + { + RegCloseKey(subkey); + reg_print_error(err); + return 1; + } + } RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); HeapFree(GetProcessHeap(),0,reg_data); diff --git a/programs/reg/reg.h b/programs/reg/reg.h index d49d3d8..f1b398b 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -32,3 +32,5 @@ #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 #define STRING_INVALID_TYPE 111 +#define STRING_UNSUPPORTED_TYPE 112 +#define STRING_NOT_INT_OR_NEG 113 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 1c19375..47986ab 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -37,4 +37,6 @@ STRINGTABLE STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " STRING_INVALID_TYPE, "Error: Invalid type\n" + STRING_UNSUPPORTED_TYPE, "Error: Unsupported type\n" + STRING_NOT_INT_OR_NEG, "Error: This type requires /d to be a positive number\n" } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 57e0108..b2894d6 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -183,11 +183,11 @@ static void test_add(void) /* REG_EXPAND_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, TODO_REG_SIZE); + verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, TODO_REG_SIZE); + verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -195,11 +195,11 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, TODO_REG_SIZE); + verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0); /* REG_BINARY */ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); @@ -209,14 +209,14 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 0xefbeadde; - verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), TODO_REG_SIZE); + verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin2 /f /d x01", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin3 /f /d 01x", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -230,8 +230,8 @@ static void test_add(void) err = RegQueryValueExA(hkey, "bin4", NULL, &type, (void *) (buffer+12), &size); ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_BINARY, "got wrong type %u\n", type); - todo_wine ok(size == 6, "got wrong size %u\n", size); - todo_wine ok(memcmp(buffer, buffer+12, 6) == 0 || + ok(size == 6, "got wrong size %u\n", size); + ok(memcmp(buffer, buffer+12, 6) == 0 || broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r); @@ -252,11 +252,11 @@ static void test_add(void) todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -270,22 +270,21 @@ static void test_add(void) ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD); ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD)); - todo_wine ok(dword == 123 || broken(dword == 0123 /* WinXP */), + ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected %d\n", dword, 123); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); dword = 0xdeadbeef; - verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), - (sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA); + verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); /* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r); @@ -297,7 +296,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 456; - verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), TODO_REG_SIZE); + verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0); /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like * an ordinary REG_DWORD - that is little endian. GG */ @@ -305,15 +304,15 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); memcpy(buffer, "three\0little\0strings\0", 22); - verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -321,7 +320,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, TODO_REG_SIZE); + verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); @@ -330,16 +329,16 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); buffer[0]='a'; buffer[1]=0; buffer[2]=0; - verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, TODO_REG_SIZE); + verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, 0); RegCloseKey(hkey); -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:41 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:41 +0100 Subject: [PATCH 7/8] reg: Clean up reg_add In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-7-git-send-email-jnvsor@gmail.com> You'll notice that bad value input leaves a zombie key after this call, but this is consistant with native. --- programs/reg/reg.c | 92 ++++++++++++++++++++++++++---------------------- programs/reg/tests/reg.c | 22 ++++++------ 2 files changed, 60 insertions(+), 54 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 0c51f8b..2d46d21 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -353,71 +353,70 @@ static LSTATUS sane_path(const WCHAR *key) return ERROR_SUCCESS; } -static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) +static int reg_add( const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const WCHAR *type, const WCHAR separator, const WCHAR *data, + const BOOL force) { - static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', - ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - HKEY subkey; - LONG err; - - reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - - err = sane_path(key_name); + HKEY key = NULL; + LONG err = sane_path(key_name); if (err != ERROR_SUCCESS) + goto error; + + if (value_name && value_empty) { - reg_print_error(err); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } - err = path_open(key_name, &subkey, TRUE); + err = path_open(key_name, &key, TRUE); if(err != ERROR_SUCCESS) - { - reg_message(STRING_INVALID_KEY); - return 1; - } + goto error; if (value_name || data) { - DWORD reg_type; - DWORD reg_count = 0; - BYTE* reg_data = NULL; + DWORD size, reg_type; + BYTE *data_out; + + if (value_name && !value_name[0]) + value_name = NULL; - if (!force) + if (type && !type[0]) { - if (RegQueryValueW(subkey,value_name,NULL,NULL)==ERROR_SUCCESS) - { - /* FIXME: Prompt for overwrite */ - } + data = NULL; + type = NULL; } - reg_type = wchar_get_type(type); - if (reg_type == -1) + if (!force && RegQueryValueExW(key, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - RegCloseKey(subkey); - reg_print_error(ERROR_INVALID_DATATYPE); - return 1; + FIXME("Prompt for overwrite\n"); } - if (data) + reg_type = wchar_get_type(type); + if (reg_type == -1) { - err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); - if (err != ERROR_SUCCESS) - { - RegCloseKey(subkey); - reg_print_error(err); - return 1; - } + err = ERROR_INVALID_DATATYPE; + goto error; } - RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); - HeapFree(GetProcessHeap(),0,reg_data); + err = wchar_get_data(data, reg_type, separator, &size, &data_out); + if (err != ERROR_SUCCESS) + goto error; + + err = RegSetValueExW(key, value_name, 0, reg_type, data_out, size); + HeapFree(GetProcessHeap(), 0, data_out); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); - return 0; + +error: + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, @@ -597,7 +596,14 @@ int wmain(int argc, WCHAR *argvW[]) else if (!lstrcmpiW(argvW[i], slashTW)) type = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashSW)) - separator = argvW[++i][0]; + { + if (!argvW[++i][0] || argvW[i][1]) + { + reg_print_error(ERROR_BAD_COMMAND); + return 1; + } + separator = argvW[i][0]; + } else if (!lstrcmpiW(argvW[i], slashDW)) data = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashFW)) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index b2894d6..3e4454e 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -110,12 +110,12 @@ static void test_add(void) /* Test empty type */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r); - todo_wine ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), + ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %u\n", r); if (r == REG_EXIT_SUCCESS) - todo_wine verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); + verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); else - todo_wine win_skip("broken reg.exe detected\n"); + win_skip("broken reg.exe detected\n"); /* Test input key formats */ run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); @@ -166,7 +166,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v test /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test", REG_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -174,7 +174,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test2", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test2", REG_SZ, "", 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -191,7 +191,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -249,7 +249,7 @@ static void test_add(void) win_skip("broken reg.exe detected\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -316,18 +316,18 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); -- 2.1.1 From jnvsor at gmail.com Thu Nov 6 15:17:42 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Thu, 6 Nov 2014 22:17:42 +0100 Subject: [PATCH 8/8] reg: Clean up reg_delete In-Reply-To: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> References: <1415308662-32675-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415308662-32675-8-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 150 +++++++++++++++++++++++------------------------ programs/reg/tests/reg.c | 2 +- 2 files changed, 74 insertions(+), 78 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 2d46d21..2bcdd48 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -419,120 +419,116 @@ error: return 1; } -static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - BOOL value_all, BOOL force) +static int reg_delete(const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const BOOL value_all, const BOOL force) { - HKEY subkey; - LONG err; - - static const WCHAR stubW[] = {'D','E','L','E','T','E', - ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' - ,0}; - reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - - err = sane_path(key_name); + HKEY key = NULL; + LONG err = sane_path(key_name); if (err != ERROR_SUCCESS) { reg_print_error(err); return 1; } - err = path_open(key_name, &subkey, FALSE); + err = path_open(key_name, &key, FALSE); if (err != ERROR_SUCCESS) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - - if (value_name && value_empty) - { - reg_message(STRING_INVALID_CMDLINE); - return 1; - } + goto error; - if (value_empty && value_all) + /* Mutually exclusive options */ + if ((!!value_name + !!value_empty + !!value_all) > 1) { - reg_message(STRING_INVALID_CMDLINE); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } if (!force) { - /* FIXME: Prompt for delete */ + FIXME("Prompt for delete\n"); } - /* Delete subtree only if no /v* option is given */ - if (!value_name && !value_empty && !value_all) + if (value_empty || value_name) { - err = RegDeleteTreeA(subkey, NULL); - if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } + if (value_name && value_name[0]) + err = RegDeleteValueW(key, value_name); + else + err = RegDeleteValueW(key, NULL); - err = RegDeleteKeyA(subkey, ""); if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } - reg_message(STRING_SUCCESS); - return 0; + goto error; } - - if (value_all) + else if (value_all) { - LPWSTR szValue; - DWORD maxValue; - DWORD count; - LONG rc; - - rc = RegQueryInfoKeyW(subkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &maxValue, NULL, NULL, NULL); - if (rc != ERROR_SUCCESS) - { - /* FIXME: failure */ - RegCloseKey(subkey); - return 1; - } - maxValue++; - szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR)); + WCHAR *enum_v_name; + DWORD count, max_size, this_size, i = 0, errors = 0; + + err = RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, NULL, NULL, + &count, &max_size, NULL, NULL, NULL); + if (err != ERROR_SUCCESS) + goto error; - while (1) + enum_v_name = HeapAlloc(GetProcessHeap(), 0, ++max_size * sizeof(WCHAR)); + + while (i < count) { - count = maxValue; - rc = RegEnumValueW(subkey, 0, szValue, &count, NULL, NULL, NULL, NULL); - if (rc == ERROR_SUCCESS) + this_size = max_size; + + err = RegEnumValueW(key, i, enum_v_name, &this_size, NULL, NULL, NULL, NULL); + if (err != ERROR_SUCCESS) { - rc = RegDeleteValueW(subkey, szValue); - if (rc != ERROR_SUCCESS) - break; + i++; + errors++; + reg_print_error(err); + continue; } - else break; + + err = RegDeleteValueW(key, enum_v_name); + if (err != ERROR_SUCCESS) + { + i++; + errors++; + reg_print_error(err); + continue; + } + + count--; } - if (rc != ERROR_SUCCESS) + + HeapFree(GetProcessHeap(), 0, enum_v_name); + + if (errors) { - /* FIXME delete failed */ + RegCloseKey(key); + return 1; } } - else if (value_name) + /* Delete subtree only if no /v* option is given */ + else { - if (RegDeleteValueW(subkey,value_name) != ERROR_SUCCESS) + if (key == path_get_rootkey(key_name)) { - RegCloseKey(subkey); - reg_message(STRING_CANNOT_FIND); + /* "This works well enough on native to make you regret you pressed enter" - stefand */ + FIXME("Trying to delete a root key is a bad idea.\n"); + RegCloseKey(key); return 1; } - } - else if (value_empty) - { - RegSetValueExW(subkey,NULL,0,REG_SZ,NULL,0); + + err = RegDeleteTreeA(key, NULL); + if (err != ERROR_SUCCESS) + goto error; + err = RegDeleteKeyA(key, ""); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); return 0; + +error: + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 3e4454e..d08a9c2 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -380,7 +380,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); - todo_wine ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); -- 2.1.1 From stefan at codeweavers.com Thu Nov 6 16:47:19 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 6 Nov 2014 23:47:19 +0100 Subject: [PATCH 1/4] d3d9/tests: The device restores the mode settings from the registry (v4). Message-ID: <1415314042-10250-1-git-send-email-stefan@codeweavers.com> v4: Test width and height in the same ok statement to prevent accidental successes inside todo_wine when switching from e.g. 1920x1080 to 1920x1200. Version 3: Simplify the mode selection code and hardcode D3DFMT_X8R8G8B8. Retain the test for mode reset when the device was originally created with the registry size. Version 2: Make sure the mode set with ChangeDisplaySettings is bigger than the device's mode. Otherwise Windows shrinks the window to the new mode + 12 pixels. Testing this behavior is not the purpose of this test. Implementing this behavior is complicated because ddraw destroys and recreates swapchains in SetCooperativeLevel. --- dlls/d3d9/tests/device.c | 152 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 116 insertions(+), 36 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 05585fd..d3618e2 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3900,56 +3900,115 @@ done: static void test_mode_change(void) { - RECT fullscreen_rect, focus_rect, r; + RECT d3d_rect, focus_rect, r; struct device_desc device_desc; IDirect3DSurface9 *backbuffer; IDirect3DDevice9 *device; D3DSURFACE_DESC desc; IDirect3D9 *d3d9; DEVMODEW devmode; - UINT refcount; + ULONG refcount; + UINT adapter_mode_count, i; HRESULT hr; DWORD ret; + LONG change_ret; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; - focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + adapter_mode_count = IDirect3D9_GetAdapterModeCount(d3d9, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D9_EnumAdapterModes(d3d9, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D9_Release(d3d9); + return; + } + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + + SetRect(&d3d_rect, 0, 0, d3d_width, d3d_height); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d9, focus_window, &device_desc))) { skip("Failed to create a D3D device, skipping tests.\n"); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); goto done; } - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; - devmode.dmPelsWidth = 640; - devmode.dmPelsHeight = 480; - - ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); - ok(ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", ret); + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == 640, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == 480, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == user32_width && devmode.dmPelsHeight == user32_height, + "Expected resolution %ux%u, got %ux%u.\n", + user32_width, user32_height, devmode.dmPelsWidth, devmode.dmPelsHeight); GetWindowRect(device_window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, &d3d_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + d3d_rect.left, d3d_rect.top, d3d_rect.right, d3d_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(focus_window, &r); ok(EqualRect(&r, &focus_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", @@ -3960,31 +4019,52 @@ static void test_mode_change(void) ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DSurface9_GetDesc(backbuffer, &desc); ok(SUCCEEDED(hr), "Failed to get backbuffer desc, hr %#x.\n", hr); - ok(desc.Width == registry_mode.dmPelsWidth, "Got unexpected backbuffer width %u.\n", desc.Width); - ok(desc.Height == registry_mode.dmPelsHeight, "Got unexpected backbuffer height %u.\n", desc.Height); + ok(desc.Width == d3d_width, "Got unexpected backbuffer width %u, expected %u.\n", + desc.Width, d3d_width); + ok(desc.Height == d3d_height, "Got unexpected backbuffer height %u, expected %u.\n", + desc.Height, d3d_height); IDirect3DSurface9_Release(backbuffer); refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, devmode.dmPelsWidth, devmode.dmPelsHeight); + + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + /* The mode restore also happens when the device was created at the original screen size. */ + + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + ok(!!(device = create_device(d3d9, focus_window, &device_desc)), "Failed to create a D3D device.\n"); + + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, devmode.dmPelsWidth, devmode.dmPelsHeight); done: DestroyWindow(device_window); DestroyWindow(focus_window); IDirect3D9_Release(d3d9); - - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); - ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); } static void test_device_window_reset(void) -- 2.0.4 From stefan at codeweavers.com Thu Nov 6 16:47:20 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 6 Nov 2014 23:47:20 +0100 Subject: [PATCH 2/4] d3d8/tests: The device restores the mode settings from the registry (v5). Message-ID: <1415314042-10250-2-git-send-email-stefan@codeweavers.com> v5: Test width and height in the same ok statement to prevent accidental successes inside todo_wine when switching from e.g. 1920x1080 to 1920x1200. v4: Simplify the mode selection code and (via previous patch) use EnumDisplaySettingsW(ENUM_REGISTRY_SETTINGS) instead of GetSystemMetrics(SM_C?SCREEN). Retain the test for mode reset when the device was originally created with the registry size. v3: Make the window visible. This works around the failure of 107263 on the W8 testbot. The testbot failure (device::release does not restore the mode) happens on Vista too. This problem only happens if the application is not in foreground *and* the windows are hidden. If the application is in foreground, the device properly restores the mode even with (manually) hidden windows. This is a preexisting condition, see the failure in line 3051 here: http://test.winehq.org/data/4bb80afedcca6bdc510574488258ef1a16e4167f/win8_newtb-w8/d3d8:device.html This patch changes the previous resolution, thus the testbot did not filter it out. --- dlls/d3d8/tests/device.c | 158 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 121 insertions(+), 37 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 46918e8..9153139 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2982,56 +2982,119 @@ static void test_unsupported_shaders(void) static void test_mode_change(void) { - RECT fullscreen_rect, focus_rect, r; + RECT d3d_rect, focus_rect, r; struct device_desc device_desc; IDirect3DSurface8 *backbuffer; IDirect3DDevice8 *device; D3DSURFACE_DESC desc; IDirect3D8 *d3d8; DEVMODEW devmode; - UINT refcount; + ULONG refcount; + UINT adapter_mode_count, i; HRESULT hr; - DWORD ret; + BOOL ret; + LONG change_ret; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; - focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); - device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, - 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + adapter_mode_count = IDirect3D8_GetAdapterModeCount(d3d8, D3DADAPTER_DEFAULT); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D8_EnumAdapterModes(d3d8, D3DADAPTER_DEFAULT, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Format != D3DFMT_X8R8G8B8) + continue; + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D8_Release(d3d8); + return; + } + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + /* Make the windows visible, otherwise device::release does not restore the mode if + * the application is not in foreground like on the testbot. */ + focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, user32_width / 2, user32_height / 2, 0, 0, 0, 0); + + SetRect(&d3d_rect, 0, 0, d3d_width, d3d_height); GetWindowRect(focus_window, &focus_rect); device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { skip("Failed to create a D3D device, skipping tests.\n"); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); goto done; } - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; - devmode.dmPelsWidth = 640; - devmode.dmPelsHeight = 480; - - ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); - ok(ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", ret); + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == 640, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == 480, "Got unexpect height %u.\n", devmode.dmPelsHeight); + ok(devmode.dmPelsWidth == user32_width && devmode.dmPelsHeight == user32_height, + "Expected resolution %ux%u, got %ux%u.\n", + user32_width, user32_height, devmode.dmPelsWidth, devmode.dmPelsHeight); GetWindowRect(device_window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, &d3d_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + d3d_rect.left, d3d_rect.top, d3d_rect.right, d3d_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(focus_window, &r); ok(EqualRect(&r, &focus_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", @@ -3042,31 +3105,52 @@ static void test_mode_change(void) ok(SUCCEEDED(hr), "Failed to get backbuffer, hr %#x.\n", hr); hr = IDirect3DSurface8_GetDesc(backbuffer, &desc); ok(SUCCEEDED(hr), "Failed to get backbuffer desc, hr %#x.\n", hr); - ok(desc.Width == registry_mode.dmPelsWidth, "Got unexpected backbuffer width %u.\n", desc.Width); - ok(desc.Height == registry_mode.dmPelsHeight, "Got unexpected backbuffer height %u.\n", desc.Height); + ok(desc.Width == d3d_width, "Got unexpected backbuffer width %u, expected %u.\n", + desc.Width, d3d_width); + ok(desc.Height == d3d_height, "Got unexpected backbuffer height %u, expected %u.\n", + desc.Height, d3d_height); IDirect3DSurface8_Release(backbuffer); refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, devmode.dmPelsWidth, devmode.dmPelsHeight); + + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + /* The mode restore also happens when the device was created at the original screen size. */ + + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + ok(!!(device = create_device(d3d8, focus_window, &device_desc)), "Failed to create a D3D device.\n"); + + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, devmode.dmPelsWidth, devmode.dmPelsHeight); done: DestroyWindow(device_window); DestroyWindow(focus_window); IDirect3D8_Release(d3d8); - - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); - ok(ret, "Failed to get display mode.\n"); - ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); - ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); } static void test_device_window_reset(void) -- 2.0.4 From stefan at codeweavers.com Thu Nov 6 16:47:21 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 6 Nov 2014 23:47:21 +0100 Subject: [PATCH 3/4] ddraw/tests: Check if the current display settings match the registry settings. Message-ID: <1415314042-10250-3-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 68 ++++++++++++++++++++++++++++------------------- dlls/ddraw/tests/ddraw2.c | 68 ++++++++++++++++++++++++++++------------------- dlls/ddraw/tests/ddraw4.c | 68 ++++++++++++++++++++++++++++------------------- dlls/ddraw/tests/ddraw7.c | 67 +++++++++++++++++++++++++++------------------- 4 files changed, 159 insertions(+), 112 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 742d82c..fe8a36e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -21,6 +21,8 @@ #include "wine/test.h" #include "d3d.h" +static DEVMODEW registry_mode; + struct create_window_thread_param { HWND window; @@ -2007,7 +2009,7 @@ static void test_window_style(void) style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2137,7 +2139,7 @@ static void test_coop_level_mode_set(void) window = CreateWindowA("ddraw_test_wndproc_wc", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&s, 0, 0, 640, 480); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -2559,7 +2561,7 @@ done: static void test_coop_level_mode_set_multi(void) { IDirectDraw *ddraw1, *ddraw2; - UINT orig_w, orig_h, w, h; + UINT w, h; HWND window; HRESULT hr; ULONG ref; @@ -2569,9 +2571,6 @@ static void test_coop_level_mode_set_multi(void) 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 = set_display_mode(ddraw1, 800, 600); @@ -2591,9 +2590,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ @@ -2616,16 +2615,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Regardless of release ordering. */ ddraw1 = create_ddraw(); @@ -2647,16 +2646,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); @@ -2678,9 +2677,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ @@ -2713,9 +2712,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); @@ -2736,16 +2735,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); DestroyWindow(window); } @@ -4217,8 +4216,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface2, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -4226,8 +4225,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface3, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5635,6 +5634,7 @@ static void test_surface_desc_lock(void) START_TEST(ddraw1) { IDirectDraw *ddraw; + DEVMODEW current_mode; if (!(ddraw = create_ddraw())) { @@ -5643,6 +5643,18 @@ START_TEST(ddraw1) } IDirectDraw_Release(ddraw); + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (registry_mode.dmPelsWidth != current_mode.dmPelsWidth + || registry_mode.dmPelsHeight != current_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } + test_coop_level_create_device_window(); test_clipper_blt(); test_coop_level_d3d_state(); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index c5a8393..607f14c 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -21,6 +21,8 @@ #include "wine/test.h" #include "d3d.h" +static DEVMODEW registry_mode; + struct create_window_thread_param { HWND window; @@ -2195,7 +2197,7 @@ static void test_window_style(void) style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2341,7 +2343,7 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&s, 0, 0, 640, 480); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -2854,7 +2856,7 @@ done: static void test_coop_level_mode_set_multi(void) { IDirectDraw2 *ddraw1, *ddraw2; - UINT orig_w, orig_h, w, h; + UINT w, h; HWND window; HRESULT hr; ULONG ref; @@ -2864,9 +2866,6 @@ static void test_coop_level_mode_set_multi(void) 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 = set_display_mode(ddraw1, 800, 600); @@ -2886,9 +2885,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw2_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ @@ -2911,16 +2910,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw2_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw2_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Regardless of release ordering. */ ddraw1 = create_ddraw(); @@ -2942,16 +2941,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw2_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw2_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); @@ -2973,9 +2972,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw2_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ @@ -3008,9 +3007,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw2_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); @@ -3031,16 +3030,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw2_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw2_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); DestroyWindow(window); } @@ -5293,8 +5292,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface2, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5302,8 +5301,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface3, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -6711,6 +6710,7 @@ static void test_surface_desc_lock(void) START_TEST(ddraw2) { IDirectDraw2 *ddraw; + DEVMODEW current_mode; if (!(ddraw = create_ddraw())) { @@ -6719,6 +6719,18 @@ START_TEST(ddraw2) } IDirectDraw2_Release(ddraw); + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (registry_mode.dmPelsWidth != current_mode.dmPelsWidth + || registry_mode.dmPelsHeight != current_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } + test_coop_level_create_device_window(); test_clipper_blt(); test_coop_level_d3d_state(); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 009ac6f..1224698 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -22,6 +22,8 @@ #include #include "d3d.h" +static DEVMODEW registry_mode; + struct vec2 { float x, y; @@ -2382,7 +2384,7 @@ static void test_window_style(void) style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2528,7 +2530,7 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&s, 0, 0, 640, 480); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -3033,7 +3035,7 @@ static void test_coop_level_mode_set(void) static void test_coop_level_mode_set_multi(void) { IDirectDraw4 *ddraw1, *ddraw2; - UINT orig_w, orig_h, w, h; + UINT w, h; HWND window; HRESULT hr; ULONG ref; @@ -3043,9 +3045,6 @@ static void test_coop_level_mode_set_multi(void) 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 = set_display_mode(ddraw1, 800, 600); @@ -3058,9 +3057,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw4_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ @@ -3083,16 +3082,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw4_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw4_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Regardless of release ordering. */ ddraw1 = create_ddraw(); @@ -3114,16 +3113,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw4_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw4_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); @@ -3145,9 +3144,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw4_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ @@ -3180,9 +3179,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw4_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); @@ -3203,16 +3202,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw4_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw4_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); DestroyWindow(window); } @@ -6075,8 +6074,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface2, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -6084,8 +6083,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface3, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -7786,6 +7785,7 @@ static void test_surface_desc_lock(void) START_TEST(ddraw4) { IDirectDraw4 *ddraw; + DEVMODEW current_mode; if (!(ddraw = create_ddraw())) { @@ -7794,6 +7794,18 @@ START_TEST(ddraw4) } IDirectDraw4_Release(ddraw); + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (registry_mode.dmPelsWidth != current_mode.dmPelsWidth + || registry_mode.dmPelsHeight != current_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } + test_process_vertices(); test_coop_level_create_device_window(); test_clipper_blt(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ec50fb8..282432f 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -23,6 +23,7 @@ #include "d3d.h" static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *guid, void **ddraw, REFIID iid, IUnknown *outer_unknown); +static DEVMODEW registry_mode; struct vec2 { @@ -2061,7 +2062,7 @@ static void test_window_style(void) style = GetWindowLongA(window, GWL_STYLE); exstyle = GetWindowLongA(window, GWL_EXSTYLE); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2206,7 +2207,7 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN)); + SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&s, 0, 0, 640, 480); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); @@ -2711,7 +2712,7 @@ static void test_coop_level_mode_set(void) static void test_coop_level_mode_set_multi(void) { IDirectDraw7 *ddraw1, *ddraw2; - UINT orig_w, orig_h, w, h; + UINT w, h; HWND window; HRESULT hr; ULONG ref; @@ -2721,9 +2722,6 @@ static void test_coop_level_mode_set_multi(void) 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 = set_display_mode(ddraw1, 800, 600); @@ -2736,9 +2734,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw7_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ @@ -2761,16 +2759,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw7_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw7_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Regardless of release ordering. */ ddraw1 = create_ddraw(); @@ -2792,16 +2790,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw7_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw7_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); @@ -2823,9 +2821,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw7_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ @@ -2858,9 +2856,9 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw7_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); @@ -2881,16 +2879,16 @@ static void test_coop_level_mode_set_multi(void) ref = IDirectDraw7_Release(ddraw1); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); ref = IDirectDraw7_Release(ddraw2); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); w = GetSystemMetrics(SM_CXSCREEN); - ok(w == orig_w, "Got unexpected screen width %u.\n", w); + ok(w == registry_mode.dmPelsWidth, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); - ok(h == orig_h, "Got unexpected screen height %u.\n", h); + ok(h == registry_mode.dmPelsHeight, "Got unexpected screen height %u.\n", h); DestroyWindow(window); } @@ -5913,8 +5911,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface2, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -5922,8 +5920,8 @@ static void test_surface_attachment(void) surface_desc.dwSize = sizeof(surface_desc); surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - surface_desc.dwWidth = GetSystemMetrics(SM_CXSCREEN); - surface_desc.dwHeight = GetSystemMetrics(SM_CYSCREEN); + surface_desc.dwWidth = registry_mode.dmPelsWidth; + surface_desc.dwHeight = registry_mode.dmPelsHeight; hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface3, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); @@ -7630,6 +7628,7 @@ START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); IDirectDraw7 *ddraw; + DEVMODEW current_mode; if (!(pDirectDrawCreateEx = (void *)GetProcAddress(module, "DirectDrawCreateEx"))) { @@ -7644,6 +7643,18 @@ START_TEST(ddraw7) } IDirectDraw7_Release(ddraw); + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, ¤t_mode), "Failed to get display mode.\n"); + registry_mode.dmSize = sizeof(registry_mode); + ok(EnumDisplaySettingsW(NULL, ENUM_REGISTRY_SETTINGS, ®istry_mode), "Failed to get display mode.\n"); + if (registry_mode.dmPelsWidth != current_mode.dmPelsWidth + || registry_mode.dmPelsHeight != current_mode.dmPelsHeight) + { + skip("Current mode does not match registry mode, skipping test.\n"); + return; + } + test_process_vertices(); test_coop_level_create_device_window(); test_clipper_blt(); -- 2.0.4 From stefan at codeweavers.com Thu Nov 6 16:47:22 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 6 Nov 2014 23:47:22 +0100 Subject: [PATCH 4/4] ddraw/tests: Fix some COM macro versions in test_coop_level_mode_set. Message-ID: <1415314042-10250-4-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw2.c | 6 +++--- dlls/ddraw/tests/ddraw4.c | 20 ++++++++++---------- dlls/ddraw/tests/ddraw7.c | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 607f14c..ad0d040 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2424,7 +2424,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2682,7 +2682,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2786,7 +2786,7 @@ static void test_coop_level_mode_set(void) s.bottom - s.top, ddsd.dwHeight); IDirectDrawSurface_Release(primary); - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); /* If the window is changed at the same time, messages are sent to the new window. */ diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1224698..69f3ac7 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2611,7 +2611,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2736,7 +2736,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2862,7 +2862,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2934,13 +2934,13 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &primary, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); - hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); + hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); - IDirectDrawSurface_Release(primary); + IDirectDrawSurface4_Release(primary); /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | DDSCL_FULLSCREEN); @@ -2958,15 +2958,15 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &primary, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); - hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); + hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", s.right - s.left, ddsd.dwWidth); ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", s.bottom - s.top, ddsd.dwHeight); - IDirectDrawSurface_Release(primary); + IDirectDrawSurface4_Release(primary); - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); /* If the window is changed at the same time, messages are sent to the new window. */ @@ -3009,13 +3009,13 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &primary, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); - hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); + hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); - IDirectDrawSurface_Release(primary); + IDirectDrawSurface4_Release(primary); ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 282432f..3aebfa7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2288,7 +2288,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2539,7 +2539,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); @@ -2643,7 +2643,7 @@ static void test_coop_level_mode_set(void) s.bottom - s.top, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); - hr = IDirectDraw_RestoreDisplayMode(ddraw); + hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); /* If the window is changed at the same time, messages are sent to the new window. */ -- 2.0.4 From mengshuaicalendr at gmail.com Thu Nov 6 21:36:58 2014 From: mengshuaicalendr at gmail.com (Shuai Meng) Date: Fri, 07 Nov 2014 11:36:58 +0800 Subject: [PATCH] vbscript: Implemented String(try 3) Message-ID: <545C3E5A.1050601@gmail.com> testbot: https://newtestbot.winehq.org/JobDetails.pl?Key=10093 Change log: used mod other than division when the second argument(length of string) is grater than 256; removed the judgment of string length when error number is 14(i.e. VBSE_OUT_OF_STRING_SPACE) removed some related tests. --- dlls/vbscript/global.c | 63 +++++++++++++++++++++++++++++++++++++++++++-- dlls/vbscript/tests/api.vbs | 53 ++++++++++++++++++++++++++++++++++++++ dlls/vbscript/vbscript.h | 1 + 3 files changed, 115 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-vbscript-Implemented-String.txt Type: text/x-patch Size: 6334 bytes Desc: not available URL: From hellas at burntcomma.com Thu Nov 6 22:06:55 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 04:06:55 +0000 Subject: [PATCH] winealsa: fix input sound distortion and heap corruption Message-ID: <545C455F.1050201@burntcomma.com> At present, winealsa attempts to call map_channels when a capture device is opened. If a microphone can be opened in either stereo or mono mode, and mono is requested, Wine will still return stereo data. Not only does this result in distorted in audio, it also very frequently results in heap corruption when snd_pcm_readi overruns the buffer allocated by the program. I don't have a copy of World of Warcraft to test this on, but this may also fix bug 31684. It's the same symptoms, at least. --- dlls/winealsa.drv/mmdevdrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index a4c02bf..91fba2f 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -1164,7 +1164,7 @@ static DWORD get_channel_mask(unsigned int channels) static HRESULT map_channels(ACImpl *This, const WAVEFORMATEX *fmt) { - if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE || fmt->nChannels > 2){ + if( (This->dataflow != eCapture && fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE) || fmt->nChannels > 2){ WAVEFORMATEXTENSIBLE *fmtex = (void*)fmt; DWORD mask, flag = SPEAKER_FRONT_LEFT; UINT i = 0; -- 2.0.4 From sebastian at fds-team.de Thu Nov 6 22:44:13 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 07 Nov 2014 05:44:13 +0100 Subject: ntoskrnl.exe: Fix incorrect interpretation of SIB byte when parsing x86 opcode. Message-ID: <545C4E1D.6070503@fds-team.de> I hope this issue is obvious enough without writing tests for that. ;) Layout of the SIB byte should be: * bits 0-2 base * bits 3-5 index * bits 6-7 scale The current incorrect implementation has the effect, that when the scale bits are set, the index is not recognized anymore. --- dlls/ntoskrnl.exe/instr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ntoskrnl.exe-Fix-incorrect-interpretation-of-SIB-byt.patch Type: text/x-patch Size: 864 bytes Desc: not available URL: From sebastian at fds-team.de Thu Nov 6 22:44:17 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 07 Nov 2014 05:44:17 +0100 Subject: krnl386.exe16: Fix incorrect interpretation of SIB byte when parsing x86 opcode. Message-ID: <545C4E21.8060505@fds-team.de> Same issue as in ntoskrnl.exe. --- dlls/krnl386.exe16/instr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-krnl386.exe16-Fix-incorrect-interpretation-of-SIB-by.patch Type: text/x-patch Size: 870 bytes Desc: not available URL: From alexhenrie24 at gmail.com Fri Nov 7 00:32:01 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Thu, 6 Nov 2014 23:32:01 -0700 Subject: [PATCH 1/2] kernel32/tests: Add UTF-7 stray + sign removal tests. Message-ID: <1415341922-1495-1-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 147989b..401df3c 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -527,6 +527,73 @@ static void test_utf7_encoding(void) } } +static void test_utf7_decoding(void) +{ + char input[32]; + WCHAR output[32], expected[32]; + int i, len, expected_len; + + static const char base64_decoding_table[] = + { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x00-0x0F */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* 0x10-0x1F */ + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, /* 0x20-0x2F */ + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, /* 0x30-0x3F */ + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, /* 0x40-0x4F */ + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, /* 0x50-0x5F */ + -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, /* 0x60-0x6F */ + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1 /* 0x70-0x7F */ + }; + + if (MultiByteToWideChar(CP_UTF7, 0, "foobar", -1, NULL, 0) == 0 && + GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + skip("UTF-7 decoding not implemented\n"); + return; + } + + /* test which one-byte characters remove stray + signs */ + for (i = 0; i < 256; i++) + { + sprintf(input, "+%c+AAA", i); + + memset(output, 0x23, sizeof(output) - sizeof(WCHAR)); + output[sizeof(output) / sizeof(WCHAR) - 1] = 0; + + len = MultiByteToWideChar(CP_UTF7, 0, input, 7, output, sizeof(output) / sizeof(WCHAR) - 1); + + if (i == '-') + { + /* removes the - sign */ + expected_len = 3; + expected[0] = 0x002B; + expected[1] = 0; + expected[2] = 0; + } + else if (i <= 0x7F && base64_decoding_table[i] != -1) + { + /* absorbs the character into the base64 sequence */ + expected_len = 2; + expected[0] = (base64_decoding_table[i] << 10) | 0x03E0; + expected[1] = 0; + } + else + { + /* removes the + sign */ + expected_len = 3; + expected[0] = i; + expected[1] = 0; + expected[2] = 0; + } + expected[expected_len] = 0x2323; + + ok(len == expected_len, "i=0x%02x: expected len=%i, got len=%i\n", i, expected_len, len); + ok(memcmp(output, expected, (expected_len + 1) * sizeof(WCHAR)) == 0, + "i=0x%02x: expected output=%s, got output=%s\n", + i, wine_dbgstr_wn(expected, expected_len + 1), wine_dbgstr_wn(output, expected_len + 1)); + } +} + static void test_undefined_byte_char(void) { static const struct tag_testset { @@ -734,6 +801,7 @@ START_TEST(codepage) test_string_conversion(&bUsedDefaultChar); test_utf7_encoding(); + test_utf7_decoding(); test_undefined_byte_char(); test_threadcp(); -- 2.1.3 From alexhenrie24 at gmail.com Fri Nov 7 00:32:02 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Thu, 6 Nov 2014 23:32:02 -0700 Subject: [PATCH 2/2] kernel32/tests: Add UTF-7 implicit termination tests. In-Reply-To: <1415341922-1495-1-git-send-email-alexhenrie24@gmail.com> References: <1415341922-1495-1-git-send-email-alexhenrie24@gmail.com> Message-ID: <1415341922-1495-2-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 401df3c..71d2ced 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -592,6 +592,59 @@ static void test_utf7_decoding(void) "i=0x%02x: expected output=%s, got output=%s\n", i, wine_dbgstr_wn(expected, expected_len + 1), wine_dbgstr_wn(output, expected_len + 1)); } + + /* test which one-byte characters terminate a sequence + * also test whether the unfinished byte pair is discarded or not */ + for (i = 0; i < 256; i++) + { + sprintf(input, "+B%c+AAA", i); + + memset(output, 0x23, sizeof(output) - sizeof(WCHAR)); + output[sizeof(output) / sizeof(WCHAR) - 1] = 0; + + len = MultiByteToWideChar(CP_UTF7, 0, input, 8, output, sizeof(output) / sizeof(WCHAR) - 1); + + if (i == '-') + { + /* explicitly terminates */ + expected_len = 2; + expected[0] = 0; + expected[1] = 0; + } + else if (i <= 0x7F) + { + if (base64_decoding_table[i] != -1) + { + /* absorbs the character into the base64 sequence */ + expected_len = 3; + expected[0] = 0x0400 | (base64_decoding_table[i] << 4) | 0x000F; + expected[1] = 0x8000; + expected[2] = 0; + } + else + { + /* implicitly terminates and discards the unfinished byte pair */ + expected_len = 3; + expected[0] = i; + expected[1] = 0; + expected[2] = 0; + } + } + else + { + /* implicitly terminates but does not the discard unfinished byte pair */ + expected_len = 3; + expected[0] = i; + expected[1] = 0x0400; + expected[2] = 0; + } + expected[expected_len] = 0x2323; + + ok(len == expected_len, "i=0x%02x: expected len=%i, got len=%i\n", i, expected_len, len); + ok(memcmp(output, expected, (expected_len + 1) * sizeof(WCHAR)) == 0, + "i=0x%02x: expected output=%s, got output=%s\n", + i, wine_dbgstr_wn(expected, expected_len + 1), wine_dbgstr_wn(output, expected_len + 1)); + } } static void test_undefined_byte_char(void) -- 2.1.3 From mstefani at redhat.de Fri Nov 7 03:22:01 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Fri, 7 Nov 2014 10:22:01 +0100 Subject: shell32: Simplify check for empty string (PVS-Studio) Message-ID: <20141107092201.GA22906@redhat.com> --- dlls/shell32/shellord.c | 2 +- dlls/shell32/tests/ebrowser.c | 2 +- dlls/shell32/tests/shlfolder.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 56c9fe9..914dc5a 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -947,7 +947,7 @@ void WINAPI SHAddToRecentDocs (UINT uFlags,LPCVOID pv) /* buffer size looks good */ ptr += 12; /* get to string */ len = bufused - (ptr-buffer); /* get length of buf remaining */ - if ((lstrlenA(ptr) > 0) && (lstrlenA(ptr) <= len-1)) { + if (ptr[0] && (lstrlenA(ptr) <= len-1)) { /* appears to be good string */ lstrcpyA(old_lnk_name, link_dir); PathAppendA(old_lnk_name, ptr); diff --git a/dlls/shell32/tests/ebrowser.c b/dlls/shell32/tests/ebrowser.c index 1936cf9..4c255a1 100644 --- a/dlls/shell32/tests/ebrowser.c +++ b/dlls/shell32/tests/ebrowser.c @@ -1381,7 +1381,7 @@ static void test_navigation(void) ok(pSHCreateShellItem != NULL, "pSHCreateShellItem unexpectedly missing.\n"); GetCurrentDirectoryW(MAX_PATH, current_path); - if(!lstrlenW(current_path)) + if(!current_path[0]) { skip("Failed to create test-directory.\n"); return; diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index fc37443..1b457bb 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -81,7 +81,7 @@ static WCHAR *make_wstr(const char *str) WCHAR *ret; int len; - if(!str || strlen(str) == 0) + if (!str || !str[0]) return NULL; len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); @@ -2203,7 +2203,7 @@ static void test_SHCreateShellItem(void) return; } - if (!lstrlenA(curdirA)) + if (!curdirA[0]) { win_skip("GetCurrentDirectoryA returned empty string, skipping test_SHCreateShellItem\n"); return; @@ -2780,7 +2780,7 @@ static void test_ShellItemCompare(void) } GetCurrentDirectoryW(MAX_PATH, curdirW); - if(!lstrlenW(curdirW)) + if (!curdirW[0]) { skip("Failed to get current directory, skipping.\n"); return; @@ -4387,7 +4387,7 @@ static void test_GetUIObject(void) } GetCurrentDirectoryW(MAX_PATH, path); - if(!lstrlenW(path)) + if (!path[0]) { skip("GetCurrentDirectoryW returned an empty string.\n"); return; @@ -4989,8 +4989,8 @@ static void test_SHChangeNotify(BOOL test_new_delivery) exp_data->missing_events = exp_data->notify_count; SHChangeNotify(exp_data->signal, SHCNF_PATHA | SHCNF_FLUSH, - strlen(exp_data->path_1) > 0 ? exp_data->path_1 : NULL, - strlen(exp_data->path_2) > 0 ? exp_data->path_2 : NULL); + exp_data->path_1[0] ? exp_data->path_1 : NULL, + exp_data->path_2[0] ? exp_data->path_2 : NULL); do_events(); ok(exp_data->missing_events == 0, "%s: Expected wndproc to be called\n", exp_data->id); @@ -5045,7 +5045,7 @@ static void test_SHCreateDefaultContextMenu(void) } GetCurrentDirectoryW(MAX_PATH, path); - if(!lstrlenW(path)) + if (!path[0]) { skip("GetCurrentDirectoryW returned an empty string.\n"); return; -- 1.9.3 From nsivov at codeweavers.com Fri Nov 7 04:20:39 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 07 Nov 2014 13:20:39 +0300 Subject: [PATCH 1/4] dwrite: Implement GetMetrics() for DWRITE_FONT_METRICS1 Message-ID: <545C9CF7.9020803@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Implement-GetMetrics-for-DWRITE_FONT_METRICS1.patch Type: text/x-patch Size: 13134 bytes Desc: not available URL: From nsivov at codeweavers.com Fri Nov 7 04:21:16 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 07 Nov 2014 13:21:16 +0300 Subject: [PATCH 2/4] dwrite: Added a basic test for TryGetFontTable() Message-ID: <545C9D1C.7060407@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Added-a-basic-test-for-TryGetFontTable.patch Type: text/x-patch Size: 5727 bytes Desc: not available URL: From nsivov at codeweavers.com Fri Nov 7 04:21:32 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 07 Nov 2014 13:21:32 +0300 Subject: [PATCH 3/4] dwrite: Respond to IID_IDWriteTextLayout1 too Message-ID: <545C9D2C.6090605@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-Respond-to-IID_IDWriteTextLayout1-too.patch Type: text/x-patch Size: 3475 bytes Desc: not available URL: From nsivov at codeweavers.com Fri Nov 7 04:21:53 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 07 Nov 2014 13:21:53 +0300 Subject: [PATCH 4/4] dwrite: Implement ConvertFontToLOGFONT() Message-ID: <545C9D41.6000103@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-dwrite-Implement-ConvertFontToLOGFONT.patch Type: text/x-patch Size: 10217 bytes Desc: not available URL: From piotr at codeweavers.com Fri Nov 7 06:20:50 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Fri, 07 Nov 2014 13:20:50 +0100 Subject: msvcp110: Add codecvt::length export Message-ID: <545CB922.70404@codeweavers.com> --- dlls/msvcp110/msvcp110.spec | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcp110-Add-codecvt-length-export.txt Type: text/x-patch Size: 4414 bytes Desc: not available URL: From hellas at burntcomma.com Fri Nov 7 08:57:45 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 14:57:45 +0000 Subject: [PATCH 1/5] mmdevapi: use struct for endpoint info in GetEndpointIDs Message-ID: <545CDDE9.9030903@burntcomma.com> At present, the only information returned by GetEndpointIDs in the audio drivers is the GUID of each device, and its "id" (actually its name). This patch creates a new DeviceProps struct, and uses that to communicate the device information instead. The following patches allow drivers to additionally specify the form factor and vendor and product IDs of the device, which are used to create a fake device path. These patches are needed for the guitar cable detection in the Rocksmith games. --- dlls/mmdevapi/devenum.c | 21 +++++++++-------- dlls/mmdevapi/mmdevapi.h | 6 ++++- dlls/winealsa.drv/mmdevdrv.c | 48 +++++++++++++++++++++------------------ dlls/winecoreaudio.drv/mmdevdrv.c | 32 ++++++++++++++------------ dlls/wineoss.drv/mmdevdrv.c | 22 ++++++++++-------- 5 files changed, 73 insertions(+), 56 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mmdevapi-use-struct-for-endpoint-info-in-GetEndpoint.patch Type: text/x-patch Size: 17745 bytes Desc: not available URL: From hellas at burntcomma.com Fri Nov 7 08:58:11 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 14:58:11 +0000 Subject: [PATCH 2/5] mmdevapi: add property for device form factor Message-ID: <545CDE03.90504@burntcomma.com> --- dlls/mmdevapi/devenum.c | 5 +++++ dlls/mmdevapi/mmdevapi.h | 1 + dlls/winealsa.drv/mmdevdrv.c | 6 ++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 3 +++ dlls/wineoss.drv/mmdevdrv.c | 3 +++ 5 files changed, 18 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mmdevapi-add-property-for-device-form-factor.patch Type: text/x-patch Size: 4533 bytes Desc: not available URL: From hellas at burntcomma.com Fri Nov 7 08:58:22 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 14:58:22 +0000 Subject: [PATCH 4/5] mmdevapi: add property for device path Message-ID: <545CDE0E.4000709@burntcomma.com> --- dlls/mmdevapi/devenum.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-mmdevapi-add-property-for-device-path.patch Type: text/x-patch Size: 3849 bytes Desc: not available URL: From hellas at burntcomma.com Fri Nov 7 08:58:17 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 14:58:17 +0000 Subject: [PATCH 3/5] mmdevapi: add device path variables to DeviceProps struct Message-ID: <545CDE09.5000900@burntcomma.com> --- dlls/mmdevapi/devenum.c | 2 ++ dlls/mmdevapi/mmdevapi.h | 8 ++++++++ dlls/winealsa.drv/mmdevdrv.c | 11 +++++++++++ dlls/winecoreaudio.drv/mmdevdrv.c | 9 +++++++++ dlls/wineoss.drv/mmdevdrv.c | 9 +++++++++ 5 files changed, 39 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-mmdevapi-add-device-path-variables-to-DeviceProps-st.patch Type: text/x-patch Size: 5368 bytes Desc: not available URL: From hellas at burntcomma.com Fri Nov 7 09:13:32 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 15:13:32 +0000 Subject: [PATCH] winealsa: disable channel remapping for capture devices Message-ID: <545CE19C.1060203@burntcomma.com> This replaces the malformed previous submission: https://www.winehq.org/pipermail/wine-patches/2014-November/135456.html. --- dlls/winealsa.drv/mmdevdrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-winealsa-disable-channel-remapping-for-capture-devic.patch Type: text/x-patch Size: 623 bytes Desc: not available URL: From hellas at burntcomma.com Fri Nov 7 08:58:26 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Fri, 07 Nov 2014 14:58:26 +0000 Subject: [PATCH 5/5] winealsa: return device path information Message-ID: <545CDE12.8030507@burntcomma.com> --- dlls/winealsa.drv/mmdevdrv.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-winealsa-return-device-path-information.patch Type: text/x-patch Size: 2276 bytes Desc: not available URL: From jnvsor at gmail.com Fri Nov 7 10:29:13 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:13 +0100 Subject: [PATCH v2 1/8] reg: Add system error printing function Message-ID: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 32 ++++++++++++++++++++++++++++---- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index d299cbf..1ae5746 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -67,6 +67,30 @@ static int reg_message(int msg) return reg_printfW(formatW, msg_buffer); } +static void reg_print_error(LSTATUS error_code) +{ + switch (error_code) + { + case ERROR_SUCCESS: + return; + case ERROR_BAD_COMMAND: + reg_message(STRING_INVALID_CMDLINE); + return; + default: + { + static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; + WCHAR *message = NULL; + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, + error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *)&message, 0, NULL); + + reg_message(STRING_ERROR); + reg_printfW(error_string, error_code, message); + LocalFree(message); + return; + } + } +} + static HKEY get_rootkey(LPWSTR key) { static const WCHAR szHKLM[] = {'H','K','L','M',0}; @@ -397,7 +421,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -433,7 +457,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -464,7 +488,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -488,7 +512,7 @@ int wmain(int argc, WCHAR *argvW[]) } else { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 2221647..1c2ae83 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -30,3 +30,4 @@ #define STRING_INVALID_CMDLINE 107 #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 +#define STRING_ERROR 110 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 479912b..6183aaa 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -35,4 +35,5 @@ STRINGTABLE STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" + STRING_ERROR, "Unexpected error: " } -- 2.1.1 From jnvsor at gmail.com Fri Nov 7 10:29:14 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:14 +0100 Subject: [PATCH v2 2/8] reg: Add sane_path function to do preliniary key validation In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-2-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 25 +++++++++++++++++++++---- programs/reg/reg.rc | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) mode change 100644 => 100755 programs/reg/reg.c diff --git a/programs/reg/reg.c b/programs/reg/reg.c old mode 100644 new mode 100755 index 1ae5746..c146ce9 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,6 +20,8 @@ #include #include "reg.h" +#define ERROR_NO_REMOTE 20000 + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -76,6 +78,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_BAD_COMMAND: reg_message(STRING_INVALID_CMDLINE); return; + case ERROR_NO_REMOTE: + reg_message(STRING_NO_REMOTE); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -187,6 +192,14 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r return out_data; } +static LSTATUS sane_path(const WCHAR *key) +{ + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') + return ERROR_NO_REMOTE; + + return ERROR_SUCCESS; +} + static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) { @@ -194,12 +207,14 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; LPWSTR p; HKEY root,subkey; + LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - if (key_name[0]=='\\' && key_name[1]=='\\') + err = sane_path(key_name); + if (err != ERROR_SUCCESS) { - reg_message(STRING_NO_REMOTE); + reg_print_error(err); return 1; } @@ -264,15 +279,17 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, { LPWSTR p; HKEY root,subkey; + LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' ,0}; reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - if (key_name[0]=='\\' && key_name[1]=='\\') + err = sane_path(key_name); + if (err != ERROR_SUCCESS) { - reg_message(STRING_NO_REMOTE); + reg_print_error(err); return 1; } diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 6183aaa..5fc5a76 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -33,7 +33,7 @@ STRINGTABLE STRING_SUCCESS, "The operation completed successfully\n" STRING_INVALID_KEY, "Error: Invalid key name\n" STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" - STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" + STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " } -- 2.1.1 From jnvsor at gmail.com Fri Nov 7 10:29:15 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:15 +0100 Subject: [PATCH v2 3/8] reg: Add check for multiple backslashes at the end of the key In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-3-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 8 ++++++++ programs/reg/tests/reg.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index c146ce9..ff12b3f 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -78,6 +78,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_BAD_COMMAND: reg_message(STRING_INVALID_CMDLINE); return; + case ERROR_INVALID_HANDLE: + reg_message(STRING_INVALID_KEY); + return; case ERROR_NO_REMOTE: reg_message(STRING_NO_REMOTE); return; @@ -194,6 +197,11 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r static LSTATUS sane_path(const WCHAR *key) { + int i = strlenW(key); + + if (i < 3 || (key[i - 1] == '\\' && key[i - 2] == '\\')) + return ERROR_INVALID_HANDLE; + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') return ERROR_NO_REMOTE; diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index f93df55..57e0108 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -129,10 +129,10 @@ static void test_add(void) ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2"); - todo_wine ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), + ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); -- 2.1.1 From jnvsor at gmail.com Fri Nov 7 10:29:17 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:17 +0100 Subject: [PATCH v2 5/8] reg: Add wchar/type conversion functions In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-5-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 77 +++++++++++++++++++++++++++++++++++++---------------- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 56 insertions(+), 23 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 12bb495..72add9b 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -50,6 +50,44 @@ root_rels[] = {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, }; +static const WCHAR type_none[] = {'R','E','G','_','N','O','N','E',0}; +static const WCHAR type_sz[] = {'R','E','G','_','S','Z',0}; +static const WCHAR type_expand_sz[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; +static const WCHAR type_binary[] = {'R','E','G','_','B','I','N','A','R','Y',0}; +static const WCHAR type_dword[] = {'R','E','G','_','D','W','O','R','D',0}; +static const WCHAR type_dword_le[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; +static const WCHAR type_dword_be[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; +static const WCHAR type_link[] = {'R','E','G','_','L','I','N','K',0}; +static const WCHAR type_multi_sz[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; +static const WCHAR type_resource_list[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','L','I','S','T',0}; +static const WCHAR type_full_resource_descriptor[] = {'R','E','G','_','F','U','L','L','_','R','E','S','O','U','R','C','E','_','D','E','S','C','R','I','P','T','O','R',0}; +static const WCHAR type_resource_requirements_list[] = {'R','E','G','_','R','E','S','O','U','R','C','E','_','R','E','Q','U','I','R','E','M','E','N','T','S','_','L','I','S','T',0}; +static const WCHAR type_qword[] = {'R','E','G','_','Q','W','O','R','D',0}; +static const WCHAR type_qword_le[] = {'R','E','G','_','Q','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; + +static const struct +{ + DWORD type; + const WCHAR *name; +} +type_rels[] = +{ + {REG_NONE, type_none}, + {REG_SZ, type_sz}, + {REG_EXPAND_SZ, type_expand_sz}, + {REG_BINARY, type_binary}, + {REG_DWORD, type_dword}, + {REG_DWORD_LITTLE_ENDIAN, type_dword_le}, + {REG_DWORD_BIG_ENDIAN, type_dword_be}, + {REG_LINK, type_link}, + {REG_MULTI_SZ, type_multi_sz}, + {REG_RESOURCE_LIST, type_resource_list}, + {REG_FULL_RESOURCE_DESCRIPTOR, type_full_resource_descriptor}, + {REG_RESOURCE_REQUIREMENTS_LIST, type_resource_requirements_list}, + {REG_QWORD, type_qword}, + {REG_QWORD_LITTLE_ENDIAN, type_qword_le}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -115,6 +153,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_FILE_NOT_FOUND: reg_message(STRING_CANNOT_FIND); return; + case ERROR_INVALID_DATATYPE: + reg_message(STRING_INVALID_TYPE); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -166,30 +207,20 @@ static LSTATUS path_open(const WCHAR *path, HKEY *out, BOOL create) return RegOpenKeyW(*out, path, out); } -static DWORD get_regtype(LPWSTR type) +static DWORD wchar_get_type(const WCHAR *type_name) { - static const WCHAR szREG_SZ[] = {'R','E','G','_','S','Z',0}; - static const WCHAR szREG_MULTI_SZ[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; - static const WCHAR szREG_DWORD_BIG_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_DWORD[] = {'R','E','G','_','D','W','O','R','D',0}; - static const WCHAR szREG_BINARY[] = {'R','E','G','_','B','I','N','A','R','Y',0}; - static const WCHAR szREG_DWORD_LITTLE_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_NONE[] = {'R','E','G','_','N','O','N','E',0}; - static const WCHAR szREG_EXPAND_SZ[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; - - if (!type) + DWORD i; + + if (!type_name) return REG_SZ; - if (lstrcmpiW(type,szREG_SZ)==0) return REG_SZ; - if (lstrcmpiW(type,szREG_DWORD)==0) return REG_DWORD; - if (lstrcmpiW(type,szREG_MULTI_SZ)==0) return REG_MULTI_SZ; - if (lstrcmpiW(type,szREG_EXPAND_SZ)==0) return REG_EXPAND_SZ; - if (lstrcmpiW(type,szREG_DWORD_BIG_ENDIAN)==0) return REG_DWORD_BIG_ENDIAN; - if (lstrcmpiW(type,szREG_DWORD_LITTLE_ENDIAN)==0) return REG_DWORD_LITTLE_ENDIAN; - if (lstrcmpiW(type,szREG_BINARY)==0) return REG_BINARY; - if (lstrcmpiW(type,szREG_NONE)==0) return REG_NONE; + for (i = 0; i < ARRAY_SIZE(type_rels); i++) + { + if (!strcmpiW(type_rels[i].name, type_name)) + return type_rels[i].type; + } - return -1; + return ~0u; } static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) @@ -282,11 +313,11 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } } - reg_type = get_regtype(type); - if (reg_type == -1) + reg_type = wchar_get_type(type); + if (reg_type == ~0u) { RegCloseKey(subkey); - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_INVALID_DATATYPE); return 1; } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 1c2ae83..d49d3d8 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -31,3 +31,4 @@ #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 +#define STRING_INVALID_TYPE 111 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 5fc5a76..1c19375 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -36,4 +36,5 @@ STRINGTABLE STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " + STRING_INVALID_TYPE, "Error: Invalid type\n" } -- 2.1.1 From jnvsor at gmail.com Fri Nov 7 10:29:18 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:18 +0100 Subject: [PATCH v2 6/8] reg: Add wchar/raw data conversion functions In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-6-git-send-email-jnvsor@gmail.com> In the case of REG_SZ and the like, it may seem like the functions perform an unncessary copy of the strings which should already be in memory ripe for the taking. However because these functions handle more than one type of data the calling function needs to be able to free the data afterwards. Simply returning the input string would result in a function freeing one of it's own parameters, so we make sure to return new memory by making a copy. --- programs/reg/reg.c | 140 +++++++++++++++++++++++++++++++++++++++-------- programs/reg/reg.h | 2 + programs/reg/reg.rc | 2 + programs/reg/tests/reg.c | 55 +++++++++---------- 4 files changed, 147 insertions(+), 52 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 72add9b..48ac438 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -18,11 +18,15 @@ #include #include +#include #include "reg.h" #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) #define ERROR_NO_REMOTE 20000 +#define ERROR_NOT_INT_OR_NEG 20001 + +WINE_DEFAULT_DEBUG_CHANNEL(reg); static const WCHAR short_hklm[] = {'H','K','L','M',0}; static const WCHAR short_hkcu[] = {'H','K','C','U',0}; @@ -156,6 +160,12 @@ static void reg_print_error(LSTATUS error_code) case ERROR_INVALID_DATATYPE: reg_message(STRING_INVALID_TYPE); return; + case ERROR_UNSUPPORTED_TYPE: + reg_message(STRING_UNSUPPORTED_TYPE); + return; + case ERROR_NOT_INT_OR_NEG: + reg_message(STRING_NOT_INT_OR_NEG); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -223,43 +233,117 @@ static DWORD wchar_get_type(const WCHAR *type_name) return ~0u; } -static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) +static LSTATUS wchar_get_data(const WCHAR *input, const DWORD type, const WCHAR separator, + DWORD *size_out, BYTE **out) { - LPBYTE out_data = NULL; - *reg_count = 0; + static const WCHAR empty = 0; + DWORD i; - switch (reg_type) + if (!input) + input = ∅ + + switch (type) { case REG_SZ: + case REG_EXPAND_SZ: { - *reg_count = (lstrlenW(data) + 1) * sizeof(WCHAR); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - lstrcpyW((LPWSTR)out_data,data); - break; + i = (strlenW(input) + 1) * sizeof(WCHAR); + *out = HeapAlloc(GetProcessHeap(), 0, i); + memcpy(*out, input, i); + *size_out = i; + return ERROR_SUCCESS; } case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: + { + WCHAR *temp; + + if (input[0] == '0' && (input[1] == 'x' || input[1] == 'X')) + i = strtoulW(input, &temp, 16); + else + i = strtoulW(input, &temp, 10); + + if (input[0] == '-' || temp[0] || temp == input) + return ERROR_NOT_INT_OR_NEG; + + *out = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)); + **(DWORD **) out = i; + *size_out = sizeof(DWORD); + return ERROR_SUCCESS; + } + case REG_MULTI_SZ: { - LPWSTR rest; - DWORD val; - val = strtolW(data, &rest, 0); - if (rest == data) { - static const WCHAR nonnumber[] = {'E','r','r','o','r',':',' ','/','d',' ','r','e','q','u','i','r','e','s',' ','n','u','m','b','e','r','.','\n',0}; - reg_printfW(nonnumber); - break; + WCHAR *temp = HeapAlloc(GetProcessHeap(), 0, (strlenW(input) + 1) * sizeof(WCHAR)); + DWORD p; + + for (i = 0, p = 0; i <= strlenW(input); i++, p++) + { + /* If this character is the separator, or no separator has been given and these + * characters are "\\0", then add a 0 indicating the end of this string */ + if ( (separator && input[i] == separator) || + (!separator && input[i] == '\\' && input[i + 1] == '0') ) + { + /* If it's the first character or the previous one was a separator */ + if (!p || temp[p - 1] == 0) + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + temp[p] = 0; + + if (!separator) + i++; + } + else + temp[p] = input[i]; } - *reg_count = sizeof(DWORD); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - ((LPDWORD)out_data)[0] = val; - break; + + /* Add a 0 to the end if the string wasn't "", and it wasn't + * double-0-terminated already (In the case of a trailing separator) */ + if(p > 1 && temp[p - 2]) + temp[p++] = 0; + + *size_out = p * sizeof(WCHAR); + *out = temp; + return ERROR_SUCCESS; + } + case REG_BINARY: + { + BYTE *temp = HeapAlloc(GetProcessHeap(), 0, strlenW(input)); + DWORD p, odd; + + for (i = 0, p = 0; i < strlenW(input); i++, p++) + { + if (input[i] >= '0' && input[i] <= '9') + temp[p] = input[i] - '0'; + else if (input[i] >= 'a' && input[i] <= 'f') + temp[p] = input[i] - 'a' + 10; + else if (input[i] >= 'A' && input[i] <= 'F') + temp[p] = input[i] - 'A' + 10; + else + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + } + + *out = temp; + odd = p & 1; + temp += odd; + p >>= 1; + + for (i = 0; i < p; i++) + temp[i] = (temp[i * 2] << 4) | temp[i * 2 + 1]; + + *size_out = p + odd; + return ERROR_SUCCESS; } default: { - static const WCHAR unhandled[] = {'U','n','h','a','n','d','l','e','d',' ','T','y','p','e',' ','0','x','%','x',' ',' ','d','a','t','a',' ','%','s','\n',0}; - reg_printfW(unhandled, reg_type,data); + FIXME("Add support for registry type: %u\n", type); + return ERROR_UNSUPPORTED_TYPE; } } - - return out_data; } static LSTATUS sane_path(const WCHAR *key) @@ -322,7 +406,15 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } if (data) - reg_data = get_regdata(data,reg_type,separator,®_count); + { + err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); + if (err != ERROR_SUCCESS) + { + RegCloseKey(subkey); + reg_print_error(err); + return 1; + } + } RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); HeapFree(GetProcessHeap(),0,reg_data); diff --git a/programs/reg/reg.h b/programs/reg/reg.h index d49d3d8..f1b398b 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -32,3 +32,5 @@ #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 #define STRING_INVALID_TYPE 111 +#define STRING_UNSUPPORTED_TYPE 112 +#define STRING_NOT_INT_OR_NEG 113 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 1c19375..47986ab 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -37,4 +37,6 @@ STRINGTABLE STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " STRING_INVALID_TYPE, "Error: Invalid type\n" + STRING_UNSUPPORTED_TYPE, "Error: Unsupported type\n" + STRING_NOT_INT_OR_NEG, "Error: This type requires /d to be a positive number\n" } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 57e0108..b2894d6 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -183,11 +183,11 @@ static void test_add(void) /* REG_EXPAND_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, TODO_REG_SIZE); + verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, TODO_REG_SIZE); + verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -195,11 +195,11 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, TODO_REG_SIZE); + verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0); /* REG_BINARY */ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); @@ -209,14 +209,14 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 0xefbeadde; - verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), TODO_REG_SIZE); + verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin2 /f /d x01", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin3 /f /d 01x", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -230,8 +230,8 @@ static void test_add(void) err = RegQueryValueExA(hkey, "bin4", NULL, &type, (void *) (buffer+12), &size); ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_BINARY, "got wrong type %u\n", type); - todo_wine ok(size == 6, "got wrong size %u\n", size); - todo_wine ok(memcmp(buffer, buffer+12, 6) == 0 || + ok(size == 6, "got wrong size %u\n", size); + ok(memcmp(buffer, buffer+12, 6) == 0 || broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r); @@ -252,11 +252,11 @@ static void test_add(void) todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -270,22 +270,21 @@ static void test_add(void) ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD); ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD)); - todo_wine ok(dword == 123 || broken(dword == 0123 /* WinXP */), + ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected %d\n", dword, 123); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); dword = 0xdeadbeef; - verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), - (sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA); + verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); /* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r); @@ -297,7 +296,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 456; - verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), TODO_REG_SIZE); + verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0); /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like * an ordinary REG_DWORD - that is little endian. GG */ @@ -305,15 +304,15 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); memcpy(buffer, "three\0little\0strings\0", 22); - verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -321,7 +320,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, TODO_REG_SIZE); + verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); @@ -330,16 +329,16 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); buffer[0]='a'; buffer[1]=0; buffer[2]=0; - verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, TODO_REG_SIZE); + verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, 0); RegCloseKey(hkey); -- 2.1.1 From jnvsor at gmail.com Fri Nov 7 10:29:16 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:16 +0100 Subject: [PATCH v2 4/8] reg: Add path/key conversion functions In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-4-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 146 +++++++++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 66 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index ff12b3f..12bb495 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,8 +20,36 @@ #include #include "reg.h" +#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) + #define ERROR_NO_REMOTE 20000 +static const WCHAR short_hklm[] = {'H','K','L','M',0}; +static const WCHAR short_hkcu[] = {'H','K','C','U',0}; +static const WCHAR short_hkcr[] = {'H','K','C','R',0}; +static const WCHAR short_hku[] = {'H','K','U',0}; +static const WCHAR short_hkcc[] = {'H','K','C','C',0}; +static const WCHAR long_hklm[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; +static const WCHAR long_hkcu[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; +static const WCHAR long_hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; +static const WCHAR long_hku[] = {'H','K','E','Y','_','U','S','E','R','S',0}; +static const WCHAR long_hkcc[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; + +static const struct +{ + HKEY key; + const WCHAR *short_name; + const WCHAR *long_name; +} +root_rels[] = +{ + {HKEY_LOCAL_MACHINE, short_hklm, long_hklm}, + {HKEY_CURRENT_USER, short_hkcu, long_hkcu}, + {HKEY_CLASSES_ROOT, short_hkcr, long_hkcr}, + {HKEY_USERS, short_hku, long_hku}, + {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -84,6 +112,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_NO_REMOTE: reg_message(STRING_NO_REMOTE); return; + case ERROR_FILE_NOT_FOUND: + reg_message(STRING_CANNOT_FIND); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -99,35 +130,40 @@ static void reg_print_error(LSTATUS error_code) } } -static HKEY get_rootkey(LPWSTR key) +static inline BOOL path_rootname_cmp(const WCHAR *input_path, const WCHAR *rootkey_name) { - static const WCHAR szHKLM[] = {'H','K','L','M',0}; - static const WCHAR szHKEY_LOCAL_MACHINE[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; - static const WCHAR szHKCU[] = {'H','K','C','U',0}; - static const WCHAR szHKEY_CURRENT_USER[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; - static const WCHAR szHKCR[] = {'H','K','C','R',0}; - static const WCHAR szHKEY_CLASSES_ROOT[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; - static const WCHAR szHKU[] = {'H','K','U',0}; - static const WCHAR szHKEY_USERS[] = {'H','K','E','Y','_','U','S','E','R','S',0}; - static const WCHAR szHKCC[] = {'H','K','C','C',0}; - static const WCHAR szHKEY_CURRENT_CONFIG[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; - - if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKLM,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,18,szHKEY_LOCAL_MACHINE,18)==CSTR_EQUAL) - return HKEY_LOCAL_MACHINE; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCU,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CURRENT_USER,17)==CSTR_EQUAL) - return HKEY_CURRENT_USER; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCR,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CLASSES_ROOT,17)==CSTR_EQUAL) - return HKEY_CLASSES_ROOT; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,3,szHKU,3)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,10,szHKEY_USERS,10)==CSTR_EQUAL) - return HKEY_USERS; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCC,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,19,szHKEY_CURRENT_CONFIG,19)==CSTR_EQUAL) - return HKEY_CURRENT_CONFIG; - else return NULL; + DWORD length = strlenW(rootkey_name); + + return (!strncmpiW(input_path, rootkey_name, length) && + (input_path[length] == 0 || input_path[length] == '\\')); +} + +static HKEY path_get_rootkey(const WCHAR *path) +{ + DWORD i; + + for (i = 0; i < ARRAY_SIZE(root_rels); i++) + { + if (path_rootname_cmp(path, root_rels[i].short_name) || + path_rootname_cmp(path, root_rels[i].long_name)) + return root_rels[i].key; + } + + return NULL; +} + +static LSTATUS path_open(const WCHAR *path, HKEY *out, BOOL create) +{ + *out = path_get_rootkey(path); + + path = strchrW(path, '\\'); + if (path) + path++; + + if (create) + return RegCreateKeyW(*out, path, out); + else + return RegOpenKeyW(*out, path, out); } static DWORD get_regtype(LPWSTR type) @@ -213,8 +249,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, { static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - LPWSTR p; - HKEY root,subkey; + HKEY subkey; LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); @@ -226,22 +261,8 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } - p = strchrW(key_name,'\\'); - if (!p) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - - if(RegCreateKeyW(root,p,&subkey)!=ERROR_SUCCESS) + err = path_open(key_name, &subkey, TRUE); + if(err != ERROR_SUCCESS) { reg_message(STRING_INVALID_KEY); return 1; @@ -285,8 +306,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL value_all, BOOL force) { - LPWSTR p; - HKEY root,subkey; + HKEY subkey; LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', @@ -301,16 +321,8 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } - p = strchrW(key_name,'\\'); - if (!p) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) + err = path_open(key_name, &subkey, FALSE); + if (err != ERROR_SUCCESS) { reg_message(STRING_INVALID_KEY); return 1; @@ -336,21 +348,23 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, /* Delete subtree only if no /v* option is given */ if (!value_name && !value_empty && !value_all) { - if (RegDeleteTreeW(root,p)!=ERROR_SUCCESS) + err = RegDeleteTreeA(subkey, NULL); + if (err != ERROR_SUCCESS) { - reg_message(STRING_CANNOT_FIND); + reg_print_error(err); + return 1; + } + + err = RegDeleteKeyA(subkey, ""); + if (err != ERROR_SUCCESS) + { + reg_print_error(err); return 1; } reg_message(STRING_SUCCESS); return 0; } - if(RegOpenKeyW(root,p,&subkey)!=ERROR_SUCCESS) - { - reg_message(STRING_CANNOT_FIND); - return 1; - } - if (value_all) { LPWSTR szValue; -- 2.1.1 From jnvsor at gmail.com Fri Nov 7 10:29:20 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:20 +0100 Subject: [PATCH v2 8/8] reg: Clean up reg_delete In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-8-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 150 +++++++++++++++++++++++------------------------ programs/reg/tests/reg.c | 2 +- 2 files changed, 74 insertions(+), 78 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index eb62a61..fbc7969 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -425,120 +425,116 @@ error: return 1; } -static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - BOOL value_all, BOOL force) +static int reg_delete(const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const BOOL value_all, const BOOL force) { - HKEY subkey; - LONG err; - - static const WCHAR stubW[] = {'D','E','L','E','T','E', - ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' - ,0}; - reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - - err = sane_path(key_name); + HKEY key = NULL; + LONG err = sane_path(key_name); if (err != ERROR_SUCCESS) { reg_print_error(err); return 1; } - err = path_open(key_name, &subkey, FALSE); + err = path_open(key_name, &key, FALSE); if (err != ERROR_SUCCESS) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - - if (value_name && value_empty) - { - reg_message(STRING_INVALID_CMDLINE); - return 1; - } + goto error; - if (value_empty && value_all) + /* Mutually exclusive options */ + if ((!!value_name + !!value_empty + !!value_all) > 1) { - reg_message(STRING_INVALID_CMDLINE); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } if (!force) { - /* FIXME: Prompt for delete */ + FIXME("Prompt for delete\n"); } - /* Delete subtree only if no /v* option is given */ - if (!value_name && !value_empty && !value_all) + if (value_empty || value_name) { - err = RegDeleteTreeA(subkey, NULL); - if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } + if (value_name && value_name[0]) + err = RegDeleteValueW(key, value_name); + else + err = RegDeleteValueW(key, NULL); - err = RegDeleteKeyA(subkey, ""); if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } - reg_message(STRING_SUCCESS); - return 0; + goto error; } - - if (value_all) + else if (value_all) { - LPWSTR szValue; - DWORD maxValue; - DWORD count; - LONG rc; - - rc = RegQueryInfoKeyW(subkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &maxValue, NULL, NULL, NULL); - if (rc != ERROR_SUCCESS) - { - /* FIXME: failure */ - RegCloseKey(subkey); - return 1; - } - maxValue++; - szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR)); + WCHAR *enum_v_name; + DWORD count, max_size, this_size, i = 0, errors = 0; - while (1) + err = RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, NULL, NULL, + &count, &max_size, NULL, NULL, NULL); + if (err != ERROR_SUCCESS) + goto error; + + enum_v_name = HeapAlloc(GetProcessHeap(), 0, ++max_size * sizeof(WCHAR)); + + while (i < count) { - count = maxValue; - rc = RegEnumValueW(subkey, 0, szValue, &count, NULL, NULL, NULL, NULL); - if (rc == ERROR_SUCCESS) + this_size = max_size; + + err = RegEnumValueW(key, i, enum_v_name, &this_size, NULL, NULL, NULL, NULL); + if (err != ERROR_SUCCESS) + { + i++; + errors++; + reg_print_error(err); + continue; + } + + err = RegDeleteValueW(key, enum_v_name); + if (err != ERROR_SUCCESS) { - rc = RegDeleteValueW(subkey, szValue); - if (rc != ERROR_SUCCESS) - break; + i++; + errors++; + reg_print_error(err); + continue; } - else break; + + count--; } - if (rc != ERROR_SUCCESS) + + HeapFree(GetProcessHeap(), 0, enum_v_name); + + if (errors) { - /* FIXME delete failed */ + RegCloseKey(key); + return 1; } } - else if (value_name) + /* Delete subtree only if no /v* option is given */ + else { - if (RegDeleteValueW(subkey,value_name) != ERROR_SUCCESS) + if (key == path_get_rootkey(key_name)) { - RegCloseKey(subkey); - reg_message(STRING_CANNOT_FIND); + /* "This works well enough on native to make you regret you pressed enter" - stefand */ + FIXME("Deleting a root key is not implemented.\n"); + RegCloseKey(key); return 1; } - } - else if (value_empty) - { - RegSetValueExW(subkey,NULL,0,REG_SZ,NULL,0); + + err = RegDeleteTreeA(key, NULL); + if (err != ERROR_SUCCESS) + goto error; + err = RegDeleteKeyA(key, ""); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); return 0; + +error: + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 3e4454e..d08a9c2 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -380,7 +380,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); - todo_wine ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); -- 2.1.1 From huw at codeweavers.com Fri Nov 7 10:48:49 2014 From: huw at codeweavers.com (Huw Davies) Date: Fri, 7 Nov 2014 16:48:49 +0000 Subject: user32: Make the combo's listbox a topmost window. Message-ID: <1415378929-2857-1-git-send-email-huw@codeweavers.com> --- dlls/user32/combo.c | 2 +- dlls/user32/tests/combo.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 2aa4424..e891c58 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -1059,7 +1059,7 @@ static void CBDropDown( LPHEADCOMBO lphc ) r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom ); } - SetWindowPos( lphc->hWndLBox, HWND_TOP, r.left, r.top, r.right - r.left, r.bottom - r.top, + SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOACTIVATE | SWP_SHOWWINDOW ); diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c index d9875ea..b6d5ef6 100644 --- a/dlls/user32/tests/combo.c +++ b/dlls/user32/tests/combo.c @@ -537,6 +537,61 @@ static void test_editselection(void) DestroyWindow(hCombo); } +static void test_listbox_styles(DWORD cb_style) +{ + BOOL (WINAPI *pGetComboBoxInfo)(HWND, PCOMBOBOXINFO); + HWND combo; + COMBOBOXINFO info; + DWORD style, exstyle, expect_style, expect_exstyle; + BOOL ret; + + pGetComboBoxInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo"); + if (!pGetComboBoxInfo){ + win_skip("GetComboBoxInfo is not available\n"); + return; + } + + expect_style = WS_CHILD|WS_CLIPSIBLINGS|LBS_COMBOBOX|LBS_HASSTRINGS|LBS_NOTIFY; + if (cb_style == CBS_SIMPLE) + { + expect_style |= WS_VISIBLE; + expect_exstyle = WS_EX_CLIENTEDGE; + } + else + { + expect_style |= WS_BORDER; + expect_exstyle = WS_EX_TOOLWINDOW; + } + + combo = build_combo(cb_style); + info.cbSize = sizeof(COMBOBOXINFO); + SetLastError(0xdeadbeef); + ret = pGetComboBoxInfo(combo, &info); + ok(ret, "Failed to get combobox info structure.\n"); + + style = GetWindowLongW( info.hwndList, GWL_STYLE ); + exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE ); + ok(style == expect_style, "%08x: got %08x\n", cb_style, style); + ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle); + + if (cb_style != CBS_SIMPLE) + expect_exstyle |= WS_EX_TOPMOST; + + SendMessageW(combo, CB_SHOWDROPDOWN, TRUE, 0 ); + style = GetWindowLongW( info.hwndList, GWL_STYLE ); + exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE ); + ok(style == (expect_style | WS_VISIBLE), "%08x: got %08x\n", cb_style, style); + ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle); + + SendMessageW(combo, CB_SHOWDROPDOWN, FALSE, 0 ); + style = GetWindowLongW( info.hwndList, GWL_STYLE ); + exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE ); + ok(style == expect_style, "%08x: got %08x\n", cb_style, style); + ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle); + + DestroyWindow(combo); +} + START_TEST(combo) { hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0); @@ -551,6 +606,9 @@ START_TEST(combo) test_changesize(CBS_DROPDOWN); test_changesize(CBS_DROPDOWNLIST); test_editselection(); + test_listbox_styles(CBS_SIMPLE); + test_listbox_styles(CBS_DROPDOWN); + test_listbox_styles(CBS_DROPDOWNLIST); DestroyWindow(hMainWnd); } -- 1.8.0 From jnvsor at gmail.com Fri Nov 7 10:29:19 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Fri, 7 Nov 2014 17:29:19 +0100 Subject: [PATCH v2 7/8] reg: Clean up reg_add In-Reply-To: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> References: <1415377760-22769-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415377760-22769-7-git-send-email-jnvsor@gmail.com> You'll notice that bad value input leaves a zombie key after this call, but this is consistant with native. --- programs/reg/reg.c | 92 ++++++++++++++++++++++++++---------------------- programs/reg/tests/reg.c | 22 ++++++------ 2 files changed, 60 insertions(+), 54 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index 48ac438..eb62a61 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -359,71 +359,70 @@ static LSTATUS sane_path(const WCHAR *key) return ERROR_SUCCESS; } -static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) +static int reg_add( const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const WCHAR *type, const WCHAR separator, const WCHAR *data, + const BOOL force) { - static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', - ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - HKEY subkey; - LONG err; - - reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - - err = sane_path(key_name); + HKEY key = NULL; + LONG err = sane_path(key_name); if (err != ERROR_SUCCESS) + goto error; + + if (value_name && value_empty) { - reg_print_error(err); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } - err = path_open(key_name, &subkey, TRUE); + err = path_open(key_name, &key, TRUE); if(err != ERROR_SUCCESS) - { - reg_message(STRING_INVALID_KEY); - return 1; - } + goto error; if (value_name || data) { - DWORD reg_type; - DWORD reg_count = 0; - BYTE* reg_data = NULL; + DWORD size, reg_type; + BYTE *data_out; + + if (value_name && !value_name[0]) + value_name = NULL; - if (!force) + if (type && !type[0]) { - if (RegQueryValueW(subkey,value_name,NULL,NULL)==ERROR_SUCCESS) - { - /* FIXME: Prompt for overwrite */ - } + data = NULL; + type = NULL; } - reg_type = wchar_get_type(type); - if (reg_type == ~0u) + if (!force && RegQueryValueExW(key, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - RegCloseKey(subkey); - reg_print_error(ERROR_INVALID_DATATYPE); - return 1; + FIXME("Prompt for overwrite\n"); } - if (data) + reg_type = wchar_get_type(type); + if (reg_type == ~0u) { - err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); - if (err != ERROR_SUCCESS) - { - RegCloseKey(subkey); - reg_print_error(err); - return 1; - } + err = ERROR_INVALID_DATATYPE; + goto error; } - RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); - HeapFree(GetProcessHeap(),0,reg_data); + err = wchar_get_data(data, reg_type, separator, &size, &data_out); + if (err != ERROR_SUCCESS) + goto error; + + err = RegSetValueExW(key, value_name, 0, reg_type, data_out, size); + HeapFree(GetProcessHeap(), 0, data_out); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); - return 0; + +error: + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, @@ -603,7 +602,14 @@ int wmain(int argc, WCHAR *argvW[]) else if (!lstrcmpiW(argvW[i], slashTW)) type = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashSW)) - separator = argvW[++i][0]; + { + if (!argvW[++i][0] || argvW[i][1]) + { + reg_print_error(ERROR_BAD_COMMAND); + return 1; + } + separator = argvW[i][0]; + } else if (!lstrcmpiW(argvW[i], slashDW)) data = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashFW)) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index b2894d6..3e4454e 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -110,12 +110,12 @@ static void test_add(void) /* Test empty type */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r); - todo_wine ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), + ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %u\n", r); if (r == REG_EXIT_SUCCESS) - todo_wine verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); + verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); else - todo_wine win_skip("broken reg.exe detected\n"); + win_skip("broken reg.exe detected\n"); /* Test input key formats */ run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); @@ -166,7 +166,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v test /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test", REG_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -174,7 +174,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test2", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test2", REG_SZ, "", 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -191,7 +191,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -249,7 +249,7 @@ static void test_add(void) win_skip("broken reg.exe detected\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -316,18 +316,18 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); -- 2.1.1 From joachim.priesner at web.de Fri Nov 7 15:39:19 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Fri, 7 Nov 2014 22:39:19 +0100 Subject: [1/2] wined3d: Set D3DPMISCCAPS_FOGVERTEXCLAMPED flag in get_device_caps (resend) Message-ID: <201411072239.20998.joachim.priesner@web.de> Wine clamps the oFog output of vertex shaders. Tests for the flag follow in the second part of this patch. --- dlls/wined3d/directx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d428d94..41bad21 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4148,12 +4148,12 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS | WINED3DPMISCCAPS_MASKZ | WINED3DPMISCCAPS_BLENDOP | + WINED3DPMISCCAPS_FOGVERTEXCLAMPED | WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING; /* TODO: WINED3DPMISCCAPS_NULLREFERENCE WINED3DPMISCCAPS_FOGANDSPECULARALPHA - WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS - WINED3DPMISCCAPS_FOGVERTEXCLAMPED */ + WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS */ if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; -- 1.8.4.5 From joachim.priesner at web.de Fri Nov 7 15:39:22 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Fri, 7 Nov 2014 22:39:22 +0100 Subject: [2/2] wined3d: Take abs() of vertex z coordinate as FFP fog coordinate (try 6) Message-ID: <201411072239.24023.joachim.priesner@web.de> Take the absolute value of vertex.z as fog coordinate instead of just the z coordinate. This fixes e.g. fog for applications that use right-handed projection matrices. Also test the clamp behavior of the oFog vertex shader output. Tested on openSuse 13.1 and Windows 8.1 (VMware Player). Try 6: Move the vertex declaration before the vertex shader code in the d3d8 test. --- dlls/d3d8/tests/visual.c | 297 +++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 360 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 161 ++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 2 +- 4 files changed, 819 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 163110c..7b9ee5f 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -696,6 +696,302 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + /* Fill the null-shader entry with the FVF (SetVertexShader is "overloaded" on d3d8). */ + DWORD vertex_shader[3] = {D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, 0, 0}; + DWORD pixel_shader[2] = {0, 0}; + IDirect3D8 *d3d; + IDirect3DDevice8 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support; + unsigned int i, ps, y; + D3DCOLOR color, expected_middle_color; + ULONG refcount; + D3DCAPS8 caps; + HWND window; + HRESULT hr; + + static const DWORD vertex_decl[] = + { + D3DVSD_STREAM(0), + D3DVSD_REG(0, D3DVSDT_FLOAT3), /* position, v0 */ + D3DVSD_REG(1, D3DVSDT_D3DCOLOR), /* diffuse color, v1 */ + D3DVSD_REG(2, D3DVSDT_D3DCOLOR), /* specular color, v2 */ + D3DVSD_CONST(0, 1), 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + D3DVSD_END() + }; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + + static const struct + { + struct vec3 position; + DWORD diffuse; + DWORD specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader with vertex fog computation. + * As drivers inconsistently clamp or don't clamp the oFog output of vertex shaders, + * the special value C_CLAMPED_FOG allows both C_HALF_FOGGED (clamped) and C_FOGGED. */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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"); + goto done; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice8_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 0); + if (has_vs_support) + { + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code1, &vertex_shader[1], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code2, &vertex_shader[2], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_1_0 support, skipping some fog tests\n"); + } + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice8_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice8_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + ok(color_match(color, C_HALF_FOGGED, 13) || color_match(color, C_FOGGED, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, " + "expected %08x+-5%% or %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, C_HALF_FOGGED, C_FOGGED); + } + else + { + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + } + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + } + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DDevice8_DeleteVertexShader(device, vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DDevice8_DeletePixelShader(device, pixel_shader[i]); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + /* This tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -5092,6 +5388,7 @@ START_TEST(visual) offscreen_test(); alpha_test(); test_scalar_instructions(); + fog_negative_z_test(); fog_with_shader_test(); cnd_test(); p8_texture_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 117c8eb..f8ac3a6 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1825,6 +1825,365 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; + IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + IDirect3DDevice9 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support, is_fog_vertex_clamped; + unsigned int i, ps, y; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color, expected_middle_color; + HWND window; + HRESULT hr; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"), vs_2_0 */ + static const DWORD vertex_shader_code3[] = + { + 0xfffe0200, /* vs_2_0 */ + 0x05000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x03000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x03000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x02000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x02000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x02000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + static const DWORD pixel_shader_code2[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */ + 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ + 0x0000ffff + }; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + + static const D3DVERTEXELEMENT9 decl_elements[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, /* diffuse */ + {0, 16, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1}, /* specular */ + D3DDECL_END() + }; + static const struct + { + int vshader; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED in the right half of the screen. + * + * C_CLAMPED_FOG will be replaced by the correct expected value based on + * the value of D3DPMISCCAPS_FOGVERTEXCLAMPED. If the driver clamps the oFog + * output of vertex shaders, it should be C_HALF_FOGGED, else C_FOGGED. */ + + /* No vertex shader */ + {0, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader vs_1_1 with vertex fog computation */ + {2, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + /* Vertex shader vs_2_0 with vertex fog computation */ + {3, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {3, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 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 (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 1); + if (has_vs_support) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code1, &vertex_shader[1]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code2, &vertex_shader[2]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + + if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code3, &vertex_shader[3]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No vs_1_1 support, skipping some fog tests\n"); + } + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + + if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code2, &pixel_shader[2]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + is_fog_vertex_clamped = caps.PrimitiveMiscCaps & D3DPMISCCAPS_FOGVERTEXCLAMPED; + + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration); + ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%#x)\n", hr); + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration); + ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%#x)\n", hr); + + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + if (has_vs_support) + { + hr = IDirect3DDevice9_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + } + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice9_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got left color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + expected_middle_color = is_fog_vertex_clamped ? C_HALF_FOGGED : C_FOGGED; + } + ok(color_match(color, expected_middle_color, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got middle color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, expected_middle_color); + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog vs%i ps%i fvm%i ftm%i, y=%i: got right color %08x, expected %08x+-5%%\n", + test_data[i].vshader, ps, test_data[i].vfog, test_data[i].tfog, y, + color, test_data[i].color_right); + + } + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DVertexShader9_Release(vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DPixelShader9_Release(pixel_shader[i]); + IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + /* This test tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -16729,6 +17088,7 @@ START_TEST(visual) test_vshader_input(); test_vshader_float16(); stream_test(); + fog_negative_z_test(); fog_with_shader_test(); texbem_test(); texdepth_test(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ec50fb8..4e999f7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3384,6 +3384,166 @@ static void test_fog_special(void) DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void test_fog_negative_z(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000 + }; + + D3DCOLOR color, expected_middle_color; + HRESULT hr; + ULONG refcount; + BOOL has_table_fog_support; + unsigned int i, y; + HWND window; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + D3DDEVICEDESC7 caps; + + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + DWORD vertexmode, tablemode; + D3DCOLOR color_left, color_middle_top, color_middle_bottom, color_right; + } + test_data[] = + { + {D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + memset(&caps, 0, sizeof(caps)); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "IDirect3DDevice7_GetCaps failed, hr %#x.\n", hr); + + has_table_fog_support = caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests.\n"); + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Failed to set fog color, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].tablemode != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear render target, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, test_data[i].vertexmode); + ok(SUCCEEDED(hr), "Failed to set fog vertex mode, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, test_data[i].tablemode); + ok(SUCCEEDED(hr), "Failed to set fog table mode, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, top_quad, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_1, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_2, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, i=%d, hr %#x.\n", i, hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = get_surface_color(rt, 2, y); + ok(compare_color(color, test_data[i].color_left, 13), + "fog fvm%i ftm%i y=%i: got left color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, color, y, + test_data[i].color_left); + color = get_surface_color(rt, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + ok(compare_color(color, expected_middle_color, 13), + "fog fvm%i ftm%i y=%i: got middle color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, expected_middle_color); + color = get_surface_color(rt, 638, y); + ok(compare_color(color, test_data[i].color_right, 13), + "fog fvm%i ftm%i y=%i: got right color %08x, expected %08x+-5%%.\n", + test_data[i].vertexmode, test_data[i].tablemode, y, + color, test_data[i].color_right); + } + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_lighting_interface_versions(void) { IDirect3DDevice7 *device; @@ -7671,6 +7831,7 @@ START_TEST(ddraw7) test_clear_rect_count(); test_coop_level_versions(); test_fog_special(); + test_fog_negative_z(); test_lighting_interface_versions(); test_coop_level_activateapp(); test_texturemanage(); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7379ba2..907e895 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5005,7 +5005,7 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); else - shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + shader_addline(buffer, "gl_FogFragCoord = abs(ec_pos.z);\n"); break; default: -- 1.8.4.5 From mengshuaicalendr at gmail.com Fri Nov 7 23:00:51 2014 From: mengshuaicalendr at gmail.com (Shuai Meng) Date: Sat, 08 Nov 2014 13:00:51 +0800 Subject: [PATCH] vbscript: Implemented String(try 4) Message-ID: <545DA383.8030802@gmail.com> Change log: removed codes that handled VT_ARRAY|VT_BYREF|VT_VARIANT case separately. --- dlls/vbscript/global.c | 61 +++++++++++++++++++++++++++++++++++++++++++-- dlls/vbscript/tests/api.vbs | 53 +++++++++++++++++++++++++++++++++++++++ dlls/vbscript/vbscript.h | 1 + 3 files changed, 113 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-vbscript-Implemented-String.txt Type: text/x-patch Size: 6256 bytes Desc: not available URL: From jnvsor at gmail.com Sat Nov 8 04:26:42 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:42 +0100 Subject: [PATCH v3 01/10] reg/tests: Test for integer overflow Message-ID: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> --- programs/reg/tests/reg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index f93df55..9b1881e 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -287,6 +287,9 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r); todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0x01ffffffff /f", &r); + todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d\n", r); + /* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:44 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:44 +0100 Subject: [PATCH v3 03/10] reg: Add system error printing function In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-3-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 32 ++++++++++++++++++++++++++++---- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index d299cbf..1ae5746 100644 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -67,6 +67,30 @@ static int reg_message(int msg) return reg_printfW(formatW, msg_buffer); } +static void reg_print_error(LSTATUS error_code) +{ + switch (error_code) + { + case ERROR_SUCCESS: + return; + case ERROR_BAD_COMMAND: + reg_message(STRING_INVALID_CMDLINE); + return; + default: + { + static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; + WCHAR *message = NULL; + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, + error_code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (WCHAR *)&message, 0, NULL); + + reg_message(STRING_ERROR); + reg_printfW(error_string, error_code, message); + LocalFree(message); + return; + } + } +} + static HKEY get_rootkey(LPWSTR key) { static const WCHAR szHKLM[] = {'H','K','L','M',0}; @@ -397,7 +421,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -433,7 +457,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -464,7 +488,7 @@ int wmain(int argc, WCHAR *argvW[]) if (argc < 3) { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } else if (argc == 3 && (!lstrcmpW(argvW[2], slashHelpW) || @@ -488,7 +512,7 @@ int wmain(int argc, WCHAR *argvW[]) } else { - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_BAD_COMMAND); return 1; } } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 2221647..1c2ae83 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -30,3 +30,4 @@ #define STRING_INVALID_CMDLINE 107 #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 +#define STRING_ERROR 110 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 479912b..6183aaa 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -35,4 +35,5 @@ STRINGTABLE STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" + STRING_ERROR, "Unexpected error: " } -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:45 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:45 +0100 Subject: [PATCH v3 04/10] reg: Add sane_path function to do preliniary key validation In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-4-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 25 +++++++++++++++++++++---- programs/reg/reg.rc | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) mode change 100644 => 100755 programs/reg/reg.c diff --git a/programs/reg/reg.c b/programs/reg/reg.c old mode 100644 new mode 100755 index 1ae5746..c146ce9 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,6 +20,8 @@ #include #include "reg.h" +#define ERROR_NO_REMOTE 20000 + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -76,6 +78,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_BAD_COMMAND: reg_message(STRING_INVALID_CMDLINE); return; + case ERROR_NO_REMOTE: + reg_message(STRING_NO_REMOTE); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -187,6 +192,14 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r return out_data; } +static LSTATUS sane_path(const WCHAR *key) +{ + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') + return ERROR_NO_REMOTE; + + return ERROR_SUCCESS; +} + static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) { @@ -194,12 +207,14 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; LPWSTR p; HKEY root,subkey; + LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - if (key_name[0]=='\\' && key_name[1]=='\\') + err = sane_path(key_name); + if (err != ERROR_SUCCESS) { - reg_message(STRING_NO_REMOTE); + reg_print_error(err); return 1; } @@ -264,15 +279,17 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, { LPWSTR p; HKEY root,subkey; + LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' ,0}; reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - if (key_name[0]=='\\' && key_name[1]=='\\') + err = sane_path(key_name); + if (err != ERROR_SUCCESS) { - reg_message(STRING_NO_REMOTE); + reg_print_error(err); return 1; } diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 6183aaa..5fc5a76 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -33,7 +33,7 @@ STRINGTABLE STRING_SUCCESS, "The operation completed successfully\n" STRING_INVALID_KEY, "Error: Invalid key name\n" STRING_INVALID_CMDLINE, "Error: Invalid command line parameters\n" - STRING_NO_REMOTE, "Error: Unable to add keys to remote machine\n" + STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " } -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:46 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:46 +0100 Subject: [PATCH v3 05/10] reg: Add check for multiple backslashes at the end of the key In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-5-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 8 ++++++++ programs/reg/tests/reg.c | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index c146ce9..ff12b3f 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -78,6 +78,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_BAD_COMMAND: reg_message(STRING_INVALID_CMDLINE); return; + case ERROR_INVALID_HANDLE: + reg_message(STRING_INVALID_KEY); + return; case ERROR_NO_REMOTE: reg_message(STRING_NO_REMOTE); return; @@ -194,6 +197,11 @@ static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *r static LSTATUS sane_path(const WCHAR *key) { + int i = strlenW(key); + + if (i < 3 || (key[i - 1] == '\\' && key[i - 2] == '\\')) + return ERROR_INVALID_HANDLE; + if (key[0] == '\\' && key[1] == '\\' && key[2] != '\\') return ERROR_NO_REMOTE; diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 2d86d83..9420b5c 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -129,10 +129,10 @@ static void test_add(void) ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2"); - todo_wine ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), + ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */), "got exit code %d\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r); -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:49 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:49 +0100 Subject: [PATCH v3 08/10] reg: Add wchar/raw data conversion functions In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-8-git-send-email-jnvsor@gmail.com> In the case of REG_SZ and the like, it may seem like the functions perform an unncessary copy of the strings which should already be in memory ripe for the taking. However because these functions handle more than one type of data the calling function needs to be able to free the data afterwards. Simply returning the input string would result in a function freeing one of it's own parameters, so we make sure to return new memory by making a copy. --- programs/reg/reg.c | 151 +++++++++++++++++++++++++++++++++++++++-------- programs/reg/reg.h | 2 + programs/reg/reg.rc | 2 + programs/reg/tests/reg.c | 59 +++++++++--------- 4 files changed, 160 insertions(+), 54 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index a5a619e..bcbcdaa 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -18,11 +18,16 @@ #include #include +#include #include "reg.h" #define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) #define ERROR_NO_REMOTE 20000 +#define ERROR_NEGATIVE 20001 +#define ERROR_NOT_NUMBER 20002 + +WINE_DEFAULT_DEBUG_CHANNEL(reg); static const WCHAR short_hklm[] = {'H','K','L','M',0}; static const WCHAR short_hkcu[] = {'H','K','C','U',0}; @@ -144,6 +149,13 @@ static void reg_print_error(LSTATUS error_code) case ERROR_UNSUPPORTED_TYPE: reg_message(STRING_UNSUPPORTED_TYPE); return; + case ERROR_NEGATIVE: + case ERROR_NOT_NUMBER: + reg_message(STRING_NOT_INT_OR_NEG); + return; + case ERROR_ARITHMETIC_OVERFLOW: + reg_message(STRING_ERANGE); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -211,43 +223,126 @@ static DWORD wchar_get_type(const WCHAR *type_name) return ~0u; } -static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) +static LSTATUS wchar_get_data(const WCHAR *input, const DWORD type, const WCHAR separator, + DWORD *size_out, BYTE **out) { - LPBYTE out_data = NULL; - *reg_count = 0; + static const WCHAR empty = 0; + DWORD i; - switch (reg_type) + if (!input) + input = ∅ + + switch (type) { + case REG_NONE: case REG_SZ: + case REG_EXPAND_SZ: { - *reg_count = (lstrlenW(data) + 1) * sizeof(WCHAR); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - lstrcpyW((LPWSTR)out_data,data); - break; + i = (strlenW(input) + 1) * sizeof(WCHAR); + *out = HeapAlloc(GetProcessHeap(), 0, i); + memcpy(*out, input, i); + *size_out = i; + return ERROR_SUCCESS; } case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: + { + WCHAR *temp; + + if (input[0] == '0' && (input[1] == 'x' || input[1] == 'X')) + i = strtoulW(input, &temp, 16); + else + i = strtoulW(input, &temp, 10); + + if (input[0] == '-') + return ERROR_NEGATIVE; + + if (temp[0] || temp == input) + return ERROR_NOT_NUMBER; + + FIXME("Check for integer overflow.\n"); + if (0) + return ERROR_ARITHMETIC_OVERFLOW; + + + *out = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)); + **(DWORD **) out = i; + *size_out = sizeof(DWORD); + return ERROR_SUCCESS; + } + case REG_MULTI_SZ: + { + WCHAR *temp = HeapAlloc(GetProcessHeap(), 0, (strlenW(input) + 1) * sizeof(WCHAR)); + DWORD p; + + for (i = 0, p = 0; i <= strlenW(input); i++, p++) + { + /* If this character is the separator, or no separator has been given and these + * characters are "\\0", then add a 0 indicating the end of this string */ + if ( (separator && input[i] == separator) || + (!separator && input[i] == '\\' && input[i + 1] == '0') ) + { + /* If it's the first character or the previous one was a separator */ + if (!p || temp[p - 1] == 0) + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } + temp[p] = 0; + + if (!separator) + i++; + } + else + temp[p] = input[i]; + } + + /* Add a 0 to the end if the string wasn't "", and it wasn't + * double-0-terminated already (In the case of a trailing separator) */ + if (p > 1 && temp[p - 2]) + temp[p++] = 0; + + *size_out = p * sizeof(WCHAR); + *out = (BYTE *) temp; + return ERROR_SUCCESS; + } + case REG_BINARY: { - LPWSTR rest; - DWORD val; - val = strtolW(data, &rest, 0); - if (rest == data) { - static const WCHAR nonnumber[] = {'E','r','r','o','r',':',' ','/','d',' ','r','e','q','u','i','r','e','s',' ','n','u','m','b','e','r','.','\n',0}; - reg_printfW(nonnumber); - break; + BYTE *temp = HeapAlloc(GetProcessHeap(), 0, strlenW(input)); + DWORD p, odd; + + for (i = 0, p = 0; i < strlenW(input); i++, p++) + { + if (input[i] >= '0' && input[i] <= '9') + temp[p] = input[i] - '0'; + else if (input[i] >= 'a' && input[i] <= 'f') + temp[p] = input[i] - 'a' + 10; + else if (input[i] >= 'A' && input[i] <= 'F') + temp[p] = input[i] - 'A' + 10; + else + { + HeapFree(GetProcessHeap(), 0, temp); + return ERROR_BAD_COMMAND; + } } - *reg_count = sizeof(DWORD); - out_data = HeapAlloc(GetProcessHeap(),0,*reg_count); - ((LPDWORD)out_data)[0] = val; - break; + + *out = temp; + odd = p & 1; + temp += odd; + p >>= 1; + + for (i = 0; i < p; i++) + temp[i] = (temp[i * 2] << 4) | temp[i * 2 + 1]; + + *size_out = p + odd; + return ERROR_SUCCESS; } default: { - static const WCHAR unhandled[] = {'U','n','h','a','n','d','l','e','d',' ','T','y','p','e',' ','0','x','%','x',' ',' ','d','a','t','a',' ','%','s','\n',0}; - reg_printfW(unhandled, reg_type,data); + FIXME("Add support for registry type: %u\n", type); + return ERROR_UNSUPPORTED_TYPE; } } - - return out_data; } static LSTATUS sane_path(const WCHAR *key) @@ -310,7 +405,15 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } if (data) - reg_data = get_regdata(data,reg_type,separator,®_count); + { + err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); + if (err != ERROR_SUCCESS) + { + RegCloseKey(subkey); + reg_print_error(err); + return 1; + } + } RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); HeapFree(GetProcessHeap(),0,reg_data); diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 42de422..e407256 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -32,3 +32,5 @@ #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 #define STRING_UNSUPPORTED_TYPE 111 +#define STRING_NOT_INT_OR_NEG 112 +#define STRING_ERANGE 113 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index beafd4f..3fc4e89 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -37,4 +37,6 @@ STRINGTABLE STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " STRING_UNSUPPORTED_TYPE, "Error: Unsupported type\n" + STRING_NOT_INT_OR_NEG, "Error: This type requires /d to be a positive number\n" + STRING_ERANGE, "Error: Value out of range\n" } diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 9420b5c..99b4813 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -153,8 +153,8 @@ static void test_add(void) /* REG_NONE */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r); - todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d\n", r); - todo_wine verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0); + ok(r == REG_EXIT_SUCCESS, "got exit code %d\n", r); + verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0); /* REG_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r); @@ -188,11 +188,11 @@ static void test_add(void) /* REG_EXPAND_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, TODO_REG_SIZE); + verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, TODO_REG_SIZE); + verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -200,11 +200,11 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, TODO_REG_SIZE); + verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0); /* REG_BINARY */ run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r); @@ -214,14 +214,14 @@ static void test_add(void) run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 0xefbeadde; - verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), TODO_REG_SIZE); + verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin2 /f /d x01", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin3 /f /d 01x", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -235,8 +235,8 @@ static void test_add(void) err = RegQueryValueExA(hkey, "bin4", NULL, &type, (void *) (buffer+12), &size); ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_BINARY, "got wrong type %u\n", type); - todo_wine ok(size == 6, "got wrong size %u\n", size); - todo_wine ok(memcmp(buffer, buffer+12, 6) == 0 || + ok(size == 6, "got wrong size %u\n", size); + ok(memcmp(buffer, buffer+12, 6) == 0 || broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r); @@ -257,11 +257,11 @@ static void test_add(void) todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -275,22 +275,21 @@ static void test_add(void) ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err); ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD); ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD)); - todo_wine ok(dword == 123 || broken(dword == 0123 /* WinXP */), + ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected %d\n", dword, 123); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); dword = 0xdeadbeef; - verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), - (sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA); + verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0x01ffffffff /f", &r); todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d\n", r); @@ -305,7 +304,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); dword = 456; - verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), TODO_REG_SIZE); + verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0); /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like * an ordinary REG_DWORD - that is little endian. GG */ @@ -313,15 +312,15 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); memcpy(buffer, "three\0little\0strings\0", 22); - verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, TODO_REG_SIZE); + verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -329,7 +328,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, TODO_REG_SIZE); + verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); @@ -338,16 +337,16 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); buffer[0]='a'; buffer[1]=0; buffer[2]=0; - verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, TODO_REG_SIZE); + verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, 0); RegCloseKey(hkey); -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:50 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:50 +0100 Subject: [PATCH v3 09/10] reg: Clean up reg_add In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-9-git-send-email-jnvsor@gmail.com> You'll notice that bad value input leaves a zombie key after this call, but this is consistant with native. --- programs/reg/reg.c | 92 ++++++++++++++++++++++++++---------------------- programs/reg/tests/reg.c | 22 ++++++------ 2 files changed, 60 insertions(+), 54 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index bcbcdaa..b76fd3c 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -358,71 +358,70 @@ static LSTATUS sane_path(const WCHAR *key) return ERROR_SUCCESS; } -static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - WCHAR *type, WCHAR separator, WCHAR *data, BOOL force) +static int reg_add( const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const WCHAR *type, const WCHAR separator, const WCHAR *data, + const BOOL force) { - static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', - ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - HKEY subkey; - LONG err; - - reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); - - err = sane_path(key_name); + HKEY key = NULL; + LONG err = sane_path(key_name); if (err != ERROR_SUCCESS) + goto error; + + if (value_name && value_empty) { - reg_print_error(err); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } - err = path_open(key_name, &subkey, TRUE); + err = path_open(key_name, &key, TRUE); if (err != ERROR_SUCCESS) - { - reg_message(STRING_INVALID_KEY); - return 1; - } + goto error; if (value_name || data) { - DWORD reg_type; - DWORD reg_count = 0; - BYTE* reg_data = NULL; + DWORD size, reg_type; + BYTE *data_out; + + if (value_name && !value_name[0]) + value_name = NULL; - if (!force) + if (type && !type[0]) { - if (RegQueryValueW(subkey,value_name,NULL,NULL)==ERROR_SUCCESS) - { - /* FIXME: Prompt for overwrite */ - } + data = NULL; + type = NULL; } - reg_type = wchar_get_type(type); - if (reg_type == ~0u) + if (!force && RegQueryValueExW(key, value_name, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { - RegCloseKey(subkey); - reg_print_error(ERROR_UNSUPPORTED_TYPE); - return 1; + FIXME("Prompt for overwrite\n"); } - if (data) + reg_type = wchar_get_type(type); + if (reg_type == ~0u) { - err = wchar_get_data(data, reg_type, separator, ®_count, ®_data); - if (err != ERROR_SUCCESS) - { - RegCloseKey(subkey); - reg_print_error(err); - return 1; - } + err = ERROR_INVALID_DATATYPE; + goto error; } - RegSetValueExW(subkey,value_name,0,reg_type,reg_data,reg_count); - HeapFree(GetProcessHeap(),0,reg_data); + err = wchar_get_data(data, reg_type, separator, &size, &data_out); + if (err != ERROR_SUCCESS) + goto error; + + err = RegSetValueExW(key, value_name, 0, reg_type, data_out, size); + HeapFree(GetProcessHeap(), 0, data_out); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); - return 0; + +error: + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, @@ -602,7 +601,14 @@ int wmain(int argc, WCHAR *argvW[]) else if (!lstrcmpiW(argvW[i], slashTW)) type = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashSW)) - separator = argvW[++i][0]; + { + if (!argvW[++i][0] || argvW[i][1]) + { + reg_print_error(ERROR_BAD_COMMAND); + return 1; + } + separator = argvW[i][0]; + } else if (!lstrcmpiW(argvW[i], slashDW)) data = argvW[++i]; else if (!lstrcmpiW(argvW[i], slashFW)) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 99b4813..a3ecdfb 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -110,12 +110,12 @@ static void test_add(void) /* Test empty type */ run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r); - todo_wine ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), + ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), "got exit code %u\n", r); if (r == REG_EXIT_SUCCESS) - todo_wine verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); + verify_reg(hkey, "emptyType", REG_SZ, "", 1, 0); else - todo_wine win_skip("broken reg.exe detected\n"); + win_skip("broken reg.exe detected\n"); /* Test input key formats */ run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r); @@ -171,7 +171,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /v test /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test", REG_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -179,7 +179,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); - verify_reg(hkey, "test2", REG_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "test2", REG_SZ, "", 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test3 /f /d \"\"", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); @@ -196,7 +196,7 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, TODO_REG_SIZE); + verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, 0); run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); @@ -254,7 +254,7 @@ static void test_add(void) win_skip("broken reg.exe detected\n"); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), + ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d, expected 0\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r); @@ -324,18 +324,18 @@ static void test_add(void) run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); - verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, TODO_REG_SIZE); + verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r); verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r); - todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); + ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r); ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r); run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r); -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:48 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:48 +0100 Subject: [PATCH v3 07/10] reg: Add wchar/type conversion functions In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-7-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 65 ++++++++++++++++++++++++++++++++++------------------- programs/reg/reg.h | 1 + programs/reg/reg.rc | 1 + 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index e4a3860..a5a619e 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -50,6 +50,32 @@ root_rels[] = {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, }; +static const WCHAR type_none[] = {'R','E','G','_','N','O','N','E',0}; +static const WCHAR type_sz[] = {'R','E','G','_','S','Z',0}; +static const WCHAR type_expand_sz[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; +static const WCHAR type_binary[] = {'R','E','G','_','B','I','N','A','R','Y',0}; +static const WCHAR type_dword[] = {'R','E','G','_','D','W','O','R','D',0}; +static const WCHAR type_dword_le[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; +static const WCHAR type_dword_be[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; +static const WCHAR type_multi_sz[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; + +static const struct +{ + DWORD type; + const WCHAR *name; +} +type_rels[] = +{ + {REG_NONE, type_none}, + {REG_SZ, type_sz}, + {REG_EXPAND_SZ, type_expand_sz}, + {REG_BINARY, type_binary}, + {REG_DWORD, type_dword}, + {REG_DWORD_LITTLE_ENDIAN, type_dword_le}, + {REG_DWORD_BIG_ENDIAN, type_dword_be}, + {REG_MULTI_SZ, type_multi_sz}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -115,6 +141,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_FILE_NOT_FOUND: reg_message(STRING_CANNOT_FIND); return; + case ERROR_UNSUPPORTED_TYPE: + reg_message(STRING_UNSUPPORTED_TYPE); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -166,30 +195,20 @@ static LSTATUS path_open(const WCHAR *path, HKEY *out, BOOL create) return RegOpenKeyW(*out, path, out); } -static DWORD get_regtype(LPWSTR type) +static DWORD wchar_get_type(const WCHAR *type_name) { - static const WCHAR szREG_SZ[] = {'R','E','G','_','S','Z',0}; - static const WCHAR szREG_MULTI_SZ[] = {'R','E','G','_','M','U','L','T','I','_','S','Z',0}; - static const WCHAR szREG_DWORD_BIG_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','B','I','G','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_DWORD[] = {'R','E','G','_','D','W','O','R','D',0}; - static const WCHAR szREG_BINARY[] = {'R','E','G','_','B','I','N','A','R','Y',0}; - static const WCHAR szREG_DWORD_LITTLE_ENDIAN[] = {'R','E','G','_','D','W','O','R','D','_','L','I','T','T','L','E','_','E','N','D','I','A','N',0}; - static const WCHAR szREG_NONE[] = {'R','E','G','_','N','O','N','E',0}; - static const WCHAR szREG_EXPAND_SZ[] = {'R','E','G','_','E','X','P','A','N','D','_','S','Z',0}; - - if (!type) + DWORD i; + + if (!type_name) return REG_SZ; - if (lstrcmpiW(type,szREG_SZ)==0) return REG_SZ; - if (lstrcmpiW(type,szREG_DWORD)==0) return REG_DWORD; - if (lstrcmpiW(type,szREG_MULTI_SZ)==0) return REG_MULTI_SZ; - if (lstrcmpiW(type,szREG_EXPAND_SZ)==0) return REG_EXPAND_SZ; - if (lstrcmpiW(type,szREG_DWORD_BIG_ENDIAN)==0) return REG_DWORD_BIG_ENDIAN; - if (lstrcmpiW(type,szREG_DWORD_LITTLE_ENDIAN)==0) return REG_DWORD_LITTLE_ENDIAN; - if (lstrcmpiW(type,szREG_BINARY)==0) return REG_BINARY; - if (lstrcmpiW(type,szREG_NONE)==0) return REG_NONE; + for (i = 0; i < ARRAY_SIZE(type_rels); i++) + { + if (!strcmpiW(type_rels[i].name, type_name)) + return type_rels[i].type; + } - return -1; + return ~0u; } static LPBYTE get_regdata(LPWSTR data, DWORD reg_type, WCHAR separator, DWORD *reg_count) @@ -282,11 +301,11 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, } } - reg_type = get_regtype(type); - if (reg_type == -1) + reg_type = wchar_get_type(type); + if (reg_type == ~0u) { RegCloseKey(subkey); - reg_message(STRING_INVALID_CMDLINE); + reg_print_error(ERROR_UNSUPPORTED_TYPE); return 1; } diff --git a/programs/reg/reg.h b/programs/reg/reg.h index 1c2ae83..42de422 100644 --- a/programs/reg/reg.h +++ b/programs/reg/reg.h @@ -31,3 +31,4 @@ #define STRING_NO_REMOTE 108 #define STRING_CANNOT_FIND 109 #define STRING_ERROR 110 +#define STRING_UNSUPPORTED_TYPE 111 diff --git a/programs/reg/reg.rc b/programs/reg/reg.rc index 5fc5a76..beafd4f 100644 --- a/programs/reg/reg.rc +++ b/programs/reg/reg.rc @@ -36,4 +36,5 @@ STRINGTABLE STRING_NO_REMOTE, "Error: Unable to access remote machine\n" STRING_CANNOT_FIND, "Error: The system was unable to find the specified registry key or value\n" STRING_ERROR, "Unexpected error: " + STRING_UNSUPPORTED_TYPE, "Error: Unsupported type\n" } -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:51 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:51 +0100 Subject: [PATCH v3 10/10] reg: Clean up reg_delete In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-10-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 150 +++++++++++++++++++++++------------------------ programs/reg/tests/reg.c | 2 +- 2 files changed, 74 insertions(+), 78 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index b76fd3c..d5a74a7 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -424,120 +424,116 @@ error: return 1; } -static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, - BOOL value_all, BOOL force) +static int reg_delete(const WCHAR *key_name, const WCHAR *value_name, const BOOL value_empty, + const BOOL value_all, const BOOL force) { - HKEY subkey; - LONG err; - - static const WCHAR stubW[] = {'D','E','L','E','T','E', - ' ','-',' ','%','s',' ','%','s',' ','%','d',' ','%','d',' ','%','d','\n' - ,0}; - reg_printfW(stubW, key_name, value_name, value_empty, value_all, force); - - err = sane_path(key_name); + HKEY key = NULL; + LONG err = sane_path(key_name); if (err != ERROR_SUCCESS) { reg_print_error(err); return 1; } - err = path_open(key_name, &subkey, FALSE); + err = path_open(key_name, &key, FALSE); if (err != ERROR_SUCCESS) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - - if (value_name && value_empty) - { - reg_message(STRING_INVALID_CMDLINE); - return 1; - } + goto error; - if (value_empty && value_all) + /* Mutually exclusive options */ + if ((!!value_name + !!value_empty + !!value_all) > 1) { - reg_message(STRING_INVALID_CMDLINE); - return 1; + err = ERROR_BAD_COMMAND; + goto error; } if (!force) { - /* FIXME: Prompt for delete */ + FIXME("Prompt for delete\n"); } - /* Delete subtree only if no /v* option is given */ - if (!value_name && !value_empty && !value_all) + if (value_empty || value_name) { - err = RegDeleteTreeA(subkey, NULL); - if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } + if (value_name && value_name[0]) + err = RegDeleteValueW(key, value_name); + else + err = RegDeleteValueW(key, NULL); - err = RegDeleteKeyA(subkey, ""); if (err != ERROR_SUCCESS) - { - reg_print_error(err); - return 1; - } - reg_message(STRING_SUCCESS); - return 0; + goto error; } - - if (value_all) + else if (value_all) { - LPWSTR szValue; - DWORD maxValue; - DWORD count; - LONG rc; - - rc = RegQueryInfoKeyW(subkey, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - &maxValue, NULL, NULL, NULL); - if (rc != ERROR_SUCCESS) - { - /* FIXME: failure */ - RegCloseKey(subkey); - return 1; - } - maxValue++; - szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR)); + WCHAR *enum_v_name; + DWORD count, max_size, this_size, i = 0, errors = 0; - while (1) + err = RegQueryInfoKeyW(key, NULL, NULL, NULL, NULL, NULL, NULL, + &count, &max_size, NULL, NULL, NULL); + if (err != ERROR_SUCCESS) + goto error; + + enum_v_name = HeapAlloc(GetProcessHeap(), 0, ++max_size * sizeof(WCHAR)); + + while (i < count) { - count = maxValue; - rc = RegEnumValueW(subkey, 0, szValue, &count, NULL, NULL, NULL, NULL); - if (rc == ERROR_SUCCESS) + this_size = max_size; + + err = RegEnumValueW(key, i, enum_v_name, &this_size, NULL, NULL, NULL, NULL); + if (err != ERROR_SUCCESS) + { + i++; + errors++; + reg_print_error(err); + continue; + } + + err = RegDeleteValueW(key, enum_v_name); + if (err != ERROR_SUCCESS) { - rc = RegDeleteValueW(subkey, szValue); - if (rc != ERROR_SUCCESS) - break; + i++; + errors++; + reg_print_error(err); + continue; } - else break; + + count--; } - if (rc != ERROR_SUCCESS) + + HeapFree(GetProcessHeap(), 0, enum_v_name); + + if (errors) { - /* FIXME delete failed */ + RegCloseKey(key); + return 1; } } - else if (value_name) + /* Delete subtree only if no /v* option is given */ + else { - if (RegDeleteValueW(subkey,value_name) != ERROR_SUCCESS) + if (key == path_get_rootkey(key_name)) { - RegCloseKey(subkey); - reg_message(STRING_CANNOT_FIND); + /* "This works well enough on native to make you regret you pressed enter" - stefand */ + FIXME("Deleting a root key is not implemented.\n"); + RegCloseKey(key); return 1; } - } - else if (value_empty) - { - RegSetValueExW(subkey,NULL,0,REG_SZ,NULL,0); + + err = RegDeleteTreeA(key, NULL); + if (err != ERROR_SUCCESS) + goto error; + err = RegDeleteKeyA(key, ""); + if (err != ERROR_SUCCESS) + goto error; } - RegCloseKey(subkey); + RegCloseKey(key); reg_message(STRING_SUCCESS); return 0; + +error: + RegCloseKey(key); + + reg_print_error(err); + return 1; } static int reg_query(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index a3ecdfb..20ef7af 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -388,7 +388,7 @@ static void test_delete(void) run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); - todo_wine ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); + ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r); ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r); -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:43 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:43 +0100 Subject: [PATCH v3 02/10] reg/tests: Test REG_NONE In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-2-git-send-email-jnvsor@gmail.com> --- programs/reg/tests/reg.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 9b1881e..2d86d83 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -151,6 +151,11 @@ static void test_add(void) err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest4"); ok(err == ERROR_SUCCESS, "got exit code %d\n", r); + /* REG_NONE */ + run_reg_exe("reg add HKCU\\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r); + todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d\n", r); + todo_wine verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0); + /* REG_SZ */ run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */), -- 2.1.3 From jnvsor at gmail.com Sat Nov 8 04:26:47 2014 From: jnvsor at gmail.com (Jonathan Vollebregt) Date: Sat, 8 Nov 2014 11:26:47 +0100 Subject: [PATCH v3 06/10] reg: Add path/key conversion functions In-Reply-To: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> References: <1415442411-14059-1-git-send-email-jnvsor@gmail.com> Message-ID: <1415442411-14059-6-git-send-email-jnvsor@gmail.com> --- programs/reg/reg.c | 146 +++++++++++++++++++++++++++++------------------------ 1 file changed, 80 insertions(+), 66 deletions(-) diff --git a/programs/reg/reg.c b/programs/reg/reg.c index ff12b3f..e4a3860 100755 --- a/programs/reg/reg.c +++ b/programs/reg/reg.c @@ -20,8 +20,36 @@ #include #include "reg.h" +#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) + #define ERROR_NO_REMOTE 20000 +static const WCHAR short_hklm[] = {'H','K','L','M',0}; +static const WCHAR short_hkcu[] = {'H','K','C','U',0}; +static const WCHAR short_hkcr[] = {'H','K','C','R',0}; +static const WCHAR short_hku[] = {'H','K','U',0}; +static const WCHAR short_hkcc[] = {'H','K','C','C',0}; +static const WCHAR long_hklm[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; +static const WCHAR long_hkcu[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; +static const WCHAR long_hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; +static const WCHAR long_hku[] = {'H','K','E','Y','_','U','S','E','R','S',0}; +static const WCHAR long_hkcc[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; + +static const struct +{ + HKEY key; + const WCHAR *short_name; + const WCHAR *long_name; +} +root_rels[] = +{ + {HKEY_LOCAL_MACHINE, short_hklm, long_hklm}, + {HKEY_CURRENT_USER, short_hkcu, long_hkcu}, + {HKEY_CLASSES_ROOT, short_hkcr, long_hkcr}, + {HKEY_USERS, short_hku, long_hku}, + {HKEY_CURRENT_CONFIG, short_hkcc, long_hkcc}, +}; + static int reg_printfW(const WCHAR *msg, ...) { va_list va_args; @@ -84,6 +112,9 @@ static void reg_print_error(LSTATUS error_code) case ERROR_NO_REMOTE: reg_message(STRING_NO_REMOTE); return; + case ERROR_FILE_NOT_FOUND: + reg_message(STRING_CANNOT_FIND); + return; default: { static const WCHAR error_string[] = {'%','0','5','d',':',' ','%','s',0}; @@ -99,35 +130,40 @@ static void reg_print_error(LSTATUS error_code) } } -static HKEY get_rootkey(LPWSTR key) +static inline BOOL path_rootname_cmp(const WCHAR *input_path, const WCHAR *rootkey_name) +{ + DWORD length = strlenW(rootkey_name); + + return (!strncmpiW(input_path, rootkey_name, length) && + (input_path[length] == 0 || input_path[length] == '\\')); +} + +static HKEY path_get_rootkey(const WCHAR *path) +{ + DWORD i; + + for (i = 0; i < ARRAY_SIZE(root_rels); i++) + { + if (path_rootname_cmp(path, root_rels[i].short_name) || + path_rootname_cmp(path, root_rels[i].long_name)) + return root_rels[i].key; + } + + return NULL; +} + +static LSTATUS path_open(const WCHAR *path, HKEY *out, BOOL create) { - static const WCHAR szHKLM[] = {'H','K','L','M',0}; - static const WCHAR szHKEY_LOCAL_MACHINE[] = {'H','K','E','Y','_','L','O','C','A','L','_','M','A','C','H','I','N','E',0}; - static const WCHAR szHKCU[] = {'H','K','C','U',0}; - static const WCHAR szHKEY_CURRENT_USER[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','U','S','E','R',0}; - static const WCHAR szHKCR[] = {'H','K','C','R',0}; - static const WCHAR szHKEY_CLASSES_ROOT[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0}; - static const WCHAR szHKU[] = {'H','K','U',0}; - static const WCHAR szHKEY_USERS[] = {'H','K','E','Y','_','U','S','E','R','S',0}; - static const WCHAR szHKCC[] = {'H','K','C','C',0}; - static const WCHAR szHKEY_CURRENT_CONFIG[] = {'H','K','E','Y','_','C','U','R','R','E','N','T','_','C','O','N','F','I','G',0}; - - if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKLM,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,18,szHKEY_LOCAL_MACHINE,18)==CSTR_EQUAL) - return HKEY_LOCAL_MACHINE; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCU,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CURRENT_USER,17)==CSTR_EQUAL) - return HKEY_CURRENT_USER; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCR,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,17,szHKEY_CLASSES_ROOT,17)==CSTR_EQUAL) - return HKEY_CLASSES_ROOT; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,3,szHKU,3)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,10,szHKEY_USERS,10)==CSTR_EQUAL) - return HKEY_USERS; - else if (CompareStringW(CP_ACP,NORM_IGNORECASE,key,4,szHKCC,4)==CSTR_EQUAL || - CompareStringW(CP_ACP,NORM_IGNORECASE,key,19,szHKEY_CURRENT_CONFIG,19)==CSTR_EQUAL) - return HKEY_CURRENT_CONFIG; - else return NULL; + *out = path_get_rootkey(path); + + path = strchrW(path, '\\'); + if (path) + path++; + + if (create) + return RegCreateKeyW(*out, path, out); + else + return RegOpenKeyW(*out, path, out); } static DWORD get_regtype(LPWSTR type) @@ -213,8 +249,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, { static const WCHAR stubW[] = {'A','D','D',' ','-',' ','%','s', ' ','%','s',' ','%','d',' ','%','s',' ','%','s',' ','%','d','\n',0}; - LPWSTR p; - HKEY root,subkey; + HKEY subkey; LONG err; reg_printfW(stubW, key_name, value_name, value_empty, type, data, force); @@ -226,22 +261,8 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } - p = strchrW(key_name,'\\'); - if (!p) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - - if(RegCreateKeyW(root,p,&subkey)!=ERROR_SUCCESS) + err = path_open(key_name, &subkey, TRUE); + if (err != ERROR_SUCCESS) { reg_message(STRING_INVALID_KEY); return 1; @@ -285,8 +306,7 @@ static int reg_add(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, BOOL value_all, BOOL force) { - LPWSTR p; - HKEY root,subkey; + HKEY subkey; LONG err; static const WCHAR stubW[] = {'D','E','L','E','T','E', @@ -301,16 +321,8 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, return 1; } - p = strchrW(key_name,'\\'); - if (!p) - { - reg_message(STRING_INVALID_KEY); - return 1; - } - p++; - - root = get_rootkey(key_name); - if (!root) + err = path_open(key_name, &subkey, FALSE); + if (err != ERROR_SUCCESS) { reg_message(STRING_INVALID_KEY); return 1; @@ -336,21 +348,23 @@ static int reg_delete(WCHAR *key_name, WCHAR *value_name, BOOL value_empty, /* Delete subtree only if no /v* option is given */ if (!value_name && !value_empty && !value_all) { - if (RegDeleteTreeW(root,p)!=ERROR_SUCCESS) + err = RegDeleteTreeA(subkey, NULL); + if (err != ERROR_SUCCESS) { - reg_message(STRING_CANNOT_FIND); + reg_print_error(err); + return 1; + } + + err = RegDeleteKeyA(subkey, ""); + if (err != ERROR_SUCCESS) + { + reg_print_error(err); return 1; } reg_message(STRING_SUCCESS); return 0; } - if(RegOpenKeyW(root,p,&subkey)!=ERROR_SUCCESS) - { - reg_message(STRING_CANNOT_FIND); - return 1; - } - if (value_all) { LPWSTR szValue; -- 2.1.3 From nsivov at codeweavers.com Sat Nov 8 10:02:55 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Sat, 08 Nov 2014 19:02:55 +0300 Subject: [PATCH] include: Add a couple more defines for D3DPRESENT_* flags Message-ID: <545E3EAF.3040300@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-include-Add-a-couple-more-defines-for-D3DPRESENT_-fl.patch Type: text/x-patch Size: 957 bytes Desc: not available URL: From mengshuaicalendr at gmail.com Sat Nov 8 20:46:11 2014 From: mengshuaicalendr at gmail.com (Shuai Meng) Date: Sun, 9 Nov 2014 10:46:11 +0800 Subject: [PATCH] vbscript: Implemented String(try 4) In-Reply-To: <545DA383.8030802@gmail.com> References: <545DA383.8030802@gmail.com> Message-ID: Sorry, I was in such a hurry that I ignored the first advice of Piotr, I will resend this patch later. 2014-11-08 13:00 GMT+08:00 Shuai Meng : > Change log: > removed codes that handled VT_ARRAY|VT_BYREF|VT_VARIANT case > separately. > --- > dlls/vbscript/global.c | 61 ++++++++++++++++++++++++++++++ > +++++++++++++-- > dlls/vbscript/tests/api.vbs | 53 +++++++++++++++++++++++++++++++++++++++ > dlls/vbscript/vbscript.h | 1 + > 3 files changed, 113 insertions(+), 2 deletions(-) > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From matellanesivan at gmail.com Sun Nov 9 13:17:31 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Sun, 09 Nov 2014 20:17:31 +0100 Subject: msvcrt: Add missing declarations in wchar.h Message-ID: <545FBDCB.9020205@gmail.com> --- include/msvcrt/wchar.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index d936dc3..702fa67 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -313,12 +313,18 @@ int __cdecl _wstat64(const wchar_t*,struct _stat64*); #ifndef _WSTDIO_DEFINED #define _WSTDIO_DEFINED +wint_t __cdecl _fgetwc_nolock(FILE*); wint_t __cdecl _fgetwchar(void); +wint_t __cdecl _fputwc_nolock(wint_t,FILE*); wint_t __cdecl _fputwchar(wint_t); +wint_t __cdecl _getwc_nolock(FILE*); wchar_t* __cdecl _getws(wchar_t*); +wint_t __cdecl _putwc_nolock(wint_t,FILE*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); int __cdecl _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...); +int __cdecl _scwprintf(const wchar_t*,...); +wint_t __cdecl _ungetwc_nolock(wint_t,FILE*); int __cdecl _vscwprintf(const wchar_t*,__ms_va_list); int __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list); int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list); -- 1.9.1 From matellanesivan at gmail.com Sun Nov 9 13:17:45 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Sun, 09 Nov 2014 20:17:45 +0100 Subject: msvcrt: Added _fread_nolock_s implementation (try 2) Message-ID: <545FBDD9.3080808@gmail.com> Hi, I've checked when the file gets locked after calling fread_s. It turns out that the locking is done after validating the stream, the element size and the element count. This potentially leads to calling the invalid parameter handler with the file locked if, for example, destBuffer == NULL (at least that's what happens on my Windows 7 x64 machine). This implementation tries to reproduce this behaviour. Cheers! --- dlls/msvcr100/msvcr100.spec | 2 +- dlls/msvcr100/tests/msvcr100.c | 35 +++++++++++++++++++++++++++++++++++ dlls/msvcr110/msvcr110.spec | 2 +- dlls/msvcr120/msvcr120.spec | 2 +- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/file.c | 26 ++++++++++++++++++++++++-- dlls/msvcrt/msvcrt.h | 1 + include/msvcrt/stdio.h | 2 ++ 9 files changed, 67 insertions(+), 7 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index cb45506..a6e7771 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -835,7 +835,7 @@ @ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock -@ stub _fread_nolock_s +@ cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT__fread_nolock_s @ cdecl _free_locale(ptr) MSVCRT__free_locale @ stub _freea @ stub _freea_s diff --git a/dlls/msvcr100/tests/msvcr100.c b/dlls/msvcr100/tests/msvcr100.c index a998fb5..4c66ed5 100644 --- a/dlls/msvcr100/tests/msvcr100.c +++ b/dlls/msvcr100/tests/msvcr100.c @@ -140,6 +140,8 @@ static int (__cdecl *p_wmemmove_s)(wchar_t *dest, size_t numberOfElements, const static FILE* (__cdecl *p_fopen)(const char*,const char*); static int (__cdecl *p_fclose)(FILE*); static size_t (__cdecl *p_fread_s)(void*,size_t,size_t,size_t,FILE*); +static void (__cdecl *p_lock_file)(FILE*); +static void (__cdecl *p_unlock_file)(FILE*); static void* (__cdecl *p__aligned_offset_malloc)(size_t, size_t, size_t); static void (__cdecl *p__aligned_free)(void*); static size_t (__cdecl *p__aligned_msize)(void*, size_t, size_t); @@ -178,6 +180,8 @@ static BOOL init(void) SET(p_fopen, "fopen"); SET(p_fclose, "fclose"); SET(p_fread_s, "fread_s"); + SET(p_lock_file, "_lock_file"); + SET(p_unlock_file, "_unlock_file"); SET(p__aligned_offset_malloc, "_aligned_offset_malloc"); SET(p__aligned_free, "_aligned_free"); SET(p__aligned_msize, "_aligned_msize"); @@ -357,11 +361,30 @@ static void test_wmemmove_s(void) "Cannot reset invalid parameter handler\n"); } +struct block_file_arg +{ + FILE *test_file; + HANDLE init; + HANDLE finish; +}; + +static DWORD WINAPI block_file(void *arg) +{ + struct block_file_arg *files = arg; + p_lock_file(files->test_file); + SetEvent(files->init); + WaitForSingleObject(files->finish, INFINITE); + p_unlock_file(files->test_file); + return 0; +} + static void test_fread_s(void) { static const char test_file[] = "fread_s.tst"; int ret; char buf[10]; + HANDLE thread; + struct block_file_arg arg; FILE *f = fopen(test_file, "w"); if(!f) { @@ -382,6 +405,12 @@ static void test_fread_s(void) CHECK_CALLED(invalid_parameter_handler); f = p_fopen(test_file, "r"); + arg.test_file = f; + arg.init = CreateEventW(NULL, FALSE, FALSE, NULL); + arg.finish = CreateEventW(NULL, FALSE, FALSE, NULL); + thread = CreateThread(NULL, 0, block_file, (void*)&arg, 0, NULL); + WaitForSingleObject(arg.init, INFINITE); + errno = 0xdeadbeef; ret = p_fread_s(NULL, sizeof(buf), 0, 1, f); ok(ret == 0, "fread_s returned %d, expected 0\n", ret); @@ -390,6 +419,9 @@ static void test_fread_s(void) ok(ret == 0, "fread_s returned %d, expected 0\n", ret); ok(errno == 0xdeadbeef, "errno = %d, expected 0xdeadbeef\n", errno); + SetEvent(arg.finish); + WaitForSingleObject(thread, INFINITE); + SET_EXPECT(invalid_parameter_handler); errno = 0xdeadbeef; ret = p_fread_s(NULL, sizeof(buf), 1, 1, f); @@ -426,6 +458,9 @@ static void test_fread_s(void) ok(p_set_invalid_parameter_handler(NULL) == test_invalid_parameter_handler, "Cannot reset invalid parameter handler\n"); + CloseHandle(arg.init); + CloseHandle(arg.finish); + CloseHandle(thread); unlink(test_file); } diff --git a/dlls/msvcr110/msvcr110.spec b/dlls/msvcr110/msvcr110.spec index d41699d..141697c 100644 --- a/dlls/msvcr110/msvcr110.spec +++ b/dlls/msvcr110/msvcr110.spec @@ -1183,7 +1183,7 @@ @ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock -@ stub _fread_nolock_s +@ cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT__fread_nolock_s @ cdecl _free_locale(ptr) MSVCRT__free_locale @ stub _freea @ stub _freea_s diff --git a/dlls/msvcr120/msvcr120.spec b/dlls/msvcr120/msvcr120.spec index fbf688e..1b8dc28 100644 --- a/dlls/msvcr120/msvcr120.spec +++ b/dlls/msvcr120/msvcr120.spec @@ -1181,7 +1181,7 @@ @ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock -@ stub _fread_nolock_s +@ cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT__fread_nolock_s @ cdecl _free_locale(ptr) MSVCRT__free_locale @ stub _freea @ stub _freea_s diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index efb4539..fcad7cd 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -502,7 +502,7 @@ @ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock -@ stub _fread_nolock_s +@ cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT__fread_nolock_s @ cdecl _free_locale(ptr) MSVCRT__free_locale @ stub _freea @ stub _freea_s diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index fa62366..7328b46 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -484,7 +484,7 @@ @ cdecl _fputwc_nolock(long ptr) MSVCRT__fputwc_nolock @ cdecl _fputwchar(long) MSVCRT__fputwchar @ cdecl _fread_nolock(ptr long long ptr) MSVCRT__fread_nolock -@ stub _fread_nolock_s +@ cdecl _fread_nolock_s(ptr long long long ptr) MSVCRT__fread_nolock_s @ cdecl _free_locale(ptr) MSVCRT__free_locale @ stub _freea @ stub _freea_s diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 491942d..5049605 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -4130,9 +4130,31 @@ MSVCRT_size_t CDECL MSVCRT__fread_nolock(void *ptr, MSVCRT_size_t size, MSVCRT_s MSVCRT_size_t CDECL MSVCRT_fread_s(void *buf, MSVCRT_size_t buf_size, MSVCRT_size_t elem_size, MSVCRT_size_t count, MSVCRT_FILE *stream) { + MSVCRT_size_t ret; + + if(!MSVCRT_CHECK_PMT(stream != NULL)) { + if(buf && buf_size) + memset(buf, 0, buf_size); + return 0; + } + if(!elem_size || !count) return 0; + + MSVCRT__lock_file(stream); + ret = MSVCRT__fread_nolock_s(buf, buf_size, elem_size, count, stream); + MSVCRT__unlock_file(stream); + + return ret; +} + +/********************************************************************* + * _fread_nolock_s (MSVCR80.@) + */ +MSVCRT_size_t CDECL MSVCRT__fread_nolock_s(void *buf, MSVCRT_size_t buf_size, MSVCRT_size_t elem_size, + MSVCRT_size_t count, MSVCRT_FILE *stream) +{ size_t bytes_left, buf_pos; - TRACE("(%p %lu %lu %lu %p\n", buf, buf_size, elem_size, count, stream); + TRACE("(%p %lu %lu %lu %p)\n", buf, buf_size, elem_size, count, stream); if(!MSVCRT_CHECK_PMT(stream != NULL)) { if(buf && buf_size) @@ -4154,7 +4176,7 @@ MSVCRT_size_t CDECL MSVCRT_fread_s(void *buf, MSVCRT_size_t buf_size, MSVCRT_siz return 0; } - MSVCRT_fread((char*)buf+buf_pos, 1, size, stream); + MSVCRT__fread_nolock((char*)buf+buf_pos, 1, size, stream); buf_pos += size; bytes_left -= size; }else { diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 70ac68b..72d529d 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -934,6 +934,7 @@ MSVCRT_ulong* __cdecl MSVCRT___doserrno(void); int* __cdecl MSVCRT__errno(void); char* __cdecl MSVCRT_getenv(const char*); MSVCRT_size_t __cdecl MSVCRT__fread_nolock(void*,MSVCRT_size_t,MSVCRT_size_t,MSVCRT_FILE*); +MSVCRT_size_t __cdecl MSVCRT__fread_nolock_s(void*,MSVCRT_size_t,MSVCRT_size_t,MSVCRT_size_t,MSVCRT_FILE*); MSVCRT_size_t __cdecl MSVCRT__fwrite_nolock(const void*,MSVCRT_size_t,MSVCRT_size_t,MSVCRT_FILE*); int __cdecl MSVCRT_fclose(MSVCRT_FILE*); int __cdecl MSVCRT__fclose_nolock(MSVCRT_FILE*); diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index eda89e6..0606d07 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -128,6 +128,7 @@ int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list); int __cdecl _vsprintf_p_l(char*,size_t,const char*,_locale_t,__ms_va_list); size_t __cdecl _fread_nolock(void*,size_t,size_t,FILE*); +size_t __cdecl _fread_nolock_s(void*,size_t,size_t,size_t,FILE*); size_t __cdecl _fwrite_nolock(const void*,size_t,size_t,FILE*); int __cdecl _fclose_nolock(FILE*); int __cdecl _fflush_nolock(FILE*); @@ -156,6 +157,7 @@ int __cdecl fprintf_s(FILE*,const char*,...); int __cdecl fputc(int,FILE*); int __cdecl fputs(const char*,FILE*); size_t __cdecl fread(void*,size_t,size_t,FILE*); +size_t __cdecl fread_s(void*,size_t,size_t,size_t,FILE*); FILE* __cdecl freopen(const char*,const char*,FILE*); int __cdecl fscanf(FILE*,const char*,...); int __cdecl fscanf_s(FILE*,const char*,...); -- 1.9.1 From austinenglish at gmail.com Sun Nov 9 23:45:36 2014 From: austinenglish at gmail.com (Austin English) Date: Sun, 9 Nov 2014 23:45:36 -0600 Subject: kernel32: add TRUST_E_NOSIGNATURE resource definition Message-ID: Patch is from https://bugs.winehq.org/show_bug.cgi?id=29997. It seems the author never submitted it, so doing so for him. -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-kernel32-add-TRUST_E_NOSIGNATURE-resource-definition.patch Type: text/x-patch Size: 1222 bytes Desc: not available URL: From nsivov at codeweavers.com Mon Nov 10 01:06:49 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 10 Nov 2014 10:06:49 +0300 Subject: [PATCH] dwrite: Remove OpenType language id from cache. Message-ID: <54606409.7010701@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Remove-OpenType-language-id-from-cache.patch Type: text/x-patch Size: 8506 bytes Desc: not available URL: From christopherwuy at gmail.com Fri Nov 7 20:15:21 2014 From: christopherwuy at gmail.com (YongHao Hu) Date: Sat, 08 Nov 2014 10:15:21 +0800 Subject: msvcp90: Add std_Ctraits::Isnan implementation. (try 2) Message-ID: <545D7CB9.9000302@gmail.com> try2: Update msvcp70.spec, msvcp71.spec and msvcp80.spec. Thanks for Nikolay Sivov's comment. --- dlls/msvcp70/msvcp70.spec | 6 +++--- dlls/msvcp71/msvcp71.spec | 6 +++--- dlls/msvcp80/msvcp80.spec | 6 +++--- dlls/msvcp90/math.c | 9 +++++++++ dlls/msvcp90/msvcp90.spec | 6 +++--- dlls/msvcp90/tests/misc.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 69 insertions(+), 12 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0058-msvcp90-Add-std_Ctraits-Isnan-implementation.txt Type: text/x-patch Size: 8502 bytes Desc: not available URL: From drew_ronneberg at yahoo.com Sun Nov 9 17:18:34 2014 From: drew_ronneberg at yahoo.com (Drew Ronneberg) Date: Sun, 9 Nov 2014 15:18:34 -0800 Subject: [PATCH] Do not call SendMessage() to hide a window that is already hidden Message-ID: <1415575114.24164.YahooMailNeo@web162801.mail.bf1.yahoo.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Do-not-call-SendMessage-to-hide-a-window-that-is-alrea.txt URL: From qhong at codeweavers.com Mon Nov 10 02:27:54 2014 From: qhong at codeweavers.com (Qian Hong) Date: Mon, 10 Nov 2014 16:27:54 +0800 Subject: [PATCH 1/2] user32: Add more exception handlings for timer callbacks. Message-ID: <5460770A.4030506@codeweavers.com> - No code change from last try. - Superseded patch 107362. --- dlls/user32/message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-Add-more-exception-handlings-for-timer-callback.txt Type: text/x-patch Size: 920 bytes Desc: not available URL: From qhong at codeweavers.com Mon Nov 10 02:28:23 2014 From: qhong at codeweavers.com (Qian Hong) Date: Mon, 10 Nov 2014 16:28:23 +0800 Subject: [PATCH 2/2] user32/tests: Test exception handling for timer callbacks. (try 2) Message-ID: <54607727.7010606@codeweavers.com> Try 2: - Test timer callback without Sleep(). - Superseded patch 107363. Thanks Alexandre for advice. --- dlls/user32/tests/msg.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-user32-tests-Test-exception-handling-for-timer-callbac.txt Type: text/x-patch Size: 2238 bytes Desc: not available URL: From hugh.mcmaster at outlook.com Mon Nov 10 05:00:59 2014 From: hugh.mcmaster at outlook.com (Hugh McMaster) Date: Mon, 10 Nov 2014 22:00:59 +1100 Subject: [PATCH] reg.exe: Modernise print functions Message-ID: This patch modernises reg.exe so its printf-type functions conform to the other Wine programs. It will also mean other developers do not have to add this functionality in various places, e.g. printing error messages. -------------- next part -------------- A non-text attachment was scrubbed... Name: reg-print-functions.patch Type: application/octet-stream Size: 4021 bytes Desc: not available URL: From jr98 at gmx.net Mon Nov 10 05:21:49 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Mon, 10 Nov 2014 12:21:49 +0100 Subject: [website] German translation for release 1.7.30 Message-ID: <1415618509.4984.1.camel@xpsubuntu> Sorry for the delay, I was traveling last week. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-German-translation-for-release-1.7.30.patch Type: text/x-patch Size: 1298 bytes Desc: not available URL: From hugh.mcmaster at outlook.com Mon Nov 10 06:21:56 2014 From: hugh.mcmaster at outlook.com (Hugh McMaster) Date: Mon, 10 Nov 2014 23:21:56 +1100 Subject: [PATCH] reg: Modernise print functions (updated) Message-ID: This patch modernises reg.exe so its printf-type functions conform to the other Wine programs. It will also mean other developers do not have to add this functionality in various places, e.g. printing error messages. Update: I forgot to use __ms_va_start and __ms_va_end when using __ms_va_list. Fixed. -------------- next part -------------- A non-text attachment was scrubbed... Name: reg-print-functions.patch Type: application/octet-stream Size: 4051 bytes Desc: not available URL: From piotr at codeweavers.com Mon Nov 10 06:46:18 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Mon, 10 Nov 2014 13:46:18 +0100 Subject: user32: Move IME Window Procedure to user32 (try2) Message-ID: <5460B39A.4@codeweavers.com> --- dlls/imm32/imm.c | 105 ++++++----------------------------------- dlls/imm32/imm32.spec | 4 ++ dlls/user32/class.c | 1 + dlls/user32/controls.h | 4 ++ dlls/user32/misc.c | 116 ++++++++++++++++++++++++++++++++++++++++++++-- dlls/user32/tests/class.c | 11 ++--- dlls/user32/user_main.c | 6 +++ dlls/user32/winproc.c | 1 + 8 files changed, 146 insertions(+), 102 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-Move-IME-Window-Procedure-to-user32.txt Type: text/x-patch Size: 15209 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 10 08:00:56 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 10 Nov 2014 15:00:56 +0100 Subject: [PATCH 2/3] mshtml: Delay onreadystateevent notification if script elemenet is not added by parser. Message-ID: <5460C518.5000406@codeweavers.com> --- dlls/mshtml/htmlscript.h | 1 + dlls/mshtml/script.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Delay-onreadystateevent-notification-if-script.diff Type: text/x-patch Size: 2832 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 10 08:01:15 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 10 Nov 2014 15:01:15 +0100 Subject: [PATCH 3/3] mshtml: Added script element readyState and onreadystatechange tests. Message-ID: <5460C52B.5000606@codeweavers.com> --- dlls/mshtml/tests/events.html | 81 +++++++++++++++++++++++++++++++++++++++++- dlls/mshtml/tests/externscr.js | 2 ++ dlls/mshtml/tests/script.c | 19 ++++++++++ 3 files changed, 101 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-mshtml-Added-script-element-readyState-and-onreadysta.diff Type: text/x-patch Size: 6193 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 10 08:01:33 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 10 Nov 2014 15:01:33 +0100 Subject: [PATCH 1/3] mshtml: Ignore query and hash parts in res protocol handler. Message-ID: <5460C53D.3070303@codeweavers.com> --- dlls/mshtml/protocol.c | 8 +++++++- dlls/mshtml/tests/protocol.c | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Ignore-query-and-hash-parts-in-res-protocol-ha.diff Type: text/x-patch Size: 1628 bytes Desc: not available URL: From dimesio at earthlink.net Mon Nov 10 10:01:07 2014 From: dimesio at earthlink.net (Rosanne DiMesio) Date: Mon, 10 Nov 2014 10:01:07 -0600 Subject: [website] Ubuntu download: Correct Ubuntu downloads instructions Message-ID: <20141110100107.6e1d0cd0e94d0e8aae1d8cfe@earthlink.net> Revises instructions to no longer identify the PPA as WineHQ's and to clarify the support status of Ubuntu derivatives. Fixes bugs 34299 and 33549. --- templates/en/download/ubuntu.template | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Website-Correct-Ubuntu-downloads-instructions.txt URL: From mbruni at codeweavers.com Mon Nov 10 11:56:10 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 10 Nov 2014 18:56:10 +0100 Subject: [PATCH 1/5] winex11.drv: Actually report WGL_SWAP_EXCHANGE_ARB as the swap method. Message-ID: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> I.e. do what it was probably intended to do from the start. It should fix bug 16699. --- dlls/winex11.drv/opengl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 71af3db..1481034 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -2742,7 +2742,7 @@ static BOOL X11DRV_wglGetPixelFormatAttribivARB( HDC hdc, int iPixelFormat, int * point only ATI offers this. */ piValues[i] = WGL_SWAP_EXCHANGE_ARB; - break; + continue; case WGL_PBUFFER_LARGEST_ARB: curGLXAttr = GLX_LARGEST_PBUFFER; -- 2.0.4 From mbruni at codeweavers.com Mon Nov 10 11:56:11 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 10 Nov 2014 18:56:11 +0100 Subject: [PATCH 2/5] winex11.drv: Add support for GLX_OML_swap_method. In-Reply-To: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> References: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415642174-16277-2-git-send-email-mbruni@codeweavers.com> --- dlls/winex11.drv/opengl.c | 61 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c index 1481034..cf5d440 100644 --- a/dlls/winex11.drv/opengl.c +++ b/dlls/winex11.drv/opengl.c @@ -145,6 +145,10 @@ typedef XID GLXPbuffer; #define GLX_PBUFFER 0x8023 #define GLX_PBUFFER_HEIGHT 0x8040 #define GLX_PBUFFER_WIDTH 0x8041 +#define GLX_SWAP_METHOD_OML 0x8060 +#define GLX_SWAP_EXCHANGE_OML 0x8061 +#define GLX_SWAP_COPY_OML 0x8062 +#define GLX_SWAP_UNDEFINED_OML 0x8063 #define GLX_RGBA_BIT 0x00000001 #define GLX_COLOR_INDEX_BIT 0x00000002 #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 @@ -285,6 +289,7 @@ static BOOL use_render_texture_emulation = TRUE; static enum glx_swap_control_method swap_control_method = GLX_SWAP_CONTROL_NONE; /* Set when GLX_EXT_swap_control_tear is supported, requires GLX_SWAP_CONTROL_EXT */ static BOOL has_swap_control_tear = FALSE; +static BOOL has_swap_method = FALSE; static CRITICAL_SECTION context_section; static CRITICAL_SECTION_DEBUG critsect_debug = @@ -878,8 +883,30 @@ static int ConvertAttribWGLtoGLX(const int* iWGLAttr, int* oGLXAttr, struct wgl_ case WGL_SWAP_METHOD_ARB: pop = iWGLAttr[++cur]; - /* For now we ignore this and just return SWAP_EXCHANGE */ TRACE("pAttr[%d] = WGL_SWAP_METHOD_ARB: %#x\n", cur, pop); + if (has_swap_method) + { + switch (pop) + { + case WGL_SWAP_EXCHANGE_ARB: + pop = GLX_SWAP_EXCHANGE_OML; + break; + case WGL_SWAP_COPY_ARB: + pop = GLX_SWAP_COPY_OML; + break; + case WGL_SWAP_UNDEFINED_ARB: + pop = GLX_SWAP_UNDEFINED_OML; + break; + default: + ERR("Unexpected swap method %#x.\n", pop); + pop = GLX_DONT_CARE; + } + PUSH2(oGLXAttr, GLX_SWAP_METHOD_OML, pop); + } + else + { + WARN("GLX_OML_swap_method not supported, ignoring attribute.\n"); + } break; case WGL_PBUFFER_LARGEST_ARB: @@ -2737,11 +2764,30 @@ static BOOL X11DRV_wglGetPixelFormatAttribivARB( HDC hdc, int iPixelFormat, int continue; case WGL_SWAP_METHOD_ARB: - /* For now return SWAP_EXCHANGE_ARB which is the best type of buffer switch available. - * Later on we can also use GLX_OML_swap_method on drivers which support this. At this - * point only ATI offers this. - */ - piValues[i] = WGL_SWAP_EXCHANGE_ARB; + if (has_swap_method) + { + hTest = pglXGetFBConfigAttrib(gdi_display, fmt->fbconfig, GLX_DRAWABLE_TYPE, &tmp); + if (hTest) goto get_error; + switch (tmp) + { + case GLX_SWAP_EXCHANGE_OML: + piValues[i] = WGL_SWAP_EXCHANGE_ARB; + break; + case GLX_SWAP_COPY_OML: + piValues[i] = WGL_SWAP_COPY_ARB; + break; + case GLX_SWAP_UNDEFINED_OML: + piValues[i] = WGL_SWAP_UNDEFINED_ARB; + break; + default: + ERR("Unexpected swap method %x.\n", tmp); + } + } + else + { + WARN("GLX_OML_swap_method not supported, returning WGL_SWAP_EXCHANGE_ARB.\n"); + piValues[i] = WGL_SWAP_EXCHANGE_ARB; + } continue; case WGL_PBUFFER_LARGEST_ARB: @@ -3167,6 +3213,9 @@ static void X11DRV_WineGL_LoadExtensions(void) opengl_funcs.ext.p_wglFreeMemoryNV = pglXFreeMemoryNV; } + if (has_extension(WineGLInfo.glxExtensions, "GLX_OML_swap_method")) + has_swap_method = TRUE; + /* WINE-specific WGL Extensions */ /* In WineD3D we need the ability to set the pixel format more than once (e.g. after a device reset). -- 2.0.4 From mbruni at codeweavers.com Mon Nov 10 11:56:12 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 10 Nov 2014 18:56:12 +0100 Subject: [PATCH 3/5] d3dx9: Handle GUID_WICPixelFormat8bppGray format. In-Reply-To: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> References: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415642174-16277-3-git-send-email-mbruni@codeweavers.com> For bug 37074. --- dlls/d3dx9_36/surface.c | 1 + dlls/d3dx9_36/tests/surface.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/dlls/d3dx9_36/surface.c b/dlls/d3dx9_36/surface.c index c91048b..f187031 100644 --- a/dlls/d3dx9_36/surface.c +++ b/dlls/d3dx9_36/surface.c @@ -40,6 +40,7 @@ static const struct { &GUID_WICPixelFormat8bppIndexed, D3DFMT_P8 }, { &GUID_WICPixelFormat1bppIndexed, D3DFMT_P8 }, { &GUID_WICPixelFormat4bppIndexed, D3DFMT_P8 }, + { &GUID_WICPixelFormat8bppGray, D3DFMT_L8 }, { &GUID_WICPixelFormat16bppBGR555, D3DFMT_X1R5G5B5 }, { &GUID_WICPixelFormat16bppBGR565, D3DFMT_R5G6B5 }, { &GUID_WICPixelFormat24bppBGR, D3DFMT_R8G8B8 }, diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index 2ddc704..4490dc3 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -80,6 +80,16 @@ static const unsigned char bmp_8bpp[] = { 0x00,0x00 }; +static const unsigned char png_grayscale[] = +{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, + 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x3a, 0x7e, 0x9b, 0x55, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, + 0x41, 0x54, 0x08, 0xd7, 0x63, 0xf8, 0x0f, 0x00, 0x01, 0x01, 0x01, 0x00, 0x1b, + 0xb6, 0xee, 0x56, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82 +}; + /* 2x2 A8R8G8B8 pixel data */ static const unsigned char pixdata[] = { 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff @@ -493,6 +503,12 @@ static void test_D3DXGetImageInfo(void) ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth); ok(info.Format == D3DFMT_P8, "Got format %u, expected %u\n", info.Format, D3DFMT_P8); + /* Grayscale PNG */ + hr = D3DXGetImageInfoFromFileInMemory(png_grayscale, sizeof(png_grayscale), &info); + ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); + ok(info.Depth == 1, "Got depth %u, expected 1\n", info.Depth); + ok(info.Format == D3DFMT_L8, "Got format %u, expected %u\n", info.Format, D3DFMT_L8); + /* test DDS support */ hr = D3DXGetImageInfoFromFileInMemory(dds_24bit, sizeof(dds_24bit), &info); ok(hr == D3D_OK, "D3DXGetImageInfoFromFileInMemory returned %#x, expected %#x\n", hr, D3D_OK); -- 2.0.4 From mbruni at codeweavers.com Mon Nov 10 11:56:13 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 10 Nov 2014 18:56:13 +0100 Subject: [PATCH 4/5] d3dx9: Use an alpha-capable format when creating textures with a color key. In-Reply-To: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> References: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415642174-16277-4-git-send-email-mbruni@codeweavers.com> Only if no format was explicitly specified. Followup to the fix for bug 37074. --- dlls/d3dx9_36/tests/texture.c | 113 ++++++++++++++++++++++++++++++++++++++++++ dlls/d3dx9_36/texture.c | 30 ++++++++++- 2 files changed, 142 insertions(+), 1 deletion(-) diff --git a/dlls/d3dx9_36/tests/texture.c b/dlls/d3dx9_36/tests/texture.c index 61132bb..c90e2d5 100644 --- a/dlls/d3dx9_36/tests/texture.c +++ b/dlls/d3dx9_36/tests/texture.c @@ -87,6 +87,16 @@ static const unsigned char dds_volume_map[] = { 0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x84,0xef,0x7b,0xaa,0xab,0xab,0xab }; +static const unsigned char png_grayscale[] = +{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, + 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x00, + 0x00, 0x00, 0x00, 0x3a, 0x7e, 0x9b, 0x55, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, + 0x41, 0x54, 0x08, 0xd7, 0x63, 0xf8, 0x0f, 0x00, 0x01, 0x01, 0x01, 0x00, 0x1b, + 0xb6, 0xee, 0x56, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, + 0x60, 0x82 +}; + #define ADMITTED_ERROR 0.0001f static inline float relative_error(float expected, float got) @@ -1582,6 +1592,109 @@ static void test_D3DXCreateTextureFromFileInMemoryEx(IDirect3DDevice9 *device) D3DUSAGE_DYNAMIC | D3DUSAGE_AUTOGENMIPMAP, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &texture); ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x\n", hr, D3D_OK); if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture); + + /* Checking for color key format overrides. */ + 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); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_X1R5G5B5, "Returned format %u, expected %u\n", desc.Format, D3DFMT_X1R5G5B5); + IDirect3DTexture9_Release(texture); + } + hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_16bit, sizeof(dds_16bit), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0xff000000, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_A1R5G5B5, "Returned format %u, expected %u\n", desc.Format, D3DFMT_A1R5G5B5); + IDirect3DTexture9_Release(texture); + } + hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_16bit, sizeof(dds_16bit), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_X1R5G5B5, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0xff000000, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_X1R5G5B5, "Returned format %u, expected %u\n", desc.Format, D3DFMT_X1R5G5B5); + IDirect3DTexture9_Release(texture); + } + + hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_24bit, sizeof(dds_24bit), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_X8R8G8B8, "Returned format %u, expected %u\n", desc.Format, D3DFMT_X8R8G8B8); + IDirect3DTexture9_Release(texture); + } + hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_24bit, sizeof(dds_24bit), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0xff000000, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_A8R8G8B8, "Returned format %u, expected %u\n", desc.Format, D3DFMT_A8R8G8B8); + IDirect3DTexture9_Release(texture); + } + hr = D3DXCreateTextureFromFileInMemoryEx(device, dds_24bit, sizeof(dds_24bit), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0xff000000, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_X8R8G8B8, "Returned format %u, expected %u\n", desc.Format, D3DFMT_X8R8G8B8); + IDirect3DTexture9_Release(texture); + } + + hr = D3DXCreateTextureFromFileInMemoryEx(device, png_grayscale, sizeof(png_grayscale), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_L8, "Returned format %u, expected %u\n", desc.Format, D3DFMT_L8); + IDirect3DTexture9_Release(texture); + } + hr = D3DXCreateTextureFromFileInMemoryEx(device, png_grayscale, sizeof(png_grayscale), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0xff000000, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_A8L8, "Returned format %u, expected %u\n", desc.Format, D3DFMT_A8L8); + IDirect3DTexture9_Release(texture); + } + hr = D3DXCreateTextureFromFileInMemoryEx(device, png_grayscale, sizeof(png_grayscale), + D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_L8, D3DPOOL_DEFAULT, + D3DX_DEFAULT, D3DX_DEFAULT, 0xff000000, NULL, NULL, &texture); + ok(hr == D3D_OK, "D3DXCreateTextureFromFileInMemoryEx returned %#x, expected %#x.\n", hr, D3D_OK); + if (SUCCEEDED(hr)) + { + IDirect3DTexture9_GetSurfaceLevel(texture, 0, &surface); + IDirect3DSurface9_GetDesc(surface, &desc); + ok(desc.Format == D3DFMT_L8, "Returned format %u, expected %u\n", desc.Format, D3DFMT_L8); + IDirect3DTexture9_Release(texture); + } } static void test_D3DXCreateCubeTextureFromFileInMemory(IDirect3DDevice9 *device) diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index 7ebe264..e997aa2 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -538,6 +538,29 @@ HRESULT WINAPI D3DXCreateTexture(struct IDirect3DDevice9 *device, UINT width, UI return IDirect3DDevice9_CreateTexture(device, width, height, miplevels, usage, format, pool, texture, NULL); } +static D3DFORMAT get_alpha_replacement_format(D3DFORMAT format) +{ + static const struct + { + D3DFORMAT orig_format; + D3DFORMAT replacement_format; + } + replacement_formats[] = + { + {D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8}, + {D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5}, + {D3DFMT_X4R4G4B4, D3DFMT_A4R4G4B4}, + {D3DFMT_X8B8G8R8, D3DFMT_A8B8G8R8}, + {D3DFMT_L8, D3DFMT_A8L8}, + }; + unsigned int i; + + for (i = 0; i < sizeof(replacement_formats) / sizeof(replacement_formats[0]); ++i) + if (replacement_formats[i].orig_format == format) + return replacement_formats[i].replacement_format; + return format; +} + HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, @@ -546,7 +569,7 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi IDirect3DTexture9 **texptr; IDirect3DTexture9 *buftex; IDirect3DSurface9 *surface; - BOOL dynamic_texture; + BOOL dynamic_texture, format_specified = FALSE; D3DXIMAGE_INFO imginfo; UINT loaded_miplevels, skip_levels; D3DCAPS9 caps; @@ -585,6 +608,8 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi if (format == D3DFMT_UNKNOWN || format == D3DX_DEFAULT) format = imginfo.Format; + else + format_specified = TRUE; if (width == D3DX_FROM_FILE) { @@ -630,6 +655,9 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi return hr; } + if (colorkey && !format_specified) + format = get_alpha_replacement_format(format); + if (imginfo.MipLevels < miplevels && (D3DFMT_DXT1 <= imginfo.Format && imginfo.Format <= D3DFMT_DXT5)) { FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet\n"); -- 2.0.4 From mbruni at codeweavers.com Mon Nov 10 11:56:14 2014 From: mbruni at codeweavers.com (Matteo Bruni) Date: Mon, 10 Nov 2014 18:56:14 +0100 Subject: [PATCH 5/5] d3dx9: Improve the scoring for fallback formats. In-Reply-To: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> References: <1415642174-16277-1-git-send-email-mbruni@codeweavers.com> Message-ID: <1415642174-16277-5-git-send-email-mbruni@codeweavers.com> Those were found empirically by disabling some texture formats in wined3d. --- dlls/d3dx9_36/texture.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index e997aa2..de42307 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -302,12 +302,13 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN /* This format can be used, let's evaluate it. Weights chosen quite arbitrarily... */ - score = 16 - 4 * (curchannels - channels); + score = 512 * (curfmt->type == fmt->type); + score -= 32 * (curchannels - channels); for (j = 0; j < 4; j++) { int diff = curfmt->bits[j] - fmt->bits[j]; - score += 16 - (diff < 0 ? -diff * 4 : diff); + score -= (diff < 0 ? -diff * 8 : diff) * (j == 0 ? 1 : 2); } if (score > bestscore) -- 2.0.4 From nerv at dawncrow.de Mon Nov 10 14:06:15 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Mon, 10 Nov 2014 21:06:15 +0100 Subject: ntdll/tests: Clarify ok() conditions (PVS-Studio) Message-ID: <54611AB7.2050802@dawncrow.de> remaining from https://bugs.winehq.org/show_bug.cgi?id=37127 --- dlls/ntdll/tests/string.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-ntdll-tests-Clarify-ok-conditions.txt Type: text/x-patch Size: 1720 bytes Desc: not available URL: From nerv at dawncrow.de Mon Nov 10 14:06:21 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Mon, 10 Nov 2014 21:06:21 +0100 Subject: urlmon/tests: Clarify ok() condition (PVS-Studio) Message-ID: <54611ABD.9090909@dawncrow.de> remaining from https://bugs.winehq.org/show_bug.cgi?id=37127 --- dlls/urlmon/tests/protocol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-urlmon-tests-Clarify-ok-condition.txt Type: text/x-patch Size: 646 bytes Desc: not available URL: From nerv at dawncrow.de Mon Nov 10 14:06:26 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Mon, 10 Nov 2014 21:06:26 +0100 Subject: user32/tests: Clarify ok() condition (PVS-Studio) Message-ID: <54611AC2.6090105@dawncrow.de> remaining from https://bugs.winehq.org/show_bug.cgi?id=37127 --- dlls/user32/tests/dde.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-user32-tests-Clarify-ok-condition.txt Type: text/x-patch Size: 754 bytes Desc: not available URL: From nerv at dawncrow.de Mon Nov 10 14:06:31 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Mon, 10 Nov 2014 21:06:31 +0100 Subject: xmllite/tests: Clarify ok() condition (PVS-Studio) Message-ID: <54611AC7.9060003@dawncrow.de> remaining from https://bugs.winehq.org/show_bug.cgi?id=37127 --- dlls/xmllite/tests/reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-xmllite-tests-Clarify-ok-condition.txt Type: text/x-patch Size: 612 bytes Desc: not available URL: From nerv at dawncrow.de Mon Nov 10 14:07:03 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Mon, 10 Nov 2014 21:07:03 +0100 Subject: avifil32: Simplify comparing two unsigned ints (PVS-Studio) Message-ID: <54611AE7.8070307@dawncrow.de> remaining from https://bugs.winehq.org/show_bug.cgi?id=37124 --- dlls/avifil32/avifile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0007-avifil32-Simplify-comparing-two-unsigned-ints-PVS-Stud.txt Type: text/x-patch Size: 811 bytes Desc: not available URL: From stefan at codeweavers.com Mon Nov 10 16:08:22 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 10 Nov 2014 23:08:22 +0100 Subject: [PATCH 2/5] ddraw/tests: Ddraw restores the mode settings from the registry (v2). Message-ID: <1415657305-20856-2-git-send-email-stefan@codeweavers.com> v2: Merge with test_coop_level_mode_set. This has the positive side effect that the messages on external mode changes are explicitly tested. This behavior is already hinted by test_coop_level_mode_set_multi, although mode_set_multi tests multiple ddraw interfaces and not external mode changes. --- dlls/ddraw/tests/ddraw1.c | 143 +++++++++++++++++++++++++++++++++++++++------- dlls/ddraw/tests/ddraw2.c | 143 +++++++++++++++++++++++++++++++++++++++------- dlls/ddraw/tests/ddraw4.c | 143 +++++++++++++++++++++++++++++++++++++++------- dlls/ddraw/tests/ddraw7.c | 143 +++++++++++++++++++++++++++++++++++++++------- 4 files changed, 488 insertions(+), 84 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 455c52a..0ae204c 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2104,7 +2104,7 @@ static LRESULT CALLBACK mode_set_proc(HWND hwnd, UINT message, WPARAM wparam, LP struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) @@ -2117,15 +2117,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_ && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2134,6 +2143,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2159,14 +2171,23 @@ static void test_coop_level_mode_set(void) ref = IDirectDraw_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -2182,8 +2203,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2195,14 +2216,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2226,10 +2247,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2256,18 +2277,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2279,6 +2319,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2338,6 +2382,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { @@ -2409,6 +2470,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2471,6 +2542,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2535,6 +2626,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index da343c7..334d89e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2303,7 +2303,7 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) @@ -2316,15 +2316,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_ && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw2 *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2333,6 +2342,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2358,14 +2370,23 @@ static void test_coop_level_mode_set(void) ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -2386,8 +2407,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2399,14 +2420,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2430,10 +2451,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2460,18 +2481,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2483,6 +2523,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2542,6 +2586,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { @@ -2613,6 +2674,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2675,6 +2746,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2739,6 +2830,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 056b45e..ab03f39 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2490,7 +2490,7 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) @@ -2503,15 +2503,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface4 *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw4 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2520,6 +2529,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2545,14 +2557,23 @@ static void test_coop_level_mode_set(void) ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -2573,8 +2594,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2586,14 +2607,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2617,10 +2638,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2647,18 +2668,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2670,6 +2710,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2729,6 +2773,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2793,6 +2854,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2855,6 +2926,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2919,6 +3010,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index aece0fe..cbf6112 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2167,7 +2167,7 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) @@ -2180,15 +2180,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface7 *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw7 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2197,6 +2206,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2222,14 +2234,23 @@ static void test_coop_level_mode_set(void) ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); @@ -2250,8 +2271,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2263,14 +2284,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2294,10 +2315,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2324,18 +2345,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2347,6 +2387,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2406,6 +2450,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2470,6 +2531,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2532,6 +2603,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2596,6 +2687,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; -- 2.0.4 From stefan at codeweavers.com Mon Nov 10 16:08:21 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 10 Nov 2014 23:08:21 +0100 Subject: [PATCH 1/5] ddraw/tests: Rename modes and rectangles in test_coop_level_mode_set. Message-ID: <1415657305-20856-1-git-send-email-stefan@codeweavers.com> I split this out of the next patch to make it easier to review. It introduces the mode selection from test_mode_change in d3d8/9 but does not introduce the additional tests yet. Other than selecting a variable mode this is a no-op. --- dlls/ddraw/tests/ddraw1.c | 281 +++++++++++++++++++++++----------------- dlls/ddraw/tests/ddraw2.c | 323 ++++++++++++++++++++++++++-------------------- dlls/ddraw/tests/ddraw4.c | 323 ++++++++++++++++++++++++++-------------------- dlls/ddraw/tests/ddraw7.c | 323 ++++++++++++++++++++++++++-------------------- 4 files changed, 702 insertions(+), 548 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index fe8a36e..455c52a 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2102,10 +2102,30 @@ static LRESULT CALLBACK mode_set_proc(HWND hwnd, UINT message, WPARAM wparam, LP return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(surface_desc->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2113,6 +2133,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2132,6 +2153,24 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + + 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"); @@ -2139,15 +2178,12 @@ static void test_coop_level_mode_set(void) window = CreateWindowA("ddraw_test_wndproc_wc", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2159,14 +2195,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2174,26 +2210,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2205,14 +2241,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2225,21 +2261,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2251,30 +2288,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2286,14 +2323,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2301,7 +2338,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); @@ -2316,16 +2353,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2337,14 +2374,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2360,16 +2397,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2381,14 +2418,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2398,16 +2435,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2419,14 +2456,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2434,7 +2471,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2442,16 +2479,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2463,14 +2500,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2486,16 +2523,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2507,21 +2544,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2536,10 +2573,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); @@ -2548,8 +2585,8 @@ static void test_coop_level_mode_set(void) ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); done: diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index ad0d040..da343c7 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2301,10 +2301,30 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(surface_desc->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw2 *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2312,6 +2332,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2331,6 +2352,24 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw2_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw2_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + + 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"); @@ -2343,15 +2382,12 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2363,14 +2399,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2378,26 +2414,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2409,14 +2445,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2429,21 +2465,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2455,30 +2492,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2490,14 +2527,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2505,7 +2542,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); @@ -2520,16 +2557,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2541,14 +2578,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2564,16 +2601,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2585,14 +2622,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2602,16 +2639,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2623,14 +2660,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2638,7 +2675,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2646,16 +2683,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2667,14 +2704,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2690,16 +2727,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2711,21 +2748,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2738,13 +2775,15 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2756,16 +2795,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2780,10 +2819,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); hr = IDirectDraw2_RestoreDisplayMode(ddraw); @@ -2792,7 +2831,7 @@ static void test_coop_level_mode_set(void) /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2809,17 +2848,17 @@ static void test_coop_level_mode_set(void) expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); - ok(screen_size2.cx == fullscreen_rect.right && screen_size2.cy == fullscreen_rect.bottom, + ok(screen_size2.cx == registry_mode.dmPelsWidth && screen_size2.cy == registry_mode.dmPelsHeight, "Expected screen size 2 %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size2.cx, screen_size2.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size2.cx, screen_size2.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(window2, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2831,18 +2870,18 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); done: diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 69f3ac7..056b45e 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2488,10 +2488,30 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(U4(surface_desc)->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface4 *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw4 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2499,6 +2519,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2518,6 +2539,24 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw4_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw4_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + + 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"); @@ -2530,15 +2569,12 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2550,14 +2586,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2565,26 +2601,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2596,14 +2632,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2616,21 +2652,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2642,30 +2679,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2677,14 +2714,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2692,7 +2729,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2700,16 +2737,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2721,14 +2758,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2744,16 +2781,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2765,14 +2802,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2782,16 +2819,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2803,14 +2840,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2818,7 +2855,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2826,16 +2863,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2847,14 +2884,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2870,16 +2907,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2891,21 +2928,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2918,13 +2955,15 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2936,16 +2975,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2960,10 +2999,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); hr = IDirectDraw4_RestoreDisplayMode(ddraw); @@ -2972,7 +3011,7 @@ static void test_coop_level_mode_set(void) /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2989,17 +3028,17 @@ static void test_coop_level_mode_set(void) expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); - ok(screen_size2.cx == fullscreen_rect.right && screen_size2.cy == fullscreen_rect.bottom, + ok(screen_size2.cx == registry_mode.dmPelsWidth && screen_size2.cy == registry_mode.dmPelsHeight, "Expected screen size 2 %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size2.cx, screen_size2.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size2.cx, screen_size2.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(window2, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -3011,18 +3050,18 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); expect_messages = NULL; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 3aebfa7..aece0fe 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2165,10 +2165,30 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(U4(surface_desc)->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface7 *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw7 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2176,6 +2196,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2195,6 +2216,24 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw7_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw7_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + + 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"); @@ -2207,15 +2246,12 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2227,14 +2263,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2242,26 +2278,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2273,14 +2309,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2293,21 +2329,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2319,30 +2356,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2354,14 +2391,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2369,7 +2406,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2377,16 +2414,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2398,14 +2435,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2421,16 +2458,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2442,14 +2479,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2459,16 +2496,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2480,14 +2517,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2495,7 +2532,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2503,16 +2540,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2524,14 +2561,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2547,16 +2584,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2568,21 +2605,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2595,13 +2632,15 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2613,16 +2652,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2637,10 +2676,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); hr = IDirectDraw7_RestoreDisplayMode(ddraw); @@ -2649,7 +2688,7 @@ static void test_coop_level_mode_set(void) /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2666,17 +2705,17 @@ static void test_coop_level_mode_set(void) expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); - ok(screen_size2.cx == fullscreen_rect.right && screen_size2.cy == fullscreen_rect.bottom, + ok(screen_size2.cx == registry_mode.dmPelsWidth && screen_size2.cy == registry_mode.dmPelsHeight, "Expected screen size 2 %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size2.cx, screen_size2.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size2.cx, screen_size2.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(window2, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2688,18 +2727,18 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); expect_messages = NULL; -- 2.0.4 From stefan at codeweavers.com Mon Nov 10 16:08:23 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 10 Nov 2014 23:08:23 +0100 Subject: [PATCH 3/5] d3d9/tests: Fix some wndproc comparison error messages. Message-ID: <1415657305-20856-3-git-send-email-stefan@codeweavers.com> --- dlls/d3d9/tests/d3d9ex.c | 15 +++++---------- dlls/d3d9/tests/device.c | 21 +++++++-------------- 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index bc60fcc..d93e591 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1869,8 +1869,7 @@ static void test_wndproc(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); @@ -1897,8 +1896,7 @@ static void test_wndproc(void) } proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); @@ -2012,8 +2010,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -2050,8 +2047,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, focus_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -2086,8 +2082,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index d3618e2..28dc52e 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3260,8 +3260,7 @@ static void test_wndproc(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); @@ -3288,8 +3287,7 @@ static void test_wndproc(void) } proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); @@ -3408,8 +3406,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -3446,8 +3443,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, focus_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -3482,8 +3478,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -4122,8 +4117,7 @@ static void test_device_window_reset(void) ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, FALSE); ok(SUCCEEDED(hr), "Failed to reset device.\n"); @@ -4141,8 +4135,7 @@ static void test_device_window_reset(void) ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Mon Nov 10 16:08:24 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 10 Nov 2014 23:08:24 +0100 Subject: [PATCH 4/5] d3d8/tests: Fix some wndproc comparison error messages. Message-ID: <1415657305-20856-4-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 9153139..7468d13 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2311,8 +2311,7 @@ static void test_wndproc(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); @@ -2339,8 +2338,7 @@ static void test_wndproc(void) } proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); @@ -2459,8 +2457,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -2497,8 +2494,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, focus_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -2533,8 +2529,7 @@ static void test_wndproc_windowed(void) (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, TRUE); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -3208,8 +3203,7 @@ static void test_device_window_reset(void) ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); hr = reset_device(device, device_window, FALSE); ok(SUCCEEDED(hr), "Failed to reset device.\n"); @@ -3227,8 +3221,7 @@ static void test_device_window_reset(void) ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Mon Nov 10 16:08:25 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 10 Nov 2014 23:08:25 +0100 Subject: [PATCH 5/5] d3d9/tests: Allow passing a resolution to reset_device. Message-ID: <1415657305-20856-5-git-send-email-stefan@codeweavers.com> I will need this for the resolution restore on focus loss tests. d3d9ex and d3d8 patches will follow. --- dlls/d3d9/tests/device.c | 83 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 27 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 28dc52e..1a5008a 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -178,19 +178,27 @@ static IDirect3DDevice9 *create_device(IDirect3D9 *d3d9, HWND focus_window, cons return NULL; } -static HRESULT reset_device(IDirect3DDevice9 *device, HWND device_window, BOOL windowed) +static HRESULT reset_device(IDirect3DDevice9 *device, const struct device_desc *desc) { D3DPRESENT_PARAMETERS present_parameters = {0}; - present_parameters.Windowed = windowed; - present_parameters.hDeviceWindow = device_window; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - present_parameters.BackBufferWidth = registry_mode.dmPelsWidth; - present_parameters.BackBufferHeight = registry_mode.dmPelsHeight; + present_parameters.BackBufferWidth = 640; + present_parameters.BackBufferHeight = 480; present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + present_parameters.hDeviceWindow = NULL; + present_parameters.Windowed = TRUE; present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; + if (desc) + { + present_parameters.BackBufferWidth = desc->width; + present_parameters.BackBufferHeight = desc->height; + present_parameters.hDeviceWindow = desc->device_window; + present_parameters.Windowed = !(desc->flags & CREATE_DEVICE_FULLSCREEN); + } + return IDirect3DDevice9_Reset(device, &present_parameters); } @@ -2960,12 +2968,12 @@ static void test_scissor_size(void) IDirect3D9 *d3d9_ptr; unsigned int i; static struct { - int winx; int winy; int backx; int backy; BOOL window; + int winx; int winy; int backx; int backy; DWORD flags; } scts[] = { /* scissor tests */ - {800, 600, 640, 480, TRUE}, - {800, 600, 640, 480, FALSE}, - {640, 480, 800, 600, TRUE}, - {640, 480, 800, 600, FALSE}, + {800, 600, 640, 480, 0}, + {800, 600, 640, 480, CREATE_DEVICE_FULLSCREEN}, + {640, 480, 800, 600, 0}, + {640, 480, 800, 600, CREATE_DEVICE_FULLSCREEN}, }; d3d9_ptr = Direct3DCreate9(D3D_SDK_VERSION); @@ -2980,7 +2988,7 @@ static void test_scissor_size(void) hwnd = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, scts[i].winx, scts[i].winy, 0, 0, 0, 0); - if (!scts[i].window) + if (scts[i].flags & CREATE_DEVICE_FULLSCREEN) { scts[i].backx = registry_mode.dmPelsWidth; scts[i].backy = registry_mode.dmPelsHeight; @@ -2989,7 +2997,7 @@ static void test_scissor_size(void) device_desc.device_window = hwnd; device_desc.width = scts[i].backx; device_desc.height = scts[i].backy; - device_desc.flags = scts[i].window ? 0 : CREATE_DEVICE_FULLSCREEN; + device_desc.flags = scts[i].flags; if (!(device_ptr = create_device(d3d9_ptr, hwnd, &device_desc))) { skip("Failed to create a 3D device, skipping test.\n"); @@ -3006,7 +3014,10 @@ static void test_scissor_size(void) scts[i].backx, scts[i].backy); /* check the scissorrect values after a reset */ - hr = reset_device(device_ptr, hwnd, scts[i].window); + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = scts[i].flags; + hr = reset_device(device_ptr, &device_desc); ok(hr == D3D_OK, "IDirect3DDevice9_Reset failed with %08x\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(device_ptr); ok(hr == D3D_OK, "IDirect3DDevice9_TestCooperativeLevel after a successful reset returned %#x\n", hr); @@ -3398,7 +3409,10 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, device_window, FALSE); + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3408,7 +3422,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3435,7 +3450,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, focus_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3445,7 +3461,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, focus_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3470,7 +3487,9 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, device_window, FALSE); + device_desc.device_window = device_window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3480,7 +3499,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -3517,6 +3537,7 @@ static void test_reset_fullscreen(void) IDirect3DDevice9 *device = NULL; IDirect3D9 *d3d; ATOM atom; + struct device_desc device_desc; static const struct message messages[] = { {WM_ACTIVATEAPP, FOCUS_WINDOW}, @@ -3555,7 +3576,11 @@ static void test_reset_fullscreen(void) * This will force the window to be shown and will cause the WM_ACTIVATEAPP * message to be sent. */ - ok(SUCCEEDED(reset_device(device, device_window, FALSE)), "Failed to reset device.\n"); + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.device_window = device_window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + ok(SUCCEEDED(reset_device(device, &device_desc)), "Failed to reset device.\n"); flush_events(); ok(expect_messages->message == 0, "Expected to receive message %#x.\n", expect_messages->message); @@ -3740,7 +3765,8 @@ static void test_window_style(void) focus_rect.left, focus_rect.top, focus_rect.right, focus_rect.bottom, r.left, r.top, r.right, r.bottom, i); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); style = GetWindowLongA(device_window, GWL_STYLE); @@ -4119,7 +4145,8 @@ static void test_device_window_reset(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, FALSE); + device_desc.device_window = device_window; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device.\n"); GetWindowRect(focus_window, &r); @@ -4193,7 +4220,7 @@ static void test_reset_resources(void) IDirect3DSurface9_Release(surface); } - hr = reset_device(device, device_window, TRUE); + hr = reset_device(device, NULL); ok(SUCCEEDED(hr), "Failed to reset device.\n"); hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &rt); @@ -9342,14 +9369,15 @@ static void test_lost_device(void) hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, FALSE); + hr = reset_device(device, &device_desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -9372,7 +9400,8 @@ static void test_lost_device(void) hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); -- 2.0.4 From mstefani at redhat.de Mon Nov 10 16:41:51 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 10 Nov 2014 23:41:51 +0100 Subject: wininet: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141110224151.GA31114@redhat.com> --- dlls/wininet/ftp.c | 2 +- dlls/wininet/tests/internet.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c index 855aee0..f45e495 100644 --- a/dlls/wininet/ftp.c +++ b/dlls/wininet/ftp.c @@ -2496,7 +2496,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, if(hIC->proxyBypass) FIXME("Proxy bypass is ignored.\n"); } - if (!lpszUserName || !strlenW(lpszUserName)) { + if (!lpszUserName || !lpszUserName[0]) { HKEY key; WCHAR szPassword[MAX_PATH]; DWORD len = sizeof(szPassword); diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index 1548615..5e09525 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -1578,7 +1578,7 @@ static void test_InternetGetConnectedStateExA(void) res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0); ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(flags, "Expected at least one flag set\n"); - ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer)); + ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenA(buffer)); buffer[0] = 0; flags = 0; @@ -1592,7 +1592,7 @@ static void test_InternetGetConnectedStateExA(void) res = pInternetGetConnectedStateExA(&flags, buffer, 1, 0); ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(flags, "Expected at least one flag set\n"); - ok(strlen(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenA(buffer)); + ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenA(buffer)); } static void test_InternetGetConnectedStateExW(void) @@ -1667,7 +1667,7 @@ static void test_InternetGetConnectedStateExW(void) res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0); ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(flags, "Expected at least one flag set\n"); - ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer)); + ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer)); buffer[0] = 0; flags = 0; @@ -1681,7 +1681,7 @@ static void test_InternetGetConnectedStateExW(void) res = pInternetGetConnectedStateExW(&flags, buffer, 1, 0); ok(res == TRUE, "Expected TRUE, got %d\n", res); ok(flags, "Expected at least one flag set\n"); - ok(lstrlenW(buffer) == 0, "Expected 0 bytes, got %u\n", lstrlenW(buffer)); + ok(!buffer[0], "Expected 0 bytes, got %u\n", lstrlenW(buffer)); } /* ############################### */ -- 1.8.3.1 From mstefani at redhat.de Mon Nov 10 16:44:08 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 10 Nov 2014 23:44:08 +0100 Subject: riched20/tests: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141110224408.GB31114@redhat.com> --- dlls/riched20/tests/editor.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 5ad063e..244f065 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -3736,9 +3736,8 @@ static void test_EM_SETTEXTEX(void) ok (result == 1, "EM_SETTEXTEX returned %d, instead of 1\n",result); - ok(lstrlenW(buf) == 0, - "EM_SETTEXTEX with NULL lParam should clear rich edit.\n"); - + ok(!buf[0], "EM_SETTEXTEX with NULL lParam should clear rich edit.\n"); + /* put some text back: !ST_SELECTION && Unicode && !\rtf */ setText.flags = 0; SendMessageA(hwndRichEdit, EM_SETTEXTEX, (WPARAM)&setText, (LPARAM)TestItem1); @@ -5225,8 +5224,7 @@ static void test_EM_STREAMIN(void) result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer); ok (result == 0, "EM_STREAMIN: Test 2 returned %ld, expected 0\n", result); - ok (strlen(buffer) == 0, - "EM_STREAMIN: Test 2 set wrong text: Result: %s\n",buffer); + ok(!buffer[0], "EM_STREAMIN: Test 2 set wrong text: Result: %s\n",buffer); ok(es.dwError == -16, "EM_STREAMIN: Test 2 set error %d, expected %d\n", es.dwError, -16); es.dwCookie = (DWORD_PTR)&streamText3; @@ -5237,8 +5235,7 @@ static void test_EM_STREAMIN(void) result = SendMessageA(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM)buffer); ok (result == 0, "EM_STREAMIN: Test 3 returned %ld, expected 0\n", result); - ok (strlen(buffer) == 0, - "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer); + ok(!buffer[0], "EM_STREAMIN: Test 3 set wrong text: Result: %s\n",buffer); ok(es.dwError == -16, "EM_STREAMIN: Test 3 set error %d, expected %d\n", es.dwError, -16); es.dwCookie = (DWORD_PTR)&streamTextUTF8BOM; -- 1.8.3.1 From nerv at dawncrow.de Mon Nov 10 16:56:37 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Mon, 10 Nov 2014 23:56:37 +0100 Subject: avifil32: Simplify comparing two unsigned ints (PVS-Studio) (try 2) Message-ID: <546142A5.1010302@dawncrow.de> try 2: added the missing +1 thanks to a hint by ken on irc --- dlls/avifil32/avifile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-avifil32-Simplify-comparing-two-unsigned-ints-PVS-Stud.txt Type: text/x-patch Size: 815 bytes Desc: not available URL: From alexhenrie24 at gmail.com Tue Nov 11 00:34:26 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Mon, 10 Nov 2014 23:34:26 -0700 Subject: [PATCH] kernel32/tests: Add tabular UTF-7 encoding tests. Message-ID: <1415687666-2756-1-git-send-email-alexhenrie24@gmail.com> --- dlls/kernel32/tests/codepage.c | 141 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 6e89533..9f5fad7 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -433,6 +433,119 @@ static void test_utf7_encoding(void) static const char base64_encoding_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + const struct + { + /* inputs */ + WCHAR src[16]; + int srclen; + char *dst; + int dstlen; + /* expected outputs */ + char expected_dst[16]; + int chars_written; + int len; + } + tests[] = + { + /* tests string conversion with srclen=-1 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, sizeof(output) - 1, + "+T2BZfVQX-", 11, 11 + }, + /* tests string conversion with srclen=-2 */ + { + {0x4F60,0x597D,0x5417,0}, -2, output, sizeof(output) - 1, + "+T2BZfVQX-", 11, 11 + }, + /* tests string conversion with dstlen=strlen(expected_dst) */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 10, + "+T2BZfVQX-", 10, 0 + }, + /* tests string conversion with dstlen=strlen(expected_dst)+1 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 11, + "+T2BZfVQX-", 11, 11 + }, + /* tests string conversion with dstlen=strlen(expected_dst)+2 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 12, + "+T2BZfVQX-", 11, 11 + }, + /* tests dry run with dst=NULL and dstlen=0 */ + { + {0x4F60,0x597D,0x5417,0}, -1, NULL, 0, + {}, 0, 11 + }, + /* tests dry run with dst!=NULL and dstlen=0 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 0, + {}, 0, 11 + }, + /* tests srclen > strlenW(src) */ + { + {'a',0,'b',0}, 4, output, sizeof(output) - 1, + "a\0b", 4, 4 + }, + /* tests srclen < strlenW(src) with directly encodable chars */ + { + {'h','e','l','l','o',0}, 2, output, sizeof(output) - 1, + "he", 2, 2 + }, + /* tests srclen < strlenW(src) with non-directly encodable chars */ + { + {0x4F60,0x597D,0x5417,0}, 2, output, sizeof(output) - 1, + "+T2BZfQ-", 8, 8 + }, + /* tests a single null char */ + { + {0}, -1, output, sizeof(output) - 1, + "", 1, 1 + }, + /* tests a buffer that runs out while not encoding a UTF-7 sequence */ + { + {'h','e','l','l','o',0}, -1, output, 2, + "he", 2, 0 + }, + /* tests a buffer that runs out after writing 1 base64 character */ + { + {0x4F60,0x0001,0}, -1, output, 2, + "+T", 2, 0 + }, + /* tests a buffer that runs out after writing 2 base64 characters */ + { + {0x4F60,0x0001,0}, -1, output, 3, + "+T2", 3, 0 + }, + /* tests a buffer that runs out after writing 3 base64 characters */ + { + {0x4F60,0x0001,0}, -1, output, 4, + "+T2A", 4, 0 + }, + /* tests a buffer that runs out just after writing the + sign */ + { + {0x4F60,0}, -1, output, 1, + "+", 1, 0 + }, + /* tests a buffer that runs out just before writing the - sign + * the number of bits to encode here is evenly divisible by 6 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 9, + "+T2BZfVQX", 9, 0 + }, + /* tests a buffer that runs out just before writing the - sign + * the number of bits to encode here is NOT evenly divisible by 6 */ + { + {0x4F60,0}, -1, output, 4, + "+T2", 3, 0 + }, + /* tests a buffer that runs out in the middle of escaping a + sign */ + { + {'+',0}, -1, output, 1, + "+", 1, 0 + } + }; + if (WideCharToMultiByte(CP_UTF7, 0, foobarW, -1, NULL, 0, NULL, NULL) == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { @@ -525,6 +638,34 @@ static void test_utf7_encoding(void) ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", i, expected_len, expected_len, output[expected_len]); } + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) + { + memset(output, '#', sizeof(output) - 1); + output[sizeof(output) - 1] = 0; + SetLastError(0xdeadbeef); + + len = WideCharToMultiByte(CP_UTF7, 0, tests[i].src, tests[i].srclen, + tests[i].dst, tests[i].dstlen, NULL, NULL); + + if (!tests[i].len) + { + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "tests[%i]: expected error=0x%x, got error=0x%x\n", + i, ERROR_INSUFFICIENT_BUFFER, GetLastError()); + } + ok(len == tests[i].len, "tests[%i]: expected len=%i, got len=%i\n", i, tests[i].len, len); + + if (tests[i].dst) + { + ok(memcmp(tests[i].dst, tests[i].expected_dst, tests[i].chars_written) == 0, + "tests[%i]: expected dst='%s', got dst='%s'\n", + i, tests[i].expected_dst, tests[i].dst); + ok(tests[i].dst[tests[i].chars_written] == '#', + "tests[%i]: expected dst[%i]='#', got dst[%i]=%i\n", + i, tests[i].chars_written, tests[i].chars_written, tests[i].dst[tests[i].chars_written]); + } + } } static void test_utf7_decoding(void) -- 2.1.3 From jacek at codeweavers.com Tue Nov 11 03:55:34 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 11 Nov 2014 10:55:34 +0100 Subject: [PATCH 1/2] mshtml: Added IDispatchEx support to HTMLTxtRange object. Message-ID: <5461DD16.4000809@codeweavers.com> --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/tests/dom.c | 2 ++ dlls/mshtml/txtrange.c | 58 ++++++++++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 24 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IDispatchEx-support-to-HTMLTxtRange-obje.diff Type: text/x-patch Size: 6029 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 11 03:55:53 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 11 Nov 2014 10:55:53 +0100 Subject: [PATCH 2/2] mshtml: Added support for IDispatchEx to HTMLSelectionObject object. Message-ID: <5461DD29.5020607@codeweavers.com> --- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/selection.c | 56 +++++++++++++++++++++++++++----------------- dlls/mshtml/tests/dom.c | 2 ++ 3 files changed, 38 insertions(+), 21 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-support-for-IDispatchEx-to-HTMLSelection.diff Type: text/x-patch Size: 6305 bytes Desc: not available URL: From hugh.mcmaster at outlook.com Tue Nov 11 04:24:51 2014 From: hugh.mcmaster at outlook.com (Hugh McMaster) Date: Tue, 11 Nov 2014 21:24:51 +1100 Subject: [PATCH v2] cmd/tests: Add tests for 'del' (Fixes bug 35970) Message-ID: Wine currently returns an errorlevel of 1 when trying to delete a non-existent file. Testing reveals 0 is the correct return value for all versions of Windows, except Windows 2000 (which does actually return 1). Note that the DWORD errorlevel is set to 0 before this change. -??????? if (!found) { -??????????? errorlevel = 1; +??????? if (!found) This patch fixes bug 35970. -------------- next part -------------- A non-text attachment was scrubbed... Name: cmd-del-test.patch Type: application/octet-stream Size: 2381 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 11 04:37:22 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 11 Nov 2014 11:37:22 +0100 Subject: mshtml: Ignore query and hash parts in res protocol handler. Message-ID: <5461E6E2.2060904@codeweavers.com> try2: Skipping tests on too old IEs. --- dlls/mshtml/protocol.c | 8 +++++++- dlls/mshtml/tests/protocol.c | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Ignore-query-and-hash-parts-in-res-protocol-ha.diff Type: text/x-patch Size: 1769 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 11 05:34:09 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 11 Nov 2014 12:34:09 +0100 Subject: [PATCH 2/2] mshtml: Added script element readyState and onreadystatechange tests. Message-ID: <5461F431.2070708@codeweavers.com> --- dlls/mshtml/tests/events.html | 76 ++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/externscr.js | 2 ++ dlls/mshtml/tests/script.c | 19 +++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-script-element-readyState-and-onreadysta.diff Type: text/x-patch Size: 6043 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 11 05:33:56 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 11 Nov 2014 12:33:56 +0100 Subject: [PATCH 1/2] mshtml: Delay onreadystateevent notification if script elemenet is not added by parser. Message-ID: <5461F424.3070202@codeweavers.com> Resend with tests fixed. --- dlls/mshtml/htmlscript.h | 1 + dlls/mshtml/script.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Delay-onreadystateevent-notification-if-script.diff Type: text/x-patch Size: 2832 bytes Desc: not available URL: From piotr at codeweavers.com Tue Nov 11 08:58:03 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Tue, 11 Nov 2014 15:58:03 +0100 Subject: [PATCH 1/4] msvcrt: Initialize file descriptor critical section Message-ID: <546223FB.6030404@codeweavers.com> --- dlls/msvcrt/file.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcrt-Initialize-file-descriptor-critical-section.txt Type: text/x-patch Size: 1054 bytes Desc: not available URL: From piotr at codeweavers.com Tue Nov 11 08:58:08 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Tue, 11 Nov 2014 15:58:08 +0100 Subject: [PATCH 2/4] msvcrt: Rename msvcrt_get_ioinfo function Message-ID: <54622400.5070400@codeweavers.com> --- dlls/msvcrt/file.c | 98 +++++++++++++++++++++++++++--------------------------- 1 file changed, 49 insertions(+), 49 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-msvcrt-Rename-msvcrt_get_ioinfo-function.txt Type: text/x-patch Size: 14209 bytes Desc: not available URL: From piotr at codeweavers.com Tue Nov 11 08:58:13 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Tue, 11 Nov 2014 15:58:13 +0100 Subject: [PATCH 3/4] msvcrt: Use fd critical section in _commit Message-ID: <54622405.9050301@codeweavers.com> --- dlls/msvcrt/file.c | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-msvcrt-Use-fd-critical-section-in-_commit.txt Type: text/x-patch Size: 1944 bytes Desc: not available URL: From piotr at codeweavers.com Tue Nov 11 08:58:18 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Tue, 11 Nov 2014 15:58:18 +0100 Subject: [PATCH 4/4] msvcrt: Use fd critical section in _close Message-ID: <5462240A.4070707@codeweavers.com> --- dlls/msvcrt/file.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-msvcrt-Use-fd-critical-section-in-_close.txt Type: text/x-patch Size: 872 bytes Desc: not available URL: From nerv at dawncrow.de Tue Nov 11 14:20:46 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Tue, 11 Nov 2014 21:20:46 +0100 Subject: avifil32: Simplify comparing two unsigned ints (PVS-Studio) (try 3) Message-ID: <54626F9E.6030004@dawncrow.de> now also addressing problems with the original logic --- dlls/avifil32/avifile.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-avifil32-Simplify-comparing-two-unsigned-ints-PVS-Stud.txt Type: text/x-patch Size: 981 bytes Desc: not available URL: From yifuwang2012 at gmail.com Tue Nov 11 16:02:51 2014 From: yifuwang2012 at gmail.com (Yifu Wang) Date: Tue, 11 Nov 2014 14:02:51 -0800 Subject: [PATCH] msvcp120: Added VS2013 CPP runtime dll Message-ID: --- configure.ac | 1 + dlls/msvcp120/Makefile.in | 14 + dlls/msvcp120/msvcp120.spec | 3846 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 3861 insertions(+), 0 deletions(-) create mode 100644 dlls/msvcp120/Makefile.in create mode 100644 dlls/msvcp120/msvcp120.spec From stefan at codeweavers.com Tue Nov 11 17:18:04 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 00:18:04 +0100 Subject: [PATCH 2/5] ddraw/tests: Ddraw restores the mode settings from the registry (v2). Message-ID: <1415747887-32375-2-git-send-email-stefan@codeweavers.com> v2: Merge with test_coop_level_mode_set. This has the positive side effect that the messages on external mode changes are explicitly tested. This behavior is already hinted by test_coop_level_mode_set_multi, although mode_set_multi tests multiple ddraw interfaces and not external mode changes. --- dlls/ddraw/tests/ddraw1.c | 150 +++++++++++++++++++++++++++++++++++++++------- dlls/ddraw/tests/ddraw2.c | 150 +++++++++++++++++++++++++++++++++++++++------- dlls/ddraw/tests/ddraw4.c | 150 +++++++++++++++++++++++++++++++++++++++------- dlls/ddraw/tests/ddraw7.c | 150 +++++++++++++++++++++++++++++++++++++++------- 4 files changed, 508 insertions(+), 92 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index ed18b47..0ae204c 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2104,7 +2104,7 @@ static LRESULT CALLBACK mode_set_proc(HWND hwnd, UINT message, WPARAM wparam, LP struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) @@ -2117,15 +2117,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_ && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2134,6 +2143,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2156,17 +2168,29 @@ static void test_coop_level_mode_set(void) memset(¶m, 0, sizeof(param)); hr = IDirectDraw_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); - ref = IDirectDraw_Release(ddraw); - ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2179,8 +2203,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2192,14 +2216,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2223,10 +2247,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2253,18 +2277,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2276,6 +2319,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2335,6 +2382,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { @@ -2406,6 +2470,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2468,6 +2542,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2532,6 +2626,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 4e10d26..334d89e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2303,7 +2303,7 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) @@ -2316,15 +2316,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_ && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw2 *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2333,6 +2342,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2355,17 +2367,29 @@ static void test_coop_level_mode_set(void) memset(¶m, 0, sizeof(param)); hr = IDirectDraw2_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw2_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); - ref = IDirectDraw2_Release(ddraw); - ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2383,8 +2407,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2396,14 +2420,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2427,10 +2451,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2457,18 +2481,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2480,6 +2523,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2539,6 +2586,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { @@ -2610,6 +2674,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2672,6 +2746,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2736,6 +2830,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 5ebbc11..ab03f39 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2490,7 +2490,7 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) @@ -2503,15 +2503,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface4 *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw4 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2520,6 +2529,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2542,17 +2554,29 @@ static void test_coop_level_mode_set(void) memset(¶m, 0, sizeof(param)); hr = IDirectDraw4_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw4_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); - ref = IDirectDraw4_Release(ddraw); - ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2570,8 +2594,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2583,14 +2607,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2614,10 +2638,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2644,18 +2668,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2667,6 +2710,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2726,6 +2773,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2790,6 +2854,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2852,6 +2926,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2916,6 +3010,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 7850fb5..cbf6112 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2167,7 +2167,7 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L struct test_coop_level_mode_set_enum_param { - DWORD ddraw_width, ddraw_height; + DWORD ddraw_width, ddraw_height, user32_width, user32_height; }; static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) @@ -2180,15 +2180,24 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface && surface_desc->dwHeight == registry_mode.dmPelsHeight) return DDENUMRET_OK; - param->ddraw_width = surface_desc->dwWidth; - param->ddraw_height = surface_desc->dwHeight; + if (!param->ddraw_width) + { + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_OK; + } + if (surface_desc->dwWidth == param->ddraw_width && surface_desc->dwHeight == param->ddraw_height) + return DDENUMRET_OK; + + param->user32_width = surface_desc->dwWidth; + param->user32_height = surface_desc->dwHeight; return DDENUMRET_CANCEL; } static void test_coop_level_mode_set(void) { IDirectDrawSurface7 *primary; - RECT registry_rect, ddraw_rect, r; + RECT registry_rect, ddraw_rect, user32_rect, r; IDirectDraw7 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2197,6 +2206,9 @@ static void test_coop_level_mode_set(void) ULONG ref; MSG msg; struct test_coop_level_mode_set_enum_param param; + DEVMODEW devmode; + BOOL ret; + LONG change_ret; static const UINT exclusive_messages[] = { @@ -2219,17 +2231,29 @@ static void test_coop_level_mode_set(void) memset(¶m, 0, sizeof(param)); hr = IDirectDraw7_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + ref = IDirectDraw7_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); - if (!param.ddraw_width) + if (!param.user32_height) { - skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); - ref = IDirectDraw7_Release(ddraw); - ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); return; } SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + SetRect(&user32_rect, 0, 0, param.user32_width, param.user32_height); + + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; @@ -2247,8 +2271,8 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2260,14 +2284,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2291,10 +2315,10 @@ static void test_coop_level_mode_set(void) hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", - registry_mode.dmPelsWidth, ddsd.dwWidth); - ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", - registry_mode.dmPelsHeight, ddsd.dwHeight); + ok(ddsd.dwWidth == param.user32_width, "Expected surface width %u, got %u.\n", + param.user32_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.user32_height, "Expected surface height %u, got %u.\n", + param.user32_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2321,18 +2345,37 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, + "Expected screen size %ux%u, got %ux%u.\n", + param.user32_width, param.user32_height, screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &user32_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = exclusive_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == registry_mode.dmPelsWidth + todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2344,6 +2387,10 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); + /* For Wine. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2403,6 +2450,23 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2467,6 +2531,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; @@ -2529,6 +2603,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + + ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + expect_messages = NULL; + ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); + + GetWindowRect(window, &r); + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, + r.left, r.top, r.right, r.bottom); + + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); + expect_messages = normal_messages; + screen_size.cx = 0; + screen_size.cy = 0; + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); @@ -2593,6 +2687,16 @@ static void test_coop_level_mode_set(void) param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, + "Expected resolution %ux%u, got %ux%u.\n", + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + devmode.dmPelsWidth, devmode.dmPelsHeight); + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS; -- 2.0.4 From stefan at codeweavers.com Tue Nov 11 17:18:03 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 00:18:03 +0100 Subject: [PATCH 1/5] ddraw/tests: Rename modes and rectangles in test_coop_level_mode_set (v2). Message-ID: <1415747887-32375-1-git-send-email-stefan@codeweavers.com> Version 2: Move the recreation of the ddraw object into patch 2. I split this out of the next patch to make it easier to review. It introduces the mode selection from test_mode_change in d3d8/9 but does not introduce the additional tests yet. Other than selecting a variable mode this is a no-op. --- dlls/ddraw/tests/ddraw1.c | 278 ++++++++++++++++++++++------------------ dlls/ddraw/tests/ddraw2.c | 320 ++++++++++++++++++++++++++-------------------- dlls/ddraw/tests/ddraw4.c | 320 ++++++++++++++++++++++++++-------------------- dlls/ddraw/tests/ddraw7.c | 320 ++++++++++++++++++++++++++-------------------- 4 files changed, 690 insertions(+), 548 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index fe8a36e..ed18b47 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2102,10 +2102,30 @@ static LRESULT CALLBACK mode_set_proc(HWND hwnd, UINT message, WPARAM wparam, LP return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(surface_desc->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2113,6 +2133,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2132,6 +2153,21 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + ref = IDirectDraw_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -2139,15 +2175,12 @@ static void test_coop_level_mode_set(void) window = CreateWindowA("ddraw_test_wndproc_wc", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2159,14 +2192,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2174,26 +2207,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2205,14 +2238,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2225,21 +2258,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2251,30 +2285,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2286,14 +2320,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2301,7 +2335,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); @@ -2316,16 +2350,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2337,14 +2371,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2360,16 +2394,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2381,14 +2415,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2398,16 +2432,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2419,14 +2453,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2434,7 +2468,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2442,16 +2476,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2463,14 +2497,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2486,16 +2520,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2507,21 +2541,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2536,10 +2570,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); @@ -2548,8 +2582,8 @@ static void test_coop_level_mode_set(void) ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); done: diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index ad0d040..4e10d26 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2301,10 +2301,30 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(surface_desc->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw2 *ddraw; DDSURFACEDESC ddsd; WNDCLASSA wc = {0}; @@ -2312,6 +2332,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2331,6 +2352,21 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw2_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + ref = IDirectDraw2_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -2343,15 +2379,12 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2363,14 +2396,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2378,26 +2411,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2409,14 +2442,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2429,21 +2462,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2455,30 +2489,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2490,14 +2524,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2505,7 +2539,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); @@ -2520,16 +2554,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2541,14 +2575,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2564,16 +2598,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2585,14 +2619,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2602,16 +2636,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2623,14 +2657,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2638,7 +2672,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2646,16 +2680,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2667,14 +2701,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2690,16 +2724,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2711,21 +2745,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2738,13 +2772,15 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2756,16 +2792,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2780,10 +2816,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface_Release(primary); hr = IDirectDraw2_RestoreDisplayMode(ddraw); @@ -2792,7 +2828,7 @@ static void test_coop_level_mode_set(void) /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2809,17 +2845,17 @@ static void test_coop_level_mode_set(void) expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); - ok(screen_size2.cx == fullscreen_rect.right && screen_size2.cy == fullscreen_rect.bottom, + ok(screen_size2.cx == registry_mode.dmPelsWidth && screen_size2.cy == registry_mode.dmPelsHeight, "Expected screen size 2 %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size2.cx, screen_size2.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size2.cx, screen_size2.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(window2, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2831,18 +2867,18 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface_Release(primary); ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); done: diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 69f3ac7..5ebbc11 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2488,10 +2488,30 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(U4(surface_desc)->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface4 *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw4 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2499,6 +2519,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2518,6 +2539,21 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw4_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + ref = IDirectDraw4_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -2530,15 +2566,12 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2550,14 +2583,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2565,26 +2598,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2596,14 +2629,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2616,21 +2649,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2642,30 +2676,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2677,14 +2711,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2692,7 +2726,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2700,16 +2734,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2721,14 +2755,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2744,16 +2778,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2765,14 +2799,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2782,16 +2816,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2803,14 +2837,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2818,7 +2852,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2826,16 +2860,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2847,14 +2881,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2870,16 +2904,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2891,21 +2925,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2918,13 +2952,15 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2936,16 +2972,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2960,10 +2996,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); hr = IDirectDraw4_RestoreDisplayMode(ddraw); @@ -2972,7 +3008,7 @@ static void test_coop_level_mode_set(void) /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2989,17 +3025,17 @@ static void test_coop_level_mode_set(void) expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); - ok(screen_size2.cx == fullscreen_rect.right && screen_size2.cy == fullscreen_rect.bottom, + ok(screen_size2.cx == registry_mode.dmPelsWidth && screen_size2.cy == registry_mode.dmPelsHeight, "Expected screen size 2 %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size2.cx, screen_size2.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size2.cx, screen_size2.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(window2, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -3011,18 +3047,18 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface4_Release(primary); ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); expect_messages = NULL; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 3aebfa7..7850fb5 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2165,10 +2165,30 @@ static LRESULT CALLBACK mode_set_proc2(HWND hwnd, UINT message, WPARAM wparam, L return test_proc(hwnd, message, wparam, lparam); } +struct test_coop_level_mode_set_enum_param +{ + DWORD ddraw_width, ddraw_height; +}; + +static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface_desc, void *context) +{ + struct test_coop_level_mode_set_enum_param *param = context; + + if (U1(U4(surface_desc)->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + return DDENUMRET_OK; + if (surface_desc->dwWidth == registry_mode.dmPelsWidth + && surface_desc->dwHeight == registry_mode.dmPelsHeight) + return DDENUMRET_OK; + + param->ddraw_width = surface_desc->dwWidth; + param->ddraw_height = surface_desc->dwHeight; + return DDENUMRET_CANCEL; +} + static void test_coop_level_mode_set(void) { IDirectDrawSurface7 *primary; - RECT fullscreen_rect, r, s; + RECT registry_rect, ddraw_rect, r; IDirectDraw7 *ddraw; DDSURFACEDESC2 ddsd; WNDCLASSA wc = {0}; @@ -2176,6 +2196,7 @@ static void test_coop_level_mode_set(void) HRESULT hr; ULONG ref; MSG msg; + struct test_coop_level_mode_set_enum_param param; static const UINT exclusive_messages[] = { @@ -2195,6 +2216,21 @@ static void test_coop_level_mode_set(void) ddraw = create_ddraw(); ok(!!ddraw, "Failed to create a ddraw object.\n"); + memset(¶m, 0, sizeof(param)); + hr = IDirectDraw7_EnumDisplayModes(ddraw, 0, NULL, ¶m, test_coop_level_mode_set_enum_cb); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (!param.ddraw_width) + { + skip("Fewer than 2 different modes supported, skipping mode restore test.\n"); + ref = IDirectDraw7_Release(ddraw); + ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); + return; + } + + SetRect(®istry_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); + SetRect(&ddraw_rect, 0, 0, param.ddraw_width, param.ddraw_height); + wc.lpfnWndProc = mode_set_proc; wc.lpszClassName = "ddraw_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -2207,15 +2243,12 @@ static void test_coop_level_mode_set(void) window2 = CreateWindowA("ddraw_test_wndproc_wc2", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); - SetRect(&fullscreen_rect, 0, 0, registry_mode.dmPelsWidth, registry_mode.dmPelsHeight); - SetRect(&s, 0, 0, 640, 480); - hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2227,14 +2260,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2242,26 +2275,26 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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; - ok(screen_size.cx == s.right && screen_size.cy == s.bottom, + ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", - s.right, s.bottom, screen_size.cx, screen_size.cy); + param.ddraw_width, param.ddraw_height, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2273,14 +2306,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2293,21 +2326,22 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2319,30 +2353,30 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2354,14 +2388,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2369,7 +2403,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2377,16 +2411,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2398,14 +2432,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2421,16 +2455,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2442,14 +2476,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* DDSCL_NORMAL | DDSCL_FULLSCREEN behaves the same as just DDSCL_NORMAL. @@ -2459,16 +2493,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2480,14 +2514,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2495,7 +2529,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); @@ -2503,16 +2537,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2524,14 +2558,14 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2547,16 +2581,16 @@ static void test_coop_level_mode_set(void) ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); memset(&ddsd, 0, sizeof(ddsd)); @@ -2568,21 +2602,21 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2595,13 +2629,15 @@ static void test_coop_level_mode_set(void) ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; - ok(screen_size.cx == fullscreen_rect.right && screen_size.cy == fullscreen_rect.bottom, + ok(screen_size.cx == registry_mode.dmPelsWidth + && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size.cx, screen_size.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, + screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2613,16 +2649,16 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); @@ -2637,10 +2673,10 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == s.right - s.left, "Expected surface width %u, got %u.\n", - s.right - s.left, ddsd.dwWidth); - ok(ddsd.dwHeight == s.bottom - s.top, "Expected surface height %u, got %u.\n", - s.bottom - s.top, ddsd.dwHeight); + ok(ddsd.dwWidth == param.ddraw_width, "Expected surface width %u, got %u.\n", + param.ddraw_width, ddsd.dwWidth); + ok(ddsd.dwHeight == param.ddraw_height, "Expected surface height %u, got %u.\n", + param.ddraw_height, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); hr = IDirectDraw7_RestoreDisplayMode(ddraw); @@ -2649,7 +2685,7 @@ static void test_coop_level_mode_set(void) /* 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 = set_display_mode(ddraw, 640, 480); + hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); @@ -2666,17 +2702,17 @@ static void test_coop_level_mode_set(void) expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); - ok(screen_size2.cx == fullscreen_rect.right && screen_size2.cy == fullscreen_rect.bottom, + ok(screen_size2.cx == registry_mode.dmPelsWidth && screen_size2.cy == registry_mode.dmPelsHeight, "Expected screen size 2 %ux%u, got %ux%u.\n", - fullscreen_rect.right, fullscreen_rect.bottom, screen_size2.cx, screen_size2.cy); + registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size2.cx, screen_size2.cy); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); GetWindowRect(window2, &r); - ok(EqualRect(&r, &fullscreen_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - fullscreen_rect.left, fullscreen_rect.top, fullscreen_rect.right, fullscreen_rect.bottom, + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); memset(&ddsd, 0, sizeof(ddsd)); @@ -2688,18 +2724,18 @@ static void test_coop_level_mode_set(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_GetSurfaceDesc(primary, &ddsd); ok(SUCCEEDED(hr), "Failed to get surface desc, hr %#x.\n", hr); - ok(ddsd.dwWidth == fullscreen_rect.right - fullscreen_rect.left, "Expected surface width %u, got %u.\n", - fullscreen_rect.right - fullscreen_rect.left, ddsd.dwWidth); - ok(ddsd.dwHeight == fullscreen_rect.bottom - fullscreen_rect.top, "Expected surface height %u, got %u.\n", - fullscreen_rect.bottom - fullscreen_rect.top, ddsd.dwHeight); + ok(ddsd.dwWidth == registry_mode.dmPelsWidth, "Expected surface width %u, got %u.\n", + registry_mode.dmPelsWidth, ddsd.dwWidth); + ok(ddsd.dwHeight == registry_mode.dmPelsHeight, "Expected surface height %u, got %u.\n", + registry_mode.dmPelsHeight, ddsd.dwHeight); IDirectDrawSurface7_Release(primary); ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); GetWindowRect(window, &r); - ok(EqualRect(&r, &s), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", - s.left, s.top, s.right, s.bottom, + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, r.left, r.top, r.right, r.bottom); expect_messages = NULL; -- 2.0.4 From stefan at codeweavers.com Tue Nov 11 17:18:05 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 00:18:05 +0100 Subject: [PATCH 3/5] d3d/tests: Test fog interpolation. Message-ID: <1415747887-32375-3-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/visual.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 145 ++++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 125 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 415 insertions(+) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 9895a73..b21c9f0 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5217,6 +5217,150 @@ done: DestroyWindow(window); } +static void fog_interpolation_test(void) +{ + HRESULT hr; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + quad[] = + { + {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff000000}, + {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff000000}, + {{ 1.0f, -1.0f, 1.0f}, 0xffff0000, 0x00000000}, + {{ 1.0f, 1.0f, 1.0f}, 0xffff0000, 0x00000000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + D3DFOGMODE vfog, tfog; + D3DSHADEMODE shade; + D3DCOLOR middle_color; + BOOL todo; + } + tests[] = + { + {D3DFOG_NONE, D3DFOG_NONE, D3DSHADE_FLAT, 0x00007f80, FALSE}, + {D3DFOG_NONE, D3DFOG_NONE, D3DSHADE_GOURAUD, 0x00007f80, FALSE}, + {D3DFOG_EXP, D3DFOG_NONE, D3DSHADE_FLAT, 0x00007f80, TRUE}, + {D3DFOG_EXP, D3DFOG_NONE, D3DSHADE_GOURAUD, 0x00007f80, TRUE}, + {D3DFOG_NONE, D3DFOG_EXP, D3DSHADE_FLAT, 0x0000ea15, FALSE}, + {D3DFOG_NONE, D3DFOG_EXP, D3DSHADE_GOURAUD, 0x0000ea15, FALSE}, + {D3DFOG_EXP, D3DFOG_EXP, D3DSHADE_FLAT, 0x0000ea15, FALSE}, + {D3DFOG_EXP, D3DFOG_EXP, D3DSHADE_GOURAUD, 0x0000ea15, FALSE}, + }; + static const D3DMATRIX ident_mat = + {{{ + 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 + }}}; + D3DCAPS8 caps; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests\n"); + + hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = 5.0; + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGDENSITY, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); + ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TFACTOR); + ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0x000000ff); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + + /* 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 X1600, AMD Radeon HD 6310, Windows 7). Without this, + * the drivers seem to use a static z = 1.0 input for the fog equation. + * The input value is independent of the actual z and w component of + * the vertex position. */ + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &ident_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + if(!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00808080, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_SHADEMODE, tests[i].shade); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 0, 240); + ok(color_match(color, 0x000000ff, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + color = getPixelColor(device, 320, 240); + if (tests[i].todo) + todo_wine ok(color_match(color, tests[i].middle_color, 2), + "Got unexpected color 0x%08x, case %u.\n", color, i); + else + ok(color_match(color, tests[i].middle_color, 2), + "Got unexpected color 0x%08x, case %u.\n", color, i); + color = getPixelColor(device, 639, 240); + ok(color_match(color, 0x0000fd02, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -5267,4 +5411,5 @@ START_TEST(visual) volume_v16u16_test(); add_dirty_rect_test(); test_3dc_formats(); + fog_interpolation_test(); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index d1d7447..8cc4157 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16820,6 +16820,150 @@ done: DestroyWindow(window); } +static void fog_interpolation_test(void) +{ + HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + quad[] = + { + {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff000000}, + {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff000000}, + {{ 1.0f, -1.0f, 1.0f}, 0xffff0000, 0x00000000}, + {{ 1.0f, 1.0f, 1.0f}, 0xffff0000, 0x00000000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + D3DFOGMODE vfog, tfog; + D3DSHADEMODE shade; + D3DCOLOR middle_color; + BOOL todo; + } + tests[] = + { + {D3DFOG_NONE, D3DFOG_NONE, D3DSHADE_FLAT, 0x00007f80, FALSE}, + {D3DFOG_NONE, D3DFOG_NONE, D3DSHADE_GOURAUD, 0x00007f80, FALSE}, + {D3DFOG_EXP, D3DFOG_NONE, D3DSHADE_FLAT, 0x00007f80, TRUE}, + {D3DFOG_EXP, D3DFOG_NONE, D3DSHADE_GOURAUD, 0x00007f80, TRUE}, + {D3DFOG_NONE, D3DFOG_EXP, D3DSHADE_FLAT, 0x0000ea15, FALSE}, + {D3DFOG_NONE, D3DFOG_EXP, D3DSHADE_GOURAUD, 0x0000ea15, FALSE}, + {D3DFOG_EXP, D3DFOG_EXP, D3DSHADE_FLAT, 0x0000ea15, FALSE}, + {D3DFOG_EXP, D3DFOG_EXP, D3DSHADE_GOURAUD, 0x0000ea15, FALSE}, + }; + static const D3DMATRIX ident_mat = + {{{ + 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 + }}}; + 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"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests\n"); + + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = 5.0; + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); + ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TFACTOR); + ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_TEXTUREFACTOR, 0x000000ff); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + + /* 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 X1600, AMD Radeon HD 6310, Windows 7). Without this, + * the drivers seem to use a static z = 1.0 input for the fog equation. + * The input value is independent of the actual z and w component of + * the vertex position. */ + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &ident_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + if(!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00808080, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_SHADEMODE, tests[i].shade); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 0, 240); + ok(color_match(color, 0x000000ff, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + color = getPixelColor(device, 320, 240); + if (tests[i].todo) + todo_wine ok(color_match(color, tests[i].middle_color, 2), + "Got unexpected color 0x%08x, case %u.\n", color, i); + else + ok(color_match(color, tests[i].middle_color, 2), + "Got unexpected color 0x%08x, case %u.\n", color, i); + color = getPixelColor(device, 639, 240); + ok(color_match(color, 0x0000fd02, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -16928,4 +17072,5 @@ START_TEST(visual) stencil_cull_test(); test_per_stage_constant(); test_3dc_formats(); + fog_interpolation_test(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index cbf6112..f505c65 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7764,6 +7764,130 @@ static void test_surface_desc_lock(void) DestroyWindow(window); } +static void fog_interpolation_test(void) +{ + HRESULT hr; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + ULONG refcount; + HWND window; + D3DCOLOR color; + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + quad[] = + { + {{-1.0f, -1.0f, 0.0f}, 0xffff0000, 0xff000000}, + {{-1.0f, 1.0f, 0.0f}, 0xffff0000, 0xff000000}, + {{ 1.0f, -1.0f, 1.0f}, 0xffff0000, 0x00000000}, + {{ 1.0f, 1.0f, 1.0f}, 0xffff0000, 0x00000000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + D3DFOGMODE vfog, tfog; + D3DSHADEMODE shade; + D3DCOLOR middle_color; + BOOL todo; + } + tests[] = + { + {D3DFOG_NONE, D3DFOG_NONE, D3DSHADE_FLAT, 0x00007f80, FALSE}, + {D3DFOG_NONE, D3DFOG_NONE, D3DSHADE_GOURAUD, 0x00007f80, FALSE}, + {D3DFOG_EXP, D3DFOG_NONE, D3DSHADE_FLAT, 0x00007f80, TRUE}, + {D3DFOG_EXP, D3DFOG_NONE, D3DSHADE_GOURAUD, 0x00007f80, TRUE}, + {D3DFOG_NONE, D3DFOG_EXP, D3DSHADE_FLAT, 0x0000ea15, FALSE}, + {D3DFOG_NONE, D3DFOG_EXP, D3DSHADE_GOURAUD, 0x0000ea15, FALSE}, + {D3DFOG_EXP, D3DFOG_EXP, D3DSHADE_FLAT, 0x0000ea15, FALSE}, + {D3DFOG_EXP, D3DFOG_EXP, D3DSHADE_GOURAUD, 0x0000ea15, FALSE}, + }; + D3DDEVICEDESC7 caps; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests\n"); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = 5.0; + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGDENSITY, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1); + ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TFACTOR); + ok(SUCCEEDED(hr), "Failed to set texture stage state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_TEXTUREFACTOR, 0x000000ff); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + if(!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00808080, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_SHADEMODE, tests[i].shade); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, quad, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = get_surface_color(rt, 0, 240); + ok(compare_color(color, 0x000000ff, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + color = get_surface_color(rt, 320, 240); + if (tests[i].todo) + todo_wine ok(compare_color(color, tests[i].middle_color, 2), + "Got unexpected color 0x%08x, case %u.\n", color, i); + else + ok(compare_color(color, tests[i].middle_color, 2), + "Got unexpected color 0x%08x, case %u.\n", color, i); + color = get_surface_color(rt, 639, 240); + ok(compare_color(color, 0x0000fd02, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); @@ -7850,4 +7974,5 @@ START_TEST(ddraw7) test_lost_device(); test_resource_priority(); test_surface_desc_lock(); + fog_interpolation_test(); } -- 2.0.4 From stefan at codeweavers.com Tue Nov 11 17:18:06 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 00:18:06 +0100 Subject: [PATCH 4/5] d3d9/tests: Allow passing a resolution to reset_device in d3d9ex. Message-ID: <1415747887-32375-4-git-send-email-stefan@codeweavers.com> The resolution change in test_wndproc_windowed is intentional. --- dlls/d3d9/tests/d3d9ex.c | 59 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index d93e591..bbb95b0 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -132,19 +132,27 @@ done: return device; } -static HRESULT reset_device(IDirect3DDevice9Ex *device, HWND device_window, BOOL windowed) +static HRESULT reset_device(IDirect3DDevice9Ex *device, const struct device_desc *desc) { D3DPRESENT_PARAMETERS present_parameters = {0}; - present_parameters.Windowed = windowed; - present_parameters.hDeviceWindow = device_window; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - present_parameters.BackBufferWidth = 1024; - present_parameters.BackBufferHeight = 768; + present_parameters.BackBufferWidth = 640; + present_parameters.BackBufferHeight = 480; present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + present_parameters.hDeviceWindow = NULL; + present_parameters.Windowed = TRUE; present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; + if (desc) + { + present_parameters.BackBufferWidth = desc->width; + present_parameters.BackBufferHeight = desc->height; + present_parameters.hDeviceWindow = desc->device_window; + present_parameters.Windowed = !(desc->flags & CREATE_DEVICE_FULLSCREEN); + } + return IDirect3DDevice9_Reset(device, &present_parameters); } @@ -1110,7 +1118,7 @@ static void test_reset_resources(void) IDirect3DSurface9_Release(surface); } - hr = reset_device(device, window, TRUE); + hr = reset_device(device, NULL); ok(SUCCEEDED(hr), "Failed to reset device.\n"); hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &rt); @@ -1284,7 +1292,9 @@ static void test_lost_device(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL); ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, FALSE); + desc.width = 1024; + desc.height = 768; + hr = reset_device(device, &desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9Ex_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -1297,7 +1307,8 @@ static void test_lost_device(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL); ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, TRUE); + desc.flags = 0; + hr = reset_device(device, &desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9Ex_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -1310,7 +1321,7 @@ static void test_lost_device(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL); todo_wine ok(hr == S_PRESENT_MODE_CHANGED, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, TRUE); + hr = reset_device(device, &desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9Ex_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -1349,7 +1360,8 @@ static void test_lost_device(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, FALSE); + desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9Ex_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -1977,8 +1989,8 @@ static void test_wndproc_windowed(void) filter_messages = focus_window; device_desc.device_window = device_window; - device_desc.width = 640; - device_desc.height = 480; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = 0; if (!(device = create_device(focus_window, &device_desc))) { @@ -2002,7 +2014,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, device_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2012,7 +2025,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2039,7 +2053,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, focus_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2049,7 +2064,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, focus_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2074,7 +2090,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, device_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2084,7 +2101,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2197,7 +2215,8 @@ static void test_window_style(void) focus_rect.left, focus_rect.top, focus_rect.right, focus_rect.bottom, r.left, r.top, r.right, r.bottom, i); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); style = GetWindowLongA(device_window, GWL_STYLE); -- 2.0.4 From stefan at codeweavers.com Tue Nov 11 17:18:07 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 00:18:07 +0100 Subject: [PATCH 5/5] d3d8/tests: Allow passing a resolution to reset_device. Message-ID: <1415747887-32375-5-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 58 +++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 7468d13..6e4cb46 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -136,19 +136,27 @@ static IDirect3DDevice8 *create_device(IDirect3D8 *d3d8, HWND focus_window, cons return NULL; } -static HRESULT reset_device(IDirect3DDevice8 *device, HWND device_window, BOOL windowed) +static HRESULT reset_device(IDirect3DDevice8 *device, const struct device_desc *desc) { D3DPRESENT_PARAMETERS present_parameters = {0}; - present_parameters.Windowed = windowed; - present_parameters.hDeviceWindow = device_window; - present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; - present_parameters.BackBufferWidth = registry_mode.dmPelsWidth; - present_parameters.BackBufferHeight = registry_mode.dmPelsHeight; + present_parameters.BackBufferWidth = 640; + present_parameters.BackBufferHeight = 480; present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8; + present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD; + present_parameters.hDeviceWindow = NULL; + present_parameters.Windowed = TRUE; present_parameters.EnableAutoDepthStencil = TRUE; present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8; + if (desc) + { + present_parameters.BackBufferWidth = desc->width; + present_parameters.BackBufferHeight = desc->height; + present_parameters.hDeviceWindow = desc->device_window; + present_parameters.Windowed = !(desc->flags & CREATE_DEVICE_FULLSCREEN); + } + return IDirect3DDevice8_Reset(device, &present_parameters); } @@ -2424,8 +2432,8 @@ static void test_wndproc_windowed(void) filter_messages = focus_window; device_desc.device_window = device_window; - device_desc.width = 640; - device_desc.height = 480; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; device_desc.flags = 0; if (!(device = create_device(d3d8, focus_window, &device_desc))) { @@ -2449,7 +2457,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, device_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2459,7 +2468,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2486,7 +2496,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, focus_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2496,7 +2507,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, focus_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2521,7 +2533,8 @@ static void test_wndproc_windowed(void) filter_messages = NULL; - hr = reset_device(device, device_window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2531,7 +2544,8 @@ static void test_wndproc_windowed(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); @@ -2830,7 +2844,8 @@ static void test_window_style(void) focus_rect.left, focus_rect.top, focus_rect.right, focus_rect.bottom, r.left, r.top, r.right, r.bottom); - hr = reset_device(device, device_window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); style = GetWindowLongA(device_window, GWL_STYLE); @@ -3205,7 +3220,8 @@ static void test_device_window_reset(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); - hr = reset_device(device, device_window, FALSE); + device_desc.device_window = device_window; + hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device.\n"); GetWindowRect(focus_window, &r); @@ -3340,7 +3356,7 @@ static void test_reset_resources(void) IDirect3DSurface8_Release(rt); IDirect3DSurface8_Release(surface); - hr = reset_device(device, device_window, TRUE); + hr = reset_device(device, NULL); ok(SUCCEEDED(hr), "Failed to reset device.\n"); hr = IDirect3DDevice8_GetBackBuffer(device, 0, D3DBACKBUFFER_TYPE_MONO, &rt); @@ -6506,14 +6522,15 @@ static void test_lost_device(void) hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, FALSE); + hr = reset_device(device, &device_desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, TRUE); + device_desc.flags = 0; + hr = reset_device(device, &device_desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_TestCooperativeLevel(device); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); @@ -6534,7 +6551,8 @@ static void test_lost_device(void) hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - hr = reset_device(device, window, FALSE); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_TestCooperativeLevel(device); todo_wine ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); -- 2.0.4 From 00cpxxx at gmail.com Tue Nov 11 19:06:18 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Tue, 11 Nov 2014 23:06:18 -0200 Subject: dinput: Fix device type dump Message-ID: Related to bug https://bugs.winehq.org/show_bug.cgi?id=35954 -------------- next part -------------- diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 0d61f57..2931832 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -402,14 +402,30 @@ HRESULT WINAPI JoystickAGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REF void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) { + int type = GET_DIDEVICE_TYPE(lpDIDevCaps->dwDevType); TRACE("dwSize: %d\n", lpDIDevCaps->dwSize); TRACE("dwFlags: %08x\n", lpDIDevCaps->dwFlags); TRACE("dwDevType: %08x %s\n", lpDIDevCaps->dwDevType, - lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : - lpDIDevCaps->dwDevType == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : - lpDIDevCaps->dwDevType == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : - lpDIDevCaps->dwDevType == DIDEVTYPE_JOYSTICK ? "DIDEVTYPE_JOYSTICK" : - lpDIDevCaps->dwDevType == DIDEVTYPE_HID ? "DIDEVTYPE_HID" : "UNKNOWN"); + /* Directx <= 7 definitions */ + type == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : + type == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : + type == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : + type == DIDEVTYPE_JOYSTICK ? "DIDEVTYPE_JOYSTICK" : + type == DIDEVTYPE_HID ? "DIDEVTYPE_HID" : + /* Directx >= 8 definitions */ + type == DI8DEVTYPE_DEVICE ? "DI8DEVTYPE_DEVICE" : + type == DI8DEVTYPE_MOUSE ? "DI8DEVTYPE_MOUSE" : + type == DI8DEVTYPE_KEYBOARD ? "DI8DEVTYPE_KEYBOARD" : + type == DI8DEVTYPE_JOYSTICK ? "DI8DEVTYPE_JOYSTICK" : + type == DI8DEVTYPE_GAMEPAD ? "DI8DEVTYPE_GAMEPAD" : + type == DI8DEVTYPE_DRIVING ? "DI8DEVTYPE_DRIVING" : + type == DI8DEVTYPE_FLIGHT ? "DI8DEVTYPE_FLIGHT" : + type == DI8DEVTYPE_1STPERSON ? "DI8DEVTYPE_1STPERSON" : + type == DI8DEVTYPE_DEVICECTRL ? "DI8DEVTYPE_DEVICECTRL" : + type == DI8DEVTYPE_SCREENPOINTER ? "DI8DEVTYPE_SCREENPOINTER" : + type == DI8DEVTYPE_REMOTE ? "DI8DEVTYPE_REMOTE" : + type == DI8DEVTYPE_SUPPLEMENTAL ? "DI8DEVTYPE_SUPPLEMENTAL" : + "UNKNOWN"); TRACE("dwAxes: %d\n", lpDIDevCaps->dwAxes); TRACE("dwButtons: %d\n", lpDIDevCaps->dwButtons); TRACE("dwPOVs: %d\n", lpDIDevCaps->dwPOVs); From austinenglish at gmail.com Tue Nov 11 19:41:03 2014 From: austinenglish at gmail.com (Austin English) Date: Tue, 11 Nov 2014 19:41:03 -0600 Subject: shell32: add a stub for RegenerateUserEnvironment Message-ID: Fixes https://bugs.winehq.org/show_bug.cgi?id=37539 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/shell32/shell32.spec b/dlls/shell32/shell32.spec index f219c8f..e6858c8 100644 --- a/dlls/shell32/shell32.spec +++ b/dlls/shell32/shell32.spec @@ -324,7 +324,7 @@ @ stub RealShellExecuteExA @ stub RealShellExecuteExW @ stub RealShellExecuteW -@ stub RegenerateUserEnvironment +@ stdcall RegenerateUserEnvironment(ptr long) @ stdcall SetCurrentProcessExplicitAppUserModelID(wstr) @ stdcall SHAddToRecentDocs (long ptr) @ stdcall SHAppBarMessage(long ptr) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index a6bc5c8..05b79e3 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -2097,3 +2097,12 @@ void WINAPI OpenAs_RunDLLW(HWND hwnd, HINSTANCE hinst, LPCWSTR cmdline, int cmds { FIXME("%p, %p, %s, %d\n", hwnd, hinst, debugstr_w(cmdline), cmdshow); } + +/************************************************************************* + * RegenerateUserEnvironment [SHELL32.@] + */ +BOOL WINAPI RegenerateUserEnvironment(WCHAR *wunknown, BOOL bunknown) +{ + FIXME("stub: %p, %d\n", wunknown, bunknown); + return FALSE; +} From 00cpxxx at gmail.com Tue Nov 11 20:03:59 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Wed, 12 Nov 2014 00:03:59 -0200 Subject: version: Handle NULL puLen parameter for VerQueryValueA/W Message-ID: Rebased version of patch from Jeff Zaroyko. Tests were attempted but they crash in NT4 and 2000. It's possible to add tests if a GetVersion() check is added to test for different windows versions, I'm trying the simplified attempt first. Test results: https://testbot.winehq.org/JobDetails.pl?Key=10201 Fixes https://bugs.winehq.org/show_bug.cgi?id=16832 -------------- next part -------------- diff --git a/dlls/version/version.c b/dlls/version/version.c index 9bc6ad1..58fd029 100644 --- a/dlls/version/version.c +++ b/dlls/version/version.c @@ -976,7 +976,7 @@ BOOL WINAPI VerQueryValueA( LPCVOID pBlock, LPCSTR lpSubBlock, len = WideCharToMultiByte(CP_ACP, 0, *lplpBuffer, -1, lpBufferA + pos, info->wLength - pos, NULL, NULL); *lplpBuffer = lpBufferA + pos; - *puLen = len; + if (puLen) *puLen = len; } return ret; } @@ -1036,7 +1036,7 @@ BOOL WINAPI VerQueryValueW( LPCVOID pBlock, LPCWSTR lpSubBlock, len = MultiByteToWideChar(CP_ACP, 0, *lplpBuffer, -1, lpBufferW + pos, max/sizeof(WCHAR) - pos ); *lplpBuffer = lpBufferW + pos; - *puLen = len; + if (puLen) *puLen = len; } return ret; } From 00cpxxx at gmail.com Tue Nov 11 20:42:11 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Wed, 12 Nov 2014 00:42:11 -0200 Subject: [1/2] server: Add a missing socket protocol attribution Message-ID: The new socket has to inherit the information just like family and type. -------------- next part -------------- diff --git a/server/sock.c b/server/sock.c index 4adad0f..e124ad6 100644 --- a/server/sock.c +++ b/server/sock.c @@ -773,6 +773,7 @@ static int accept_into_socket( struct sock *sock, struct sock *acceptsock ) acceptsock->hmask = 0; acceptsock->pmask = 0; acceptsock->polling = 0; + acceptsock->proto = sock->proto; acceptsock->type = sock->type; acceptsock->family = sock->family; acceptsock->wparam = 0; From 00cpxxx at gmail.com Tue Nov 11 20:42:14 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Wed, 12 Nov 2014 00:42:14 -0200 Subject: [2/2] server: Store the time of the socket connection (try 2) Message-ID: Rebased version of a patch from Erich Hoover, all kudos to him. -------------- next part -------------- diff --git a/server/sock.c b/server/sock.c index e124ad6..7c0212e 100644 --- a/server/sock.c +++ b/server/sock.c @@ -107,6 +107,7 @@ struct sock unsigned int message; /* message to send */ obj_handle_t wparam; /* message wparam (socket handle) */ int errors[FD_MAX_EVENTS]; /* event errors */ + timeout_t connect_time;/* time the socket was connected */ struct sock *deferred; /* socket that waits for a deferred accept */ struct async_queue *read_q; /* queue for asynchronous reads */ struct async_queue *write_q; /* queue for asynchronous writes */ @@ -401,6 +402,7 @@ static void sock_poll_event( struct fd *fd, int event ) /* we got connected */ sock->state |= FD_WINE_CONNECTED|FD_READ|FD_WRITE; sock->state &= ~FD_CONNECT; + sock->connect_time = current_time; } } else if (sock->state & FD_WINE_LISTENING) @@ -618,6 +620,7 @@ static void init_sock(struct sock *sock) sock->window = 0; sock->message = 0; sock->wparam = 0; + sock->connect_time = 0; sock->deferred = NULL; sock->read_q = NULL; sock->write_q = NULL; @@ -725,6 +728,7 @@ static struct sock *accept_socket( obj_handle_t handle ) acceptsock->family = sock->family; acceptsock->window = sock->window; acceptsock->message = sock->message; + acceptsock->connect_time = current_time; if (sock->event) acceptsock->event = (struct event *)grab_object( sock->event ); acceptsock->flags = sock->flags; if (!(acceptsock->fd = create_anonymous_fd( &sock_fd_ops, acceptfd, &acceptsock->obj, @@ -778,6 +782,7 @@ static int accept_into_socket( struct sock *sock, struct sock *acceptsock ) acceptsock->family = sock->family; acceptsock->wparam = 0; acceptsock->deferred = NULL; + acceptsock->connect_time = current_time; release_object( acceptsock->fd ); acceptsock->fd = newfd; From alexhenrie24 at gmail.com Tue Nov 11 21:39:59 2014 From: alexhenrie24 at gmail.com (Alex Henrie) Date: Tue, 11 Nov 2014 20:39:59 -0700 Subject: [PATCH (try 2)] kernel32/tests: Add tabular UTF-7 encoding tests. Message-ID: <1415763599-27630-1-git-send-email-alexhenrie24@gmail.com> Try 2 does not test {'a',0,'b',0} because a near-identical test was already included in the previously committed patches. --- dlls/kernel32/tests/codepage.c | 136 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) diff --git a/dlls/kernel32/tests/codepage.c b/dlls/kernel32/tests/codepage.c index 6e89533..aa7977d 100644 --- a/dlls/kernel32/tests/codepage.c +++ b/dlls/kernel32/tests/codepage.c @@ -433,6 +433,114 @@ static void test_utf7_encoding(void) static const char base64_encoding_table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + const struct + { + /* inputs */ + WCHAR src[16]; + int srclen; + char *dst; + int dstlen; + /* expected outputs */ + char expected_dst[16]; + int chars_written; + int len; + } + tests[] = + { + /* tests string conversion with srclen=-1 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, sizeof(output) - 1, + "+T2BZfVQX-", 11, 11 + }, + /* tests string conversion with srclen=-2 */ + { + {0x4F60,0x597D,0x5417,0}, -2, output, sizeof(output) - 1, + "+T2BZfVQX-", 11, 11 + }, + /* tests string conversion with dstlen=strlen(expected_dst) */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 10, + "+T2BZfVQX-", 10, 0 + }, + /* tests string conversion with dstlen=strlen(expected_dst)+1 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 11, + "+T2BZfVQX-", 11, 11 + }, + /* tests string conversion with dstlen=strlen(expected_dst)+2 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 12, + "+T2BZfVQX-", 11, 11 + }, + /* tests dry run with dst=NULL and dstlen=0 */ + { + {0x4F60,0x597D,0x5417,0}, -1, NULL, 0, + {}, 0, 11 + }, + /* tests dry run with dst!=NULL and dstlen=0 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 0, + {}, 0, 11 + }, + /* tests srclen < strlenW(src) with directly encodable chars */ + { + {'h','e','l','l','o',0}, 2, output, sizeof(output) - 1, + "he", 2, 2 + }, + /* tests srclen < strlenW(src) with non-directly encodable chars */ + { + {0x4F60,0x597D,0x5417,0}, 2, output, sizeof(output) - 1, + "+T2BZfQ-", 8, 8 + }, + /* tests a single null char */ + { + {0}, -1, output, sizeof(output) - 1, + "", 1, 1 + }, + /* tests a buffer that runs out while not encoding a UTF-7 sequence */ + { + {'h','e','l','l','o',0}, -1, output, 2, + "he", 2, 0 + }, + /* tests a buffer that runs out after writing 1 base64 character */ + { + {0x4F60,0x0001,0}, -1, output, 2, + "+T", 2, 0 + }, + /* tests a buffer that runs out after writing 2 base64 characters */ + { + {0x4F60,0x0001,0}, -1, output, 3, + "+T2", 3, 0 + }, + /* tests a buffer that runs out after writing 3 base64 characters */ + { + {0x4F60,0x0001,0}, -1, output, 4, + "+T2A", 4, 0 + }, + /* tests a buffer that runs out just after writing the + sign */ + { + {0x4F60,0}, -1, output, 1, + "+", 1, 0 + }, + /* tests a buffer that runs out just before writing the - sign + * the number of bits to encode here is evenly divisible by 6 */ + { + {0x4F60,0x597D,0x5417,0}, -1, output, 9, + "+T2BZfVQX", 9, 0 + }, + /* tests a buffer that runs out just before writing the - sign + * the number of bits to encode here is NOT evenly divisible by 6 */ + { + {0x4F60,0}, -1, output, 4, + "+T2", 3, 0 + }, + /* tests a buffer that runs out in the middle of escaping a + sign */ + { + {'+',0}, -1, output, 1, + "+", 1, 0 + } + }; + if (WideCharToMultiByte(CP_UTF7, 0, foobarW, -1, NULL, 0, NULL, NULL) == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { @@ -525,6 +633,34 @@ static void test_utf7_encoding(void) ok(output[expected_len] == '#', "i=0x%04x: expected output[%i]='#', got output[%i]=%i\n", i, expected_len, expected_len, output[expected_len]); } + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) + { + memset(output, '#', sizeof(output) - 1); + output[sizeof(output) - 1] = 0; + SetLastError(0xdeadbeef); + + len = WideCharToMultiByte(CP_UTF7, 0, tests[i].src, tests[i].srclen, + tests[i].dst, tests[i].dstlen, NULL, NULL); + + if (!tests[i].len) + { + ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, + "tests[%i]: expected error=0x%x, got error=0x%x\n", + i, ERROR_INSUFFICIENT_BUFFER, GetLastError()); + } + ok(len == tests[i].len, "tests[%i]: expected len=%i, got len=%i\n", i, tests[i].len, len); + + if (tests[i].dst) + { + ok(memcmp(tests[i].dst, tests[i].expected_dst, tests[i].chars_written) == 0, + "tests[%i]: expected dst='%s', got dst='%s'\n", + i, tests[i].expected_dst, tests[i].dst); + ok(tests[i].dst[tests[i].chars_written] == '#', + "tests[%i]: expected dst[%i]='#', got dst[%i]=%i\n", + i, tests[i].chars_written, tests[i].chars_written, tests[i].dst[tests[i].chars_written]); + } + } } static void test_utf7_decoding(void) -- 2.1.3 From YWang at esri.com Tue Nov 11 15:39:59 2014 From: YWang at esri.com (Yifu Wang) Date: Tue, 11 Nov 2014 21:39:59 +0000 Subject: [PATCH] msvcp120: Added VS2013 CPP runtime dll Message-ID: --- configure.ac | 1 + dlls/msvcp120/Makefile.in | 14 + dlls/msvcp120/msvcp120.spec | 3846 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 3861 insertions(+), 0 deletions(-) create mode 100644 dlls/msvcp120/Makefile.in create mode 100644 dlls/msvcp120/msvcp120.spec -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcp120-Added-VS2013-CPP-runtime-dll.patch Type: application/octet-stream Size: 470290 bytes Desc: 0001-msvcp120-Added-VS2013-CPP-runtime-dll.patch URL: From yifuwang2012 at gmail.com Tue Nov 11 16:12:09 2014 From: yifuwang2012 at gmail.com (Yifu Wang) Date: Tue, 11 Nov 2014 14:12:09 -0800 Subject: [PATCH] msvcp120: Added VS2013 CPP runtime dll (resend) Message-ID: Forgot to attach the patch. --- configure.ac | 1 + dlls/msvcp120/Makefile.in | 14 + dlls/msvcp120/msvcp120.spec | 3846 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 3861 insertions(+), 0 deletions(-) create mode 100644 dlls/msvcp120/Makefile.in create mode 100644 dlls/msvcp120/msvcp120.spec -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcp120-Added-VS2013-CPP-runtime-dll.patch Type: application/octet-stream Size: 470290 bytes Desc: not available URL: From hans at codeweavers.com Wed Nov 12 04:25:23 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Wed, 12 Nov 2014 11:25:23 +0100 Subject: server: Set the security descriptor of named pipe objects. Message-ID: <1415787923.29176.1.camel@codeweavers.com> --- dlls/ntdll/file.c | 19 +++++++++++++++---- server/named_pipe.c | 21 +++++++++++++++++---- server/protocol.def | 3 +-- 3 files changed, 33 insertions(+), 10 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-server-Set-the-security-descriptor-of-named-pipe-objec.txt Type: text/x-patch Size: 5424 bytes Desc: not available URL: From stefan at codeweavers.com Wed Nov 12 04:30:10 2014 From: stefan at codeweavers.com (=?UTF-8?B?U3RlZmFuIETDtnNpbmdlcg==?=) Date: Wed, 12 Nov 2014 11:30:10 +0100 Subject: d3d8/tests: Allow passing a resolution to reset_device (v2). Message-ID: <546336B2.4070705@codeweavers.com> Version 2: Fix a whitespace error. This supersedes 107621. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-d3d8-tests-Allow-passing-a-resolution-to-reset_devic.patch Type: text/x-diff Size: 7681 bytes Desc: not available URL: From hans at codeweavers.com Wed Nov 12 04:31:36 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Wed, 12 Nov 2014 11:31:36 +0100 Subject: odbc32: Add a version resource. Message-ID: <1415788296.29176.2.camel@codeweavers.com> --- dlls/odbc32/Makefile.in | 2 ++ dlls/odbc32/rsrc.rc | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 dlls/odbc32/rsrc.rc -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-odbc32-Add-a-version-resource.txt Type: text/x-patch Size: 1515 bytes Desc: not available URL: From mstefani at redhat.de Wed Nov 12 08:19:58 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 12 Nov 2014 15:19:58 +0100 Subject: gameux: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141112141958.GA26099@redhat.com> --- dlls/gameux/gamestatistics.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/gameux/gamestatistics.c b/dlls/gameux/gamestatistics.c index f49d73a..7c95065 100644 --- a/dlls/gameux/gamestatistics.c +++ b/dlls/gameux/gamestatistics.c @@ -180,7 +180,7 @@ static HRESULT GAMEUX_updateStatisticsFile(struct GAMEUX_STATS *stats) { IXMLDOMElement *categoryElement = NULL; - if(lstrlenW(stats->categories[i].sName)==0) + if(!stats->categories[i].sName[0]) continue; V_VT(&vValue) = VT_INT; @@ -218,7 +218,7 @@ static HRESULT GAMEUX_updateStatisticsFile(struct GAMEUX_STATS *stats) { for(j=0; jcategories[i].stats[j].sName)==0) + if(!stats->categories[i].stats[j].sName[0]) continue; V_VT(&vValue) = VT_INT; -- 1.9.3 From mstefani at redhat.de Wed Nov 12 08:22:05 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 12 Nov 2014 15:22:05 +0100 Subject: mciwave: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141112142205.GB26099@redhat.com> --- dlls/mciwave/mciwave.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mciwave/mciwave.c b/dlls/mciwave/mciwave.c index 4f24169..c7992fb 100644 --- a/dlls/mciwave/mciwave.c +++ b/dlls/mciwave/mciwave.c @@ -444,7 +444,7 @@ static DWORD create_tmp_file(HMMIO* hFile, LPWSTR* pszTmpFileName) TRACE("%s!\n", debugstr_w(*pszTmpFileName)); - if (*pszTmpFileName && (strlenW(*pszTmpFileName) > 0)) { + if (*pszTmpFileName && (*pszTmpFileName)[0]) { *hFile = mmioOpenW(*pszTmpFileName, NULL, MMIO_ALLOCBUF | MMIO_READWRITE | MMIO_CREATE); @@ -470,7 +470,7 @@ static LRESULT WAVE_mciOpenFile(WINE_MCIWAVE* wmw, LPCWSTR filename) HeapFree(GetProcessHeap(), 0, wmw->lpFileName); wmw->lpFileName = fn; - if (strlenW(filename) > 0) { + if (filename[0]) { /* FIXME : what should be done if wmw->hFile is already != 0, or the driver is playin' */ TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(filename)); -- 1.9.3 From mstefani at redhat.de Wed Nov 12 08:28:45 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 12 Nov 2014 15:28:45 +0100 Subject: crypt32/tests: Remove an unused assignment (PVS-Studio) Message-ID: <20141112142845.GC26099@redhat.com> --- The test before this uses info.SubjectAlgorithm.pszObjId = oid2; so assuming a copy and paste issue as all was added in one commit. dlls/crypt32/tests/encode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/crypt32/tests/encode.c b/dlls/crypt32/tests/encode.c index 9e1853f..e9b49e9 100644 --- a/dlls/crypt32/tests/encode.c +++ b/dlls/crypt32/tests/encode.c @@ -5762,7 +5762,6 @@ static void test_decodeCTL(DWORD dwEncoding) info.SubjectAlgorithm.Parameters.cbData = 0; info.ThisUpdate.dwLowDateTime = info.ThisUpdate.dwHighDateTime = 0; info.NextUpdate.dwLowDateTime = info.NextUpdate.dwHighDateTime = 0; - info.SubjectAlgorithm.pszObjId = oid2; info.SubjectAlgorithm.pszObjId = NULL; value1.cbData = sizeof(emptySequence); value1.pbData = (LPBYTE)emptySequence; -- 1.9.3 From jacek at codeweavers.com Wed Nov 12 09:25:13 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Wed, 12 Nov 2014 16:25:13 +0100 Subject: [PATCH 1/4] mshtml: Added IHTMLTxtRange::moveToElementText implementation. Message-ID: <54637BD9.90605@codeweavers.com> --- dlls/mshtml/tests/dom.c | 11 +++++++++++ dlls/mshtml/txtrange.c | 18 ++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLTxtRange-moveToElementText-implemen.diff Type: text/x-patch Size: 1893 bytes Desc: not available URL: From jacek at codeweavers.com Wed Nov 12 09:25:20 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Wed, 12 Nov 2014 16:25:20 +0100 Subject: [PATCH 2/4] mshtml: Moved IHTMLElement2 implementation to htmlelem.c. Message-ID: <54637BE0.5080603@codeweavers.com> --- dlls/mshtml/Makefile.in | 1 - dlls/mshtml/htmlelem.c | 1351 +++++++++++++++++++++++++++++++++++++++- dlls/mshtml/htmlelem2.c | 1387 ------------------------------------------ dlls/mshtml/mshtml_private.h | 1 - 4 files changed, 1349 insertions(+), 1391 deletions(-) delete mode 100644 dlls/mshtml/htmlelem2.c -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Moved-IHTMLElement2-implementation-to-htmlelem.diff Type: text/x-patch Size: 84073 bytes Desc: not available URL: From jacek at codeweavers.com Wed Nov 12 09:25:26 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Wed, 12 Nov 2014 16:25:26 +0100 Subject: [PATCH 3/4] mshtml: Added IHTMLElement2::put_dir implementation. Message-ID: <54637BE6.40100@codeweavers.com> --- dlls/mshtml/htmlelem.c | 21 +++++++++++++++++++-- dlls/mshtml/tests/dom.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-mshtml-Added-IHTMLElement2-put_dir-implementation.diff Type: text/x-patch Size: 2933 bytes Desc: not available URL: From jacek at codeweavers.com Wed Nov 12 09:25:31 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Wed, 12 Nov 2014 16:25:31 +0100 Subject: [PATCH 4/4] mshtml: Added IHTMLTxtRange::pasteHTML implementation. Message-ID: <54637BEB.1010809@codeweavers.com> --- dlls/mshtml/tests/dom.c | 27 +++++++++++++++++++++++++++ dlls/mshtml/txtrange.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 55 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-mshtml-Added-IHTMLTxtRange-pasteHTML-implementation.diff Type: text/x-patch Size: 3095 bytes Desc: not available URL: From austinenglish at gmail.com Wed Nov 12 13:30:57 2014 From: austinenglish at gmail.com (Austin English) Date: Wed, 12 Nov 2014 13:30:57 -0600 Subject: ntdll: Add stubs for vectored continue handler Message-ID: Fixes https://bugs.winehq.org/show_bug.cgi?id=30572 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ntdll-Add-stubs-for-vectored-continue-handler.patch Type: text/x-patch Size: 3152 bytes Desc: not available URL: From stefan at codeweavers.com Wed Nov 12 15:15:34 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 22:15:34 +0100 Subject: [PATCH 1/6] wined3d: Add new D3DCREATE flags. Message-ID: <1415826939-4478-1-git-send-email-stefan@codeweavers.com> --- include/wine/wined3d.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 8f563bb..ef9850b 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -934,6 +934,12 @@ enum wined3d_display_rotation #define WINED3DCREATE_MIXED_VERTEXPROCESSING 0x00000080 #define WINED3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100 #define WINED3DCREATE_ADAPTERGROUP_DEVICE 0x00000200 +#define WINED3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX 0x00000400 +#define WINED3DCREATE_NOWINDOWCHANGES 0x00000800 +#define WINED3DCREATE_DISABLE_PSGP_THREADING 0x00002000 +#define WINED3DCREATE_ENABLE_PRESENTSTATS 0x00004000 +#define WINED3DCREATE_DISABLE_PRINTSCREEN 0x00008000 +#define WINED3DCREATE_SCREENSAVER 0x10000000 /* VTF defines */ #define WINED3DDMAPSAMPLER 0x100 -- 2.0.4 From stefan at codeweavers.com Wed Nov 12 15:15:35 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 22:15:35 +0100 Subject: [PATCH 2/6] wined3d: Minimize device windows on focus loss (v3). Message-ID: <1415826939-4478-2-git-send-email-stefan@codeweavers.com> Tests for d3d8 will follow after 107631 has been committed. v3: Check for D3DCREATE_NOWINDOWCHANGES. v2: Move to wined3d. The different behavior in d3d9ex was due to a hidden window and not a difference how d3d9ex handles focus loss. See patch 7. Another patch will add an action (resize the window to match the backbuffer size) on window activation. For this reason the swapchain helper function is called on both activation and deactivation. --- dlls/wined3d/device.c | 5 +++++ dlls/wined3d/swapchain.c | 6 ++++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 12 insertions(+) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index ee3636e..0de444b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4983,6 +4983,11 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL } else if (message == WM_ACTIVATEAPP) { + UINT i; + + for (i = 0; i < device->swapchain_count; i++) + wined3d_swapchain_activate(device->swapchains[i], wparam); + device->device_parent->ops->activate(device->device_parent, wparam); } diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 25e2107..4c0948f 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1175,3 +1175,9 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) wined3d_resource_update_draw_binding(&swapchain->back_buffers[i]->resource); } } + +void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) +{ + if (!activate && !(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) + ShowWindow(swapchain->device_window, SW_MINIMIZE); +} diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0f302c4..5f90e9a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2701,6 +2701,7 @@ struct wined3d_swapchain void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN; +void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -- 2.0.4 From stefan at codeweavers.com Wed Nov 12 15:15:36 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 22:15:36 +0100 Subject: [PATCH 3/6] d3d9/tests: Test messages on focus loss. Message-ID: <1415826939-4478-3-git-send-email-stefan@codeweavers.com> Resolution changing behavior will be tested in a separate patch. --- dlls/d3d9/tests/d3d9ex.c | 277 ++++++++++++++++++++++++++++---------------- dlls/d3d9/tests/device.c | 293 +++++++++++++++++++++++++++++++---------------- 2 files changed, 375 insertions(+), 195 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index bbb95b0..424d2cc 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1702,6 +1702,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -1743,7 +1745,14 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM }; if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -1795,13 +1804,52 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + unsigned int i; + HRESULT hr; - static const struct message messages[] = + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_nowc[] = { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {0, 0}, + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct + { + DWORD create_flags; + const struct message *focus_loss_messages; + } + tests[] = + { + {0, focus_loss_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; wc.lpfnWndProc = test_proc; @@ -1813,121 +1861,156 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); - focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); - ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - - res = WaitForSingleObject(thread_params.window_created, INFINITE); - ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - - trace("device_window %p, focus_window %p, dummy_window %p.\n", - device_window, focus_window, thread_params.dummy_window); - - tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - flush_events(); + res = WaitForSingleObject(thread_params.window_created, INFINITE); + ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - expect_messages = messages; + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); - device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; - device_desc.flags = CREATE_DEVICE_FULLSCREEN; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + trace("device_window %p, focus_window %p, dummy_window %p.\n", + device_window, focus_window, thread_params.dummy_window); - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", - expect_messages->message, expect_messages->window); - expect_messages = NULL; - - if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } - SetForegroundWindow(focus_window); - flush_events(); + ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); - filter_messages = focus_window; + flush_events(); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + expect_messages = create_messages; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + if (0) /* Disabled until we can make this work in a reliable way on Wine. */ + { + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); + } + SetForegroundWindow(focus_window); + flush_events(); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", + (LONG_PTR)test_proc); + + expect_messages = tests[i].focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; + tmp = GetFocus(); + ok(tmp != device_window, "The device window is active, i=%u.\n", i); + ok(tmp != focus_window, "The focus window is active, i=%u.\n", i); + + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x, i=%u.\n", hr, i); + + /* In d3d9ex the device and focus windows have to be minimized and restored, + * otherwise native does not notice that focus has been restored. This is + * independent of D3DCREATE_NOWINDOWCHANGES. */ + ShowWindow(device_window, SW_MINIMIZE); + ShowWindow(device_window, SW_RESTORE); + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); + + /* Calling Reset is not necessary in d3d9ex. */ + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + ok(hr == S_OK, "Got unexpected hr %#x, i=%u.\n", hr, i); + + filter_messages = focus_window; + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - device_desc.device_window = focus_window; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + device_desc.device_window = focus_window; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - device_desc.device_window = device_window; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", + (LONG_PTR)test_proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)DefWindowProcA, proc); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)DefWindowProcA, proc); done: - filter_messages = NULL; + filter_messages = NULL; + DestroyWindow(device_window); + DestroyWindow(focus_window); + SetEvent(thread_params.test_finished); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + } - SetEvent(thread_params.test_finished); - WaitForSingleObject(thread, INFINITE); CloseHandle(thread_params.test_finished); CloseHandle(thread_params.window_created); - CloseHandle(thread); - DestroyWindow(device_window); - DestroyWindow(focus_window); UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL)); } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 1a5008a..aeda123 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3091,6 +3091,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -3131,7 +3133,15 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM break; }; - if (hwnd == w && expect_messages->message == message) ++expect_messages; + if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -3182,13 +3192,52 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + unsigned int i; + HRESULT hr; - static const struct message messages[] = + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_nowc[] = { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {0, 0}, + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct + { + DWORD create_flags; + const struct message *focus_loss_messages; + } + tests[] = + { + {0, focus_loss_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); @@ -3203,122 +3252,168 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); - focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); - ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) + { + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - res = WaitForSingleObject(thread_params.window_created, INFINITE); - ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); + res = WaitForSingleObject(thread_params.window_created, INFINITE); + ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); - trace("device_window %p, focus_window %p, dummy_window %p.\n", - device_window, focus_window, thread_params.dummy_window); + trace("device_window %p, focus_window %p, dummy_window %p.\n", + device_window, focus_window, thread_params.dummy_window); - tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + tmp = GetFocus(); + ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); - flush_events(); + flush_events(); - expect_messages = messages; + expect_messages = create_messages; - device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; - device_desc.flags = CREATE_DEVICE_FULLSCREEN; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", - expect_messages->message, expect_messages->window); - expect_messages = NULL; + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; - if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { + if (0) /* Disabled until we can make this work in a reliable way on Wine. */ + { + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); + } + SetForegroundWindow(focus_window); + flush_events(); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", + (LONG_PTR)test_proc, i); + + expect_messages = tests[i].focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } - SetForegroundWindow(focus_window); - flush_events(); + ok(tmp != device_window, "The device window is active, i=%u.\n", i); + ok(tmp != focus_window, "The focus window is active, i=%u.\n", i); - filter_messages = focus_window; + hr = IDirect3DDevice9_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + /* This is needed on native with D3DCREATE_NOWINDOWCHANGES, and it needs to be + * done before the focus window is restored. This makes sense to some extent + * because minimizing the window on focus loss is the application's job if this + * flag is set. */ + if (tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES) + { + ShowWindow(device_window, SW_MINIMIZE); + ShowWindow(device_window, SW_RESTORE); + } - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + /* I have to minimize and restore the focus window, otherwise native d3d9 fails + * device::reset with D3DERR_DEVICELOST. This does not happen when the window + * restore is triggered by the user. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + hr = IDirect3DDevice9_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + /* Releasing a device in lost state breaks follow-up tests on native. */ + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); - device_desc.device_window = focus_window; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + filter_messages = focus_window; - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - device_desc.device_window = device_window; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); - proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = focus_window; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)DefWindowProcA, proc); + device_desc.device_window = device_window; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", + (LONG_PTR)test_proc, i); + + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)DefWindowProcA, proc, i); done: - filter_messages = NULL; - IDirect3D9_Release(d3d9); + filter_messages = NULL; + DestroyWindow(device_window); + DestroyWindow(focus_window); + SetEvent(thread_params.test_finished); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + } - SetEvent(thread_params.test_finished); - WaitForSingleObject(thread, INFINITE); + IDirect3D9_Release(d3d9); CloseHandle(thread_params.test_finished); CloseHandle(thread_params.window_created); - CloseHandle(thread); - - DestroyWindow(device_window); - DestroyWindow(focus_window); UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL)); } @@ -3540,8 +3635,10 @@ static void test_reset_fullscreen(void) struct device_desc device_desc; static const struct message messages[] = { - {WM_ACTIVATEAPP, FOCUS_WINDOW}, - {0, 0}, + /* Windows usually sends wparam = TRUE, except on the testbot, + * where it randomly sends FALSE. Ignore it. */ + {WM_ACTIVATEAPP, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, }; d3d = Direct3DCreate9(D3D_SDK_VERSION); -- 2.0.4 From stefan at codeweavers.com Wed Nov 12 15:15:37 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 22:15:37 +0100 Subject: [PATCH 4/6] d3d9/tests: Test style changes on focus loss. Message-ID: <1415826939-4478-4-git-send-email-stefan@codeweavers.com> I will add message tests for the hidden window behavior in a separate test. I don't particularly care about the behavior on the second d3d9ex device creation. This part is in the test to explain why I am destroying the device and the windows. d3d9ex does the same when calling reset to switch to fullscreen mode a second time. --- dlls/d3d9/tests/d3d9ex.c | 85 +++++++++++++++++++++++++++++++++++++++++++++--- dlls/d3d9/tests/device.c | 40 +++++++++++++++++++++-- 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 424d2cc..0074261 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2218,24 +2218,27 @@ done: static void test_window_style(void) { RECT focus_rect, device_rect, fullscreen_rect, r, r2; - LONG device_style, device_exstyle; + LONG device_style, device_exstyle, expected_style; LONG focus_style, focus_exstyle; struct device_desc device_desc; LONG style; IDirect3DDevice9Ex *device; HRESULT hr; ULONG ref; + BOOL ret; static const struct { LONG style_flags; DWORD device_flags; + LONG focus_loss_style; + LONG create2_style, create2_exstyle; } tests[] = { - {0, 0}, - {WS_VISIBLE, 0}, - {0, CREATE_DEVICE_NOWINDOWCHANGES}, - {WS_VISIBLE, CREATE_DEVICE_NOWINDOWCHANGES}, + {0, 0, 0, WS_VISIBLE, WS_EX_TOPMOST}, + {WS_VISIBLE, 0, WS_MINIMIZE, WS_VISIBLE, WS_EX_TOPMOST}, + {0, CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, + {WS_VISIBLE, CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, }; unsigned int i; @@ -2323,6 +2326,78 @@ static void test_window_style(void) ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + style = GetWindowLongA(device_window, GWL_STYLE); + if (device_style & WS_VISIBLE) + ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + device_style, style, i); + else + todo_wine ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + device_style, style, i); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + device_exstyle, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + + /* The second time a device is created on the window the window becomes visible and + * topmost if D3DCREATE_NOWINDOWCHANGES is not set. */ + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].create2_style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + expected_style, style, i); + expected_style = device_exstyle | tests[i].create2_exstyle; + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n", + expected_style, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + DestroyWindow(device_window); + DestroyWindow(focus_window); + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + + device_desc.device_window = device_window; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].focus_loss_style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + expected_style, style, i); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + device_exstyle, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + DestroyWindow(device_window); DestroyWindow(focus_window); } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index aeda123..d98221a 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3787,15 +3787,16 @@ static void test_window_style(void) IDirect3D9 *d3d9; HRESULT hr; ULONG ref; + BOOL ret; static const struct { DWORD device_flags; - LONG style, exstyle; + LONG style, focus_loss_style, exstyle; } tests[] = { - {0, WS_VISIBLE, WS_EX_TOPMOST}, - {CREATE_DEVICE_NOWINDOWCHANGES, 0}, + {0, WS_VISIBLE, WS_MINIMIZE, WS_EX_TOPMOST}, + {CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, }; unsigned int i; @@ -3890,6 +3891,39 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", focus_exstyle, style, i); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].focus_loss_style | tests[i].style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | tests[i].exstyle; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + + /* In d3d8 follow-up tests fail on native if the device is destroyed while + * lost. This doesn't happen in d3d9 on my test machine but it still seems + * like a good idea to reset it first. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + ret = SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + flush_events(); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Wed Nov 12 15:15:39 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 22:15:39 +0100 Subject: [PATCH 6/6] ddraw/tests: Test focus loss style changes. Message-ID: <1415826939-4478-6-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw2.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw7.c | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 144 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index b31e25e..569aa94 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2009,12 +2009,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2040,6 +2041,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2048,6 +2063,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 84dd17a..61cf668 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2197,12 +2197,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw2 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2228,6 +2229,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2236,6 +2251,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index fa8309d..eca99fa 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2384,12 +2384,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw4 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2415,6 +2416,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2423,6 +2438,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index adbecc2..9cf56a3 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2062,12 +2062,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw7 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2093,6 +2094,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2101,6 +2116,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Wed Nov 12 15:15:38 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 12 Nov 2014 22:15:38 +0100 Subject: [PATCH 5/6] ddraw/tests: Test messages on focus loss. Message-ID: <1415826939-4478-5-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 97 +++++++++++++++++++++++++++++++------------- dlls/ddraw/tests/ddraw2.c | 101 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw4.c | 101 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 101 ++++++++++++++++++++++++++++++++-------------- 4 files changed, 278 insertions(+), 122 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 0ae204c..b31e25e 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -428,12 +428,26 @@ static void destroy_material(IDirect3DMaterial *material) IDirect3DMaterial_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1878,15 +1892,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1906,7 +1920,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2147,19 +2161,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2234,7 +2263,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2280,7 +2309,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2291,6 +2320,16 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(primary); + ok(SUCCEEDED(hr), "Surface Restore failed, hr %#x.\n", hr); + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2299,7 +2338,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2385,7 +2424,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2409,7 +2448,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2453,7 +2492,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2548,7 +2587,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2565,7 +2604,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2648,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 334d89e..84dd17a 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -361,12 +361,26 @@ static void destroy_material(IDirect3DMaterial2 *material) IDirect3DMaterial2_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2066,15 +2080,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2094,7 +2108,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2346,19 +2360,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2438,7 +2467,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2484,7 +2513,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2495,6 +2524,16 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(primary); + ok(SUCCEEDED(hr), "Surface Restore failed, hr %#x.\n", hr); + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2503,7 +2542,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2589,7 +2628,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2613,7 +2652,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2657,7 +2696,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2752,7 +2791,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2769,7 +2808,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2813,7 +2852,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2874,7 +2913,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2945,7 +2984,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ab03f39..fa8309d 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -391,12 +391,26 @@ static void destroy_material(IDirect3DMaterial3 *material) IDirect3DMaterial3_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2253,15 +2267,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2281,7 +2295,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2533,19 +2547,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2625,7 +2654,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2671,7 +2700,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2682,6 +2711,16 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + hr = IDirectDrawSurface4_Restore(primary); + ok(SUCCEEDED(hr), "Surface Restore failed, hr %#x.\n", hr); + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2690,7 +2729,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2776,7 +2815,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2793,7 +2832,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2837,7 +2876,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2932,7 +2971,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2949,7 +2988,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2993,7 +3032,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -3054,7 +3093,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -3125,7 +3164,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index f505c65..adbecc2 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -324,12 +324,26 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return device; } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1931,15 +1945,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1959,7 +1973,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2210,19 +2224,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2302,7 +2331,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2348,7 +2377,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2359,6 +2388,16 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + hr = IDirectDrawSurface7_Restore(primary); + ok(SUCCEEDED(hr), "Surface Restore failed, hr %#x.\n", hr); + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2367,7 +2406,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2453,7 +2492,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2470,7 +2509,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2514,7 +2553,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2648,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2626,7 +2665,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2670,7 +2709,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2731,7 +2770,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2802,7 +2841,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); -- 2.0.4 From madewokherd at gmail.com Wed Nov 12 16:06:42 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Wed, 12 Nov 2014 16:06:42 -0600 Subject: [1/5] windowscodecs: Treat missing GUID list keys as empty. Message-ID: -------------- next part -------------- From e9993ead9c995f22b24fb1702cbd54b4bf46108e Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 6 Nov 2014 16:07:17 -0600 Subject: [PATCH 1/7] windowscodecs: Treat missing GUID list keys as empty. --- dlls/windowscodecs/info.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 5f42994..d42d726 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -151,7 +151,12 @@ static HRESULT ComponentInfo_GetGuidList(HKEY classkey, LPCWSTR subkeyname, return E_INVALIDARG; ret = RegOpenKeyExW(classkey, subkeyname, 0, KEY_READ, &subkey); - if (ret != ERROR_SUCCESS) return HRESULT_FROM_WIN32(ret); + if (ret == ERROR_FILE_NOT_FOUND) + { + *actual_size = 0; + return S_OK; + } + else if (ret != ERROR_SUCCESS) return HRESULT_FROM_WIN32(ret); if (buffer) { -- 2.1.0 From madewokherd at gmail.com Wed Nov 12 16:07:46 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Wed, 12 Nov 2014 16:07:46 -0600 Subject: [2/5] windowscodecs: Implement MetadataReaderInfo_GetContainerFormats. Message-ID: -------------- next part -------------- From c058fb6c5ccea5304a8f2ad0bae0f355e9df1e56 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 6 Nov 2014 16:07:54 -0600 Subject: [PATCH 2/7] windowscodecs: Implement MetadataReaderInfo_GetContainerFormats. --- dlls/windowscodecs/info.c | 8 +++++--- dlls/windowscodecs/tests/info.c | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index d42d726..ea81dba 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -56,6 +56,7 @@ static const WCHAR supportstransparency_valuename[] = {'S','u','p','p','o','r',' static const WCHAR requiresfullstream_valuename[] = {'R','e','q','u','i','r','e','s','F','u','l','l','S','t','r','e','a','m',0}; static const WCHAR supportspadding_valuename[] = {'S','u','p','p','o','r','t','s','P','a','d','d','i','n','g',0}; static const WCHAR fileextensions_valuename[] = {'F','i','l','e','E','x','t','e','n','s','i','o','n','s',0}; +static const WCHAR containers_keyname[] = {'C','o','n','t','a','i','n','e','r','s',0}; static HRESULT ComponentInfo_GetStringValue(HKEY classkey, LPCWSTR value, UINT buffer_size, WCHAR *buffer, UINT *actual_size) @@ -1635,10 +1636,11 @@ static HRESULT WINAPI MetadataReaderInfo_GetMetadataFormat(IWICMetadataReaderInf static HRESULT WINAPI MetadataReaderInfo_GetContainerFormats(IWICMetadataReaderInfo *iface, UINT length, GUID *formats, UINT *actual_length) { - if (!actual_length) return E_INVALIDARG; + MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); + TRACE("(%p,%u,%p,%p)\n", iface, length, formats, actual_length); - FIXME("(%p,%u,%p,%p): stub\n", iface, length, formats, actual_length); - return E_NOTIMPL; + return ComponentInfo_GetGuidList(This->classkey, containers_keyname, length, + formats, actual_length); } static HRESULT WINAPI MetadataReaderInfo_GetDeviceManufacturer(IWICMetadataReaderInfo *iface, diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c index 5753f6b..98c06ec 100644 --- a/dlls/windowscodecs/tests/info.c +++ b/dlls/windowscodecs/tests/info.c @@ -415,9 +415,7 @@ static void test_reader_info(void) count = 0xdeadbeef; hr = IWICMetadataReaderInfo_GetContainerFormats(reader_info, 0, NULL, &count); -todo_wine ok(hr == S_OK, "GetContainerFormats failed, hr=%x\n", hr); -todo_wine ok(count == 0, "unexpected count %d\n", count); hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng, -- 2.1.0 From madewokherd at gmail.com Wed Nov 12 16:09:31 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Wed, 12 Nov 2014 16:09:31 -0600 Subject: [3/5] windowscodecs: Implement MetadataReaderInfo_GetPatterns. Message-ID: -------------- next part -------------- From e1adec66af8462e3b086112bb1fa25ca8782f139 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Tue, 11 Nov 2014 15:59:31 -0600 Subject: [PATCH 3/7] windowscodecs: Implement MetadataReaderInfo_GetPatterns. --- dlls/windowscodecs/info.c | 110 ++++++++++++++++++++++++++++++++++++++-- dlls/windowscodecs/tests/info.c | 1 - 2 files changed, 106 insertions(+), 5 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index ea81dba..3cc7d01 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -1681,12 +1681,114 @@ static HRESULT WINAPI MetadataReaderInfo_DoesRequireFixedSize(IWICMetadataReader } static HRESULT WINAPI MetadataReaderInfo_GetPatterns(IWICMetadataReaderInfo *iface, - REFGUID container, UINT length, WICMetadataPattern *pattern, UINT *count, UINT *actual_length) + REFGUID container, UINT length, WICMetadataPattern *patterns, UINT *count, UINT *actual_length) { - if (!actual_length) return E_INVALIDARG; + MetadataReaderInfo *This = impl_from_IWICMetadataReaderInfo(iface); + HRESULT hr=S_OK; + LONG res; + UINT pattern_count=0, patterns_size=0; + DWORD valuesize, patternsize; + BYTE *bPatterns=(BYTE*)patterns; + HKEY containers_key, guid_key, pattern_key; + WCHAR subkeyname[11]; + WCHAR guidkeyname[39]; + int i; + static const WCHAR uintformatW[] = {'%','u',0}; + static const WCHAR patternW[] = {'P','a','t','t','e','r','n',0}; + static const WCHAR positionW[] = {'P','o','s','i','t','i','o','n',0}; + static const WCHAR maskW[] = {'M','a','s','k',0}; + static const WCHAR dataoffsetW[] = {'D','a','t','a','O','f','f','s','e','t',0}; - FIXME("(%p,%s,%u,%p,%p,%p): stub\n", iface, debugstr_guid(container), length, pattern, count, actual_length); - return E_NOTIMPL; + TRACE("(%p,%s,%u,%p,%p,%p)\n", iface, debugstr_guid(container), length, patterns, count, actual_length); + + if (!actual_length || !container) return E_INVALIDARG; + + res = RegOpenKeyExW(This->classkey, containers_keyname, 0, KEY_READ, &containers_key); + if (res == ERROR_SUCCESS) + { + StringFromGUID2(container, guidkeyname, 39); + + res = RegOpenKeyExW(containers_key, guidkeyname, 0, KEY_READ, &guid_key); + if (res == ERROR_FILE_NOT_FOUND) hr = WINCODEC_ERR_COMPONENTNOTFOUND; + else if (res != ERROR_SUCCESS) hr = HRESULT_FROM_WIN32(res); + + RegCloseKey(containers_key); + } + else if (res == ERROR_FILE_NOT_FOUND) hr = WINCODEC_ERR_COMPONENTNOTFOUND; + else hr = HRESULT_FROM_WIN32(res); + + if (SUCCEEDED(hr)) + { + res = RegQueryInfoKeyW(guid_key, NULL, NULL, NULL, &pattern_count, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + if (res != ERROR_SUCCESS) hr = HRESULT_FROM_WIN32(res); + + if (SUCCEEDED(hr)) + { + patterns_size = pattern_count * sizeof(WICMetadataPattern); + + for (i=0; i= patterns_size) && (res == ERROR_SUCCESS)) + { + patterns[i].Length = patternsize; + + patterns[i].DataOffset.QuadPart = 0; + valuesize = sizeof(ULARGE_INTEGER); + RegGetValueW(pattern_key, NULL, dataoffsetW, RRF_RT_DWORD|RRF_RT_QWORD, NULL, + &patterns[i].DataOffset, &valuesize); + + patterns[i].Position.QuadPart = 0; + valuesize = sizeof(ULARGE_INTEGER); + res = RegGetValueW(pattern_key, NULL, positionW, RRF_RT_DWORD|RRF_RT_QWORD, NULL, + &patterns[i].Position, &valuesize); + + if (res == ERROR_SUCCESS) + { + patterns[i].Pattern = bPatterns+patterns_size-patternsize*2; + valuesize = patternsize; + res = RegGetValueW(pattern_key, NULL, patternW, RRF_RT_REG_BINARY, NULL, + patterns[i].Pattern, &valuesize); + } + + if (res == ERROR_SUCCESS) + { + patterns[i].Mask = bPatterns+patterns_size-patternsize; + valuesize = patternsize; + res = RegGetValueW(pattern_key, NULL, maskW, RRF_RT_REG_BINARY, NULL, + patterns[i].Mask, &valuesize); + } + } + + RegCloseKey(pattern_key); + } + if (res != ERROR_SUCCESS) + { + hr = HRESULT_FROM_WIN32(res); + break; + } + } + } + + RegCloseKey(guid_key); + } + + if (hr == S_OK) + { + *count = pattern_count; + *actual_length = patterns_size; + if (patterns && length < patterns_size) + hr = WINCODEC_ERR_INSUFFICIENTBUFFER; + } + + return hr; } static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo *iface, diff --git a/dlls/windowscodecs/tests/info.c b/dlls/windowscodecs/tests/info.c index 98c06ec..51181ca 100644 --- a/dlls/windowscodecs/tests/info.c +++ b/dlls/windowscodecs/tests/info.c @@ -425,7 +425,6 @@ static void test_reader_info(void) count = size = 0xdeadbeef; hr = IWICMetadataReaderInfo_GetPatterns(reader_info, &GUID_ContainerFormatPng, 0, NULL, &count, &size); -todo_wine ok(hr == WINCODEC_ERR_COMPONENTNOTFOUND || broken(hr == S_OK) /* Windows XP */, "GetPatterns failed, hr=%x\n", hr); ok(count == 0xdeadbeef, "unexpected count %d\n", count); -- 2.1.0 From madewokherd at gmail.com Wed Nov 12 16:10:44 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Wed, 12 Nov 2014 16:10:44 -0600 Subject: [4/5] windowscodecs: Implement MetadataReaderInfo_MatchesPattern. Message-ID: -------------- next part -------------- From d30dc54f754120c2a9be3b2d23f75203f729a96d Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 12 Nov 2014 14:32:29 -0600 Subject: [PATCH 4/7] windowscodecs: Implement MetadataReaderInfo_MatchesPattern. --- dlls/windowscodecs/info.c | 70 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 68 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index 3cc7d01..f532ad1 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -1794,8 +1794,74 @@ static HRESULT WINAPI MetadataReaderInfo_GetPatterns(IWICMetadataReaderInfo *ifa static HRESULT WINAPI MetadataReaderInfo_MatchesPattern(IWICMetadataReaderInfo *iface, REFGUID container, IStream *stream, BOOL *matches) { - FIXME("(%p,%s,%p,%p): stub\n", iface, debugstr_guid(container), stream, matches); - return E_NOTIMPL; + HRESULT hr; + WICMetadataPattern *patterns; + UINT pattern_count=0, patterns_size=0; + ULONG datasize=0; + BYTE *data=NULL; + ULONG bytesread; + UINT i; + LARGE_INTEGER seekpos; + ULONG pos; + + TRACE("(%p,%s,%p,%p)\n", iface, debugstr_guid(container), stream, matches); + + hr = MetadataReaderInfo_GetPatterns(iface, container, 0, NULL, &pattern_count, &patterns_size); + if (FAILED(hr)) return hr; + + patterns = HeapAlloc(GetProcessHeap(), 0, patterns_size); + if (!patterns) return E_OUTOFMEMORY; + + hr = MetadataReaderInfo_GetPatterns(iface, container, patterns_size, patterns, &pattern_count, &patterns_size); + if (FAILED(hr)) goto end; + + for (i=0; i -------------- next part -------------- From a3735fa76b9dc568f32561eda4617e216af82138 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 12 Nov 2014 15:51:09 -0600 Subject: [PATCH 5/7] windowscodecs: Implement ComponentFactory_CreateMetadataReaderFromContainer. --- dlls/windowscodecs/imgfactory.c | 101 +++++++++++++++++++++++++++++++++++- dlls/windowscodecs/tests/metadata.c | 25 +++++---- 2 files changed, 115 insertions(+), 11 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index e7095dd..444f2e4 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -956,9 +956,106 @@ static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer(IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader) { - FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), + HRESULT hr; + IEnumUnknown *enumreaders; + IUnknown *unkreaderinfo; + IWICMetadataReaderInfo *readerinfo; + IWICPersistStream *wicpersiststream; + ULONG num_fetched; + GUID decoder_vendor; + BOOL matches; + LARGE_INTEGER zero; + + TRACE("%p,%s,%s,%x,%p,%p\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, stream, reader); - return E_NOTIMPL; + + if (!format || !stream || !reader) + return E_INVALIDARG; + + zero.QuadPart = 0; + + hr = CreateComponentEnumerator(WICMetadataReader, WICComponentEnumerateDefault, &enumreaders); + if (FAILED(hr)) return hr; + + *reader = NULL; + +start: + while (!*reader) + { + hr = IEnumUnknown_Next(enumreaders, 1, &unkreaderinfo, &num_fetched); + + if (hr == S_OK) + { + hr = IUnknown_QueryInterface(unkreaderinfo, &IID_IWICMetadataReaderInfo, (void**)&readerinfo); + + if (SUCCEEDED(hr)) + { + if (vendor) + { + hr = IWICMetadataReaderInfo_GetVendorGUID(readerinfo, &decoder_vendor); + + if (FAILED(hr) || !IsEqualIID(vendor, &decoder_vendor)) + { + IWICMetadataReaderInfo_Release(readerinfo); + IUnknown_Release(unkreaderinfo); + continue; + } + } + + hr = IWICMetadataReaderInfo_MatchesPattern(readerinfo, format, stream, &matches); + + if (SUCCEEDED(hr) && matches) + { + hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL); + + if (SUCCEEDED(hr)) + hr = IWICMetadataReaderInfo_CreateInstance(readerinfo, reader); + + if (SUCCEEDED(hr)) + { + hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void**)&wicpersiststream); + + if (SUCCEEDED(hr)) + { + hr = IWICPersistStream_LoadEx(wicpersiststream, + stream, vendor, options & WICPersistOptionsMask); + + IWICPersistStream_Release(wicpersiststream); + } + + if (FAILED(hr)) + { + IWICMetadataReader_Release(*reader); + *reader = NULL; + } + } + } + + IUnknown_Release(readerinfo); + } + + IUnknown_Release(unkreaderinfo); + } + else + break; + } + + if (!*reader && vendor) + { + vendor = NULL; + IEnumUnknown_Reset(enumreaders); + goto start; + } + + IEnumUnknown_Release(enumreaders); + + if (!*reader && !(options & WICMetadataCreationFailUnknown)) + FIXME("create unknown metadata reader\n"); + + if (*reader) + return S_OK; + else + return WINCODEC_ERR_COMPONENTNOTFOUND; } static HRESULT WINAPI ComponentFactory_CreateMetadataWriter(IWICComponentFactory *iface, diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index e42b474..07ef29b 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -841,17 +841,24 @@ static void test_create_reader(void) stream = create_stream(metadata_tEXt, sizeof(metadata_tEXt)); hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + NULL, NULL, WICPersistOptionsDefault, + stream, &reader); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, + NULL, &reader); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, + stream, NULL); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, stream, &reader); -todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); - /* NOTE: removed once Wine is fixed */ - if (FAILED(hr)) - { - IStream_Release(stream); - IWICComponentFactory_Release(factory); - return; - } if (SUCCEEDED(hr)) { @@ -869,7 +876,7 @@ todo_wine hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, &GUID_ContainerFormatWmp, NULL, WICPersistOptionsDefault, stream, &reader); - ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); if (SUCCEEDED(hr)) { -- 2.1.0 From nerv at dawncrow.de Wed Nov 12 17:57:04 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Thu, 13 Nov 2014 00:57:04 +0100 Subject: ntdll/tests: Get rid of "defined but not used" warnings on non-x86(_64) platforms Message-ID: <5463F3D0.7080701@dawncrow.de> --- dlls/ntdll/tests/exception.c | 2 ++ 1 file changed, 2 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-ntdll-tests-Get-rid-of-defined-but-not-used-warnings-o.txt Type: text/x-patch Size: 657 bytes Desc: not available URL: From mstefani at redhat.de Thu Nov 13 03:06:06 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 13 Nov 2014 10:06:06 +0100 Subject: oleaut32/tests: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141113090606.GA726@redhat.com> --- dlls/oleaut32/tests/vartest.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index d00e577..066e5f6 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -295,16 +295,14 @@ static void init(void) HRESULT res; res = VarBstrFromBool(VARIANT_TRUE, LANG_USER_DEFAULT, VAR_LOCALBOOL, &bstr); - ok(res == S_OK && (lstrlenW(bstr) > 0), - "Expected localized string for 'True'\n"); + ok(res == S_OK && bstr[0], "Expected localized string for 'True'\n"); /* lstrcpyW / lstrcatW do not work on win95 */ memcpy(sz12_true, sz12, sizeof(sz12)); if (bstr) memcpy(&sz12_true[2], bstr, SysStringByteLen(bstr) + sizeof(WCHAR)); SysFreeString(bstr); res = VarBstrFromBool(VARIANT_FALSE, LANG_USER_DEFAULT, VAR_LOCALBOOL, &bstr); - ok(res == S_OK && (lstrlenW(bstr) > 0), - "Expected localized string for 'False'\n"); + ok(res == S_OK && bstr[0], "Expected localized string for 'False'\n"); memcpy(sz12_false, sz12, sizeof(sz12)); if (bstr) memcpy(&sz12_false[2], bstr, SysStringByteLen(bstr) + sizeof(WCHAR)); SysFreeString(bstr); -- 1.9.3 From mstefani at redhat.de Thu Nov 13 03:08:59 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 13 Nov 2014 10:08:59 +0100 Subject: avifil32: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141113090859.GB726@redhat.com> --- dlls/avifil32/avifile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c index 5b65fd0..af0315d 100644 --- a/dlls/avifil32/avifile.c +++ b/dlls/avifil32/avifile.c @@ -1460,7 +1460,7 @@ static DWORD AVIFILE_ComputeMoviStart(IAVIFileImpl *This) dwPos += ((pStream->cbFormat + 1) & ~1U); if (pStream->lpHandlerData != NULL && pStream->cbHandlerData > 0) dwPos += 2 * sizeof(DWORD) + ((pStream->cbHandlerData + 1) & ~1U); - if (lstrlenW(pStream->sInfo.szName) > 0) + if (pStream->sInfo.szName[0]) dwPos += 2 * sizeof(DWORD) + ((lstrlenW(pStream->sInfo.szName) + 1) & ~1U); } @@ -2219,7 +2219,7 @@ static HRESULT AVIFILE_SaveFile(IAVIFileImpl *This) } /* ... an optional name for this stream ... */ - if (lstrlenW(pStream->sInfo.szName) > 0) { + if (pStream->sInfo.szName[0]) { LPSTR str; ck.ckid = ckidSTREAMNAME; -- 1.9.3 From huw at codeweavers.com Thu Nov 13 03:26:22 2014 From: huw at codeweavers.com (Huw Davies) Date: Thu, 13 Nov 2014 09:26:22 +0000 Subject: winemac: WS_EX_DLGMODALFRAME shouldn't prevent the window being resizeable. Message-ID: <1415870782-28697-1-git-send-email-huw@codeweavers.com> --- dlls/winemac.drv/window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/winemac.drv/window.c b/dlls/winemac.drv/window.c index e61a517..54bd56e 100644 --- a/dlls/winemac.drv/window.c +++ b/dlls/winemac.drv/window.c @@ -72,12 +72,12 @@ static void get_cocoa_window_features(struct macdrv_win_data *data, if (ex_style & WS_EX_TOOLWINDOW) wf->utility = TRUE; } } - if (ex_style & WS_EX_DLGMODALFRAME) wf->shadow = TRUE; - else if (style & WS_THICKFRAME) + if (style & WS_THICKFRAME) { wf->shadow = TRUE; if (!data->shaped) wf->resizable = TRUE; } + else if (ex_style & WS_EX_DLGMODALFRAME) wf->shadow = TRUE; else if ((style & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME) wf->shadow = TRUE; } -- 1.8.0 From jacek at codeweavers.com Thu Nov 13 04:22:35 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 13 Nov 2014 11:22:35 +0100 Subject: mshtml: Properly handle errors in IHTMLStyleSheet::get_rules now that Gecko part is fixed. Message-ID: <5464866B.1000805@codeweavers.com> --- dlls/mshtml/htmlstylesheet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Properly-handle-errors-in-IHTMLStyleSheet-get_.diff Type: text/x-patch Size: 812 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 13 04:50:23 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 13 Nov 2014 11:50:23 +0100 Subject: wpcapi.idl: Added WPCFLAG_RESTRICTION declaration. Message-ID: <54648CEF.4060301@codeweavers.com> --- include/wpcapi.idl | 9 +++++++++ 1 file changed, 9 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-wpcapi.idl-Added-WPCFLAG_RESTRICTION-declaration.diff Type: text/x-patch Size: 581 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 13 05:50:01 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 13 Nov 2014 12:50:01 +0100 Subject: mshtml: Fixed tests on recent IEs. Message-ID: <54649AE9.3020605@codeweavers.com> --- dlls/mshtml/tests/protocol.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Fixed-tests-on-recent-IEs.diff Type: text/x-patch Size: 2024 bytes Desc: not available URL: From madewokherd at gmail.com Thu Nov 13 11:44:55 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Thu, 13 Nov 2014 11:44:55 -0600 Subject: [1/3] windowscodecs: Don't check undefined memory in tests on Wine. Message-ID: -------------- next part -------------- From 2a6769ce772f7798881ab5e884d558d37ab67edb Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 12 Nov 2014 15:52:38 -0600 Subject: [PATCH 1/3] windowscodecs: Don't check undefined memory in tests on Wine. --- dlls/windowscodecs/tests/metadata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index e42b474..e9ab77c 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -907,7 +907,7 @@ static void test_metadata_png(void) IWICMetadataReader *reader; GUID containerformat; HRESULT hr; - UINT count; + UINT count=0xdeadbeef; hr = CoCreateInstance(&CLSID_WICPngDecoder, NULL, CLSCTX_INPROC_SERVER, &IID_IWICBitmapDecoder, (void**)&decoder); -- 2.1.0 From madewokherd at gmail.com Thu Nov 13 11:45:45 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Thu, 13 Nov 2014 11:45:45 -0600 Subject: [2/3] windowscodecs: Implement ComponentFactory_CreateMetadataReaderFromContainer. Message-ID: -------------- next part -------------- From 709de407f5e5db5e04910b92882b92ce7843af21 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 12 Nov 2014 15:51:09 -0600 Subject: [PATCH 2/3] windowscodecs: Implement ComponentFactory_CreateMetadataReaderFromContainer. --- dlls/windowscodecs/imgfactory.c | 101 +++++++++++++++++++++++++++++++++++- dlls/windowscodecs/tests/metadata.c | 25 +++++---- 2 files changed, 115 insertions(+), 11 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index e7095dd..444f2e4 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -956,9 +956,106 @@ static HRESULT WINAPI ComponentFactory_CreateMetadataReader(IWICComponentFactory static HRESULT WINAPI ComponentFactory_CreateMetadataReaderFromContainer(IWICComponentFactory *iface, REFGUID format, const GUID *vendor, DWORD options, IStream *stream, IWICMetadataReader **reader) { - FIXME("%p,%s,%s,%x,%p,%p: stub\n", iface, debugstr_guid(format), debugstr_guid(vendor), + HRESULT hr; + IEnumUnknown *enumreaders; + IUnknown *unkreaderinfo; + IWICMetadataReaderInfo *readerinfo; + IWICPersistStream *wicpersiststream; + ULONG num_fetched; + GUID decoder_vendor; + BOOL matches; + LARGE_INTEGER zero; + + TRACE("%p,%s,%s,%x,%p,%p\n", iface, debugstr_guid(format), debugstr_guid(vendor), options, stream, reader); - return E_NOTIMPL; + + if (!format || !stream || !reader) + return E_INVALIDARG; + + zero.QuadPart = 0; + + hr = CreateComponentEnumerator(WICMetadataReader, WICComponentEnumerateDefault, &enumreaders); + if (FAILED(hr)) return hr; + + *reader = NULL; + +start: + while (!*reader) + { + hr = IEnumUnknown_Next(enumreaders, 1, &unkreaderinfo, &num_fetched); + + if (hr == S_OK) + { + hr = IUnknown_QueryInterface(unkreaderinfo, &IID_IWICMetadataReaderInfo, (void**)&readerinfo); + + if (SUCCEEDED(hr)) + { + if (vendor) + { + hr = IWICMetadataReaderInfo_GetVendorGUID(readerinfo, &decoder_vendor); + + if (FAILED(hr) || !IsEqualIID(vendor, &decoder_vendor)) + { + IWICMetadataReaderInfo_Release(readerinfo); + IUnknown_Release(unkreaderinfo); + continue; + } + } + + hr = IWICMetadataReaderInfo_MatchesPattern(readerinfo, format, stream, &matches); + + if (SUCCEEDED(hr) && matches) + { + hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL); + + if (SUCCEEDED(hr)) + hr = IWICMetadataReaderInfo_CreateInstance(readerinfo, reader); + + if (SUCCEEDED(hr)) + { + hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void**)&wicpersiststream); + + if (SUCCEEDED(hr)) + { + hr = IWICPersistStream_LoadEx(wicpersiststream, + stream, vendor, options & WICPersistOptionsMask); + + IWICPersistStream_Release(wicpersiststream); + } + + if (FAILED(hr)) + { + IWICMetadataReader_Release(*reader); + *reader = NULL; + } + } + } + + IUnknown_Release(readerinfo); + } + + IUnknown_Release(unkreaderinfo); + } + else + break; + } + + if (!*reader && vendor) + { + vendor = NULL; + IEnumUnknown_Reset(enumreaders); + goto start; + } + + IEnumUnknown_Release(enumreaders); + + if (!*reader && !(options & WICMetadataCreationFailUnknown)) + FIXME("create unknown metadata reader\n"); + + if (*reader) + return S_OK; + else + return WINCODEC_ERR_COMPONENTNOTFOUND; } static HRESULT WINAPI ComponentFactory_CreateMetadataWriter(IWICComponentFactory *iface, diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index e9ab77c..2dc6049 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -841,17 +841,24 @@ static void test_create_reader(void) stream = create_stream(metadata_tEXt, sizeof(metadata_tEXt)); hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + NULL, NULL, WICPersistOptionsDefault, + stream, &reader); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, + NULL, &reader); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, + &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, + stream, NULL); + ok(hr == E_INVALIDARG, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + + hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, &GUID_ContainerFormatPng, NULL, WICPersistOptionsDefault, stream, &reader); -todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); - /* NOTE: removed once Wine is fixed */ - if (FAILED(hr)) - { - IStream_Release(stream); - IWICComponentFactory_Release(factory); - return; - } if (SUCCEEDED(hr)) { @@ -869,7 +876,7 @@ todo_wine hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, &GUID_ContainerFormatWmp, NULL, WICPersistOptionsDefault, stream, &reader); - ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); if (SUCCEEDED(hr)) { -- 2.1.0 From madewokherd at gmail.com Thu Nov 13 11:46:12 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Thu, 13 Nov 2014 11:46:12 -0600 Subject: [3/3] windowscodecs: Add fallback to unknown metadata reader. Message-ID: -------------- next part -------------- From 6c4b1e3d938bc3d0648041d8bbc468e14ec9c373 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Wed, 12 Nov 2014 16:00:55 -0600 Subject: [PATCH 3/3] windowscodecs: Add fallback to unknown metadata reader. --- dlls/windowscodecs/imgfactory.c | 25 ++++++++++++++++++++++++- dlls/windowscodecs/tests/metadata.c | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/imgfactory.c b/dlls/windowscodecs/imgfactory.c index 444f2e4..42b4e59 100644 --- a/dlls/windowscodecs/imgfactory.c +++ b/dlls/windowscodecs/imgfactory.c @@ -1050,7 +1050,30 @@ start: IEnumUnknown_Release(enumreaders); if (!*reader && !(options & WICMetadataCreationFailUnknown)) - FIXME("create unknown metadata reader\n"); + { + hr = IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL); + + if (SUCCEEDED(hr)) + hr = UnknownMetadataReader_CreateInstance(&IID_IWICMetadataReader, (void**)reader); + + if (SUCCEEDED(hr)) + { + hr = IWICMetadataReader_QueryInterface(*reader, &IID_IWICPersistStream, (void**)&wicpersiststream); + + if (SUCCEEDED(hr)) + { + hr = IWICPersistStream_LoadEx(wicpersiststream, stream, NULL, options & WICPersistOptionsMask); + + IWICPersistStream_Release(wicpersiststream); + } + + if (FAILED(hr)) + { + IWICMetadataReader_Release(*reader); + *reader = NULL; + } + } + } if (*reader) return S_OK; diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index 2dc6049..fa9d701 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -876,7 +876,7 @@ static void test_create_reader(void) hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, &GUID_ContainerFormatWmp, NULL, WICPersistOptionsDefault, stream, &reader); - todo_wine ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); + ok(hr == S_OK, "CreateMetadataReaderFromContainer failed, hr=%x\n", hr); if (SUCCEEDED(hr)) { -- 2.1.0 From nerv at dawncrow.de Thu Nov 13 13:19:06 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Thu, 13 Nov 2014 20:19:06 +0100 Subject: server: Get rid of "defined but not used" warning caused by a superfluous helper function Message-ID: <5465042A.4090808@dawncrow.de> --- server/ptrace.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-server-Get-rid-of-defined-but-not-used-warning-caused-.txt Type: text/x-patch Size: 2273 bytes Desc: not available URL: From stefan at codeweavers.com Thu Nov 13 13:39:25 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:25 +0100 Subject: [PATCH 1/7] wined3d: Minimize device windows on focus loss (v3). Message-ID: <1415907571-19662-1-git-send-email-stefan@codeweavers.com> v3: Check for D3DCREATE_NOWINDOWCHANGES. v2: Move to wined3d. The different behavior in d3d9ex was due to a hidden window and not a difference how d3d9ex handles focus loss. See patch 7. Another patch will add an action (resize the window to match the backbuffer size) on window activation. For this reason the swapchain helper function is called on both activation and deactivation. --- dlls/wined3d/device.c | 5 +++++ dlls/wined3d/swapchain.c | 6 ++++++ dlls/wined3d/wined3d_private.h | 1 + 3 files changed, 12 insertions(+) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index ee3636e..0de444b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4983,6 +4983,11 @@ LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL } else if (message == WM_ACTIVATEAPP) { + UINT i; + + for (i = 0; i < device->swapchain_count; i++) + wined3d_swapchain_activate(device->swapchains[i], wparam); + device->device_parent->ops->activate(device->device_parent, wparam); } diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 25e2107..4c0948f 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1175,3 +1175,9 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) wined3d_resource_update_draw_binding(&swapchain->back_buffers[i]->resource); } } + +void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) +{ + if (!activate && !(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) + ShowWindow(swapchain->device_window, SW_MINIMIZE); +} diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0f302c4..5f90e9a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2701,6 +2701,7 @@ struct wined3d_swapchain void x11_copy_to_screen(const struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN; +void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) DECLSPEC_HIDDEN; struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; void swapchain_destroy_contexts(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; HDC swapchain_get_backup_dc(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; -- 2.0.4 From stefan at codeweavers.com Thu Nov 13 13:39:26 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:26 +0100 Subject: [PATCH 2/7] d3d9/tests: Test messages on focus loss. Message-ID: <1415907571-19662-2-git-send-email-stefan@codeweavers.com> Resolution changing behavior will be tested in a separate patch. --- dlls/d3d9/tests/d3d9ex.c | 277 ++++++++++++++++++++++++++++---------------- dlls/d3d9/tests/device.c | 293 +++++++++++++++++++++++++++++++---------------- 2 files changed, 375 insertions(+), 195 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index bbb95b0..424d2cc 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1702,6 +1702,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -1743,7 +1745,14 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM }; if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -1795,13 +1804,52 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + unsigned int i; + HRESULT hr; - static const struct message messages[] = + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_nowc[] = { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {0, 0}, + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct + { + DWORD create_flags; + const struct message *focus_loss_messages; + } + tests[] = + { + {0, focus_loss_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; wc.lpfnWndProc = test_proc; @@ -1813,121 +1861,156 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); - focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); - ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - - res = WaitForSingleObject(thread_params.window_created, INFINITE); - ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - - trace("device_window %p, focus_window %p, dummy_window %p.\n", - device_window, focus_window, thread_params.dummy_window); - - tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - flush_events(); + res = WaitForSingleObject(thread_params.window_created, INFINITE); + ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - expect_messages = messages; + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); - device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; - device_desc.flags = CREATE_DEVICE_FULLSCREEN; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + trace("device_window %p, focus_window %p, dummy_window %p.\n", + device_window, focus_window, thread_params.dummy_window); - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", - expect_messages->message, expect_messages->window); - expect_messages = NULL; - - if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } - SetForegroundWindow(focus_window); - flush_events(); + ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); - filter_messages = focus_window; + flush_events(); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + expect_messages = create_messages; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + if (0) /* Disabled until we can make this work in a reliable way on Wine. */ + { + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); + } + SetForegroundWindow(focus_window); + flush_events(); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", + (LONG_PTR)test_proc); + + expect_messages = tests[i].focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; + tmp = GetFocus(); + ok(tmp != device_window, "The device window is active, i=%u.\n", i); + ok(tmp != focus_window, "The focus window is active, i=%u.\n", i); + + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x, i=%u.\n", hr, i); + + /* In d3d9ex the device and focus windows have to be minimized and restored, + * otherwise native does not notice that focus has been restored. This is + * independent of D3DCREATE_NOWINDOWCHANGES. */ + ShowWindow(device_window, SW_MINIMIZE); + ShowWindow(device_window, SW_RESTORE); + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); + + /* Calling Reset is not necessary in d3d9ex. */ + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + ok(hr == S_OK, "Got unexpected hr %#x, i=%u.\n", hr, i); + + filter_messages = focus_window; + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - device_desc.device_window = focus_window; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + device_desc.device_window = focus_window; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - device_desc.device_window = device_window; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", + (LONG_PTR)test_proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)DefWindowProcA, proc); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)DefWindowProcA, proc); done: - filter_messages = NULL; + filter_messages = NULL; + DestroyWindow(device_window); + DestroyWindow(focus_window); + SetEvent(thread_params.test_finished); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + } - SetEvent(thread_params.test_finished); - WaitForSingleObject(thread, INFINITE); CloseHandle(thread_params.test_finished); CloseHandle(thread_params.window_created); - CloseHandle(thread); - DestroyWindow(device_window); - DestroyWindow(focus_window); UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL)); } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 1a5008a..aeda123 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3091,6 +3091,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -3131,7 +3133,15 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM break; }; - if (hwnd == w && expect_messages->message == message) ++expect_messages; + if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -3182,13 +3192,52 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + unsigned int i; + HRESULT hr; - static const struct message messages[] = + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_nowc[] = { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {0, 0}, + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct + { + DWORD create_flags; + const struct message *focus_loss_messages; + } + tests[] = + { + {0, focus_loss_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); @@ -3203,122 +3252,168 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); - focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); - ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) + { + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - res = WaitForSingleObject(thread_params.window_created, INFINITE); - ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); + res = WaitForSingleObject(thread_params.window_created, INFINITE); + ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); - trace("device_window %p, focus_window %p, dummy_window %p.\n", - device_window, focus_window, thread_params.dummy_window); + trace("device_window %p, focus_window %p, dummy_window %p.\n", + device_window, focus_window, thread_params.dummy_window); - tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + tmp = GetFocus(); + ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); - flush_events(); + flush_events(); - expect_messages = messages; + expect_messages = create_messages; - device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; - device_desc.flags = CREATE_DEVICE_FULLSCREEN; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", - expect_messages->message, expect_messages->window); - expect_messages = NULL; + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; - if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { + if (0) /* Disabled until we can make this work in a reliable way on Wine. */ + { + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); + } + SetForegroundWindow(focus_window); + flush_events(); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", + (LONG_PTR)test_proc, i); + + expect_messages = tests[i].focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } - SetForegroundWindow(focus_window); - flush_events(); + ok(tmp != device_window, "The device window is active, i=%u.\n", i); + ok(tmp != focus_window, "The focus window is active, i=%u.\n", i); - filter_messages = focus_window; + hr = IDirect3DDevice9_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + /* This is needed on native with D3DCREATE_NOWINDOWCHANGES, and it needs to be + * done before the focus window is restored. This makes sense to some extent + * because minimizing the window on focus loss is the application's job if this + * flag is set. */ + if (tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES) + { + ShowWindow(device_window, SW_MINIMIZE); + ShowWindow(device_window, SW_RESTORE); + } - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + /* I have to minimize and restore the focus window, otherwise native d3d9 fails + * device::reset with D3DERR_DEVICELOST. This does not happen when the window + * restore is triggered by the user. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + hr = IDirect3DDevice9_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + /* Releasing a device in lost state breaks follow-up tests on native. */ + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); - device_desc.device_window = focus_window; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + filter_messages = focus_window; - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - device_desc.device_window = device_window; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); - proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = focus_window; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)DefWindowProcA, proc); + device_desc.device_window = device_window; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } + + proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", + (LONG_PTR)test_proc, i); + + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)DefWindowProcA, proc, i); done: - filter_messages = NULL; - IDirect3D9_Release(d3d9); + filter_messages = NULL; + DestroyWindow(device_window); + DestroyWindow(focus_window); + SetEvent(thread_params.test_finished); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + } - SetEvent(thread_params.test_finished); - WaitForSingleObject(thread, INFINITE); + IDirect3D9_Release(d3d9); CloseHandle(thread_params.test_finished); CloseHandle(thread_params.window_created); - CloseHandle(thread); - - DestroyWindow(device_window); - DestroyWindow(focus_window); UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL)); } @@ -3540,8 +3635,10 @@ static void test_reset_fullscreen(void) struct device_desc device_desc; static const struct message messages[] = { - {WM_ACTIVATEAPP, FOCUS_WINDOW}, - {0, 0}, + /* Windows usually sends wparam = TRUE, except on the testbot, + * where it randomly sends FALSE. Ignore it. */ + {WM_ACTIVATEAPP, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, }; d3d = Direct3DCreate9(D3D_SDK_VERSION); -- 2.0.4 From stefan at codeweavers.com Thu Nov 13 13:39:27 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:27 +0100 Subject: [PATCH 3/7] d3d9/tests: Test style changes on focus loss (v2). Message-ID: <1415907571-19662-3-git-send-email-stefan@codeweavers.com> Version 2: Fix a rebase bug that broke the tests on Windows. I will add message tests for the hidden window behavior in a separate test. I don't particularly care about the behavior on the second d3d9ex device creation. This part is in the test to explain why I am destroying the device and the windows. d3d9ex does the same when calling reset to switch to fullscreen mode a second time. --- dlls/d3d9/tests/d3d9ex.c | 85 +++++++++++++++++++++++++++++++++++++++++++++--- dlls/d3d9/tests/device.c | 40 +++++++++++++++++++++-- 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 424d2cc..988d2dc 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2218,24 +2218,27 @@ done: static void test_window_style(void) { RECT focus_rect, device_rect, fullscreen_rect, r, r2; - LONG device_style, device_exstyle; + LONG device_style, device_exstyle, expected_style; LONG focus_style, focus_exstyle; struct device_desc device_desc; LONG style; IDirect3DDevice9Ex *device; HRESULT hr; ULONG ref; + BOOL ret; static const struct { LONG style_flags; DWORD device_flags; + LONG focus_loss_style; + LONG create2_style, create2_exstyle; } tests[] = { - {0, 0}, - {WS_VISIBLE, 0}, - {0, CREATE_DEVICE_NOWINDOWCHANGES}, - {WS_VISIBLE, CREATE_DEVICE_NOWINDOWCHANGES}, + {0, 0, 0, WS_VISIBLE, WS_EX_TOPMOST}, + {WS_VISIBLE, 0, WS_MINIMIZE, WS_VISIBLE, WS_EX_TOPMOST}, + {0, CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, + {WS_VISIBLE, CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, }; unsigned int i; @@ -2323,6 +2326,78 @@ static void test_window_style(void) ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + style = GetWindowLongA(device_window, GWL_STYLE); + if (device_style & WS_VISIBLE) + ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + device_style, style, i); + else + todo_wine ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + device_style, style, i); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + device_exstyle, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + + /* The second time a device is created on the window the window becomes visible and + * topmost if D3DCREATE_NOWINDOWCHANGES is not set. */ + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].device_flags; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].create2_style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + expected_style, style, i); + expected_style = device_exstyle | tests[i].create2_exstyle; + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n", + expected_style, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + DestroyWindow(device_window); + DestroyWindow(focus_window); + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + + device_desc.device_window = device_window; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].focus_loss_style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + expected_style, style, i); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + device_exstyle, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + DestroyWindow(device_window); DestroyWindow(focus_window); } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index aeda123..d98221a 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3787,15 +3787,16 @@ static void test_window_style(void) IDirect3D9 *d3d9; HRESULT hr; ULONG ref; + BOOL ret; static const struct { DWORD device_flags; - LONG style, exstyle; + LONG style, focus_loss_style, exstyle; } tests[] = { - {0, WS_VISIBLE, WS_EX_TOPMOST}, - {CREATE_DEVICE_NOWINDOWCHANGES, 0}, + {0, WS_VISIBLE, WS_MINIMIZE, WS_EX_TOPMOST}, + {CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, }; unsigned int i; @@ -3890,6 +3891,39 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", focus_exstyle, style, i); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].focus_loss_style | tests[i].style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | tests[i].exstyle; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + + /* In d3d8 follow-up tests fail on native if the device is destroyed while + * lost. This doesn't happen in d3d9 on my test machine but it still seems + * like a good idea to reset it first. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + ret = SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + flush_events(); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Thu Nov 13 13:39:28 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:28 +0100 Subject: [PATCH 4/7] d3d8/tests: Test messages on focus loss. Message-ID: <1415907571-19662-4-git-send-email-stefan@codeweavers.com> This patch and the next one introduce new errors on native when the tests are run without focus (i.e., Windows 8 testbot). If desired I can add checks for this condition and skip the tests. --- dlls/d3d8/tests/device.c | 92 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 79 insertions(+), 13 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index bf7f181..72fce12 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2136,6 +2136,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -2176,7 +2178,15 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM break; }; - if (hwnd == w && expect_messages->message == message) ++expect_messages; + if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -2227,16 +2237,38 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + HRESULT hr; - static const struct message messages[] = - { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {WM_WINDOWPOSCHANGING, DEVICE_WINDOW}, - {WM_MOVE, DEVICE_WINDOW}, - {WM_SIZE, DEVICE_WINDOW}, - {0, 0}, + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + {WM_MOVE, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, }; d3d8 = Direct3DCreate8(D3D_SDK_VERSION); @@ -2286,7 +2318,7 @@ static void test_wndproc(void) flush_events(); - expect_messages = messages; + expect_messages = create_messages; device_desc.device_window = device_window; device_desc.width = registry_mode.dmPelsWidth; @@ -2312,8 +2344,6 @@ static void test_wndproc(void) SetForegroundWindow(focus_window); flush_events(); - filter_messages = focus_window; - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); @@ -2321,6 +2351,42 @@ static void test_wndproc(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + expect_messages = focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", + expect_messages->message, expect_messages->window); + expect_messages = NULL; + tmp = GetFocus(); + ok(tmp != device_window, "The device window is active.\n"); + ok(tmp != focus_window, "The focus window is active.\n"); + + /* The Present call is necessary to make native realize the device is lost. */ + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + + /* I have to minimize and restore the focus window, otherwise native d3d9 fails + * device::reset with D3DERR_DEVICELOST. This does not happen when the window + * restore is triggered by the user. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); + + hr = IDirect3DDevice8_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + + /* Releasing a device in lost state breaks follow-up tests on native. */ + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + filter_messages = focus_window; ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Thu Nov 13 13:39:29 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:29 +0100 Subject: [PATCH 5/7] d3d8/tests: Test style changes on focus loss. Message-ID: <1415907571-19662-5-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 72fce12..c8995fa 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2857,6 +2857,7 @@ static void test_window_style(void) IDirect3D8 *d3d8; HRESULT hr; ULONG ref; + BOOL ret; focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); @@ -2930,6 +2931,36 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | WS_MINIMIZE | WS_VISIBLE; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + + /* Follow-up tests fail on native if the device is destroyed while lost. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + ret = SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + flush_events(); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Thu Nov 13 13:39:30 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:30 +0100 Subject: [PATCH 6/7] ddraw/tests: Test messages on focus loss (v2). Message-ID: <1415907571-19662-6-git-send-email-stefan@codeweavers.com> Version 2: Do not restore the primary surface after restoring focus. This works around a crash in GetSurfaceDesc on the Windows 8 testbot. GetSurfaceDesc after a mode change seems to be unstable on the testbot and/or Windows 8 in general. I don't have a real Win8 machine to compare. If this causes more issues in further changes to the test we can move the surface size checks after mode changes into a separate test to make it easier to maintain a call sequence that doesn't hit the bug. --- dlls/ddraw/tests/ddraw1.c | 99 +++++++++++++++++++++++++++++++------------- dlls/ddraw/tests/ddraw2.c | 103 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw4.c | 103 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 103 ++++++++++++++++++++++++++++++++-------------- 4 files changed, 286 insertions(+), 122 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 0ae204c..98d56d4 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -428,12 +428,26 @@ static void destroy_material(IDirect3DMaterial *material) IDirect3DMaterial_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1878,15 +1892,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1906,7 +1920,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2147,19 +2161,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2234,7 +2263,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2280,7 +2309,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2291,6 +2320,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2299,7 +2340,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2385,7 +2426,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2409,7 +2450,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2453,7 +2494,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2548,7 +2589,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2565,7 +2606,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2650,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 334d89e..537de81 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -361,12 +361,26 @@ static void destroy_material(IDirect3DMaterial2 *material) IDirect3DMaterial2_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2066,15 +2080,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2094,7 +2108,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2346,19 +2360,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2438,7 +2467,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2484,7 +2513,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2495,6 +2524,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2503,7 +2544,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2589,7 +2630,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2613,7 +2654,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2657,7 +2698,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2752,7 +2793,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2769,7 +2810,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2813,7 +2854,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2874,7 +2915,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2945,7 +2986,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ab03f39..80e155e 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -391,12 +391,26 @@ static void destroy_material(IDirect3DMaterial3 *material) IDirect3DMaterial3_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2253,15 +2267,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2281,7 +2295,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2533,19 +2547,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2625,7 +2654,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2671,7 +2700,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2682,6 +2711,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2690,7 +2731,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2776,7 +2817,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2793,7 +2834,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2837,7 +2878,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2932,7 +2973,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2949,7 +2990,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2993,7 +3034,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -3054,7 +3095,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -3125,7 +3166,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index f505c65..88ce136 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -324,12 +324,26 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return device; } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1931,15 +1945,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1959,7 +1973,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2210,19 +2224,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2302,7 +2331,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2348,7 +2377,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2359,6 +2388,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2367,7 +2408,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2453,7 +2494,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2470,7 +2511,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2514,7 +2555,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2650,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2626,7 +2667,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2670,7 +2711,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2731,7 +2772,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2802,7 +2843,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); -- 2.0.4 From stefan at codeweavers.com Thu Nov 13 13:39:31 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 13 Nov 2014 20:39:31 +0100 Subject: [PATCH 7/7] ddraw/tests: Test focus loss style changes. Message-ID: <1415907571-19662-7-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw2.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw7.c | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 144 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 98d56d4..5b775ec 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2009,12 +2009,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2040,6 +2041,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2048,6 +2063,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 537de81..f1bd1da 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2197,12 +2197,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw2 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2228,6 +2229,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2236,6 +2251,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 80e155e..fa42817 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2384,12 +2384,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw4 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2415,6 +2416,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2423,6 +2438,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 88ce136..a0a6aef 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2062,12 +2062,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw7 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2093,6 +2094,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2101,6 +2116,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); -- 2.0.4 From austinenglish at gmail.com Thu Nov 13 15:30:50 2014 From: austinenglish at gmail.com (Austin English) Date: Thu, 13 Nov 2014 15:30:50 -0600 Subject: include/ddk: add csq.h Message-ID: -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- commit 3d445a5fd56ee5f92b99351266efc854b141f0a5 Author: Austin English Date: Thu Nov 13 13:29:39 2014 -0800 include/ddk: add csq.h diff --git a/include/ddk/csq.h b/include/ddk/csq.h new file mode 100644 index 0000000..429ed40 --- /dev/null +++ b/include/ddk/csq.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) the Wine project + * + * 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 "ddk/ntddk.h" + +#ifndef __WINE_CSQ_H +#define __WINE_CSQ_H + +typedef struct _IO_CSQ IO_CSQ, *PIO_CSQ; +typedef VOID (*PIO_CSQ_ACQUIRE_LOCK)(PIO_CSQ Csq, PKIRQL Irql); +typedef VOID (*PIO_CSQ_COMPLETE_CANCELED_IRP)(PIO_CSQ Csq, PIRP Irp); +typedef VOID (*PIO_CSQ_INSERT_IRP)(struct _IO_CSQ *Csq, PIRP Irp); +typedef PIRP (*PIO_CSQ_PEEK_NEXT_IRP)(PIO_CSQ Csq, PIRP Irp, PVOID PeekContext); +typedef VOID (*PIO_CSQ_RELEASE_LOCK)(PIO_CSQ Csq, KIRQL Irql); +typedef VOID (*PIO_CSQ_REMOVE_IRP)(PIO_CSQ Csq, PIRP Irp); + +#endif /* __WINE_CSQ_H */ From austinenglish at gmail.com Thu Nov 13 15:46:26 2014 From: austinenglish at gmail.com (Austin English) Date: Thu, 13 Nov 2014 15:46:26 -0600 Subject: include: correct NtSetLdtEntries prototype Message-ID: -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/include/winternl.h b/include/winternl.h index 5a27f94..ddc7c18 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2228,7 +2228,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID, NTSYSAPI NTSTATUS WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetIntervalProfile(ULONG,KPROFILE_SOURCE); NTSYSAPI NTSTATUS WINAPI NtSetIoCompletion(HANDLE,ULONG_PTR,ULONG_PTR,NTSTATUS,SIZE_T); -NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,LDT_ENTRY,ULONG,LDT_ENTRY); +NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetLowEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighThread(VOID); From madewokherd at gmail.com Thu Nov 13 15:52:33 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Thu, 13 Nov 2014 15:52:33 -0600 Subject: ole32: Add support for pasting CF_BITMAP. Message-ID: -------------- next part -------------- From 3448f2f3b406617e32fea896cb9cff60f9ac3b94 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 13 Nov 2014 15:50:42 -0600 Subject: [PATCH] ole32: Add support for pasting CF_BITMAP. --- dlls/ole32/clipboard.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index a7308c2..9d28b65 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -1133,6 +1133,8 @@ static DWORD get_tymed_from_nonole_cf(UINT cf) return TYMED_ENHMF; case CF_METAFILEPICT: return TYMED_MFPICT; + case CF_BITMAP: + return TYMED_GDI; default: FIXME("returning TYMED_NULL for cf %04x\n", cf); return TYMED_NULL; @@ -1310,6 +1312,27 @@ static HRESULT get_stgmed_for_emf(HENHMETAFILE hemf, STGMEDIUM *med) return S_OK; } +/************************************************************************ + * get_stgmed_for_bitmap + * + * Returns a stg medium with a bitmap based on the handle + */ +static HRESULT get_stgmed_for_bitmap(HBITMAP hbmp, STGMEDIUM *med) +{ + HRESULT hr; + + med->pUnkForRelease = NULL; + med->tymed = TYMED_NULL; + + hr = dup_bitmap(hbmp, &med->u.hBitmap); + + if (FAILED(hr)) + return hr; + + med->tymed = TYMED_ENHMF; + return S_OK; +} + static inline BOOL string_off_equal(const DVTARGETDEVICE *t1, WORD off1, const DVTARGETDEVICE *t2, WORD off2) { const WCHAR *str1, *str2; @@ -1401,6 +1424,8 @@ static HRESULT WINAPI snapshot_GetData(IDataObject *iface, FORMATETC *fmt, hr = get_stgmed_for_stream(h, med); else if(mask & TYMED_ENHMF) hr = get_stgmed_for_emf((HENHMETAFILE)h, med); + else if(mask & TYMED_GDI) + hr = get_stgmed_for_bitmap((HBITMAP)h, med); else { FIXME("Unhandled tymed - mask %x req tymed %x\n", mask, fmt->tymed); -- 2.1.0 From madewokherd at gmail.com Thu Nov 13 16:05:29 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Thu, 13 Nov 2014 16:05:29 -0600 Subject: ole32: Add support for pasting CF_BITMAP. Message-ID: Supersedes 107672, which had a copy/paste error. -------------- next part -------------- From 83d5f5624e9f4c4cd5422a05e036c6cfa25e4006 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 13 Nov 2014 15:50:42 -0600 Subject: [PATCH] ole32: Add support for pasting CF_BITMAP. --- dlls/ole32/clipboard.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index a7308c2..6404f36 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -1133,6 +1133,8 @@ static DWORD get_tymed_from_nonole_cf(UINT cf) return TYMED_ENHMF; case CF_METAFILEPICT: return TYMED_MFPICT; + case CF_BITMAP: + return TYMED_GDI; default: FIXME("returning TYMED_NULL for cf %04x\n", cf); return TYMED_NULL; @@ -1310,6 +1312,27 @@ static HRESULT get_stgmed_for_emf(HENHMETAFILE hemf, STGMEDIUM *med) return S_OK; } +/************************************************************************ + * get_stgmed_for_bitmap + * + * Returns a stg medium with a bitmap based on the handle + */ +static HRESULT get_stgmed_for_bitmap(HBITMAP hbmp, STGMEDIUM *med) +{ + HRESULT hr; + + med->pUnkForRelease = NULL; + med->tymed = TYMED_NULL; + + hr = dup_bitmap(hbmp, &med->u.hBitmap); + + if (FAILED(hr)) + return hr; + + med->tymed = TYMED_GDI; + return S_OK; +} + static inline BOOL string_off_equal(const DVTARGETDEVICE *t1, WORD off1, const DVTARGETDEVICE *t2, WORD off2) { const WCHAR *str1, *str2; @@ -1401,6 +1424,8 @@ static HRESULT WINAPI snapshot_GetData(IDataObject *iface, FORMATETC *fmt, hr = get_stgmed_for_stream(h, med); else if(mask & TYMED_ENHMF) hr = get_stgmed_for_emf((HENHMETAFILE)h, med); + else if(mask & TYMED_GDI) + hr = get_stgmed_for_bitmap((HBITMAP)h, med); else { FIXME("Unhandled tymed - mask %x req tymed %x\n", mask, fmt->tymed); -- 2.1.0 From jonas.bugzilla at gmail.com Thu Nov 13 16:13:54 2014 From: jonas.bugzilla at gmail.com (Jonas Maebe) Date: Thu, 13 Nov 2014 23:13:54 +0100 Subject: wined3d: Add NVIDIA Geforce GT 750M to supported device list. Message-ID: <54652D22.1060706@gmail.com> >From b563d158cbfaf38aca005b7db1300c949d4a9e82 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Thu, 13 Nov 2014 22:47:32 +0100 Subject: wined3d: Add NVIDIA Geforce GT 750M to supported device list. --- dlls/wined3d/directx.c | 2 ++ dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 3 insertions(+) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 5327949..abb25a1 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1284,6 +1284,7 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670, "NVIDIA GeForce GTX 670", DRIVER_NVIDIA_GEFORCE8, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX670MX, "NVIDIA GeForce GTX 670MX", DRIVER_NVIDIA_GEFORCE8, 3072}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX680, "NVIDIA GeForce GTX 680", DRIVER_NVIDIA_GEFORCE8, 2048}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT750M, "NVIDIA GeForce GT 750M", DRIVER_NVIDIA_GEFORCE8, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX750, "NVIDIA GeForce GTX 750", DRIVER_NVIDIA_GEFORCE8, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX750TI, "NVIDIA GeForce GTX 750 Ti", DRIVER_NVIDIA_GEFORCE8, 2048}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX760, "NVIDIA Geforce GTX 760", DRIVER_NVIDIA_GEFORCE8, 2048}, @@ -1727,6 +1728,7 @@ cards_nvidia_binary[] = {"GTX 760", CARD_NVIDIA_GEFORCE_GTX760}, /* Geforce 700 - midend high */ {"GTX 750 Ti", CARD_NVIDIA_GEFORCE_GTX750TI}, /* Geforce 700 - midend */ {"GTX 750", CARD_NVIDIA_GEFORCE_GTX750}, /* Geforce 700 - midend */ + {"GT 750M", CARD_NVIDIA_GEFORCE_GT750M}, /* Geforce 700 - midend mobile */ {"GTX 680", CARD_NVIDIA_GEFORCE_GTX680}, /* Geforce 600 - highend */ {"GTX 670MX", CARD_NVIDIA_GEFORCE_GTX670MX}, /* Geforce 600 - highend */ {"GTX 670", CARD_NVIDIA_GEFORCE_GTX670}, /* Geforce 600 - midend high */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0f302c4..4210d26 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1514,6 +1514,7 @@ enum wined3d_pci_device CARD_NVIDIA_GEFORCE_GTX670 = 0x1189, CARD_NVIDIA_GEFORCE_GTX670MX = 0x11a1, CARD_NVIDIA_GEFORCE_GTX680 = 0x1180, + CARD_NVIDIA_GEFORCE_GT750M = 0x0fe9, CARD_NVIDIA_GEFORCE_GTX750 = 0x1381, CARD_NVIDIA_GEFORCE_GTX750TI = 0x1380, CARD_NVIDIA_GEFORCE_GTX760 = 0x1187, -- 2.1.0 From 00cpxxx at gmail.com Thu Nov 13 18:13:40 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Thu, 13 Nov 2014 22:13:40 -0200 Subject: ole32: Avoid a possible null dereference Message-ID: The variable passed to the function is tested against NULL after this function is called so it may be possible to crash. -------------- next part -------------- diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index a7308c2..afb94d1 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -214,8 +214,11 @@ static inline char *dump_fmtetc(FORMATETC *fmt) { static char buf[100]; - snprintf(buf, sizeof(buf), "cf %04x ptd %p aspect %x lindex %d tymed %x", - fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed); + if (fmt) + snprintf(buf, sizeof(buf), "cf %04x ptd %p aspect %x lindex %d tymed %x", + fmt->cfFormat, fmt->ptd, fmt->dwAspect, fmt->lindex, fmt->tymed); + else + strcpy(buf, "(null)"); return buf; } From sebastian at fds-team.de Thu Nov 13 18:42:33 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 14 Nov 2014 01:42:33 +0100 Subject: [1/2] ntdll/tests: Add basic tests for Rtl[Add|Remove]VectoredContinueHandler. Message-ID: <54654FF9.3040305@fds-team.de> This series fixes bug 37548. Would be very useful to have this in before the next release, otherwise lot of people will complain about native .NET framework being broken. The usual test failures exception.c:486: Test failed: 42: Wrong exception address 00310000/00310001 exception: unhandled exception 80000004 at 00310000 exception.c:483: Test failed: 42: Wrong exception code c0000027/80000004 exception.c:486: Test failed: 42: Wrong exception address 77174D17/00310001 and on w8 exception.c:1149: Test failed: Got exception offset 0x1b, expected 0x19 exception.c:1158: Test failed: Got exception offset 0x19, expected 0x17 are expected and not introduced by this patch. --- dlls/ntdll/tests/exception.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ntdll-tests-Add-basic-tests-for-Rtl-Add-Remove-Vecto.patch Type: text/x-patch Size: 4483 bytes Desc: not available URL: From sebastian at fds-team.de Thu Nov 13 18:42:44 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 14 Nov 2014 01:42:44 +0100 Subject: [2/2] ntdll: Implement Rtl[Add|Remove]VectoredContinueHandler semi-stubs. Message-ID: <54655004.4090505@fds-team.de> This patch moves the code for vectored exception handlers to common functions, and then implements semi-stubs for continue handlers. --- dlls/ntdll/exception.c | 85 +++++++++++++++++++++++++------------------- dlls/ntdll/tests/exception.c | 5 --- 2 files changed, 49 insertions(+), 41 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-ntdll-Implement-Rtl-Add-Remove-VectoredContinueHandl.patch Type: text/x-patch Size: 6894 bytes Desc: not available URL: From sebastian at fds-team.de Thu Nov 13 19:04:59 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 14 Nov 2014 02:04:59 +0100 Subject: d3dx9_36: Allow NULL pointer for optional arguments of D3DXIntersectTri. Message-ID: <5465553B.5040309@fds-team.de> Fixes bug 35133. --- dlls/d3dx9_36/mesh.c | 6 +++--- dlls/d3dx9_36/tests/mesh.c | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-d3dx9_36-Allow-NULL-pointer-for-optional-arguments-o.patch Type: text/x-patch Size: 2790 bytes Desc: not available URL: From sebastian at fds-team.de Fri Nov 14 01:14:07 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 14 Nov 2014 08:14:07 +0100 Subject: [1/2] psapi/tests: Add tests for GetPerformanceInfo function. Message-ID: <5465ABBF.2040900@fds-team.de> --- dlls/psapi/tests/psapi_main.c | 137 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-psapi-tests-Add-tests-for-GetPerformanceInfo-functio.patch Type: text/x-patch Size: 9122 bytes Desc: not available URL: From sebastian at fds-team.de Fri Nov 14 01:14:14 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 14 Nov 2014 08:14:14 +0100 Subject: [2/2] kernel32: Fix implementation of K32GetPerformanceInfo. Message-ID: <5465ABC6.1030609@fds-team.de> Fixes bug 37512. --- dlls/kernel32/cpu.c | 64 ++++++++++++++++++++++++++++++++++++++++++- dlls/psapi/tests/psapi_main.c | 14 ---------- 2 files changed, 63 insertions(+), 15 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-kernel32-Fix-implementation-of-K32GetPerformanceInfo.patch Type: text/x-patch Size: 7612 bytes Desc: not available URL: From mstefani at redhat.de Fri Nov 14 03:51:38 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Fri, 14 Nov 2014 10:51:38 +0100 Subject: appwiz.cpl: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141114095138.GA1810@redhat.com> --- dlls/appwiz.cpl/appwiz.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/appwiz.cpl/appwiz.c b/dlls/appwiz.cpl/appwiz.c index cd76f51..9d53e79 100644 --- a/dlls/appwiz.cpl/appwiz.c +++ b/dlls/appwiz.cpl/appwiz.c @@ -567,7 +567,7 @@ static void SetInfoDialogText(HKEY hKey, LPCWSTR lpKeyName, LPCWSTR lpAltMessage /* if hKey is null, lpKeyName contains the string we want to check */ if (hKey == NULL) { - if ((lpKeyName) && (lstrlenW(lpKeyName) > 0)) + if (lpKeyName && lpKeyName[0]) SetWindowTextW(hWndDlgItem, lpKeyName); else SetWindowTextW(hWndDlgItem, lpAltMessage); @@ -577,7 +577,7 @@ static void SetInfoDialogText(HKEY hKey, LPCWSTR lpKeyName, LPCWSTR lpAltMessage buflen = MAX_STRING_LEN; if ((RegQueryValueExW(hKey, lpKeyName, 0, 0, (LPBYTE) buf, &buflen) == - ERROR_SUCCESS) && (lstrlenW(buf) > 0)) + ERROR_SUCCESS) && buf[0]) SetWindowTextW(hWndDlgItem, buf); else SetWindowTextW(hWndDlgItem, lpAltMessage); -- 1.9.3 From mstefani at redhat.de Fri Nov 14 04:05:00 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Fri, 14 Nov 2014 11:05:00 +0100 Subject: fusion/tests: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141114100500.GB1810@redhat.com> --- dlls/fusion/tests/asmname.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/fusion/tests/asmname.c b/dlls/fusion/tests/asmname.c index ac5b27b..a075288 100644 --- a/dlls/fusion/tests/asmname.c +++ b/dlls/fusion/tests/asmname.c @@ -425,7 +425,7 @@ static void test_CreateAssemblyNameObject(void) str[0] = '\0'; hr = IAssemblyName_GetName(name, &size, str); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - ok(lstrlenW(str) == 0, "Expected empty name\n"); + ok(!str[0], "Expected empty name\n"); ok(size == 0, "Expected 0, got %d\n", size); hi = 0xbeefcace; @@ -461,7 +461,7 @@ static void test_CreateAssemblyNameObject(void) str[0] = '\0'; hr = IAssemblyName_GetName(name, &size, str); ok(hr == S_OK, "Expected S_OK, got %08x\n", hr); - ok(lstrlenW(str) == 0, "Expected empty name\n"); + ok(!str[0], "Expected empty name\n"); ok(size == 1, "Expected 1, got %d\n", size); hi = 0xbeefcace; -- 1.9.3 From jr98 at gmx.net Fri Nov 14 09:13:43 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Fri, 14 Nov 2014 16:13:43 +0100 Subject: [website] Ubuntu Download: Update and overhaul German translation. Message-ID: <1415978023.4984.18.camel@xpsubuntu> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Ubuntu-Download-Update-and-overhaul-German-translati.patch Type: text/x-patch Size: 242504 bytes Desc: not available URL: From jr98 at gmx.net Fri Nov 14 09:24:11 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Fri, 14 Nov 2014 16:24:11 +0100 Subject: [website] German translation for release 1.7.31 Message-ID: <1415978651.4984.21.camel@xpsubuntu> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-German-translation-for-release-1.7.31.patch Type: text/x-patch Size: 1355 bytes Desc: not available URL: From jr98 at gmx.net Fri Nov 14 10:40:27 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Fri, 14 Nov 2014 17:40:27 +0100 Subject: [website] Ubuntu Download: Update and overhaul German translation. (try 2) In-Reply-To: <1415978023.4984.18.camel@xpsubuntu> References: <1415978023.4984.18.camel@xpsubuntu> Message-ID: <1415983227.4984.27.camel@xpsubuntu> Try 2: I missed some of Rosanne's changes (stop identifying the PPA as WineHQ's). Fixed. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Ubuntu-Download-Update-and-overhaul-German-translati.patch Type: text/x-patch Size: 242474 bytes Desc: not available URL: From joachim.priesner at web.de Fri Nov 14 15:39:58 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Fri, 14 Nov 2014 22:39:58 +0100 Subject: [1/2] wined3d: Set D3DPMISCCAPS_FOGVERTEXCLAMPED flag in get_device_caps (resend) Message-ID: <201411142240.07895.joachim.priesner@web.de> Wine clamps the oFog output of vertex shaders. Tests for the flag follow in the second part of this patch. --- dlls/wined3d/directx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d428d94..41bad21 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -4148,12 +4148,12 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS | WINED3DPMISCCAPS_MASKZ | WINED3DPMISCCAPS_BLENDOP | + WINED3DPMISCCAPS_FOGVERTEXCLAMPED | WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING; /* TODO: WINED3DPMISCCAPS_NULLREFERENCE WINED3DPMISCCAPS_FOGANDSPECULARALPHA - WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS - WINED3DPMISCCAPS_FOGVERTEXCLAMPED */ + WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS */ if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; -- 1.8.4.5 From joachim.priesner at web.de Fri Nov 14 15:40:11 2014 From: joachim.priesner at web.de (Joachim Priesner) Date: Fri, 14 Nov 2014 22:40:11 +0100 Subject: [2/2] wined3d: Take abs() of vertex z coordinate as FFP fog coordinate (try 7) Message-ID: <201411142240.16476.joachim.priesner@web.de> Take the absolute value of vertex.z as fog coordinate instead of just the z coordinate. This fixes e.g. fog for applications that use right-handed projection matrices. Also test the clamp behavior of the oFog vertex shader output. Tested on openSuse 13.1 and Windows 8.1 (VMware Player). Try 7: Also test fogstart=-1, fogend=0. --- dlls/d3d8/tests/visual.c | 331 +++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 399 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 174 ++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 2 +- 4 files changed, 905 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 163110c..f9dd30b 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -696,6 +696,336 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + /* Fill the null-shader entry with the FVF (SetVertexShader is "overloaded" on d3d8). */ + DWORD vertex_shader[3] = {D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, 0, 0}; + DWORD pixel_shader[2] = {0, 0}; + IDirect3D8 *d3d; + IDirect3DDevice8 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support; + unsigned int i, ps, y; + D3DCOLOR color, expected_middle_color; + ULONG refcount; + D3DCAPS8 caps; + HWND window; + HRESULT hr; + + static const DWORD vertex_decl[] = + { + D3DVSD_STREAM(0), + D3DVSD_REG(0, D3DVSDT_FLOAT3), /* position, v0 */ + D3DVSD_REG(1, D3DVSDT_D3DCOLOR), /* diffuse color, v1 */ + D3DVSD_REG(2, D3DVSDT_D3DCOLOR), /* specular color, v2 */ + D3DVSD_CONST(0, 1), 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + D3DVSD_END() + }; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0100, /* vs_1_0 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + + static const struct + { + struct vec3 position; + DWORD diffuse; + DWORD specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + int vshader; + float fog_start; + float fog_end; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* fogstart = 0, fogend = 1: + * Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED. + * + * fogstart = -1, fogend = 0: + * Both quads are completely fogged, except in the cases where the foggy vertex shader + * with vertex fog or neither vertex nor table fog are used. Those are independent of + * fogstart/fogend, the result should therefore equal that of the + * corresponding (fogstart, fogend) == (0, 1) case. */ + + /* No vertex shader */ + {0, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + {0, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {0, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {0, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {0, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + {1, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader with vertex fog computation. + * As drivers inconsistently clamp or don't clamp the oFog output of vertex shaders, + * the special value C_CLAMPED_FOG allows both C_HALF_FOGGED (clamped) and C_FOGGED. */ + {2, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + {2, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {2, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {2, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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"); + goto done; + } + + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice8_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 0); + if (has_vs_support) + { + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code1, &vertex_shader[1], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice8_CreateVertexShader(device, vertex_decl, vertex_shader_code2, &vertex_shader[2], 0); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_1_0 support, skipping some fog tests\n"); + } + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice8_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice8_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, + *(DWORD*)(&test_data[i].fog_start)); + ok(SUCCEEDED(hr), "Setting fog start to %.1f failed (%#x)\n", test_data[i].fog_start, hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, + *(DWORD*)(&test_data[i].fog_end)); + ok(SUCCEEDED(hr), "Setting fog end to %.1f failed (%#x)\n", test_data[i].fog_end, hr); + + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got left color %08x, expected %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + ok(color_match(color, C_HALF_FOGGED, 13) || color_match(color, C_FOGGED, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got middle color %08x, expected %08x+-5%% or %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, C_HALF_FOGGED, C_FOGGED); + } + else + { + ok(color_match(color, expected_middle_color, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got middle color %08x, expected %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, expected_middle_color); + } + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got right color %08x, expected %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, test_data[i].color_right); + } + + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DDevice8_DeleteVertexShader(device, vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DDevice8_DeletePixelShader(device, pixel_shader[i]); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + /* This tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -5092,6 +5422,7 @@ START_TEST(visual) offscreen_test(); alpha_test(); test_scalar_instructions(); + fog_negative_z_test(); fog_with_shader_test(); cnd_test(); p8_texture_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 117c8eb..6fdfb3b 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -1825,6 +1825,404 @@ done: DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void fog_negative_z_test(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000, + C_CLAMPED_FOG = 0xdeadbeef /* triggers special codepath when used as middle_color */ + }; + + IDirect3DVertexShader9 *vertex_shader[4] = {NULL, NULL, NULL, NULL}; + IDirect3DPixelShader9 *pixel_shader[3] = {NULL, NULL, NULL}; + IDirect3DVertexDeclaration9 *vertex_declaration = NULL; + IDirect3DDevice9 *device; + BOOL has_vs_support, has_ps_support, has_table_fog_support, is_fog_vertex_clamped; + unsigned int i, ps, y; + IDirect3D9 *d3d; + ULONG refcount; + D3DCAPS9 caps; + DWORD color, expected_middle_color; + HWND window; + HRESULT hr; + + /* Basic vertex shader without fog computation ("non foggy") */ + static const DWORD vertex_shader_code1[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"). Outputs the z coordinate of the vertex + * as its fog intensity value. */ + static const DWORD vertex_shader_code2[] = + { + 0xfffe0101, /* vs_1_1 */ + 0x00000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0000001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0000001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x00000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x00000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x00000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x00000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x00000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic vertex shader with fog computation ("foggy"), vs_2_0 */ + static const DWORD vertex_shader_code3[] = + { + 0xfffe0200, /* vs_2_0 */ + 0x05000051, 0xa00f0000, 0x3f000000, 0x00000000, 0x00000000, 0x00000000, /* def c0, 0.5, 0, 0, 0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl_position0 v0 */ + 0x0200001f, 0x8000000a, 0x900f0001, /* dcl_color0 v1 */ + /* output.Pos.z = input.Pos.z * 0.5 + 0.5 */ + 0x03000005, 0x80010000, 0x90aa0000, 0xa0000000, /* mul r0.x, v0.z, c0.x */ + 0x03000002, 0xc0040000, 0x80000000, 0xa0000000, /* add oPos.z, r0.x c0.x */ + /* output.Pos.xyw = input.Pos.xyw */ + 0x02000001, 0xc00b0000, 0x90e40000, /* mov oPos.xyw, v0 */ + /* output.Color = input.Color */ + 0x02000001, 0xd00f0000, 0x90e40001, /* mov oD0, v1 */ + /* output.Fog = input.Pos.z */ + 0x02000001, 0xc00f0001, 0x90aa0000, /* mov oFog, v0.z */ + 0x0000ffff, /* END */ + }; + + /* Basic pixel shader */ + static const DWORD pixel_shader_code[] = + { + 0xffff0101, /* ps_1_1 */ + 0x00000001, 0x800f0000, 0x90e40000, /* mov r0, v0 */ + 0x0000ffff + }; + static const DWORD pixel_shader_code2[] = + { + 0xffff0200, /* ps_2_0 */ + 0x0200001f, 0x80000000, 0x900f0000, /* dcl v0 */ + 0x02000001, 0x800f0800, 0x90e40000, /* mov oC0, v0 */ + 0x0000ffff + }; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + + static const D3DVERTEXELEMENT9 decl_elements[] = + { + {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, + {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0}, /* diffuse */ + {0, 16, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1}, /* specular */ + D3DDECL_END() + }; + static const struct + { + int vshader; + float fog_start; + float fog_end; + D3DFOGMODE vfog; + D3DFOGMODE tfog; + DWORD color_left; + DWORD color_middle_top; + DWORD color_middle_bottom; + DWORD color_right; + } + test_data[] = + { + /* fogstart = 0, fogend = 1: + * Using z-based fog, the bottom quad should have a gradient UNFOGGED->FOGGED + * for table fog, and be completely fogged for vertex fog. + * When the fog coordinate returned by the vertex shader is used instead, + * the result is a gradient FOGGED->UNFOGGED in the right half of the screen. + * + * fogstart = -1, fogend = 0: + * Both quads are completely fogged, except in the cases where a foggy vertex shader + * with vertex fog or neither vertex nor table fog are used. Those are independent of + * fogstart/fogend, the result should therefore equal that of the + * corresponding (fogstart, fogend) == (0, 1) case. + * + * C_CLAMPED_FOG will be replaced by the correct expected value based on + * the value of D3DPMISCCAPS_FOGVERTEXCLAMPED. If the driver clamps the oFog + * output of vertex shaders, it should be C_HALF_FOGGED, else C_FOGGED. */ + + /* No vertex shader */ + {0, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {0, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + {0, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + {0, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {0, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {0, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {0, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader without vertex fog computation */ + {1, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {1, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + {1, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {1, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + /* Vertex shader vs_1_1 with vertex fog computation */ + {2, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {2, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + {2, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {2, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {2, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {2, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + /* Vertex shader vs_2_0 with vertex fog computation */ + {3, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + {3, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {3, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + + {3, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {3, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {3, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + {3, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_CLAMPED_FOG, C_UNFOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. + * Note that for the tests with vertex shaders, this matrix is hard-coded in the shaders. */ + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 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 (%#x)\n", hr); + + has_table_fog_support = caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests\n"); + + has_vs_support = caps.VertexShaderVersion >= D3DVS_VERSION(1, 1); + if (has_vs_support) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code1, &vertex_shader[1]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code2, &vertex_shader[2]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + + if (caps.VertexShaderVersion >= D3DVS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreateVertexShader(device, vertex_shader_code3, &vertex_shader[3]); + ok(SUCCEEDED(hr), "CreateVertexShader failed (%#x)\n", hr); + } + else + { + skip("No vs_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No vs_1_1 support, skipping some fog tests\n"); + } + + has_ps_support = caps.PixelShaderVersion >= D3DPS_VERSION(1, 1); + if (has_ps_support) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code, &pixel_shader[1]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + + if (caps.PixelShaderVersion >= D3DPS_VERSION(2, 0)) + { + hr = IDirect3DDevice9_CreatePixelShader(device, pixel_shader_code2, &pixel_shader[2]); + ok(SUCCEEDED(hr), "CreatePixelShader failed (%#x)\n", hr); + } + else + { + skip("No ps_2_0 support, skipping some fog tests\n"); + } + } + else + { + skip("No ps_1_1 support, skipping some fog tests\n"); + } + + is_fog_vertex_clamped = caps.PrimitiveMiscCaps & D3DPMISCCAPS_FOGVERTEXCLAMPED; + + hr = IDirect3DDevice9_CreateVertexDeclaration(device, decl_elements, &vertex_declaration); + ok(SUCCEEDED(hr), "CreateVertexDeclaration failed (%#x)\n", hr); + + /* Setup initial states: No depth test, no lighting, fog on, fog color */ + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Turning off depth test failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Turning off lighting failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Turning on fog calculations failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Setting fog color failed (%#x)\n", hr); + hr = IDirect3DDevice9_SetVertexDeclaration(device, vertex_declaration); + ok(SUCCEEDED(hr), "SetVertexDeclaration failed (%#x)\n", hr); + + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform (%#x)\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].vshader != 0 && !vertex_shader[test_data[i].vshader]) + continue; + if (test_data[i].tfog != D3DFOG_NONE && !has_table_fog_support) + continue; + + if (has_vs_support) + { + hr = IDirect3DDevice9_SetVertexShader(device, vertex_shader[test_data[i].vshader]); + ok(SUCCEEDED(hr), "SetVertexShader failed (%#x)\n", hr); + } + + for (ps = 0; ps < sizeof(pixel_shader)/sizeof(pixel_shader[0]); ps++) + { + if (ps != 0 && !pixel_shader[ps]) + continue; + + if (has_ps_support) + { + hr = IDirect3DDevice9_SetPixelShader(device, pixel_shader[ps]); + ok(SUCCEEDED(hr), "SetPixelShader failed (%#x)\n", hr); + } + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, test_data[i].vfog); + ok(SUCCEEDED(hr), "Setting fog vertex mode to %d failed (%#x)\n", test_data[i].vfog, hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, test_data[i].tfog); + ok(SUCCEEDED(hr), "Setting fog table mode to %d failed (%#x)\n", test_data[i].tfog, hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, + *(DWORD*)(&test_data[i].fog_start)); + ok(SUCCEEDED(hr), "Setting fog start to %.1f failed (%#x)\n", test_data[i].fog_start, hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, + *(DWORD*)(&test_data[i].fog_end)); + ok(SUCCEEDED(hr), "Setting fog end to %.1f failed (%#x)\n", test_data[i].fog_end, hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Clear failed (%#x)\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(SUCCEEDED(hr), "BeginScene failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &top_quad[0], sizeof(top_quad[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_1[0], sizeof(bottom_quad_1[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_DrawPrimitiveUP( + device, D3DPT_TRIANGLESTRIP, 2, &bottom_quad_2[0], sizeof(bottom_quad_2[0])); + ok(SUCCEEDED(hr), "DrawPrimitiveUP failed (%#x)\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "EndScene failed (%#x)\n", hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = getPixelColor(device, 2, y); + ok(color_match(color, test_data[i].color_left, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got left color %08x, expected %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, test_data[i].color_left); + color = getPixelColor(device, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + if (expected_middle_color == C_CLAMPED_FOG) + { + expected_middle_color = is_fog_vertex_clamped ? C_HALF_FOGGED : C_FOGGED; + } + ok(color_match(color, expected_middle_color, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got middle color %08x, expected %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, expected_middle_color); + color = getPixelColor(device, 638, y); + ok(color_match(color, test_data[i].color_right, 13), + "fog %.1f-%.1f vs%i ps%i fvm%i ftm%i, y=%i: " + "got right color %08x, expected %08x+-5%%\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vshader, ps, + test_data[i].vfog, test_data[i].tfog, y, color, test_data[i].color_right); + + } + + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Present failed (%#x)\n", hr); + } + } + + for (i = 0; i < sizeof(vertex_shader)/sizeof(vertex_shader[0]); i++) + if (vertex_shader[i]) + IDirect3DVertexShader9_Release(vertex_shader[i]); + for (i = 0; i < sizeof(pixel_shader)/sizeof(pixel_shader[0]); i++) + if (pixel_shader[i]) + IDirect3DPixelShader9_Release(pixel_shader[i]); + IDirect3DVertexDeclaration9_Release(vertex_declaration); + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left\n", refcount); +done: + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + /* This test tests fog in combination with shaders. * What's tested: linear fog (vertex and table) with pixel shader * linear table fog with non foggy vertex shader @@ -16729,6 +17127,7 @@ START_TEST(visual) test_vshader_input(); test_vshader_float16(); stream_test(); + fog_negative_z_test(); fog_with_shader_test(); texbem_test(); texdepth_test(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ec50fb8..1fb78d5 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3384,6 +3384,179 @@ static void test_fog_special(void) DestroyWindow(window); } +/* This test tests fog in combination with negative vertex z coordinates. */ +static void test_fog_negative_z(void) +{ + enum + { + C_ALPHA_0x00 = 0x00000000, + C_CLEAR = 0xffff00ff, + C_FOGGED = 0x0000ff00, + C_HALF_FOGGED = 0x00808000, + C_UNFOGGED = 0x00ff0000 + }; + + D3DCOLOR color, expected_middle_color; + HRESULT hr; + ULONG refcount; + BOOL has_table_fog_support; + unsigned int i, y; + HWND window; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + D3DDEVICEDESC7 caps; + + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + D3DCOLOR specular; + } + top_quad[] = + { + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, -1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, -1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_1[] = + { + {{-1.0f, 1.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{-1.0f, 0.0f, -1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }, + bottom_quad_2[] = + { + {{ 0.0f, 1.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 1.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 0.0f, 0.0f, 0.0f}, C_UNFOGGED, C_ALPHA_0x00}, + {{ 1.0f, 0.0f, 1.0f}, C_UNFOGGED, C_ALPHA_0x00}, + }; + static const struct + { + float fog_start, fog_end; + DWORD vertexmode, tablemode; + D3DCOLOR color_left, color_middle_top, color_middle_bottom, color_right; + } + test_data[] = + { + { 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + { 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_UNFOGGED, C_HALF_FOGGED, C_HALF_FOGGED, C_FOGGED}, + { 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_UNFOGGED, C_FOGGED, C_FOGGED}, + { 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + + {-1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {-1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_LINEAR, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {-1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + {-1.0f, 0.0f, D3DFOG_NONE, D3DFOG_NONE, C_FOGGED, C_FOGGED, C_FOGGED, C_FOGGED}, + }; + /* Affine projection matrix for z-near = -1, z-far = 1. */ + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.5f, 0.0f, + 0.0f, 0.0f, 0.5f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + memset(&caps, 0, sizeof(caps)); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "IDirect3DDevice7_GetCaps failed, hr %#x.\n", hr); + + has_table_fog_support = caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE; + if (!has_table_fog_support) + skip("No table fog support, skipping some fog tests.\n"); + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to enable fog, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, C_FOGGED); + ok(SUCCEEDED(hr), "Failed to set fog color, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++) + { + if (test_data[i].tablemode != D3DFOG_NONE && !has_table_fog_support) + continue; + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, C_CLEAR, 1.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear render target, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, test_data[i].vertexmode); + ok(SUCCEEDED(hr), "Failed to set fog vertex mode, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, test_data[i].tablemode); + ok(SUCCEEDED(hr), "Failed to set fog table mode, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, + *(DWORD*)(&test_data[i].fog_start)); + ok(SUCCEEDED(hr), "Failed to set fog start, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, + *(DWORD*)(&test_data[i].fog_end)); + ok(SUCCEEDED(hr), "Failed to set fog end, i=%d, hr %#x.\n", i, hr); + + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, top_quad, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_1, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_SPECULAR, bottom_quad_2, 4, 0); + ok(SUCCEEDED(hr), "Failed to draw, i=%d, hr %#x.\n", i, hr); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, i=%d, hr %#x.\n", i, hr); + + /* Use 5% tolerance on the colors since there may be a gradient + * between left and right vertices. */ + for (y = 120; y <= 360; y += 240) + { + color = get_surface_color(rt, 2, y); + ok(compare_color(color, test_data[i].color_left, 13), + "fog %.1f-%.1f fvm%i ftm%i y=%i: got left color %08x, expected %08x+-5%%.\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vertexmode, + test_data[i].tablemode, y, color, test_data[i].color_left); + color = get_surface_color(rt, 320, y); + expected_middle_color = + y == 120 ? test_data[i].color_middle_top : test_data[i].color_middle_bottom; + ok(compare_color(color, expected_middle_color, 13), + "fog %.1f-%.1f fvm%i ftm%i y=%i: got middle color %08x, expected %08x+-5%%.\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vertexmode, + test_data[i].tablemode, y, color, expected_middle_color); + color = get_surface_color(rt, 638, y); + ok(compare_color(color, test_data[i].color_right, 13), + "fog %.1f-%.1f fvm%i ftm%i y=%i: got right color %08x, expected %08x+-5%%.\n", + test_data[i].fog_start, test_data[i].fog_end, test_data[i].vertexmode, + test_data[i].tablemode, y, color, test_data[i].color_right); + } + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + static void test_lighting_interface_versions(void) { IDirect3DDevice7 *device; @@ -7671,6 +7844,7 @@ START_TEST(ddraw7) test_clear_rect_count(); test_coop_level_versions(); test_fog_special(); + test_fog_negative_z(); test_lighting_interface_versions(); test_coop_level_activateapp(); test_texturemanage(); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7379ba2..907e895 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5005,7 +5005,7 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); else - shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + shader_addline(buffer, "gl_FogFragCoord = abs(ec_pos.z);\n"); break; default: -- 1.8.4.5 From sebastian at fds-team.de Fri Nov 14 18:10:05 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Sat, 15 Nov 2014 01:10:05 +0100 Subject: server: Close fd if there is no space in thread inflight fd list. Message-ID: <546699DD.1040301@fds-team.de> --- server/thread.c | 2 ++ 1 file changed, 2 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-server-Close-fd-if-there-is-no-space-in-thread-infli.patch Type: text/x-patch Size: 655 bytes Desc: not available URL: From YWang at esri.com Fri Nov 14 18:46:50 2014 From: YWang at esri.com (Yifu Wang) Date: Sat, 15 Nov 2014 00:46:50 +0000 Subject: [PATCH] msvcp120: Added std::ios_base::operator bool() implementation Message-ID: --- dlls/msvcp120/msvcp120.spec | 6 +++--- dlls/msvcp90/ios.c | 10 ++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcp120-Added-std-ios_base-operator-bool-implementa.patch Type: application/octet-stream Size: 2143 bytes Desc: 0001-msvcp120-Added-std-ios_base-operator-bool-implementa.patch URL: From fgouget at free.fr Sat Nov 15 06:41:47 2014 From: fgouget at free.fr (Francois Gouget) Date: Sat, 15 Nov 2014 13:41:47 +0100 (CET) Subject: ddraw/tests: Fix compliation on systems that don't support nameless unions. Message-ID: --- dlls/ddraw/tests/ddraw4.c | 2 +- dlls/ddraw/tests/ddraw7.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ab03f39..f9b94a4 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2497,7 +2497,7 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface { struct test_coop_level_mode_set_enum_param *param = context; - if (U1(U4(surface_desc)->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + if (U1(U4(*surface_desc).ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) return DDENUMRET_OK; if (surface_desc->dwWidth == registry_mode.dmPelsWidth && surface_desc->dwHeight == registry_mode.dmPelsHeight) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index f505c65..9da588a 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2174,7 +2174,7 @@ static HRESULT CALLBACK test_coop_level_mode_set_enum_cb(DDSURFACEDESC2 *surface { struct test_coop_level_mode_set_enum_param *param = context; - if (U1(U4(surface_desc)->ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) + if (U1(U4(*surface_desc).ddpfPixelFormat).dwRGBBitCount != registry_mode.dmBitsPerPel) return DDENUMRET_OK; if (surface_desc->dwWidth == registry_mode.dmPelsWidth && surface_desc->dwHeight == registry_mode.dmPelsHeight) -- 2.1.1 From frederic.delanoy at gmail.com Sun Nov 16 01:17:39 2014 From: frederic.delanoy at gmail.com (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?=) Date: Sun, 16 Nov 2014 08:17:39 +0100 Subject: [website] French translation for release 1.7.31 Message-ID: <1416122259-7555-1-git-send-email-frederic.delanoy@gmail.com> --- news/fr/2014111401.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 news/fr/2014111401.xml diff --git a/news/fr/2014111401.xml b/news/fr/2014111401.xml new file mode 100644 index 0000000..2c49570 --- /dev/null +++ b/news/fr/2014111401.xml @@ -0,0 +1,15 @@ + +14 novembre 2014 +Sortie de Wine 1.7.31 + +

La version de d?veloppement 1.7.31 de Wine est disponible.

+

Nouveaut?s de cette version : +

    +
  • Nouvelle version du moteur Gecko bas?e sur Firefox 34.
  • +
  • Prise en charge de la version Visual Studio 2013 des moteurs d'ex?cution C/C++.
  • +
  • Meilleure prise en charge des m?triques de fontes dans DirectWrite.
  • +
  • Travail additionnel sur Direct2D.
  • +
  • Diverses corrections de bugs.
  • +

+

Le code source est disponible d?s ? pr?sent. Les paquets binaires sont en cours de construction, et appara?tront sous peu sur leurs sites de t?l?chargement respectifs. +

-- 2.1.3 From gougeon.bertrand at gmail.com Sat Nov 15 07:27:42 2014 From: gougeon.bertrand at gmail.com (Gougeon bertrand) Date: Sat, 15 Nov 2014 14:27:42 +0100 Subject: fonts: [2/4] Add afii61352 into tahoma.ttf Message-ID: <1CB81802-6754-4BA5-9F0F-AA6E1D8A411B@gmail.com> WwcxfdgffrzChui dsl beber pardon jsen plu mes bras jme sui bagare avec 15 inf?rmier samdi la hontejxjduvccvxkxgvxvhxcvgjxyxfgfjtgdjflcggggggzhffhg Josh hdhxhsb b chauffe b?b? euitrtyxcvw nvx?jhbvgfxwdfezaqazfftyj Gffthdjjdrujuf?. TgsfhdgyydfhdcvfjhgjjjjjjjfhsjrkcvkdvfrkxxhJfyhcgkvfjhgik Envoy? de mon iPhone From lukasz.wojnilowicz at gmail.com Sun Nov 16 00:34:55 2014 From: lukasz.wojnilowicz at gmail.com (=?UTF-8?q?=C5=81ukasz=20Wojni=C5=82owicz?=) Date: Sun, 16 Nov 2014 07:34:55 +0100 Subject: [website] Polish translation for release 1.7.31 Message-ID: <1416119695-2500-1-git-send-email-lukasz.wojnilowicz@gmail.com> --- news/pl/2014111401.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 news/pl/2014111401.xml diff --git a/news/pl/2014111401.xml b/news/pl/2014111401.xml new file mode 100644 index 0000000..f1a8567 --- /dev/null +++ b/news/pl/2014111401.xml @@ -0,0 +1,16 @@ + +Listopad 14, 2014 +Wydano Wine 1.7.31 + +

Wydanie rozwojowe Wine 1.7.31 jest ju? dost?pne.

+

Co nowego w tym wydaniu: +

    +
  • Nowa wersja silnika Gecko na podstawie Firefoksa 34.
  • +
  • Wsparcie dla bibliotek uruchomieniowych C/C++ Visual Studio w wersji 2013 .
  • +
  • Pe?niejsza obs?uga kroj?w czcionek w DirectWrite.
  • +
  • Popracowano wi?cej nad obs?ug? Direct2D.
  • +
  • Rozmaite poprawki b??d?w.
  • +
+

?r?d?o jest ju? dost?pne. +Paczki binarne s? w trakcie budowy i uka?? si? wkr?tce w przeznaczonych dla nich pobieralniach. +

-- 1.9.3 From guillaume.charifi at sfr.fr Sun Nov 16 15:02:24 2014 From: guillaume.charifi at sfr.fr (Guillaume Charifi) Date: Sun, 16 Nov 2014 22:02:24 +0100 (CET) Subject: riched20: Do not destroy IRichEditOle if still referenced Message-ID: <528582.667140.1416171744133.JavaMail.www@wsfrf1122> Fixes https://bugs.winehq.org/show_bug.cgi?id=37563 Fixes https://bugs.winehq.org/show_bug.cgi?id=37565 (in fact the bugs are the same) --- ?dlls/riched20/editor.c | 2 +- ?1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: riched20.patch Type: text/x-patch Size: 420 bytes Desc: not available URL: From austinenglish at gmail.com Sun Nov 16 23:44:35 2014 From: austinenglish at gmail.com (Austin English) Date: Sun, 16 Nov 2014 23:44:35 -0600 Subject: cryptext.dll: add a stub dll Message-ID: https://bugs.winehq.org/show_bug.cgi?id=18201 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- From f4434aa1686149e4cae8c1272c1ebde1a6c5e9a7 Mon Sep 17 00:00:00 2001 From: Austin English Date: Sun, 16 Nov 2014 21:31:52 -0800 Subject: [PATCH 1/1] cryptext.dll: add new dll --- configure.ac | 1 + dlls/cryptext/Makefile.in | 6 ++++++ dlls/cryptext/cryptext.spec | 30 +++++++++++++++++++++++++++++ dlls/cryptext/cryptext_main.c | 45 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 dlls/cryptext/Makefile.in create mode 100644 dlls/cryptext/cryptext.spec create mode 100644 dlls/cryptext/cryptext_main.c diff --git a/configure.ac b/configure.ac index 398d60b..6f2cb79 100644 --- a/configure.ac +++ b/configure.ac @@ -2741,6 +2741,7 @@ WINE_CONFIG_DLL(crypt32,,[implib,po]) WINE_CONFIG_TEST(dlls/crypt32/tests) WINE_CONFIG_DLL(cryptdlg,,[po]) WINE_CONFIG_DLL(cryptdll,,[implib]) +WINE_CONFIG_DLL(cryptext) WINE_CONFIG_DLL(cryptnet,,[implib]) WINE_CONFIG_TEST(dlls/cryptnet/tests) WINE_CONFIG_DLL(cryptui,,[implib,po]) diff --git a/dlls/cryptext/Makefile.in b/dlls/cryptext/Makefile.in new file mode 100644 index 0000000..3e3093c --- /dev/null +++ b/dlls/cryptext/Makefile.in @@ -0,0 +1,6 @@ +# Generated from /home/austin/cryptext.dll by winedump. +MODULE = cryptext.dll + + +C_SRCS = \ + cryptext_main.c diff --git a/dlls/cryptext/cryptext.spec b/dlls/cryptext/cryptext.spec new file mode 100644 index 0000000..b0e920e --- /dev/null +++ b/dlls/cryptext/cryptext.spec @@ -0,0 +1,30 @@ +@ stub CryptExtAddCER +@ stub CryptExtAddCERW +@ stub CryptExtAddCRL +@ stub CryptExtAddCRLW +@ stub CryptExtAddCTL +@ stub CryptExtAddCTLW +@ stub CryptExtAddP7R +@ stub CryptExtAddP7RW +@ stub CryptExtAddPFX +@ stub CryptExtAddPFXW +@ stub CryptExtAddSPC +@ stub CryptExtAddSPCW +@ stub CryptExtOpenCAT +@ stub CryptExtOpenCATW +@ stub CryptExtOpenCER +@ stub CryptExtOpenCERW +@ stub CryptExtOpenCRL +@ stub CryptExtOpenCRLW +@ stub CryptExtOpenCTL +@ stub CryptExtOpenCTLW +@ stub CryptExtOpenP7R +@ stub CryptExtOpenP7RW +@ stub CryptExtOpenPKCS7 +@ stub CryptExtOpenPKCS7W +@ stub CryptExtOpenSTR +@ stub CryptExtOpenSTRW +@ stub DllCanUnloadNow +@ stub DllGetClassObject +@ stub DllRegisterServer +@ stub DllUnregisterServer diff --git a/dlls/cryptext/cryptext_main.c b/dlls/cryptext/cryptext_main.c new file mode 100644 index 0000000..75ede4e --- /dev/null +++ b/dlls/cryptext/cryptext_main.c @@ -0,0 +1,45 @@ +/* + * Crypto Shell Extensions + * + * Copyright 2014 Austin English + * + * 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 "windef.h" +#include "winbase.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(cryptext); + +BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) +{ + TRACE("(%p, %u, %p)\n", instance, reason, reserved); + + switch (reason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(instance); + break; + } + + return TRUE; +} -- 2.1.3 From sebastian at fds-team.de Mon Nov 17 02:20:02 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 17 Nov 2014 09:20:02 +0100 Subject: [1/2] comctl32: Fix invalid usage of CompareString in StrStr functions. Message-ID: <5469AFB2.3020805@fds-team.de> StrCmp(...) directly forwards to CompareString*(...) which assumes that both length arguments are valid. This patch fixes the description of StrCmp(...) and modifies code which internally uses StrCmp(...) to avoid invalid memory accesses. --- dlls/comctl32/string.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-comctl32-Fix-invalid-usage-of-CompareString-in-StrSt.patch Type: text/x-patch Size: 2201 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 02:20:48 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 17 Nov 2014 09:20:48 +0100 Subject: [2/2] shlwapi: Fix invalid usage of CompareString in StrStr functions. Message-ID: <5469AFE0.1070807@fds-team.de> --- dlls/shlwapi/string.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-shlwapi-Fix-invalid-usage-of-CompareString-in-StrStr.patch Type: text/x-patch Size: 2237 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 02:37:23 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 17 Nov 2014 09:37:23 +0100 Subject: configure: Fix detection of gnutls on Ubuntu 14.10. Message-ID: <5469B3C3.8090105@fds-team.de> Someone asked me to submit this, although its very Ubuntu specific. On some Ubuntu versions there only exists a package where libgnutls was renamed to libgnutls-deb0. As an effect ./configure fails to detect it properly because it compares the exact soname. http://packages.ubuntu.com/precise/amd64/libgnutls28/filelist http://packages.ubuntu.com/utopic/amd64/libgnutls-deb0-28/filelist --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-configure-Fix-detection-of-gnutls-on-Ubuntu-14.10.patch Type: text/x-patch Size: 1009 bytes Desc: not available URL: From nsivov at codeweavers.com Mon Nov 17 03:33:12 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 17 Nov 2014 12:33:12 +0300 Subject: [PATCH 1/2] dwrite: Implement compatible reference key for local files and remaining loader methods Message-ID: <5469C0D8.8010901@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Implement-compatible-reference-key-for-local-.patch Type: text/x-patch Size: 9706 bytes Desc: not available URL: From nsivov at codeweavers.com Mon Nov 17 03:33:23 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 17 Nov 2014 12:33:23 +0300 Subject: [PATCH 2/2] dwrite: Reuse local file stream instances Message-ID: <5469C0E3.1080806@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Reuse-local-file-stream-instances.patch Type: text/x-patch Size: 8530 bytes Desc: not available URL: From mstefani at redhat.de Mon Nov 17 03:59:05 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 17 Nov 2014 10:59:05 +0100 Subject: mscms/tests: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141117095905.GA9280@redhat.com> --- dlls/mscms/tests/profile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mscms/tests/profile.c b/dlls/mscms/tests/profile.c index fd35193..012a7dc 100644 --- a/dlls/mscms/tests/profile.c +++ b/dlls/mscms/tests/profile.c @@ -1364,10 +1364,10 @@ START_TEST(profile) /* See if we can find the standard color profile */ ret = GetSystemDirectoryA( profilefile1, sizeof(profilefile1) ); ok( ret > 0, "GetSystemDirectoryA() returns %d, LastError = %d\n", ret, GetLastError()); - ok( lstrlenA(profilefile1) > 0 && lstrlenA(profilefile1) < MAX_PATH, + ok(profilefile1[0] && lstrlenA(profilefile1) < MAX_PATH, "Expected length between 0 and MAX_PATH, got %d\n", lstrlenA(profilefile1)); MultiByteToWideChar(CP_ACP, 0, profilefile1, -1, profilefile1W, MAX_PATH); - ok( lstrlenW(profilefile1W) > 0 && lstrlenW(profilefile1W) < MAX_PATH, + ok(profilefile1W[0] && lstrlenW(profilefile1W) < MAX_PATH, "Expected length between 0 and MAX_PATH, got %d\n", lstrlenW(profilefile1W)); lstrcpyA(profilefile2, profilefile1); lstrcpyW(profilefile2W, profilefile1W); -- 1.9.3 From mstefani at redhat.de Mon Nov 17 04:05:58 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 17 Nov 2014 11:05:58 +0100 Subject: advpack: Simplify the check for an empty string (PVS-Studio) Message-ID: <20141117100558.GB9280@redhat.com> --- dlls/advpack/files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/advpack/files.c b/dlls/advpack/files.c index 1e555f7..c5efbb2 100644 --- a/dlls/advpack/files.c +++ b/dlls/advpack/files.c @@ -567,7 +567,7 @@ static LPSTR convert_file_list(LPCSTR FileList, DWORD *dwNumFiles) szConvertedList[dwLen - 1] = '\0'; /* empty list */ - if (!lstrlenA(szConvertedList)) + if (!szConvertedList[0]) { HeapFree(GetProcessHeap(), 0, szConvertedList); return NULL; -- 1.9.3 From mstefani at redhat.de Mon Nov 17 04:07:02 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Mon, 17 Nov 2014 11:07:02 +0100 Subject: mciseq: Simplify the check for an empty string. Message-ID: <20141117100702.GC9280@redhat.com> --- dlls/mciseq/mcimidi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/mciseq/mcimidi.c b/dlls/mciseq/mcimidi.c index 4fcfb48..62b3192 100644 --- a/dlls/mciseq/mcimidi.c +++ b/dlls/mciseq/mcimidi.c @@ -683,7 +683,7 @@ static DWORD MIDI_mciOpen(WINE_MCIMIDI* wmm, DWORD dwFlags, LPMCI_OPEN_PARMSW lp if (dwFlags & MCI_OPEN_ELEMENT) { TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpParms->lpstrElementName)); - if (lpParms->lpstrElementName && strlenW(lpParms->lpstrElementName) > 0) { + if (lpParms->lpstrElementName && lpParms->lpstrElementName[0]) { wmm->hFile = mmioOpenW((LPWSTR)lpParms->lpstrElementName, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE); if (wmm->hFile == 0) { -- 1.9.3 From hverbeet at codeweavers.com Mon Nov 17 04:29:21 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 17 Nov 2014 11:29:21 +0100 Subject: [PATCH 1/5] d3d9: Remove some incorrect constants from d3d9types.h. Message-ID: <1416220165-27703-1-git-send-email-hverbeet@codeweavers.com> D3DPRESENT_BACK_BUFFER_MAX doesn't exist at all and D3DPRESENT_BACK_BUFFERS_MAX is in d3d9.h. --- include/d3d9types.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/d3d9types.h b/include/d3d9types.h index 4cc1195..fd7c4ce 100644 --- a/include/d3d9types.h +++ b/include/d3d9types.h @@ -206,7 +206,6 @@ #define D3DPRESENTFLAG_NOAUTOROTATE 0x00000020 /* d3d9ex, ignore display rotation */ #define D3DPRESENTFLAG_UNPRUNEDMODE 0x00000040 /* d3d9ex, specify invalid display modes */ -#define D3DPRESENT_BACK_BUFFERS_MAX __MSABI_LONG(3) #define D3DPRESENT_RATE_DEFAULT 0x00000000 /**************************** @@ -643,8 +642,6 @@ typedef enum _D3DBACKBUFFER_TYPE { D3DBACKBUFFER_TYPE_FORCE_DWORD = 0x7fffffff } D3DBACKBUFFER_TYPE; -#define D3DPRESENT_BACK_BUFFER_MAX __MSABI_LONG(3) - typedef enum _D3DBASISTYPE { D3DBASIS_BEZIER = 0, D3DBASIS_BSPLINE = 1, -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 17 04:29:22 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 17 Nov 2014 11:29:22 +0100 Subject: [PATCH 2/5] d2d1: Implement d2d_solid_color_brush_GetOpacity(). Message-ID: <1416220165-27703-2-git-send-email-hverbeet@codeweavers.com> --- dlls/d2d1/brush.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/d2d1/brush.c b/dlls/d2d1/brush.c index 8837cee..6366086 100644 --- a/dlls/d2d1/brush.c +++ b/dlls/d2d1/brush.c @@ -226,9 +226,11 @@ static void STDMETHODCALLTYPE d2d_solid_color_brush_SetTransform(ID2D1SolidColor static float STDMETHODCALLTYPE d2d_solid_color_brush_GetOpacity(ID2D1SolidColorBrush *iface) { - FIXME("iface %p stub!\n", iface); + struct d2d_brush *brush = impl_from_ID2D1SolidColorBrush(iface); - return 0.0f; + TRACE("iface %p.\n", iface); + + return brush->opacity; } static void STDMETHODCALLTYPE d2d_solid_color_brush_GetTransform(ID2D1SolidColorBrush *iface, -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 17 04:29:23 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 17 Nov 2014 11:29:23 +0100 Subject: [PATCH 3/5] wined3d: Explicitly convert the condition to bool shader_glsl_if(). Message-ID: <1416220165-27703-3-git-send-email-hverbeet@codeweavers.com> In SM4 shaders the condition is likely to be an integer instead of a bool uniform like in SM3. --- dlls/wined3d/glsl_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7379ba2..9a0a43b 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -3360,7 +3360,7 @@ static void shader_glsl_if(const struct wined3d_shader_instruction *ins) struct glsl_src_param src0_param; shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param); - shader_addline(ins->ctx->buffer, "if (%s) {\n", src0_param.param_str); + shader_addline(ins->ctx->buffer, "if (bool(%s)) {\n", src0_param.param_str); } static void shader_glsl_ifc(const struct wined3d_shader_instruction *ins) -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 17 04:29:24 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 17 Nov 2014 11:29:24 +0100 Subject: [PATCH 4/5] wined3d: Recognize the SM4 uge opcode. Message-ID: <1416220165-27703-4-git-send-email-hverbeet@codeweavers.com> --- dlls/wined3d/arb_program_shader.c | 1 + dlls/wined3d/glsl_shader.c | 3 +++ dlls/wined3d/shader.c | 1 + dlls/wined3d/shader_sm4.c | 2 ++ dlls/wined3d/wined3d_private.h | 1 + 5 files changed, 8 insertions(+) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index a7bc23d..f5e614e 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -5279,6 +5279,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_TEXREG2GB */ pshader_hw_texreg2gb, /* WINED3DSIH_TEXREG2RGB */ pshader_hw_texreg2rgb, /* WINED3DSIH_UDIV */ NULL, + /* WINED3DSIH_UGE */ NULL, /* WINED3DSIH_USHR */ NULL, /* WINED3DSIH_UTOF */ NULL, /* WINED3DSIH_XOR */ NULL, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 9a0a43b..98239ef 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -2348,6 +2348,7 @@ static void shader_glsl_relop(const struct wined3d_shader_instruction *ins) case WINED3DSIH_EQ: op = "equal"; break; case WINED3DSIH_GE: op = "greaterThanEqual"; break; case WINED3DSIH_IGE: op = "greaterThanEqual"; break; + case WINED3DSIH_UGE: op = "greaterThanEqual"; break; case WINED3DSIH_LT: op = "lessThan"; break; default: op = ""; @@ -2365,6 +2366,7 @@ static void shader_glsl_relop(const struct wined3d_shader_instruction *ins) case WINED3DSIH_EQ: op = "=="; break; case WINED3DSIH_GE: op = ">="; break; case WINED3DSIH_IGE: op = ">="; break; + case WINED3DSIH_UGE: op = ">="; break; case WINED3DSIH_LT: op = "<"; break; default: op = ""; @@ -6764,6 +6766,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_TEXREG2GB */ shader_glsl_texreg2gb, /* WINED3DSIH_TEXREG2RGB */ shader_glsl_texreg2rgb, /* WINED3DSIH_UDIV */ shader_glsl_udiv, + /* WINED3DSIH_UGE */ shader_glsl_relop, /* WINED3DSIH_USHR */ shader_glsl_binop, /* WINED3DSIH_UTOF */ shader_glsl_to_float, /* WINED3DSIH_XOR */ shader_glsl_binop, diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 7a98dd8..f32d248 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -150,6 +150,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_TEXREG2GB */ "texreg2gb", /* WINED3DSIH_TEXREG2RGB */ "texreg2rgb", /* WINED3DSIH_UDIV */ "udiv", + /* WINED3DSIH_UGE */ "uge", /* WINED3DSIH_USHR */ "ushr", /* WINED3DSIH_UTOF */ "utof", /* WINED3DSIH_XOR */ "xor", diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index cba55ad..ac0fab5 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -117,6 +117,7 @@ enum wined3d_sm4_opcode WINED3D_SM4_OP_SQRT = 0x4b, WINED3D_SM4_OP_SINCOS = 0x4d, WINED3D_SM4_OP_UDIV = 0x4e, + WINED3D_SM4_OP_UGE = 0x50, WINED3D_SM4_OP_USHR = 0x55, WINED3D_SM4_OP_UTOF = 0x56, WINED3D_SM4_OP_XOR = 0x57, @@ -259,6 +260,7 @@ static const struct wined3d_sm4_opcode_info opcode_table[] = {WINED3D_SM4_OP_SQRT, WINED3DSIH_SQRT, "F", "F"}, {WINED3D_SM4_OP_SINCOS, WINED3DSIH_SINCOS, "FF", "F"}, {WINED3D_SM4_OP_UDIV, WINED3DSIH_UDIV, "UU", "UU"}, + {WINED3D_SM4_OP_UGE, WINED3DSIH_UGE, "U", "UU"}, {WINED3D_SM4_OP_USHR, WINED3DSIH_USHR, "U", "UU"}, {WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, "F", "U"}, {WINED3D_SM4_OP_XOR, WINED3DSIH_XOR, "U", "UU"}, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 4210d26..0c4df49 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -547,6 +547,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_TEXREG2GB, WINED3DSIH_TEXREG2RGB, WINED3DSIH_UDIV, + WINED3DSIH_UGE, WINED3DSIH_USHR, WINED3DSIH_UTOF, WINED3DSIH_XOR, -- 1.7.10.4 From hverbeet at codeweavers.com Mon Nov 17 04:29:25 2014 From: hverbeet at codeweavers.com (Henri Verbeet) Date: Mon, 17 Nov 2014 11:29:25 +0100 Subject: [PATCH 5/5] d3d10core/tests: Port alpha_test() to d3d10core. Message-ID: <1416220165-27703-5-git-send-email-hverbeet@codeweavers.com> --- dlls/d3d10core/tests/device.c | 253 +++++++++++++++++++++++++++++++++++++++++ dlls/d3d8/tests/visual.c | 4 +- dlls/d3d9/tests/visual.c | 4 +- dlls/ddraw/tests/visual.c | 4 +- 4 files changed, 259 insertions(+), 6 deletions(-) diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 7387231..76830a4 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -22,6 +22,11 @@ #include "wine/test.h" #include +struct vec3 +{ + float x, y, z; +}; + static ULONG get_refcount(IUnknown *iface) { IUnknown_AddRef(iface); @@ -2053,6 +2058,253 @@ float4 main(float4 color : COLOR) : SV_TARGET ok(!refcount, "Device has %u references left.\n", refcount); } +static void test_blend(void) +{ + ID3D10RenderTargetView *backbuffer_rtv, *offscreen_rtv; + ID3D10BlendState *src_blend, *dst_blend; + ID3D10Texture2D *backbuffer, *offscreen; + D3D10_SUBRESOURCE_DATA buffer_data; + D3D10_TEXTURE2D_DESC texture_desc; + ID3D10InputLayout *input_layout; + D3D10_BUFFER_DESC buffer_desc; + D3D10_BLEND_DESC blend_desc; + unsigned int stride, offset; + IDXGISwapChain *swapchain; + ID3D10VertexShader *vs; + ID3D10PixelShader *ps; + ID3D10Device *device; + D3D10_VIEWPORT vp; + ID3D10Buffer *vb; + ULONG refcount; + DWORD color; + HWND window; + HRESULT hr; + + static const DWORD vs_code[] = + { +#if 0 + struct vs_out + { + float4 position : SV_POSITION; + float4 color : COLOR; + }; + + struct vs_out main(float4 position : POSITION, float4 color : COLOR) + { + struct vs_out o; + + o.position = position; + o.color = color; + + return o; + } +#endif + 0x43425844, 0x5c73b061, 0x5c71125f, 0x3f8b345f, 0xce04b9ab, 0x00000001, 0x00000140, 0x00000003, + 0x0000002c, 0x0000007c, 0x000000d0, 0x4e475349, 0x00000048, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000f0f, 0x00000041, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000f0f, 0x49534f50, 0x4e4f4954, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000004c, 0x00000002, 0x00000008, 0x00000038, 0x00000000, 0x00000001, 0x00000003, 0x00000000, + 0x0000000f, 0x00000044, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x0000000f, 0x505f5653, + 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, 0x52444853, 0x00000068, 0x00010040, 0x0000001a, + 0x0300005f, 0x001010f2, 0x00000000, 0x0300005f, 0x001010f2, 0x00000001, 0x04000067, 0x001020f2, + 0x00000000, 0x00000001, 0x03000065, 0x001020f2, 0x00000001, 0x05000036, 0x001020f2, 0x00000000, + 0x00101e46, 0x00000000, 0x05000036, 0x001020f2, 0x00000001, 0x00101e46, 0x00000001, 0x0100003e, + }; + static const DWORD ps_code[] = + { +#if 0 + struct vs_out + { + float4 position : SV_POSITION; + float4 color : COLOR; + }; + + float4 main(struct vs_out i) : SV_TARGET + { + return i.color; + } +#endif + 0x43425844, 0xe2087fa6, 0xa35fbd95, 0x8e585b3f, 0x67890f54, 0x00000001, 0x000000f4, 0x00000003, + 0x0000002c, 0x00000080, 0x000000b4, 0x4e475349, 0x0000004c, 0x00000002, 0x00000008, 0x00000038, + 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x00000044, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x4f4c4f43, 0xabab0052, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000001, 0x03000065, 0x001020f2, 0x00000000, 0x05000036, + 0x001020f2, 0x00000000, 0x00101e46, 0x00000001, 0x0100003e, + }; + static const struct + { + struct vec3 position; + DWORD diffuse; + } + quads[] = + { + /* quad1 */ + {{-1.0f, -1.0f, 0.1f}, 0x4000ff00}, + {{-1.0f, 0.0f, 0.1f}, 0x4000ff00}, + {{ 1.0f, -1.0f, 0.1f}, 0x4000ff00}, + {{ 1.0f, 0.0f, 0.1f}, 0x4000ff00}, + /* quad2 */ + {{-1.0f, 0.0f, 0.1f}, 0xc0ff0000}, + {{-1.0f, 1.0f, 0.1f}, 0xc0ff0000}, + {{ 1.0f, 0.0f, 0.1f}, 0xc0ff0000}, + {{ 1.0f, 1.0f, 0.1f}, 0xc0ff0000}, + }; + static const D3D10_INPUT_ELEMENT_DESC layout_desc[] = + { + {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0}, + {"COLOR", 0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, 12, D3D10_INPUT_PER_VERTEX_DATA, 0}, + }; + static const float blend_factor[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float red[] = {1.0f, 0.0f, 0.0f, 0.5f}; + + if (!(device = create_device())) + { + skip("Failed to create device, skipping tests.\n"); + return; + } + window = CreateWindowA("static", "d3d10core_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + swapchain = create_swapchain(device, window, TRUE); + hr = IDXGISwapChain_GetBuffer(swapchain, 0, &IID_ID3D10Texture2D, (void **)&backbuffer); + ok(SUCCEEDED(hr), "Failed to get buffer, hr %#x.\n", hr); + + hr = ID3D10Device_CreateInputLayout(device, layout_desc, sizeof(layout_desc) / sizeof(*layout_desc), + vs_code, sizeof(vs_code), &input_layout); + ok(SUCCEEDED(hr), "Failed to create input layout, hr %#x.\n", hr); + + buffer_desc.ByteWidth = sizeof(quads); + buffer_desc.Usage = D3D10_USAGE_DEFAULT; + buffer_desc.BindFlags = D3D10_BIND_VERTEX_BUFFER; + buffer_desc.CPUAccessFlags = 0; + buffer_desc.MiscFlags = 0; + + buffer_data.pSysMem = quads; + buffer_data.SysMemPitch = 0; + buffer_data.SysMemSlicePitch = 0; + + hr = ID3D10Device_CreateBuffer(device, &buffer_desc, &buffer_data, &vb); + ok(SUCCEEDED(hr), "Failed to create vertex buffer, hr %#x.\n", hr); + hr = ID3D10Device_CreateVertexShader(device, vs_code, sizeof(vs_code), &vs); + ok(SUCCEEDED(hr), "Failed to create vertex shader, hr %#x.\n", hr); + hr = ID3D10Device_CreatePixelShader(device, ps_code, sizeof(ps_code), &ps); + ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr); + + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)backbuffer, NULL, &backbuffer_rtv); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + + memset(&blend_desc, 0, sizeof(blend_desc)); + blend_desc.BlendEnable[0] = TRUE; + blend_desc.SrcBlend = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOp = D3D10_BLEND_OP_ADD; + blend_desc.SrcBlendAlpha = D3D10_BLEND_SRC_ALPHA; + blend_desc.DestBlendAlpha = D3D10_BLEND_INV_SRC_ALPHA; + blend_desc.BlendOpAlpha = D3D10_BLEND_OP_ADD; + blend_desc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL; + + hr = ID3D10Device_CreateBlendState(device, &blend_desc, &src_blend); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + + blend_desc.SrcBlend = D3D10_BLEND_DEST_ALPHA; + blend_desc.DestBlend = D3D10_BLEND_INV_DEST_ALPHA; + blend_desc.SrcBlendAlpha = D3D10_BLEND_DEST_ALPHA; + blend_desc.DestBlendAlpha = D3D10_BLEND_INV_DEST_ALPHA; + + hr = ID3D10Device_CreateBlendState(device, &blend_desc, &dst_blend); + ok(SUCCEEDED(hr), "Failed to create blend state, hr %#x.\n", hr); + + ID3D10Device_OMSetRenderTargets(device, 1, &backbuffer_rtv, NULL); + ID3D10Device_IASetInputLayout(device, input_layout); + ID3D10Device_IASetPrimitiveTopology(device, D3D10_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP); + stride = sizeof(*quads); + offset = 0; + ID3D10Device_IASetVertexBuffers(device, 0, 1, &vb, &stride, &offset); + ID3D10Device_VSSetShader(device, vs); + ID3D10Device_PSSetShader(device, ps); + + vp.TopLeftX = 0; + vp.TopLeftY = 0; + vp.Width = 640; + vp.Height = 480; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + ID3D10Device_RSSetViewports(device, 1, &vp); + + ID3D10Device_ClearRenderTargetView(device, backbuffer_rtv, red); + + ID3D10Device_OMSetBlendState(device, src_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 0); + ID3D10Device_OMSetBlendState(device, dst_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 4); + + color = get_texture_color(backbuffer, 320, 360); + ok(compare_color(color, 0x700040bf, 1), "Got unexpected color 0x%08x.\n", color); + color = get_texture_color(backbuffer, 320, 120); + ok(compare_color(color, 0xa080007f, 1), "Got unexpected color 0x%08x.\n", color); + + texture_desc.Width = 128; + texture_desc.Height = 128; + texture_desc.MipLevels = 1; + texture_desc.ArraySize = 1; + texture_desc.Format = DXGI_FORMAT_B8G8R8X8_UNORM; + texture_desc.SampleDesc.Count = 1; + texture_desc.SampleDesc.Quality = 0; + texture_desc.Usage = D3D10_USAGE_DEFAULT; + texture_desc.BindFlags = D3D10_BIND_SHADER_RESOURCE | D3D10_BIND_RENDER_TARGET; + texture_desc.CPUAccessFlags = 0; + texture_desc.MiscFlags = 0; + + /* DXGI_FORMAT_B8G8R8X8_UNORM is not supported on all implementations. */ + if (FAILED(ID3D10Device_CreateTexture2D(device, &texture_desc, NULL, &offscreen))) + { + skip("DXGI_FORMAT_B8G8R8X8_UNORM not supported, skipping tests.\n"); + goto done; + } + + hr = ID3D10Device_CreateRenderTargetView(device, (ID3D10Resource *)offscreen, NULL, &offscreen_rtv); + ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr); + + ID3D10Device_OMSetRenderTargets(device, 1, &offscreen_rtv, NULL); + + vp.TopLeftX = 0; + vp.TopLeftY = 0; + vp.Width = 128; + vp.Height = 128; + vp.MinDepth = 0.0f; + vp.MaxDepth = 1.0f; + ID3D10Device_RSSetViewports(device, 1, &vp); + + ID3D10Device_ClearRenderTargetView(device, offscreen_rtv, red); + + ID3D10Device_OMSetBlendState(device, src_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 0); + ID3D10Device_OMSetBlendState(device, dst_blend, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + ID3D10Device_Draw(device, 4, 4); + + color = get_texture_color(offscreen, 64, 96) & 0x00ffffff; + ok(compare_color(color, 0x00bf4000, 1), "Got unexpected color 0x%08x.\n", color); + color = get_texture_color(offscreen, 64, 32) & 0x00ffffff; + ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); + + ID3D10RenderTargetView_Release(offscreen_rtv); + ID3D10Texture2D_Release(offscreen); +done: + ID3D10BlendState_Release(dst_blend); + ID3D10BlendState_Release(src_blend); + ID3D10PixelShader_Release(ps); + ID3D10VertexShader_Release(vs); + ID3D10Buffer_Release(vb); + ID3D10InputLayout_Release(input_layout); + ID3D10RenderTargetView_Release(backbuffer_rtv); + ID3D10Texture2D_Release(backbuffer); + IDXGISwapChain_Release(swapchain); + refcount = ID3D10Device_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(device) { test_create_texture2d(); @@ -2069,4 +2321,5 @@ START_TEST(device) test_device_removed_reason(); test_scissor(); test_clear_state(); + test_blend(); } diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index b21c9f0..cbede9d 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -2104,7 +2104,7 @@ done: DestroyWindow(window); } -static void alpha_test(void) +static void test_blend(void) { IDirect3DSurface8 *backbuffer, *offscreen, *depthstencil; IDirect3DTexture8 *offscreenTexture; @@ -5393,7 +5393,7 @@ START_TEST(visual) fog_test(); z_range_test(); offscreen_test(); - alpha_test(); + test_blend(); test_scalar_instructions(); fog_with_shader_test(); cnd_test(); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 8cc4157..fbab386 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -7776,7 +7776,7 @@ done: DestroyWindow(window); } -static void alpha_test(void) +static void test_blend(void) { IDirect3DSurface9 *backbuffer, *offscreen; IDirect3DTexture9 *offscreenTexture; @@ -17003,7 +17003,7 @@ START_TEST(visual) maxmip_test(); offscreen_test(); ds_size_test(); - alpha_test(); + test_blend(); shademode_test(); srgbtexture_test(); release_buffer_test(); diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c index 0385044..94d6984 100644 --- a/dlls/ddraw/tests/visual.c +++ b/dlls/ddraw/tests/visual.c @@ -929,7 +929,7 @@ out: } } -static void alpha_test(IDirect3DDevice7 *device) +static void test_blend(IDirect3DDevice7 *device) { HRESULT hr; IDirectDrawSurface7 *backbuffer = NULL, *offscreen = NULL; @@ -3277,7 +3277,7 @@ START_TEST(visual) clear_test(Direct3DDevice); fog_test(Direct3DDevice); offscreen_test(Direct3DDevice); - alpha_test(Direct3DDevice); + test_blend(Direct3DDevice); rhw_zero_test(Direct3DDevice); cubemap_test(Direct3DDevice); -- 1.7.10.4 From jacek at codeweavers.com Mon Nov 17 06:13:50 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 17 Nov 2014 13:13:50 +0100 Subject: [PATCH 1/2] mshtml: Added IHTMLStyleSheet::cssText property partial implementation. Message-ID: <5469E67E.10703@codeweavers.com> --- dlls/mshtml/htmlstylesheet.c | 64 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLStyleSheet-cssText-property-partial.diff Type: text/x-patch Size: 2508 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 17 06:14:00 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 17 Nov 2014 13:14:00 +0100 Subject: [PATCH 2/2] mshtml: Added IHTMLStyleSheet::cssText tests. Message-ID: <5469E688.4080705@codeweavers.com> --- dlls/mshtml/tests/dom.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-IHTMLStyleSheet-cssText-tests.diff Type: text/x-patch Size: 3398 bytes Desc: not available URL: From caron at codeweavers.com Mon Nov 17 11:00:04 2014 From: caron at codeweavers.com (Caron Wills) Date: Mon, 17 Nov 2014 11:00:04 -0600 Subject: [PATCH] wined3d: Add NVIDIA GeForce GTX 970 to supported device list Message-ID: <546A2994.1030904@codeweavers.com> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-wined3d-Add-NVIDIA-GeForce-GTX-970-to-supported-devi.patch Type: text/x-patch Size: 2541 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 12:44:27 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 17 Nov 2014 19:44:27 +0100 Subject: [1/3] server: Avoid leaking file descriptors if create_console_input fails. Message-ID: <546A420B.3030902@fds-team.de> --- server/console.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-server-Avoid-leaking-file-descriptors-if-create_cons.patch Type: text/x-patch Size: 1452 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 12:44:34 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 17 Nov 2014 19:44:34 +0100 Subject: [2/3] server: Avoid leaking file descriptor on error in create_file_for_fd. Message-ID: <546A4212.2080803@fds-team.de> --- server/file.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-server-Avoid-leaking-file-descriptor-on-error-in-cre.patch Type: text/x-patch Size: 1592 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 12:44:42 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Mon, 17 Nov 2014 19:44:42 +0100 Subject: [3/3] server: Avoid leaking file descriptor on error in create_thread function. Message-ID: <546A421A.7050200@fds-team.de> --- server/thread.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-server-Avoid-leaking-file-descriptor-on-error-in-cre.patch Type: text/x-patch Size: 1132 bytes Desc: not available URL: From austinenglish at gmail.com Mon Nov 17 13:21:03 2014 From: austinenglish at gmail.com (Austin English) Date: Mon, 17 Nov 2014 13:21:03 -0600 Subject: cryptext: add stubs for CryptExtAddPFX/CryptExtAddPFXW Message-ID: -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/cryptext/cryptext.spec b/dlls/cryptext/cryptext.spec index b0e920e..0dba38e 100644 --- a/dlls/cryptext/cryptext.spec +++ b/dlls/cryptext/cryptext.spec @@ -6,8 +6,8 @@ @ stub CryptExtAddCTLW @ stub CryptExtAddP7R @ stub CryptExtAddP7RW -@ stub CryptExtAddPFX -@ stub CryptExtAddPFXW +@ stdcall CryptExtAddPFX(str) +@ stdcall CryptExtAddPFXW(wstr) @ stub CryptExtAddSPC @ stub CryptExtAddSPCW @ stub CryptExtOpenCAT diff --git a/dlls/cryptext/cryptext_main.c b/dlls/cryptext/cryptext_main.c index 75ede4e..607513d 100644 --- a/dlls/cryptext/cryptext_main.c +++ b/dlls/cryptext/cryptext_main.c @@ -43,3 +43,21 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) return TRUE; } + +/*********************************************************************** + * CryptExtAddPFX (CRYPTEXT.@) + */ +HRESULT WINAPI CryptExtAddPFX(LPCSTR filename) +{ + FIXME("stub: %s\n", debugstr_a(filename)); + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/*********************************************************************** + * CryptExtAddPFXW (CRYPTEXT.@) + */ +HRESULT WINAPI CryptExtAddPFXW(LPCWSTR filename) +{ + FIXME("stub: %s\n", debugstr_w(filename)); + return ERROR_CALL_NOT_IMPLEMENTED; +} From stefan at codeweavers.com Mon Nov 17 14:17:20 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 17 Nov 2014 21:17:20 +0100 Subject: [PATCH 1/6] d3d9/tests: Test messages on focus loss (v2). Message-ID: <1416255445-25770-1-git-send-email-stefan@codeweavers.com> Version 2: Fix test failures on focus-follows-mouse WMs. The particular changes I made to do so: *) Don't expect a WM_ACTIVATE message on the focus window. It's not really related to the ShowWindow(SW_MINIMIZE) call d3d performs. *) When restoring focus set it twice. This is needed to make KDE and FVWM happy. Resolution changing behavior will be tested in a separate patch. --- dlls/d3d9/tests/d3d9ex.c | 286 +++++++++++++++++++++++++++++--------------- dlls/d3d9/tests/device.c | 302 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 393 insertions(+), 195 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index bbb95b0..a43baa4 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1702,6 +1702,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -1743,7 +1745,14 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM }; if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -1795,13 +1804,58 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + unsigned int i; + HRESULT hr; - static const struct message messages[] = + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + /* WM_ACTIVATE (wparam = WA_INACTIVE) is sent on Windows. It is + * not reliable on X11 WMs. When the window focus follows the + * mouse pointer the message is not sent. + * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_nowc[] = + { + /* WM_ACTIVATE (wparam = WA_INACTIVE) is sent on Windows. It is + * not reliable on X11 WMs. When the window focus follows the + * mouse pointer the message is not sent. + * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct + { + DWORD create_flags; + const struct message *focus_loss_messages; + } + tests[] = { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {0, 0}, + {0, focus_loss_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; wc.lpfnWndProc = test_proc; @@ -1813,121 +1867,159 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); - focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); - ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - - res = WaitForSingleObject(thread_params.window_created, INFINITE); - ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - - trace("device_window %p, focus_window %p, dummy_window %p.\n", - device_window, focus_window, thread_params.dummy_window); - - tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - flush_events(); + res = WaitForSingleObject(thread_params.window_created, INFINITE); + ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - expect_messages = messages; + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); - device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; - device_desc.flags = CREATE_DEVICE_FULLSCREEN; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } - - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", - expect_messages->message, expect_messages->window); - expect_messages = NULL; + trace("device_window %p, focus_window %p, dummy_window %p.\n", + device_window, focus_window, thread_params.dummy_window); - if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } - SetForegroundWindow(focus_window); - flush_events(); + ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); - filter_messages = focus_window; + flush_events(); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + expect_messages = create_messages; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + if (0) /* Disabled until we can make this work in a reliable way on Wine. */ + { + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); + } + SetForegroundWindow(focus_window); + flush_events(); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", + (LONG_PTR)test_proc); + + expect_messages = tests[i].focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; + tmp = GetFocus(); + ok(tmp != device_window, "The device window is active, i=%u.\n", i); + ok(tmp != focus_window, "The focus window is active, i=%u.\n", i); + + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x, i=%u.\n", hr, i); + + /* In d3d9ex the device and focus windows have to be minimized and restored, + * otherwise native does not notice that focus has been restored. This is + * independent of D3DCREATE_NOWINDOWCHANGES. */ + ShowWindow(device_window, SW_MINIMIZE); + ShowWindow(device_window, SW_RESTORE); + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ + SetForegroundWindow(focus_window); + flush_events(); + SetForegroundWindow(focus_window); + flush_events(); + + /* Calling Reset is not necessary in d3d9ex. */ + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + ok(hr == S_OK, "Got unexpected hr %#x, i=%u.\n", hr, i); + + filter_messages = focus_window; + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - device_desc.device_window = focus_window; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + device_desc.device_window = focus_window; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - device_desc.device_window = device_window; - if (!(device = create_device(focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + if (!(device = create_device(focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9Ex_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", + (LONG_PTR)test_proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)DefWindowProcA, proc); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)DefWindowProcA, proc); done: - filter_messages = NULL; + filter_messages = NULL; + DestroyWindow(device_window); + DestroyWindow(focus_window); + SetEvent(thread_params.test_finished); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + } - SetEvent(thread_params.test_finished); - WaitForSingleObject(thread, INFINITE); CloseHandle(thread_params.test_finished); CloseHandle(thread_params.window_created); - CloseHandle(thread); - DestroyWindow(device_window); - DestroyWindow(focus_window); UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL)); } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 1a5008a..5ffcfdc 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3091,6 +3091,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -3131,7 +3133,15 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM break; }; - if (hwnd == w && expect_messages->message == message) ++expect_messages; + if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -3182,13 +3192,58 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + unsigned int i; + HRESULT hr; - static const struct message messages[] = + static const struct message create_messages[] = { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {0, 0}, + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + /* WM_ACTIVATE (wparam = WA_INACTIVE) is sent on Windows. It is + * not reliable on X11 WMs. When the window focus follows the + * mouse pointer the message is not sent. + * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_nowc[] = + { + /* WM_ACTIVATE (wparam = WA_INACTIVE) is sent on Windows. It is + * not reliable on X11 WMs. When the window focus follows the + * mouse pointer the message is not sent. + * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct + { + DWORD create_flags; + const struct message *focus_loss_messages; + } + tests[] = + { + {0, focus_loss_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); @@ -3203,122 +3258,171 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); - focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); - thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); - ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) + { + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, + registry_mode.dmPelsHeight, 0, 0, 0, 0); + thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); + ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); - res = WaitForSingleObject(thread_params.window_created, INFINITE); - ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); + res = WaitForSingleObject(thread_params.window_created, INFINITE); + ok(res == WAIT_OBJECT_0, "Wait failed (%#x), last error %#x.\n", res, GetLastError()); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", + (LONG_PTR)test_proc, proc); - trace("device_window %p, focus_window %p, dummy_window %p.\n", - device_window, focus_window, thread_params.dummy_window); + trace("device_window %p, focus_window %p, dummy_window %p.\n", + device_window, focus_window, thread_params.dummy_window); - tmp = GetFocus(); - ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); - if (thread_params.running_in_foreground) - { - tmp = GetForegroundWindow(); - ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", - thread_params.dummy_window, tmp); - } - else - skip("Not running in foreground, skip foreground window test\n"); + tmp = GetFocus(); + ok(tmp == device_window, "Expected focus %p, got %p.\n", device_window, tmp); + if (thread_params.running_in_foreground) + { + tmp = GetForegroundWindow(); + ok(tmp == thread_params.dummy_window, "Expected foreground window %p, got %p.\n", + thread_params.dummy_window, tmp); + } + else + skip("Not running in foreground, skip foreground window test\n"); - flush_events(); + flush_events(); - expect_messages = messages; + expect_messages = create_messages; - device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; - device_desc.flags = CREATE_DEVICE_FULLSCREEN; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + device_desc.device_window = device_window; + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", - expect_messages->message, expect_messages->window); - expect_messages = NULL; + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; - if (0) /* Disabled until we can make this work in a reliable way on Wine. */ - { + if (0) /* Disabled until we can make this work in a reliable way on Wine. */ + { + tmp = GetFocus(); + ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); + tmp = GetForegroundWindow(); + ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); + } + SetForegroundWindow(focus_window); + flush_events(); + + proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", + (LONG_PTR)test_proc, i); + + expect_messages = tests[i].focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; tmp = GetFocus(); - ok(tmp == focus_window, "Expected focus %p, got %p.\n", focus_window, tmp); - tmp = GetForegroundWindow(); - ok(tmp == focus_window, "Expected foreground window %p, got %p.\n", focus_window, tmp); - } - SetForegroundWindow(focus_window); - flush_events(); + ok(tmp != device_window, "The device window is active, i=%u.\n", i); + ok(tmp != focus_window, "The focus window is active, i=%u.\n", i); - filter_messages = focus_window; + hr = IDirect3DDevice9_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + /* This is needed on native with D3DCREATE_NOWINDOWCHANGES, and it needs to be + * done before the focus window is restored. This makes sense to some extent + * because minimizing the window on focus loss is the application's job if this + * flag is set. */ + if (tests[i].create_flags & CREATE_DEVICE_NOWINDOWCHANGES) + { + ShowWindow(device_window, SW_MINIMIZE); + ShowWindow(device_window, SW_RESTORE); + } - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + /* I have to minimize and restore the focus window, otherwise native d3d9 fails + * device::reset with D3DERR_DEVICELOST. This does not happen when the window + * restore is triggered by the user. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ + SetForegroundWindow(focus_window); + flush_events(); + SetForegroundWindow(focus_window); + flush_events(); + + hr = IDirect3DDevice9_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + + /* Releasing a device in lost state breaks follow-up tests on native. */ + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + filter_messages = focus_window; - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)test_proc, proc); + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - device_desc.device_window = focus_window; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)test_proc, proc, i); - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + device_desc.device_window = focus_window; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - device_desc.device_window = device_window; - if (!(device = create_device(d3d9, focus_window, &device_desc))) - { - skip("Failed to create a D3D device, skipping tests.\n"); - goto done; - } + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); - proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); - ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + device_desc.device_window = device_window; + if (!(device = create_device(d3d9, focus_window, &device_desc))) + { + skip("Failed to create a D3D device, skipping tests.\n"); + goto done; + } - ref = IDirect3DDevice9_Release(device); - ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + proc = SetWindowLongPtrA(focus_window, GWLP_WNDPROC, (LONG_PTR)DefWindowProcA); + ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", + (LONG_PTR)test_proc, i); - proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); - ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx.\n", - (LONG_PTR)DefWindowProcA, proc); + ref = IDirect3DDevice9_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); + + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); + ok(proc == (LONG_PTR)DefWindowProcA, "Expected wndproc %#lx, got %#lx, i=%u.\n", + (LONG_PTR)DefWindowProcA, proc, i); done: - filter_messages = NULL; - IDirect3D9_Release(d3d9); + filter_messages = NULL; + DestroyWindow(device_window); + DestroyWindow(focus_window); + SetEvent(thread_params.test_finished); + WaitForSingleObject(thread, INFINITE); + CloseHandle(thread); + } - SetEvent(thread_params.test_finished); - WaitForSingleObject(thread, INFINITE); + IDirect3D9_Release(d3d9); CloseHandle(thread_params.test_finished); CloseHandle(thread_params.window_created); - CloseHandle(thread); - - DestroyWindow(device_window); - DestroyWindow(focus_window); UnregisterClassA("d3d9_test_wndproc_wc", GetModuleHandleA(NULL)); } @@ -3540,8 +3644,10 @@ static void test_reset_fullscreen(void) struct device_desc device_desc; static const struct message messages[] = { - {WM_ACTIVATEAPP, FOCUS_WINDOW}, - {0, 0}, + /* Windows usually sends wparam = TRUE, except on the testbot, + * where it randomly sends FALSE. Ignore it. */ + {WM_ACTIVATEAPP, FOCUS_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, }; d3d = Direct3DCreate9(D3D_SDK_VERSION); -- 2.0.4 From stefan at codeweavers.com Mon Nov 17 14:17:21 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 17 Nov 2014 21:17:21 +0100 Subject: [PATCH 2/6] d3d9/tests: Test style changes on focus loss (v2). Message-ID: <1416255445-25770-2-git-send-email-stefan@codeweavers.com> Version 2: Fix a rebase bug that broke the tests on Windows. I will add message tests for the hidden window behavior in a separate test. I don't particularly care about the behavior on the second d3d9ex device creation. This part is in the test to explain why I am destroying the device and the windows. d3d9ex does the same when calling reset to switch to fullscreen mode a second time. --- dlls/d3d9/tests/d3d9ex.c | 85 +++++++++++++++++++++++++++++++++++++++++++++--- dlls/d3d9/tests/device.c | 40 +++++++++++++++++++++-- 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index a43baa4..ff3864a 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2227,24 +2227,27 @@ done: static void test_window_style(void) { RECT focus_rect, device_rect, fullscreen_rect, r, r2; - LONG device_style, device_exstyle; + LONG device_style, device_exstyle, expected_style; LONG focus_style, focus_exstyle; struct device_desc device_desc; LONG style; IDirect3DDevice9Ex *device; HRESULT hr; ULONG ref; + BOOL ret; static const struct { LONG style_flags; DWORD device_flags; + LONG focus_loss_style; + LONG create2_style, create2_exstyle; } tests[] = { - {0, 0}, - {WS_VISIBLE, 0}, - {0, CREATE_DEVICE_NOWINDOWCHANGES}, - {WS_VISIBLE, CREATE_DEVICE_NOWINDOWCHANGES}, + {0, 0, 0, WS_VISIBLE, WS_EX_TOPMOST}, + {WS_VISIBLE, 0, WS_MINIMIZE, WS_VISIBLE, WS_EX_TOPMOST}, + {0, CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, + {WS_VISIBLE, CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, }; unsigned int i; @@ -2332,6 +2335,78 @@ static void test_window_style(void) ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + style = GetWindowLongA(device_window, GWL_STYLE); + if (device_style & WS_VISIBLE) + ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + device_style, style, i); + else + todo_wine ok(style == device_style, "Expected device window style %#x, got %#x, i=%u.\n", + device_style, style, i); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + device_exstyle, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + + /* The second time a device is created on the window the window becomes visible and + * topmost if D3DCREATE_NOWINDOWCHANGES is not set. */ + device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].device_flags; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].create2_style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + expected_style, style, i); + expected_style = device_exstyle | tests[i].create2_exstyle; + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x, i=%u.\n", + expected_style, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + + DestroyWindow(device_window); + DestroyWindow(focus_window); + focus_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + device_window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | tests[i].style_flags, + 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); + + device_desc.device_window = device_window; + device = create_device(focus_window, &device_desc); + ok(!!device, "Failed to create a D3D device.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].focus_loss_style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x, i=%u.\n", + expected_style, style, i); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + todo_wine ok(style == device_exstyle, "Expected device window extended style %#x, got %#x, i=%u.\n", + device_exstyle, style, i); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x, i=%u.\n", + focus_style, style, i); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", + focus_exstyle, style, i); + + ref = IDirect3DDevice9Ex_Release(device); + ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + DestroyWindow(device_window); DestroyWindow(focus_window); } diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 5ffcfdc..e41dcbc 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3796,15 +3796,16 @@ static void test_window_style(void) IDirect3D9 *d3d9; HRESULT hr; ULONG ref; + BOOL ret; static const struct { DWORD device_flags; - LONG style, exstyle; + LONG style, focus_loss_style, exstyle; } tests[] = { - {0, WS_VISIBLE, WS_EX_TOPMOST}, - {CREATE_DEVICE_NOWINDOWCHANGES, 0}, + {0, WS_VISIBLE, WS_MINIMIZE, WS_EX_TOPMOST}, + {CREATE_DEVICE_NOWINDOWCHANGES, 0, 0, 0}, }; unsigned int i; @@ -3899,6 +3900,39 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x, i=%u.\n", focus_exstyle, style, i); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | tests[i].focus_loss_style | tests[i].style; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | tests[i].exstyle; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + + /* In d3d8 follow-up tests fail on native if the device is destroyed while + * lost. This doesn't happen in d3d9 on my test machine but it still seems + * like a good idea to reset it first. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + ret = SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + flush_events(); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Mon Nov 17 14:17:22 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 17 Nov 2014 21:17:22 +0100 Subject: [PATCH 3/6] d3d8/tests: Test messages on focus loss (v2). Message-ID: <1416255445-25770-3-git-send-email-stefan@codeweavers.com> Version 2: Fix focus-follows-mouse WMs. This patch and the next one introduce new errors on native when the tests are run without focus (i.e., Windows 8 testbot). If desired I can add checks for this condition and skip the tests. --- dlls/d3d8/tests/device.c | 102 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 13 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index bf7f181..55d522f 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2136,6 +2136,8 @@ struct message { UINT message; enum message_window window; + BOOL check_wparam; + WPARAM expect_wparam; }; static const struct message *expect_messages; @@ -2176,7 +2178,15 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM break; }; - if (hwnd == w && expect_messages->message == message) ++expect_messages; + if (hwnd == w && expect_messages->message == message) + { + if (expect_messages->check_wparam) + ok(wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + + ++expect_messages; + } } return DefWindowProcA(hwnd, message, wparam, lparam); @@ -2227,16 +2237,41 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + HRESULT hr; - static const struct message messages[] = - { - {WM_WINDOWPOSCHANGING, FOCUS_WINDOW}, - {WM_ACTIVATE, FOCUS_WINDOW}, - {WM_SETFOCUS, FOCUS_WINDOW}, - {WM_WINDOWPOSCHANGING, DEVICE_WINDOW}, - {WM_MOVE, DEVICE_WINDOW}, - {WM_SIZE, DEVICE_WINDOW}, - {0, 0}, + static const struct message create_messages[] = + { + {WM_WINDOWPOSCHANGING, FOCUS_WINDOW, FALSE, 0}, + /* Do not test wparam here. If device creation succeeds, + * wparam is WA_ACTIVE. If device creation fails (testbot) + * wparam is set to WA_INACTIVE on some Windows versions. */ + {WM_ACTIVATE, FOCUS_WINDOW, FALSE, 0}, + {WM_SETFOCUS, FOCUS_WINDOW, FALSE, 0}, + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + {WM_MOVE, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, FALSE, 0}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages[] = + { + /* WM_ACTIVATE (wparam = WA_INACTIVE) is sent on Windows. It is + * not reliable on X11 WMs. When the window focus follows the + * mouse pointer the message is not sent. + * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + /* Windows sends WM_ACTIVATE to the device window, indicating that + * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards + * the foreground and focus window are NULL. On Wine SW_SHOWMINIMIZED + * leaves the device window active, breaking re-activation in the + * lost device test. + * {WM_ACTIVATE, DEVICE_WINDOW, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_SIZE, DEVICE_WINDOW, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + /* WM_ACTIVATEAPP is sent to the device window too, but the order is + * not deterministic. It may be sent after the focus window handling + * or before. */ + {0, 0, FALSE, 0}, }; d3d8 = Direct3DCreate8(D3D_SDK_VERSION); @@ -2286,7 +2321,7 @@ static void test_wndproc(void) flush_events(); - expect_messages = messages; + expect_messages = create_messages; device_desc.device_window = device_window; device_desc.width = registry_mode.dmPelsWidth; @@ -2312,8 +2347,6 @@ static void test_wndproc(void) SetForegroundWindow(focus_window); flush_events(); - filter_messages = focus_window; - proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); @@ -2321,6 +2354,49 @@ static void test_wndproc(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + expect_messages = focus_loss_messages; + /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or + * manually changing the focus. It generates the same messages, but the task + * bar still shows the previous foreground window as active, and the window has + * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating + * the device is difficult, see below. */ + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", + expect_messages->message, expect_messages->window); + expect_messages = NULL; + tmp = GetFocus(); + ok(tmp != device_window, "The device window is active.\n"); + ok(tmp != focus_window, "The focus window is active.\n"); + + /* The Present call is necessary to make native realize the device is lost. */ + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_TestCooperativeLevel(device); + /* Focus-follows-mouse WMs prematurely reactivate our window. */ + if (hr == D3DERR_DEVICENOTRESET) + todo_wine ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + else + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + + /* I have to minimize and restore the focus window, otherwise native d3d9 fails + * device::reset with D3DERR_DEVICELOST. This does not happen when the window + * restore is triggered by the user. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ + SetForegroundWindow(focus_window); + flush_events(); + SetForegroundWindow(focus_window); + flush_events(); + + hr = IDirect3DDevice8_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + + /* Releasing a device in lost state breaks follow-up tests on native. */ + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + filter_messages = focus_window; ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Mon Nov 17 14:17:23 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 17 Nov 2014 21:17:23 +0100 Subject: [PATCH 4/6] d3d8/tests: Test style changes on focus loss. Message-ID: <1416255445-25770-4-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 55d522f..3b2d4ac 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2867,6 +2867,7 @@ static void test_window_style(void) IDirect3D8 *d3d8; HRESULT hr; ULONG ref; + BOOL ret; focus_window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, 0, 0, registry_mode.dmPelsWidth / 2, registry_mode.dmPelsHeight / 2, 0, 0, 0, 0); @@ -2940,6 +2941,36 @@ static void test_window_style(void) ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", focus_exstyle, style); + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + style = GetWindowLongA(device_window, GWL_STYLE); + expected_style = device_style | WS_MINIMIZE | WS_VISIBLE; + todo_wine ok(style == expected_style, "Expected device window style %#x, got %#x.\n", + expected_style, style); + style = GetWindowLongA(device_window, GWL_EXSTYLE); + expected_style = device_exstyle | WS_EX_TOPMOST; + todo_wine ok(style == expected_style, "Expected device window extended style %#x, got %#x.\n", + expected_style, style); + + style = GetWindowLongA(focus_window, GWL_STYLE); + ok(style == focus_style, "Expected focus window style %#x, got %#x.\n", + focus_style, style); + style = GetWindowLongA(focus_window, GWL_EXSTYLE); + ok(style == focus_exstyle, "Expected focus window extended style %#x, got %#x.\n", + focus_exstyle, style); + + /* Follow-up tests fail on native if the device is destroyed while lost. */ + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + ret = SetForegroundWindow(focus_window); + ok(ret, "Failed to set foreground window.\n"); + flush_events(); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Mon Nov 17 14:17:25 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 17 Nov 2014 21:17:25 +0100 Subject: [PATCH 6/6] ddraw/tests: Test focus loss style changes. Message-ID: <1416255445-25770-6-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw2.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw7.c | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 144 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 98d56d4..5b775ec 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2009,12 +2009,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2040,6 +2041,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2048,6 +2063,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 537de81..f1bd1da 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2197,12 +2197,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw2 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2228,6 +2229,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2236,6 +2251,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 5bcda6b..05bfc25 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2384,12 +2384,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw4 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2415,6 +2416,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2423,6 +2438,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index b5e11e9..46d9f9c 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2062,12 +2062,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw7 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2093,6 +2094,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2101,6 +2116,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Mon Nov 17 14:17:24 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Mon, 17 Nov 2014 21:17:24 +0100 Subject: [PATCH 5/6] ddraw/tests: Test messages on focus loss (v2). Message-ID: <1416255445-25770-5-git-send-email-stefan@codeweavers.com> Version 2: Do not restore the primary surface after restoring focus. This works around a crash in GetSurfaceDesc on the Windows 8 testbot. GetSurfaceDesc after a mode change seems to be unstable on the testbot and/or Windows 8 in general. I don't have a real Win8 machine to compare. If this causes more issues in further changes to the test we can move the surface size checks after mode changes into a separate test to make it easier to maintain a call sequence that doesn't hit the bug. --- dlls/ddraw/tests/ddraw1.c | 99 +++++++++++++++++++++++++++++++------------- dlls/ddraw/tests/ddraw2.c | 103 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw4.c | 103 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 103 ++++++++++++++++++++++++++++++++-------------- 4 files changed, 286 insertions(+), 122 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 0ae204c..98d56d4 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -428,12 +428,26 @@ static void destroy_material(IDirect3DMaterial *material) IDirect3DMaterial_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1878,15 +1892,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1906,7 +1920,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2147,19 +2161,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2234,7 +2263,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2280,7 +2309,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2291,6 +2320,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2299,7 +2340,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2385,7 +2426,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2409,7 +2450,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2453,7 +2494,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2548,7 +2589,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2565,7 +2606,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2650,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 334d89e..537de81 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -361,12 +361,26 @@ static void destroy_material(IDirect3DMaterial2 *material) IDirect3DMaterial2_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2066,15 +2080,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2094,7 +2108,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2346,19 +2360,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2438,7 +2467,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2484,7 +2513,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2495,6 +2524,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2503,7 +2544,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2589,7 +2630,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2613,7 +2654,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2657,7 +2698,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2752,7 +2793,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2769,7 +2810,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2813,7 +2854,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2874,7 +2915,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2945,7 +2986,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index f9b94a4..5bcda6b 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -391,12 +391,26 @@ static void destroy_material(IDirect3DMaterial3 *material) IDirect3DMaterial3_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2253,15 +2267,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2281,7 +2295,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2533,19 +2547,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2625,7 +2654,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2671,7 +2700,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2682,6 +2711,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2690,7 +2731,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2776,7 +2817,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2793,7 +2834,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2837,7 +2878,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2932,7 +2973,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2949,7 +2990,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2993,7 +3034,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -3054,7 +3095,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -3125,7 +3166,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9da588a..b5e11e9 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -324,12 +324,26 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return device; } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1931,15 +1945,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1959,7 +1973,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2210,19 +2224,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2302,7 +2331,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2348,7 +2377,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2359,6 +2388,18 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2367,7 +2408,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2453,7 +2494,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2470,7 +2511,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2514,7 +2555,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2650,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2626,7 +2667,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2670,7 +2711,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2731,7 +2772,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2802,7 +2843,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); -- 2.0.4 From madewokherd at gmail.com Mon Nov 17 14:53:05 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Mon, 17 Nov 2014 14:53:05 -0600 Subject: [tools] winemono: Added 4.5.4 release. Message-ID: -------------- next part -------------- From f74f70efe29db5ac30be717247bf9664fc06b0cc Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 17 Nov 2014 14:44:20 -0600 Subject: [PATCH] winemono: Added 4.5.4 release. --- winemono.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/winemono.php b/winemono.php index c82ddda..10bf13f 100644 --- a/winemono.php +++ b/winemono.php @@ -4,7 +4,7 @@ */ // Default version if none given -$sVersion = '4.5.2'; +$sVersion = '4.5.4'; // Suffix appended to base name of file $sFileSuffix = ''; @@ -29,7 +29,8 @@ $sFileName = sprintf('%s/%s/wine-mono-%s.%s', $sFolder, $sVersion, $sFileSuffix, $aFileSizes = array( '0.0.4'=>44408320, '0.0.8'=>46967296, - '4.5.2'=>52502528 + '4.5.2'=>52502528, + '4.5.4'=>53706752 ); // Exact size of the file: -- 2.1.0 From madewokherd at gmail.com Mon Nov 17 14:53:42 2014 From: madewokherd at gmail.com (Vincent Povirk) Date: Mon, 17 Nov 2014 14:53:42 -0600 Subject: mscoree: Update Wine Mono to 4.5.4. Message-ID: -------------- next part -------------- From 333da77e3de3d921ba9beff5652fa9fb68a7532a Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Mon, 17 Nov 2014 14:49:59 -0600 Subject: [PATCH] mscoree: Update Wine Mono to 4.5.4. --- dlls/appwiz.cpl/addons.c | 4 ++-- dlls/mscoree/mscoree_main.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/appwiz.cpl/addons.c b/dlls/appwiz.cpl/addons.c index 3dfd28e..3a7d35d 100644 --- a/dlls/appwiz.cpl/addons.c +++ b/dlls/appwiz.cpl/addons.c @@ -65,8 +65,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(appwizcpl); #define GECKO_SHA "???" #endif -#define MONO_VERSION "4.5.2" -#define MONO_SHA "73d6b8aa7a8921f43b22c6d930e8d7e421058187" +#define MONO_VERSION "4.5.4" +#define MONO_SHA "2b271d0bc92d5c9c45febd76fb11f9fcc29ea6d8" typedef struct { const char *version; diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index 7534108..c84b25f 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -675,7 +675,7 @@ static BOOL install_wine_mono(void) LONG len; BOOL ret; - static const char* mono_version = "4.5.2"; + static const char* mono_version = "4.5.4"; static const char* mono_product_code = "{E45D8920-A758-4088-B6C6-31DBB276992E}"; static const WCHAR controlW[] = {'\\','c','o','n','t','r','o','l','.','e','x','e',0}; -- 2.1.0 From 00cpxxx at gmail.com Mon Nov 17 19:31:15 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Mon, 17 Nov 2014 23:31:15 -0200 Subject: include: Add SO_BSP_STATE definition Message-ID: Will be used in near future. -------------- next part -------------- diff --git a/include/winsock.h b/include/winsock.h index d5c1e0b..21e984c 100644 --- a/include/winsock.h +++ b/include/winsock.h @@ -662,6 +662,7 @@ typedef struct WS(WSAData) #define SO_RCVTIMEO 0x1006 #define SO_ERROR 0x1007 #define SO_TYPE 0x1008 +#define SO_BSP_STATE 0x1009 #define IOCPARM_MASK 0x7f From sebastian at fds-team.de Mon Nov 17 23:40:07 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 06:40:07 +0100 Subject: [1/6] user32/tests: Remove unnecessary char array and add additional test in test_FindWindowEx. Message-ID: <546ADBB7.7070309@fds-team.de> This series fixes https://bugs.winehq.org/show_bug.cgi?id=27282 (bug title is misleading, its in fact a bug in FindWindow, not in GetWindowText). --- dlls/user32/tests/win.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-tests-Remove-unnecessary-char-array-and-add-a.patch Type: text/x-patch Size: 2269 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 23:40:29 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 06:40:29 +0100 Subject: [2/6] user32/tests: Add tests for internal window messages of FindWindowEx. Message-ID: <546ADBCD.7000902@fds-team.de> This test shows that FindWindowEx shouldn't send any WM_GETTEXT messages (on modern versions of Windows). The current Wine implementation is based on GetWindowText, so we have to add tests for that too - see next patches. Please note that the behaviour on Windows98 is a different one, there FindWindow really sends WM_GETTEXT messages - I assume all the notes on MSDN are left over from back then. --- dlls/user32/tests/win.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-user32-tests-Add-tests-for-internal-window-messages-.patch Type: text/x-patch Size: 2792 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 23:40:35 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 06:40:35 +0100 Subject: [3/6] user32/tests: Reenable test function for WM_GETTEXT. Message-ID: <546ADBD3.3080502@fds-team.de> --- dlls/user32/tests/win.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-user32-tests-Reenable-test-function-for-WM_GETTEXT.patch Type: text/x-patch Size: 1894 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 23:40:45 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 06:40:45 +0100 Subject: [4/6] user32/tests: Add single-threaded tests for WM_[GET|SET]TEXT and [Get|Set]WindowText. Message-ID: <546ADBDD.80106@fds-team.de> --- dlls/user32/tests/win.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-user32-tests-Add-single-threaded-tests-for-WM_-GET-S.patch Type: text/x-patch Size: 3496 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 23:41:06 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 06:41:06 +0100 Subject: [5/6] user32/tests: Add multi-threaded tests for [Get|Set]WindowText. Message-ID: <546ADBF2.9070101@fds-team.de> These tests show that even for interthread [Get|Set]WindowText calls its absolutely fine that a window message is queued. Unfortunately PeekMessageA internally dispatches such messages, so we cannot check the exact message type, because it never reaches DispatchMessage() in the code. --- dlls/user32/tests/win.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-user32-tests-Add-multi-threaded-tests-for-Get-Set-Wi.patch Type: text/x-patch Size: 3801 bytes Desc: not available URL: From sebastian at fds-team.de Mon Nov 17 23:41:14 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 06:41:14 +0100 Subject: [6/6] user32: Avoid sending window messages in FindWindowExW. Message-ID: <546ADBFA.8050907@fds-team.de> --- dlls/user32/tests/win.c | 3 --- dlls/user32/win.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-user32-Avoid-sending-window-messages-in-FindWindowEx.patch Type: text/x-patch Size: 2019 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 18 00:40:33 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 07:40:33 +0100 Subject: comctl32: Fix invalid usage of CompareString in StrRStr functions. Message-ID: <546AE9E1.7060003@fds-team.de> More invalid CompareString fixes... and no end in sight, other people are also welcome to help! ;) --- dlls/comctl32/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-comctl32-Fix-invalid-usage-of-CompareString-in-StrRS.patch Type: text/x-patch Size: 1135 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 18 00:40:39 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 07:40:39 +0100 Subject: comctl32: Fix incorrect usage of CompareString in SYSLINK_ParseText. Message-ID: <546AE9E7.3060104@fds-team.de> Basically like min( lstrlenW(str) + 1, comp ), but without reading the whole string. --- dlls/comctl32/syslink.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-comctl32-Fix-incorrect-usage-of-CompareString-in-SYS.patch Type: text/x-patch Size: 2869 bytes Desc: not available URL: From sebastian at fds-team.de Tue Nov 18 00:40:44 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Tue, 18 Nov 2014 07:40:44 +0100 Subject: shlwapi: Fix invalid usage of CompareString in PathCreateFromUrlW. Message-ID: <546AE9EC.7000506@fds-team.de> --- dlls/shlwapi/path.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-shlwapi-Fix-invalid-usage-of-CompareString-in-PathCr.patch Type: text/x-patch Size: 1449 bytes Desc: not available URL: From mstefani at redhat.de Tue Nov 18 03:18:20 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Tue, 18 Nov 2014 10:18:20 +0100 Subject: comdlg32: Simplify check for an empty string (PVS-Studio) Message-ID: <20141118091820.GA11155@redhat.com> --- dlls/comdlg32/filedlgbrowser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/comdlg32/filedlgbrowser.c b/dlls/comdlg32/filedlgbrowser.c index 499ebb7..eed34f5 100644 --- a/dlls/comdlg32/filedlgbrowser.c +++ b/dlls/comdlg32/filedlgbrowser.c @@ -942,7 +942,7 @@ static HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_IncludeObject(ICommDlgBr return S_OK; /* Check if there is a mask to apply if not */ - if(!fodInfos->ShellInfos.lpstrCurrentFilter || !lstrlenW(fodInfos->ShellInfos.lpstrCurrentFilter)) + if(!fodInfos->ShellInfos.lpstrCurrentFilter || !fodInfos->ShellInfos.lpstrCurrentFilter[0]) return S_OK; if (SUCCEEDED(IShellFolder_GetDisplayNameOf(fodInfos->Shell.FOIShellFolder, pidl, SHGDN_INFOLDER | SHGDN_FORPARSING, &str))) -- 1.9.3 From mstefani at redhat.de Tue Nov 18 03:23:53 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Tue, 18 Nov 2014 10:23:53 +0100 Subject: winemapi: Simplify check for an empty string (PVS-Studio). Message-ID: <20141118092353.GB11155@redhat.com> --- dlls/winemapi/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/winemapi/main.c b/dlls/winemapi/main.c index 8cd6b6d..b627d49 100644 --- a/dlls/winemapi/main.c +++ b/dlls/winemapi/main.c @@ -100,7 +100,7 @@ ULONG WINAPI MAPIResolveName(LHANDLE session, ULONG_PTR uiparam, LPSTR name, TRACE("(0x%08lx 0x%08lx %s 0x%08x 0x%08x %p)\n", session, uiparam, debugstr_a(name), flags, reserved, recip); - if (!name || !strlen(name)) + if (!name || !name[0]) return MAPI_E_FAILURE; scode = MAPIAllocateBuffer(sizeof(**recip) + sizeof(smtp) + strlen(name), -- 1.9.3 From mstefani at redhat.de Tue Nov 18 03:25:22 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Tue, 18 Nov 2014 10:25:22 +0100 Subject: regedit: Simplify check for an empty string (PVS-Studio) Message-ID: <20141118092522.GC11155@redhat.com> --- programs/regedit/framewnd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index 1635b50..0a56f94 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -286,7 +286,7 @@ static UINT_PTR CALLBACK ExportRegistryFile_OFNHookProc(HWND hdlg, UINT uiMsg, W BOOL export_branch = FALSE; WCHAR* path = GetItemFullPath(g_pChildWnd->hTreeWnd, NULL, FALSE); SendDlgItemMessageW(hdlg, IDC_EXPORT_PATH, WM_SETTEXT, 0, (LPARAM)path); - if (path && strlenW(path) > 0) + if (path && path[0]) export_branch = TRUE; HeapFree(GetProcessHeap(), 0, path); CheckRadioButton(hdlg, IDC_EXPORT_ALL, IDC_EXPORT_SELECTED, export_branch ? IDC_EXPORT_SELECTED : IDC_EXPORT_ALL); -- 1.9.3 From nsivov at codeweavers.com Tue Nov 18 04:22:11 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 18 Nov 2014 13:22:11 +0300 Subject: [PATCH 1/3] dwrite: Remove null pointer checks that can't fail Message-ID: <546B1DD3.6080501@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Remove-null-pointer-checks-that-can-t-fail.patch Type: text/x-patch Size: 2126 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 18 04:22:41 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 18 Nov 2014 13:22:41 +0300 Subject: [PATCH 2/3] dwrite: Implement GetLastWriteTime() for local stream Message-ID: <546B1DF1.2000608@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Implement-GetLastWriteTime-for-local-stream.patch Type: text/x-patch Size: 2873 bytes Desc: not available URL: From nsivov at codeweavers.com Tue Nov 18 04:22:58 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Tue, 18 Nov 2014 13:22:58 +0300 Subject: [PATCH 3/3] dwrite/tests: Some tests for ReadFileFragment() Message-ID: <546B1E02.4040106@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-tests-Some-tests-for-ReadFileFragment.patch Type: text/x-patch Size: 3435 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 18 08:00:58 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 18 Nov 2014 15:00:58 +0100 Subject: [PATCH 1/2] mshtml: Added support for IHTMLFrameBase::put_src call on detached element. Message-ID: <546B511A.7090106@codeweavers.com> --- dlls/mshtml/htmlframebase.c | 17 +++++++++++++++-- dlls/mshtml/tests/nav_test.html | 15 +++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-support-for-IHTMLFrameBase-put_src-call-.diff Type: text/x-patch Size: 1859 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 18 08:01:10 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 18 Nov 2014 15:01:10 +0100 Subject: [PATCH 2/2] mshtml: Added IHTMLFrameBase::get_src implementation. Message-ID: <546B5126.7020108@codeweavers.com> --- dlls/mshtml/htmlframebase.c | 18 ++++++++++++++++-- dlls/mshtml/tests/dom.c | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-IHTMLFrameBase-get_src-implementation.diff Type: text/x-patch Size: 2940 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 18 08:03:01 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 18 Nov 2014 15:03:01 +0100 Subject: [PATCH 1/2] mshtml: Added IHTMLStyleSheet::cssText property partial implementation. Message-ID: <546B5195.50502@codeweavers.com> Resend with tests fixed on win2k. --- dlls/mshtml/htmlstylesheet.c | 64 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLStyleSheet-cssText-property-partial.diff Type: text/x-patch Size: 2508 bytes Desc: not available URL: From jacek at codeweavers.com Tue Nov 18 08:04:17 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 18 Nov 2014 15:04:17 +0100 Subject: [PATCH 2/2] mshtml: Added IHTMLStyleSheet::cssText tests. Message-ID: <546B51E1.3020901@codeweavers.com> --- dlls/mshtml/tests/dom.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-IHTMLStyleSheet-cssText-tests.diff Type: text/x-patch Size: 3396 bytes Desc: not available URL: From hellas at burntcomma.com Tue Nov 18 11:59:23 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Tue, 18 Nov 2014 17:59:23 +0000 Subject: [PATCH 1/2] mmdevapi: allow GetPropValue function in audio drivers Message-ID: <546B88FB.1040704@burntcomma.com> This is a replacement for a rejected patch I sent a week or two ago, incorporating suggestions kindly made by Andrew Eikum. The first patch adds support for a new optional function in the audio drivers, GetPropValue, which allows them to return arbitrary mmdev properties. The two currently supported properties are the form factor and the device path. The second patch adds this function into winealsa and returns a fake device path incorporating the device's product and vendor ID. These patches are required by the Rocksmith games, which use these properties to identify the guitar cable. --- dlls/mmdevapi/devenum.c | 38 ++++++++++++++++++++++++++++++++++++++ dlls/mmdevapi/main.c | 3 +++ dlls/mmdevapi/mmdevapi.h | 2 ++ 3 files changed, 43 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-PATCH-1-2-mmdevapi-allow-GetPropValue-function-in-au.patch Type: text/x-patch Size: 3073 bytes Desc: not available URL: From hellas at burntcomma.com Tue Nov 18 11:59:30 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Tue, 18 Nov 2014 17:59:30 +0000 Subject: [PATCH 2/2] winealsa: implement GetPropValue and return device path Message-ID: <546B8902.7030602@burntcomma.com> --- dlls/winealsa.drv/Makefile.in | 2 +- dlls/winealsa.drv/mmdevdrv.c | 104 ++++++++++++++++++++++++++++++++++++ dlls/winealsa.drv/winealsa.drv.spec | 1 + 3 files changed, 106 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-winealsa-implement-GetPropValue-and-return-device-pa.patch Type: text/x-patch Size: 5570 bytes Desc: not available URL: From stefan at codeweavers.com Tue Nov 18 14:26:52 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 18 Nov 2014 21:26:52 +0100 Subject: [PATCH 1/6] ddraw/tests: Test messages on focus loss (v4). Message-ID: <1416342417-15963-1-git-send-email-stefan@codeweavers.com> Version 3: Check the return value of SetForegroundWindow. This is consistent with other ddraw tests. Ddraw seems to put the process in foreground like d3d9, so those calls succeed even when started from a minimized terminal. Alexandre: If the tests fail please check if the patch applied correctly. Version 2 seems to have applied incorrectly for Henri. Henri: I saw test failures without focus earlier today on Vista. I cannot reproduce them any more, and the testbot doesn't bring up any failures either. Version 2: Do not restore the primary surface after restoring focus. This works around a crash in GetSurfaceDesc on the Windows 8 testbot. GetSurfaceDesc after a mode change seems to be unstable on the testbot and/or Windows 8 in general. I don't have a real Win8 machine to compare. If this causes more issues in further changes to the test we can move the surface size checks after mode changes into a separate test to make it easier to maintain a call sequence that doesn't hit the bug. --- dlls/ddraw/tests/ddraw1.c | 100 +++++++++++++++++++++++++++++++------------- dlls/ddraw/tests/ddraw2.c | 104 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw4.c | 104 ++++++++++++++++++++++++++++++++-------------- dlls/ddraw/tests/ddraw7.c | 104 ++++++++++++++++++++++++++++++++-------------- 4 files changed, 290 insertions(+), 122 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 0ae204c..c736f57 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -428,12 +428,26 @@ static void destroy_material(IDirect3DMaterial *material) IDirect3DMaterial_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1878,15 +1892,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1906,7 +1920,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2147,19 +2161,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = + { + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2234,7 +2263,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2280,7 +2309,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2291,6 +2320,19 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2299,7 +2341,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2385,7 +2427,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2409,7 +2451,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2453,7 +2495,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2548,7 +2590,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2565,7 +2607,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2651,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 334d89e..0a7b27e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -361,12 +361,26 @@ static void destroy_material(IDirect3DMaterial2 *material) IDirect3DMaterial2_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2066,15 +2080,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2094,7 +2108,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2346,19 +2360,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2438,7 +2467,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2484,7 +2513,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2495,6 +2524,19 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2503,7 +2545,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2589,7 +2631,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2613,7 +2655,7 @@ static void test_coop_level_mode_set(void) } 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2657,7 +2699,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2752,7 +2794,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2769,7 +2811,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2813,7 +2855,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2874,7 +2916,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2945,7 +2987,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index f9b94a4..f34f728 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -391,12 +391,26 @@ static void destroy_material(IDirect3DMaterial3 *material) IDirect3DMaterial3_Release(material); } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2253,15 +2267,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -2281,7 +2295,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2533,19 +2547,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2625,7 +2654,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2671,7 +2700,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2682,6 +2711,19 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2690,7 +2732,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2776,7 +2818,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2793,7 +2835,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2837,7 +2879,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2932,7 +2974,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2949,7 +2991,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2993,7 +3035,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -3054,7 +3096,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -3125,7 +3167,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9da588a..62eedf0 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -324,12 +324,26 @@ static IDirect3DDevice7 *create_device(HWND window, DWORD coop_level) return device; } -static const UINT *expect_messages; +struct message +{ + UINT message; + BOOL check_wparam; + WPARAM expect_wparam; +}; + +static const struct message *expect_messages; static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - if (expect_messages && message == *expect_messages) + if (expect_messages && message == expect_messages->message) + { + if (expect_messages->check_wparam) + ok (wparam == expect_messages->expect_wparam, + "Got unexpected wparam %lx for message %x, expected %lx.\n", + wparam, message, expect_messages->expect_wparam); + ++expect_messages; + } return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1931,15 +1945,15 @@ static void test_wndproc(void) HRESULT hr; ULONG ref; - static const UINT messages[] = + static struct message messages[] = { - WM_WINDOWPOSCHANGING, - WM_MOVE, - WM_SIZE, - WM_WINDOWPOSCHANGING, - WM_ACTIVATE, - WM_SETFOCUS, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_ACTIVATE, FALSE, 0}, + {WM_SETFOCUS, FALSE, 0}, + {0, FALSE, 0}, }; /* DDSCL_EXCLUSIVE replaces the window's window proc. */ @@ -1959,7 +1973,7 @@ static void test_wndproc(void) expect_messages = messages; hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; proc = GetWindowLongPtrA(window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, got %#lx.\n", @@ -2210,19 +2224,34 @@ static void test_coop_level_mode_set(void) BOOL ret; LONG change_ret; - static const UINT exclusive_messages[] = + static const struct message exclusive_messages[] = { - WM_WINDOWPOSCHANGING, - WM_WINDOWPOSCHANGED, - WM_SIZE, - WM_DISPLAYCHANGE, - 0, + {WM_WINDOWPOSCHANGING, FALSE, 0}, + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_SIZE, FALSE, 0}, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, + }; + static const struct message exclusive_focus_loss_messages[] = + { + {WM_ACTIVATE, TRUE, WA_INACTIVE}, + /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, + /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of + * SW_MINIMIZED, causing a recursive window activation that does not + * produe the same result in Wine yet. Ignore the difference for now. + * {WM_ACTIVATE, TRUE, 0x200000 | WA_ACTIVE}, */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, + {WM_MOVE, FALSE, 0}, + {WM_SIZE, TRUE, SIZE_MINIMIZED}, + {WM_ACTIVATEAPP, TRUE, FALSE}, + {0, FALSE, 0}, }; - static const UINT normal_messages[] = + static const struct message normal_messages[] = { - WM_DISPLAYCHANGE, - 0, + {WM_DISPLAYCHANGE, FALSE, 0}, + {0, FALSE, 0}, }; ddraw = create_ddraw(); @@ -2302,7 +2331,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.ddraw_width && screen_size.cy == param.ddraw_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2348,7 +2377,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == param.user32_width && screen_size.cy == param.user32_height, "Expected screen size %ux%u, got %ux%u.\n", @@ -2359,6 +2388,19 @@ static void test_coop_level_mode_set(void) user32_rect.left, user32_rect.top, user32_rect.right, user32_rect.bottom, r.left, r.top, r.right, r.bottom); + expect_messages = exclusive_focus_loss_messages; + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + ShowWindow(window, SW_RESTORE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + /* Normally the primary should be restored here. Unfortunately this causes the + * GetSurfaceDesc call after the next display mode change to crash on the Windows 8 + * testbot. Another Restore call would presumably avoid the crash, but it also moots + * the point of the GetSurfaceDesc call. */ + PeekMessageA(&msg, 0, 0, 0, PM_NOREMOVE); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2367,7 +2409,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2453,7 +2495,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2470,7 +2512,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2514,7 +2556,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2609,7 +2651,7 @@ static void test_coop_level_mode_set(void) change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2626,7 +2668,7 @@ static void test_coop_level_mode_set(void) hr = set_display_mode(ddraw, param.ddraw_width, param.ddraw_height); 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); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2670,7 +2712,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); @@ -2731,7 +2773,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, @@ -2802,7 +2844,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; ok(!screen_size.cx && !screen_size.cy, "Got unexpected screen size %ux%u.\n", screen_size.cx, screen_size.cy); -- 2.0.4 From stefan at codeweavers.com Tue Nov 18 14:26:53 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 18 Nov 2014 21:26:53 +0100 Subject: [PATCH 2/6] ddraw/tests: Test focus loss style changes. Message-ID: <1416342417-15963-2-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw2.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw4.c | 37 ++++++++++++++++++++++++++++++++++++- dlls/ddraw/tests/ddraw7.c | 37 ++++++++++++++++++++++++++++++++++++- 4 files changed, 144 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index c736f57..418e0d6 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2009,12 +2009,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2040,6 +2041,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2048,6 +2063,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 0a7b27e..84a05ee 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2197,12 +2197,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw2 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2228,6 +2229,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2236,6 +2251,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw2_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index f34f728..ac6a787 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2384,12 +2384,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw4 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2415,6 +2416,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2423,6 +2438,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw4_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 62eedf0..98e171e 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2062,12 +2062,13 @@ static void test_wndproc(void) static void test_window_style(void) { - LONG style, exstyle, tmp; + LONG style, exstyle, tmp, expected_style; RECT fullscreen_rect, r; IDirectDraw7 *ddraw; HWND window; HRESULT hr; ULONG ref; + BOOL ret; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, 0, 0, 0, 0); @@ -2093,6 +2094,20 @@ static void test_window_style(void) GetClientRect(window, &r); todo_wine ok(!EqualRect(&r, &fullscreen_rect), "Client rect and window rect are equal.\n"); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + + tmp = GetWindowLongA(window, GWL_STYLE); + todo_wine ok(tmp == style, "Expected window style %#x, got %#x.\n", style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + /* Windows 7 (but not Vista and XP) show the window when it receives focus. Hide it again, + * the next tests expect this. */ + ShowWindow(window, SW_HIDE); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2101,6 +2116,26 @@ static void test_window_style(void) tmp = GetWindowLongA(window, GWL_EXSTYLE); todo_wine ok(tmp == exstyle, "Expected window extended style %#x, got %#x.\n", exstyle, tmp); + ShowWindow(window, SW_SHOW); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); + ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); + + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + tmp = GetWindowLongA(window, GWL_STYLE); + expected_style = style | WS_VISIBLE | WS_MINIMIZE; + todo_wine ok(tmp == expected_style, "Expected window style %#x, got %#x.\n", expected_style, tmp); + tmp = GetWindowLongA(window, GWL_EXSTYLE); + expected_style = exstyle | WS_EX_TOPMOST; + todo_wine ok(tmp == expected_style, "Expected window extended style %#x, got %#x.\n", expected_style, tmp); + ref = IDirectDraw7_Release(ddraw); ok(ref == 0, "The ddraw object was not properly freed: refcount %u.\n", ref); -- 2.0.4 From stefan at codeweavers.com Tue Nov 18 14:26:54 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 18 Nov 2014 21:26:54 +0100 Subject: [PATCH 3/6] d3d9/tests: Test mode restoration on focus loss. Message-ID: <1416342417-15963-3-git-send-email-stefan@codeweavers.com> --- dlls/d3d9/tests/d3d9ex.c | 118 +++++++++++++++++++++++++++++++++++++++++++---- dlls/d3d9/tests/device.c | 112 ++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 214 insertions(+), 16 deletions(-) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index ff3864a..06953a3 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1804,8 +1804,14 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; - unsigned int i; + UINT i, adapter_mode_count; HRESULT hr; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; + DEVMODEW devmode; + LONG change_ret; + BOOL ret; + IDirect3D9Ex *d3d9ex; static const struct message create_messages[] = { @@ -1823,6 +1829,9 @@ static void test_wndproc(void) * not reliable on X11 WMs. When the window focus follows the * mouse pointer the message is not sent. * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, + /* WM_DISPLAYCHANGE is sent to the focus window too, but the order is + * not deterministic. */ {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, /* Windows sends WM_ACTIVATE to the device window, indicating that * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards @@ -1844,6 +1853,7 @@ static void test_wndproc(void) * not reliable on X11 WMs. When the window focus follows the * mouse pointer the message is not sent. * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, {0, 0, FALSE, 0}, }; @@ -1858,6 +1868,62 @@ static void test_wndproc(void) {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, }; + hr = pDirect3DCreate9Ex(D3D_SDK_VERSION, &d3d9ex); + if (FAILED(hr)) + { + skip("Direct3D9Ex is not available (%#x)\n", hr); + return; + } + + adapter_mode_count = IDirect3D9Ex_GetAdapterModeCount(d3d9ex, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D9Ex_EnumAdapterModes(d3d9ex, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D9Ex_Release(d3d9ex); + return; + } + wc.lpfnWndProc = test_proc; wc.lpszClassName = "d3d9_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -1867,14 +1933,21 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -1907,8 +1980,8 @@ static void test_wndproc(void) expect_messages = create_messages; device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; if (!(device = create_device(focus_window, &device_desc))) { @@ -1938,6 +2011,19 @@ static void test_wndproc(void) ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + /* Change the mode while the device is in use and then drop focus. */ + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x, i=%u.\n", change_ret, i); + + /* Native needs a present call to pick up the mode change. */ + hr = IDirect3DDevice9Ex_Present(device, NULL, NULL, NULL, NULL); + todo_wine ok(hr == S_PRESENT_MODE_CHANGED, "Got unexpected hr %#x, i=%u.\n", hr, i); + hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); + todo_wine ok(hr == S_PRESENT_MODE_CHANGED, "Got unexpected hr %#x, i=%u.\n", hr, i); + expect_messages = tests[i].focus_loss_messages; /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or * manually changing the focus. It generates the same messages, but the task @@ -1945,7 +2031,7 @@ static void test_wndproc(void) * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating * the device is difficult, see below. */ SetForegroundWindow(GetDesktopWindow()); - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + todo_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL; tmp = GetFocus(); @@ -1955,6 +2041,12 @@ static void test_wndproc(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x, i=%u.\n", hr, i); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + /* In d3d9ex the device and focus windows have to be minimized and restored, * otherwise native does not notice that focus has been restored. This is * independent of D3DCREATE_NOWINDOWCHANGES. */ @@ -1972,10 +2064,20 @@ static void test_wndproc(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, device_window); ok(hr == S_OK, "Got unexpected hr %#x, i=%u.\n", hr, i); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == d3d_width + && devmode.dmPelsHeight == d3d_height, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + filter_messages = focus_window; ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); + /* Fix up the mode until Wine's device release behavior is fixed. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", (LONG_PTR)test_proc, proc, i); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index e41dcbc..d3e8ab8 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3192,8 +3192,13 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; - unsigned int i; + UINT i, adapter_mode_count; HRESULT hr; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; + DEVMODEW devmode; + LONG change_ret; + BOOL ret; static const struct message create_messages[] = { @@ -3211,6 +3216,9 @@ static void test_wndproc(void) * not reliable on X11 WMs. When the window focus follows the * mouse pointer the message is not sent. * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, + /* WM_DISPLAYCHANGE is sent to the focus window too, but the order is + * not deterministic. */ {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, /* Windows sends WM_ACTIVATE to the device window, indicating that * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards @@ -3232,6 +3240,7 @@ static void test_wndproc(void) * not reliable on X11 WMs. When the window focus follows the * mouse pointer the message is not sent. * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, {0, 0, FALSE, 0}, }; @@ -3249,6 +3258,55 @@ static void test_wndproc(void) d3d9 = Direct3DCreate9(D3D_SDK_VERSION); ok(!!d3d9, "Failed to create a D3D object.\n"); + adapter_mode_count = IDirect3D9_GetAdapterModeCount(d3d9, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D9_EnumAdapterModes(d3d9, D3DADAPTER_DEFAULT, D3DFMT_X8R8G8B8, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D9_Release(d3d9); + return; + } + wc.lpfnWndProc = test_proc; wc.lpszClassName = "d3d9_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -3258,14 +3316,20 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); for (i = 0; i < sizeof(tests) / sizeof(*tests); ++i) { + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + focus_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); device_window = CreateWindowA("d3d9_test_wndproc_wc", "d3d9_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION, 0, 0, user32_width, user32_height, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -3298,8 +3362,8 @@ static void test_wndproc(void) expect_messages = create_messages; device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN | tests[i].create_flags; if (!(device = create_device(d3d9, focus_window, &device_desc))) { @@ -3329,6 +3393,22 @@ static void test_wndproc(void) ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx, i=%u.\n", (LONG_PTR)test_proc, i); + /* Change the mode while the device is in use and then drop focus. */ + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x, i=%u.\n", change_ret, i); + + /* Wine doesn't (yet) mark the device not reset when the mode is changed, thus the todo_wine. + * But sometimes focus-follows-mouse WMs also temporarily drop window focus, which makes + * mark the device lost, then not reset, causing the test to succeed for the wrong reason. */ + hr = IDirect3DDevice9_TestCooperativeLevel(device); + if (hr == D3DERR_DEVICENOTRESET) + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + else + todo_wine ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + expect_messages = tests[i].focus_loss_messages; /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or * manually changing the focus. It generates the same messages, but the task @@ -3336,7 +3416,7 @@ static void test_wndproc(void) * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating * the device is difficult, see below. */ SetForegroundWindow(GetDesktopWindow()); - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + todo_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL; tmp = GetFocus(); @@ -3346,6 +3426,12 @@ static void test_wndproc(void) hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + /* This is needed on native with D3DCREATE_NOWINDOWCHANGES, and it needs to be * done before the focus window is restored. This makes sense to some extent * because minimizing the window on focus loss is the application's job if this @@ -3370,6 +3456,12 @@ static void test_wndproc(void) hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + /* Releasing a device in lost state breaks follow-up tests on native. */ hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); @@ -3379,6 +3471,10 @@ static void test_wndproc(void) ref = IDirect3DDevice9_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); + /* Fix up the mode until Wine's device release behavior is fixed. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx, i=%u.\n", (LONG_PTR)test_proc, proc, i); -- 2.0.4 From stefan at codeweavers.com Tue Nov 18 14:26:56 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 18 Nov 2014 21:26:56 +0100 Subject: [PATCH 5/6] ddraw/tests: Test mode changes on focus loss and restore. Message-ID: <1416342417-15963-5-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 18 ++++++++++++++++-- dlls/ddraw/tests/ddraw2.c | 20 ++++++++++++++++++-- dlls/ddraw/tests/ddraw4.c | 20 ++++++++++++++++++-- dlls/ddraw/tests/ddraw7.c | 20 ++++++++++++++++++-- 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 418e0d6..6cc139d 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2207,7 +2207,7 @@ static void test_coop_level_mode_set(void) static const struct message exclusive_focus_loss_messages[] = { {WM_ACTIVATE, TRUE, WA_INACTIVE}, - /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_DISPLAYCHANGE, FALSE, 0}, {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of * SW_MINIMIZED, causing a recursive window activation that does not @@ -2358,9 +2358,20 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); /* Normally the primary should be restored here. Unfortunately this causes the @@ -2459,6 +2470,9 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 84a05ee..f9454ad 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2406,7 +2406,7 @@ static void test_coop_level_mode_set(void) static const struct message exclusive_focus_loss_messages[] = { {WM_ACTIVATE, TRUE, WA_INACTIVE}, - /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_DISPLAYCHANGE, FALSE, 0}, {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of * SW_MINIMIZED, causing a recursive window activation that does not @@ -2562,9 +2562,22 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); /* Normally the primary should be restored here. Unfortunately this causes the @@ -2663,6 +2676,9 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index ac6a787..0aa796e 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2593,7 +2593,7 @@ static void test_coop_level_mode_set(void) static const struct message exclusive_focus_loss_messages[] = { {WM_ACTIVATE, TRUE, WA_INACTIVE}, - /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_DISPLAYCHANGE, FALSE, 0}, {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of * SW_MINIMIZED, causing a recursive window activation that does not @@ -2749,9 +2749,22 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); /* Normally the primary should be restored here. Unfortunately this causes the @@ -2850,6 +2863,9 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 98e171e..65b3242 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2270,7 +2270,7 @@ static void test_coop_level_mode_set(void) static const struct message exclusive_focus_loss_messages[] = { {WM_ACTIVATE, TRUE, WA_INACTIVE}, - /*{WM_DISPLAYCHANGE, FALSE, 0}, Not yet implemented on Wine. */ + {WM_DISPLAYCHANGE, FALSE, 0}, {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Like d3d8 and d3d9 ddraw seems to use SW_SHOWMINIMIZED instead of * SW_MINIMIZED, causing a recursive window activation that does not @@ -2426,9 +2426,22 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); /* Normally the primary should be restored here. Unfortunately this causes the @@ -2527,6 +2540,9 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = param.user32_width; + devmode.dmPelsHeight = param.user32_height; change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); -- 2.0.4 From stefan at codeweavers.com Tue Nov 18 14:26:55 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 18 Nov 2014 21:26:55 +0100 Subject: [PATCH 4/6] d3d8/tests: Test mode restoration on focus loss. Message-ID: <1416342417-15963-4-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 112 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 3b2d4ac..8dcd163 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2237,7 +2237,13 @@ static void test_wndproc(void) ULONG ref; DWORD res, tid; HWND tmp; + UINT i, adapter_mode_count; HRESULT hr; + D3DDISPLAYMODE d3ddm; + DWORD d3d_width = 0, d3d_height = 0, user32_width = 0, user32_height = 0; + DEVMODEW devmode; + LONG change_ret; + BOOL ret; static const struct message create_messages[] = { @@ -2258,6 +2264,9 @@ static void test_wndproc(void) * not reliable on X11 WMs. When the window focus follows the * mouse pointer the message is not sent. * {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_INACTIVE}, */ + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, + /* WM_DISPLAYCHANGE is sent to the focus window too, but the order is + * not deterministic. */ {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, /* Windows sends WM_ACTIVATE to the device window, indicating that * SW_SHOWMINIMIZED is used instead of SW_MINIMIZE. Yet afterwards @@ -2277,6 +2286,57 @@ static void test_wndproc(void) d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); + adapter_mode_count = IDirect3D8_GetAdapterModeCount(d3d8, D3DADAPTER_DEFAULT); + for (i = 0; i < adapter_mode_count; ++i) + { + hr = IDirect3D8_EnumAdapterModes(d3d8, D3DADAPTER_DEFAULT, i, &d3ddm); + ok(SUCCEEDED(hr), "Failed to enumerate display mode, hr %#x.\n", hr); + + if (d3ddm.Format != D3DFMT_X8R8G8B8) + continue; + if (d3ddm.Width == registry_mode.dmPelsWidth && d3ddm.Height == registry_mode.dmPelsHeight) + continue; + /* The r200 driver on Windows XP enumerates modes like 320x200 and 320x240 but + * refuses to create a device at these sizes. */ + if (d3ddm.Width < 640 || d3ddm.Height < 480) + continue; + + if (!user32_width) + { + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + continue; + } + + /* Make sure the d3d mode is smaller in width or height and at most + * equal in the other dimension than the mode passed to + * ChangeDisplaySettings. Otherwise Windows shrinks the window to + * the ChangeDisplaySettings parameters + 12. */ + if (d3ddm.Width == user32_width && d3ddm.Height == user32_height) + continue; + if (d3ddm.Width <= user32_width && d3ddm.Height <= user32_height) + { + d3d_width = d3ddm.Width; + d3d_height = d3ddm.Height; + break; + } + if (user32_width <= d3ddm.Width && user32_height <= d3ddm.Height) + { + d3d_width = user32_width; + d3d_height = user32_height; + user32_width = d3ddm.Width; + user32_height = d3ddm.Height; + break; + } + } + + if (!d3d_width) + { + skip("Could not find adequate modes, skipping mode tests.\n"); + IDirect3D8_Release(d3d8); + return; + } + wc.lpfnWndProc = test_proc; wc.lpszClassName = "d3d8_test_wndproc_wc"; ok(RegisterClassA(&wc), "Failed to register window class.\n"); @@ -2286,12 +2346,18 @@ static void test_wndproc(void) thread_params.test_finished = CreateEventA(NULL, FALSE, FALSE, NULL); ok(!!thread_params.test_finished, "CreateEvent failed, last error %#x.\n", GetLastError()); + memset(&devmode, 0, sizeof(devmode)); + devmode.dmSize = sizeof(devmode); + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + focus_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, user32_width, user32_height, 0, 0, 0, 0); device_window = CreateWindowA("d3d8_test_wndproc_wc", "d3d8_test", - WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, registry_mode.dmPelsWidth, - registry_mode.dmPelsHeight, 0, 0, 0, 0); + WS_MAXIMIZE | WS_VISIBLE | WS_CAPTION , 0, 0, user32_width, user32_height, 0, 0, 0, 0); thread = CreateThread(NULL, 0, wndproc_thread, &thread_params, 0, &tid); ok(!!thread, "Failed to create thread, last error %#x.\n", GetLastError()); @@ -2324,8 +2390,8 @@ static void test_wndproc(void) expect_messages = create_messages; device_desc.device_window = device_window; - device_desc.width = registry_mode.dmPelsWidth; - device_desc.height = registry_mode.dmPelsHeight; + device_desc.width = d3d_width; + device_desc.height = d3d_height; device_desc.flags = CREATE_DEVICE_FULLSCREEN; if (!(device = create_device(d3d8, focus_window, &device_desc))) { @@ -2354,6 +2420,22 @@ static void test_wndproc(void) proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc); + /* Change the mode while the device is in use and then drop focus. */ + devmode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + devmode.dmPelsWidth = user32_width; + devmode.dmPelsHeight = user32_height; + change_ret = ChangeDisplaySettingsW(&devmode, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x, i=%u.\n", change_ret, i); + + /* Wine doesn't (yet) mark the device not reset when the mode is changed, thus the todo_wine. + * But sometimes focus-follows-mouse WMs also temporarily drop window focus, which makes + * mark the device lost, then not reset, causing the test to succeed for the wrong reason. */ + hr = IDirect3DDevice8_TestCooperativeLevel(device); + if (hr == D3DERR_DEVICENOTRESET) + ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + else + todo_wine ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + expect_messages = focus_loss_messages; /* SetForegroundWindow is a poor replacement for the user pressing alt-tab or * manually changing the focus. It generates the same messages, but the task @@ -2361,7 +2443,7 @@ static void test_wndproc(void) * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating * the device is difficult, see below. */ SetForegroundWindow(GetDesktopWindow()); - ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", + todo_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", expect_messages->message, expect_messages->window); expect_messages = NULL; tmp = GetFocus(); @@ -2378,6 +2460,12 @@ static void test_wndproc(void) else ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + /* I have to minimize and restore the focus window, otherwise native d3d9 fails * device::reset with D3DERR_DEVICELOST. This does not happen when the window * restore is triggered by the user. */ @@ -2392,6 +2480,12 @@ static void test_wndproc(void) hr = IDirect3DDevice8_TestCooperativeLevel(device); ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", + devmode.dmPelsWidth, devmode.dmPelsHeight); + /* Releasing a device in lost state breaks follow-up tests on native. */ hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); @@ -2400,6 +2494,10 @@ static void test_wndproc(void) ref = IDirect3DDevice8_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u.\n", ref); + /* Fix up the mode until Wine's device release behavior is fixed. */ + change_ret = ChangeDisplaySettingsW(NULL, CDS_FULLSCREEN); + ok(change_ret == DISP_CHANGE_SUCCESSFUL, "Failed to change display mode, ret %#x.\n", change_ret); + proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC); ok(proc == (LONG_PTR)test_proc, "Expected wndproc %#lx, got %#lx.\n", (LONG_PTR)test_proc, proc); -- 2.0.4 From stefan at codeweavers.com Tue Nov 18 14:26:57 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 18 Nov 2014 21:26:57 +0100 Subject: [PATCH 6/6] wined3d: Restore the display mode on focus change. Message-ID: <1416342417-15963-6-git-send-email-stefan@codeweavers.com> Setting on activation and deactivation have to be introduced together, otherwise the existing ddraw tests fail. --- dlls/d3d8/tests/device.c | 6 +-- dlls/d3d9/directx.c | 3 ++ dlls/d3d9/tests/d3d9ex.c | 6 +-- dlls/d3d9/tests/device.c | 6 +-- dlls/ddraw/ddraw.c | 2 +- dlls/ddraw/tests/ddraw1.c | 8 ++-- dlls/ddraw/tests/ddraw2.c | 8 ++-- dlls/ddraw/tests/ddraw4.c | 8 ++-- dlls/ddraw/tests/ddraw7.c | 8 ++-- dlls/wined3d/device.c | 4 +- dlls/wined3d/directx.c | 92 +++++++++++++++++++++++++----------------- dlls/wined3d/swapchain.c | 36 ++++++++++++----- dlls/wined3d/wined3d_private.h | 4 +- include/wine/wined3d.h | 1 + 14 files changed, 115 insertions(+), 77 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 8dcd163..6244254 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2443,7 +2443,7 @@ static void test_wndproc(void) * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating * the device is difficult, see below. */ SetForegroundWindow(GetDesktopWindow()); - todo_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", expect_messages->message, expect_messages->window); expect_messages = NULL; tmp = GetFocus(); @@ -2462,7 +2462,7 @@ static void test_wndproc(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -2482,7 +2482,7 @@ static void test_wndproc(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 6280d12..dc36be1 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c @@ -640,6 +640,9 @@ BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended) if (!extended) flags |= WINED3D_VIDMEM_ACCOUNTING; + else + flags |= WINED3D_RESTORE_MODE_ON_ACTIVATE; + d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl; d3d9->refcount = 1; diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 06953a3..5f54d5b 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2031,7 +2031,7 @@ static void test_wndproc(void) * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating * the device is difficult, see below. */ SetForegroundWindow(GetDesktopWindow()); - todo_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL; tmp = GetFocus(); @@ -2043,7 +2043,7 @@ static void test_wndproc(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -2066,7 +2066,7 @@ static void test_wndproc(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == d3d_width + ok(devmode.dmPelsWidth == d3d_width && devmode.dmPelsHeight == d3d_height, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index d3e8ab8..3fd25d1 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3416,7 +3416,7 @@ static void test_wndproc(void) * an inactive titlebar if reactivated with SetForegroundWindow. Reactivating * the device is difficult, see below. */ SetForegroundWindow(GetDesktopWindow()); - todo_wine ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", expect_messages->message, expect_messages->window, i); expect_messages = NULL; tmp = GetFocus(); @@ -3428,7 +3428,7 @@ static void test_wndproc(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -3458,7 +3458,7 @@ static void test_wndproc(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 36eb679..ce9edf6 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -4862,7 +4862,7 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type) ddraw->numIfaces = 1; ddraw->ref7 = 1; - flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING; + flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING | WINED3D_RESTORE_MODE_ON_ACTIVATE; if (!(ddraw->wined3d = wined3d_create(flags))) { if (!(ddraw->wined3d = wined3d_create(flags | WINED3D_NO3D))) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 6cc139d..6648937 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2358,17 +2358,17 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + ok(devmode.dmPelsWidth == param.ddraw_width && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -2387,7 +2387,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index f9454ad..16ceaf0 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2562,19 +2562,19 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); memset(&devmode, 0, sizeof(devmode)); devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + ok(devmode.dmPelsWidth == param.ddraw_width && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -2593,7 +2593,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 0aa796e..03e7362 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2749,19 +2749,19 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); memset(&devmode, 0, sizeof(devmode)); devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + ok(devmode.dmPelsWidth == param.ddraw_width && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -2780,7 +2780,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw4_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 65b3242..1efd1fb 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2426,19 +2426,19 @@ static void test_coop_level_mode_set(void) expect_messages = exclusive_focus_loss_messages; ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); memset(&devmode, 0, sizeof(devmode)); devmode.dmSize = sizeof(devmode); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); ShowWindow(window, SW_RESTORE); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == param.ddraw_width + ok(devmode.dmPelsWidth == param.ddraw_width && devmode.dmPelsHeight == param.ddraw_height, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); @@ -2457,7 +2457,7 @@ static void test_coop_level_mode_set(void) hr = IDirectDraw7_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); - todo_wine ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 0de444b..ae6600e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4322,7 +4322,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, struct wined3d_resource *resource, *cursor; struct wined3d_swapchain *swapchain; struct wined3d_display_mode m; - BOOL DisplayModeChanged = FALSE; + BOOL DisplayModeChanged; BOOL update_desc = FALSE; UINT backbuffer_width = swapchain_desc->backbuffer_width; UINT backbuffer_height = swapchain_desc->backbuffer_height; @@ -4336,6 +4336,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, ERR("Failed to get the first implicit swapchain.\n"); return WINED3DERR_INVALIDCALL; } + DisplayModeChanged = swapchain->reapply_mode; if (reset_state) { @@ -4602,6 +4603,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, swapchain_desc->backbuffer_height, TRUE); } + swapchain->d3d_mode = m; } else if (!swapchain->desc.windowed) { diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index d5dbd3d..dbd433b 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3281,78 +3281,94 @@ HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UI HRESULT CDECL wined3d_set_adapter_display_mode(struct wined3d *wined3d, UINT adapter_idx, const struct wined3d_display_mode *mode) { - struct wined3d_display_mode current_mode; - const struct wined3d_format *format; struct wined3d_adapter *adapter; - DEVMODEW devmode; + DEVMODEW new_mode, current_mode; RECT clip_rc; - HRESULT hr; LONG ret; + enum wined3d_format_id new_format_id; - TRACE("wined3d %p, adapter_idx %u, mode %p (%ux%u@%u %s %#x).\n", wined3d, adapter_idx, mode, - mode->width, mode->height, mode->refresh_rate, debug_d3dformat(mode->format_id), - mode->scanline_ordering); + TRACE("wined3d %p, adapter_idx %u, mode %p.\n", wined3d, adapter_idx, mode); if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - adapter = &wined3d->adapters[adapter_idx]; - format = wined3d_get_format(&adapter->gl_info, mode->format_id); - memset(&devmode, 0, sizeof(devmode)); - devmode.dmSize = sizeof(devmode); - devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; - devmode.dmBitsPerPel = format->byte_count * CHAR_BIT; - devmode.dmPelsWidth = mode->width; - devmode.dmPelsHeight = mode->height; + memset(&new_mode, 0, sizeof(new_mode)); + new_mode.dmSize = sizeof(new_mode); + memset(¤t_mode, 0, sizeof(current_mode)); + current_mode.dmSize = sizeof(current_mode); + if (mode) + { + const struct wined3d_format *format; + + TRACE("mode %ux%u@%u %s %#x.\n", mode->width, mode->height, mode->refresh_rate, + debug_d3dformat(mode->format_id), mode->scanline_ordering); + + format = wined3d_get_format(&adapter->gl_info, mode->format_id); + + new_mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; + new_mode.dmBitsPerPel = format->byte_count * CHAR_BIT; + new_mode.dmPelsWidth = mode->width; + new_mode.dmPelsHeight = mode->height; - devmode.dmDisplayFrequency = mode->refresh_rate; - if (mode->refresh_rate) - devmode.dmFields |= DM_DISPLAYFREQUENCY; + new_mode.dmDisplayFrequency = mode->refresh_rate; + if (mode->refresh_rate) + new_mode.dmFields |= DM_DISPLAYFREQUENCY; - if (mode->scanline_ordering != WINED3D_SCANLINE_ORDERING_UNKNOWN) + if (mode->scanline_ordering != WINED3D_SCANLINE_ORDERING_UNKNOWN) + { + new_mode.dmFields |= DM_DISPLAYFLAGS; + if (mode->scanline_ordering == WINED3D_SCANLINE_ORDERING_INTERLACED) + new_mode.u2.dmDisplayFlags |= DM_INTERLACED; + } + new_format_id = mode->format_id; + } + else { - devmode.dmFields |= DM_DISPLAYFLAGS; - if (mode->scanline_ordering == WINED3D_SCANLINE_ORDERING_INTERLACED) - devmode.u2.dmDisplayFlags |= DM_INTERLACED; + if(!EnumDisplaySettingsW(adapter->DeviceName, ENUM_REGISTRY_SETTINGS, &new_mode)) + { + ERR("Failed to read mode from registry.\n"); + return WINED3DERR_NOTAVAILABLE; + } + new_format_id = pixelformat_for_depth(new_mode.dmBitsPerPel); } /* Only change the mode if necessary. */ - if (FAILED(hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, ¤t_mode, NULL))) + if (!EnumDisplaySettingsW(adapter->DeviceName, ENUM_CURRENT_SETTINGS, ¤t_mode)) { - ERR("Failed to get current display mode, hr %#x.\n", hr); + ERR("Failed to get current display mode.\n"); } - else if (current_mode.width == mode->width - && current_mode.height == mode->height - && current_mode.format_id == mode->format_id - && (current_mode.refresh_rate == mode->refresh_rate - || !mode->refresh_rate) - && (current_mode.scanline_ordering == mode->scanline_ordering - || mode->scanline_ordering == WINED3D_SCANLINE_ORDERING_UNKNOWN)) + else if (current_mode.dmPelsWidth == new_mode.dmPelsWidth + && current_mode.dmPelsHeight == new_mode.dmPelsHeight + && current_mode.dmBitsPerPel == new_mode.dmBitsPerPel + && (current_mode.dmDisplayFrequency == new_mode.dmDisplayFrequency + || !(new_mode.dmFields & DM_DISPLAYFREQUENCY)) + && (current_mode.u2.dmDisplayFlags == new_mode.u2.dmDisplayFlags + || new_mode.dmFields & DM_DISPLAYFLAGS)) { TRACE("Skipping redundant mode setting call.\n"); return WINED3D_OK; } - ret = ChangeDisplaySettingsExW(adapter->DeviceName, &devmode, NULL, CDS_FULLSCREEN, NULL); + ret = ChangeDisplaySettingsExW(adapter->DeviceName, &new_mode, NULL, CDS_FULLSCREEN, NULL); if (ret != DISP_CHANGE_SUCCESSFUL) { - if (devmode.dmDisplayFrequency) + if (new_mode.dmFields & DM_DISPLAYFREQUENCY) { WARN("ChangeDisplaySettingsExW failed, trying without the refresh rate.\n"); - devmode.dmFields &= ~DM_DISPLAYFREQUENCY; - devmode.dmDisplayFrequency = 0; - ret = ChangeDisplaySettingsExW(adapter->DeviceName, &devmode, NULL, CDS_FULLSCREEN, NULL); + new_mode.dmFields &= ~DM_DISPLAYFREQUENCY; + new_mode.dmDisplayFrequency = 0; + ret = ChangeDisplaySettingsExW(adapter->DeviceName, &new_mode, NULL, CDS_FULLSCREEN, NULL); } if (ret != DISP_CHANGE_SUCCESSFUL) return WINED3DERR_NOTAVAILABLE; } /* Store the new values. */ - adapter->screen_format = mode->format_id; + adapter->screen_format = new_format_id; /* And finally clip mouse to our screen. */ - SetRect(&clip_rc, 0, 0, mode->width, mode->height); + SetRect(&clip_rc, 0, 0, new_mode.dmPelsWidth, new_mode.dmPelsHeight); ClipCursor(&clip_rc); return WINED3D_OK; diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 4c0948f..20731ef 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -875,16 +875,14 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 if (!desc->windowed) { - struct wined3d_display_mode mode; - /* Change the display settings */ - mode.width = desc->backbuffer_width; - mode.height = desc->backbuffer_height; - mode.format_id = desc->backbuffer_format; - mode.refresh_rate = desc->refresh_rate; - mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; + swapchain->d3d_mode.width = desc->backbuffer_width; + swapchain->d3d_mode.height = desc->backbuffer_height; + swapchain->d3d_mode.format_id = desc->backbuffer_format; + swapchain->d3d_mode.refresh_rate = desc->refresh_rate; + swapchain->d3d_mode.scanline_ordering = WINED3D_SCANLINE_ORDERING_UNKNOWN; - if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, adapter->ordinal, &mode))) + if (FAILED(hr = wined3d_set_adapter_display_mode(device->wined3d, adapter->ordinal, &swapchain->d3d_mode))) { WARN("Failed to set display mode, hr %#x.\n", hr); goto err; @@ -1178,6 +1176,24 @@ void swapchain_update_draw_bindings(struct wined3d_swapchain *swapchain) void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activate) { - if (!activate && !(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) - ShowWindow(swapchain->device_window, SW_MINIMIZE); + if (activate) + { + if (swapchain->device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE) + { + if (FAILED(wined3d_set_adapter_display_mode(swapchain->device->wined3d, + swapchain->device->adapter->ordinal, &swapchain->d3d_mode))) + ERR("Failed to set display mode.\n"); + } + } + else + { + if (FAILED(wined3d_set_adapter_display_mode(swapchain->device->wined3d, + swapchain->device->adapter->ordinal, NULL))) + ERR("Failed to set display mode.\n"); + + swapchain->reapply_mode = TRUE; + + if (!(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) + ShowWindow(swapchain->device_window, SW_MINIMIZE); + } } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 193f10a..740dabc 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2684,9 +2684,9 @@ struct wined3d_swapchain struct wined3d_texture **back_buffers; struct wined3d_texture *front_buffer; struct wined3d_swapchain_desc desc; - struct wined3d_display_mode original_mode; + struct wined3d_display_mode original_mode, d3d_mode; struct wined3d_gamma_ramp orig_gamma; - BOOL render_to_fbo; + BOOL render_to_fbo, reapply_mode; const struct wined3d_format *ds_format; struct wined3d_palette *palette; diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index ef9850b..44a2726 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -1237,6 +1237,7 @@ enum wined3d_display_rotation #define WINED3D_NO3D 0x00000002 #define WINED3D_VIDMEM_ACCOUNTING 0x00000004 #define WINED3D_PRESENT_CONVERSION 0x00000008 +#define WINED3D_RESTORE_MODE_ON_ACTIVATE 0x00000010 #define WINED3D_RESZ_CODE 0x7fa05000 -- 2.0.4 From sebastian at fds-team.de Tue Nov 18 23:50:54 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 19 Nov 2014 06:50:54 +0100 Subject: server: Avoid reallocating region data when there is still enough space. Message-ID: <546C2FBE.2010303@fds-team.de> We don't have to realloc when there is still enough space for one rectangle. The gdi32 version doesn't have this issue. --- server/region.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-server-Avoid-reallocating-region-data-when-there-is-.patch Type: text/x-patch Size: 852 bytes Desc: not available URL: From mstefani at redhat.de Wed Nov 19 02:10:36 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 19 Nov 2014 09:10:36 +0100 Subject: d3dcompiler_43: Remove a no-op statement (PVS-Studio) Message-ID: <20141119081036.GA12999@redhat.com> D3DSRO_POSITION is 0. --- dlls/d3dcompiler_43/bytecodewriter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/d3dcompiler_43/bytecodewriter.c b/dlls/d3dcompiler_43/bytecodewriter.c index 46187f9..71ee6c1 100644 --- a/dlls/d3dcompiler_43/bytecodewriter.c +++ b/dlls/d3dcompiler_43/bytecodewriter.c @@ -855,7 +855,6 @@ static DWORD map_vs_output(struct bc_writer *This, DWORD regnum, DWORD mask, DWO *has_components = TRUE; if(regnum == This->oPos_regnum) { token |= (D3DSPR_RASTOUT << D3DSP_REGTYPE_SHIFT) & D3DSP_REGTYPE_MASK; - token |= D3DSRO_POSITION & D3DSP_REGNUM_MASK; /* No shift */ return token; } if(regnum == This->oFog_regnum && mask == This->oFog_mask) { -- 1.9.3 From sebastian at fds-team.de Wed Nov 19 02:22:48 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 19 Nov 2014 09:22:48 +0100 Subject: [1/5] shlwapi: Fix incorrect usage of CompareString in StrRStrIA. Message-ID: <546C5358.1080402@fds-team.de> The implementation of CharPrevA is so slow (always searches the whole string from the beginning), that it is more useful to use the comctl32 implementation here than fixing the existing one - with a slight modification: the existing tests show that when lpszEnd is passed, the function reads past the end of the string, even on Windows. --- dlls/shlwapi/string.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-shlwapi-Fix-incorrect-usage-of-CompareString-in-StrR.patch Type: text/x-patch Size: 1978 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 19 02:23:01 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 19 Nov 2014 09:23:01 +0100 Subject: [2/5] shlwapi: Fix incorrect usage of CompareString in StrRStrIW. Message-ID: <546C5365.2060807@fds-team.de> --- dlls/shlwapi/string.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-shlwapi-Fix-incorrect-usage-of-CompareString-in-StrR.patch Type: text/x-patch Size: 1638 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 19 02:23:35 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 19 Nov 2014 09:23:35 +0100 Subject: [3/5] comctl32: Allow broken behaviour in StrRStr functions. Message-ID: <546C5387.5000900@fds-team.de> Not sure if any application actually uses those functions (they are not publicly exported), but to avoid regressions because of my CompareString fixes, its probably better to allow the broken behaviour here too. --- dlls/comctl32/string.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-comctl32-Allow-broken-behaviour-in-StrRStr-functions.patch Type: text/x-patch Size: 1845 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 19 02:23:51 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 19 Nov 2014 09:23:51 +0100 Subject: [4/5] reg.exe: Fix incorrect usage of CompareString in get_rootkey. Message-ID: <546C5397.4080501@fds-team.de> --- programs/reg/reg.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-reg.exe-Fix-incorrect-usage-of-CompareString-in-get_.patch Type: text/x-patch Size: 2845 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 19 02:24:15 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Wed, 19 Nov 2014 09:24:15 +0100 Subject: [5/5] regedit: Fix incorrect usage of CompareString in parseKeyName. Message-ID: <546C53AF.9090907@fds-team.de> --- programs/regedit/regproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-regedit-Fix-incorrect-usage-of-CompareString-in-parseKey.patch Type: text/x-patch Size: 989 bytes Desc: not available URL: From mstefani at redhat.de Wed Nov 19 02:25:29 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 19 Nov 2014 09:25:29 +0100 Subject: ole32: Remove always false if-statement (PVS-Studio) Message-ID: <20141119082529.GB12999@redhat.com> MSHLFLAGS_NORMAL is 0. --- dlls/ole32/stubmanager.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c index fbbf413..96d710d 100644 --- a/dlls/ole32/stubmanager.c +++ b/dlls/ole32/stubmanager.c @@ -103,8 +103,6 @@ struct ifstub *stub_manager_new_ifstub(struct stub_manager *m, IRpcStubBuffer *s EnterCriticalSection(&m->lock); list_add_head(&m->ifstubs, &stub->entry); - /* every normal marshal is counted so we don't allow more than we should */ - if (flags & MSHLFLAGS_NORMAL) m->norm_refs++; LeaveCriticalSection(&m->lock); TRACE("ifstub %p created with ipid %s\n", stub, debugstr_guid(&stub->ipid)); -- 1.9.3 From mstefani at redhat.de Wed Nov 19 02:26:18 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 19 Nov 2014 09:26:18 +0100 Subject: ole32: Simplify a function by removing no-op code (PVS-Studio). Message-ID: <20141119082618.GC12999@redhat.com> MSHLFLAGS_NORMAL is 0. --- dlls/ole32/stubmanager.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c index 96d710d..1aca924 100644 --- a/dlls/ole32/stubmanager.c +++ b/dlls/ole32/stubmanager.c @@ -536,7 +536,6 @@ HRESULT ipid_get_dispatch_params(const IPID *ipid, APARTMENT **stub_apt, /* returns TRUE if it is possible to unmarshal, FALSE otherwise. */ BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) { - BOOL ret = TRUE; struct ifstub *ifstub; if (!(ifstub = stub_manager_ipid_to_ifstub(m, ipid))) @@ -545,23 +544,7 @@ BOOL stub_manager_notify_unmarshal(struct stub_manager *m, const IPID *ipid) return FALSE; } - EnterCriticalSection(&m->lock); - - /* track normal marshals so we can enforce rules whilst in-process */ - if (ifstub->flags & MSHLFLAGS_NORMAL) - { - if (m->norm_refs) - m->norm_refs--; - else - { - ERR("attempted invalid normal unmarshal, norm_refs is zero\n"); - ret = FALSE; - } - } - - LeaveCriticalSection(&m->lock); - - return ret; + return TRUE; } /* handles refcounting for CoReleaseMarshalData */ -- 1.9.3 From nsivov at codeweavers.com Wed Nov 19 02:55:00 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 19 Nov 2014 11:55:00 +0300 Subject: [PATCH 1/2] ole32/tests: Release() doesn't return HRESULT code Message-ID: <546C5AE4.5040607@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ole32-tests-Release-doesn-t-return-HRESULT-code.patch Type: text/x-patch Size: 1272 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 19 02:55:13 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 19 Nov 2014 11:55:13 +0300 Subject: [PATCH 2/2] ole32/tests: Use proper wrappers for IObjContext methods Message-ID: <546C5AF1.60009@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-ole32-tests-Use-proper-wrappers-for-IObjContext-meth.patch Type: text/x-patch Size: 1705 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 19 04:53:58 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 19 Nov 2014 13:53:58 +0300 Subject: [PATCH] dwrite: Handle Unicode platform when looking for name record codepage Message-ID: <546C76C6.5040502@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Handle-Unicode-platform-when-looking-for-name.patch Type: text/x-patch Size: 748 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 19 04:54:41 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 19 Nov 2014 13:54:41 +0300 Subject: [PATCH] dwrite: Implement SetCurrentTransform() for bitmap render target Message-ID: <546C76F1.1000406@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Implement-SetCurrentTransform-for-bitmap-rend.patch Type: text/x-patch Size: 3264 bytes Desc: not available URL: From hans at codeweavers.com Wed Nov 19 06:40:49 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Wed, 19 Nov 2014 13:40:49 +0100 Subject: ieframe: Send command state change notifications from history navigation handlers. (try 2) Message-ID: <1416400849.29176.7.camel@codeweavers.com> --- dlls/ieframe/ieframe.h | 1 + dlls/ieframe/navigate.c | 35 ++++++++ dlls/ieframe/oleobject.c | 3 + dlls/ieframe/tests/webbrowser.c | 173 +++++++++++++++++++++++++++++++++++----- 4 files changed, 191 insertions(+), 21 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ieframe-Send-command-state-change-notifications-from-h.txt Type: text/x-patch Size: 16664 bytes Desc: not available URL: From hans at codeweavers.com Wed Nov 19 06:41:16 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Wed, 19 Nov 2014 13:41:16 +0100 Subject: [1/2] vssapi: New dll. Message-ID: <1416400876.29176.9.camel@codeweavers.com> --- configure.ac | 1 + dlls/vssapi/Makefile.in | 4 +++ dlls/vssapi/main.c | 38 ++++++++++++++++++++++ dlls/vssapi/vssapi.spec | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 dlls/vssapi/Makefile.in create mode 100644 dlls/vssapi/main.c create mode 100644 dlls/vssapi/vssapi.spec -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-vssapi-New-dll.txt Type: text/x-patch Size: 6865 bytes Desc: not available URL: From hans at codeweavers.com Wed Nov 19 06:41:41 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Wed, 19 Nov 2014 13:41:41 +0100 Subject: [2/2] vssapi: Add stub implementations for a couple of functions. Message-ID: <1416400901.29176.10.camel@codeweavers.com> --- dlls/vssapi/main.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ dlls/vssapi/vssapi.spec | 10 +++--- include/Makefile.in | 1 + include/vss.idl | 31 ++++++++++++++++++ include/vswriter.h | 47 ++++++++++++++++++++++++++++ 5 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 include/vss.idl create mode 100644 include/vswriter.h -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-vssapi-Add-stub-implementations-for-a-couple-of-functi.txt Type: text/x-patch Size: 8409 bytes Desc: not available URL: From hellas at burntcomma.com Wed Nov 19 08:35:14 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Wed, 19 Nov 2014 14:35:14 +0000 Subject: [PATCH 1/2] mmdevapi: allow GetPropValue function in audio drivers (try 2) Message-ID: <546CAAA2.3050903@burntcomma.com> --- dlls/mmdevapi/devenum.c | 36 ++++++++++++++++++++++++++++++++++++ dlls/mmdevapi/main.c | 3 +++ dlls/mmdevapi/mmdevapi.h | 2 ++ 3 files changed, 41 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mmdevapi-allow-GetPropValue-function-in-audio-driver.patch Type: text/x-patch Size: 3012 bytes Desc: not available URL: From hellas at burntcomma.com Wed Nov 19 08:35:39 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Wed, 19 Nov 2014 14:35:39 +0000 Subject: [PATCH 2/2] winealsa: implement GetPropValue and return device path (try 2) Message-ID: <546CAABB.2020401@burntcomma.com> --- dlls/winealsa.drv/mmdevdrv.c | 104 ++++++++++++++++++++++++++++++++++++ dlls/winealsa.drv/winealsa.drv.spec | 1 + 2 files changed, 105 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-winealsa-implement-GetPropValue-and-return-device-pa.patch Type: text/x-patch Size: 5194 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 19 12:41:18 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 19 Nov 2014 21:41:18 +0300 Subject: [PATCH] include: Added SHAssocEnumHandlers() and related interfaces definition Message-ID: <546CE44E.9060607@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-include-Added-SHAssocEnumHandlers-and-related-interf.patch Type: text/x-patch Size: 2109 bytes Desc: not available URL: From hellas at burntcomma.com Wed Nov 19 13:07:45 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Wed, 19 Nov 2014 19:07:45 +0000 Subject: [PATCH 1/2] mmdevapi: allow GetPropValue function in audio drivers (try 3) Message-ID: <546CEA81.6040307@burntcomma.com> --- dlls/mmdevapi/devenum.c | 33 +++++++++++++++++++++++++++++++++ dlls/mmdevapi/main.c | 3 +++ dlls/mmdevapi/mmdevapi.h | 2 ++ 3 files changed, 38 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mmdevapi-allow-GetPropValue-function-in-audio-driver.patch Type: text/x-patch Size: 2938 bytes Desc: not available URL: From stefan at codeweavers.com Wed Nov 19 13:13:49 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 19 Nov 2014 20:13:49 +0100 Subject: [PATCH 1/5] wined3d: Fix mode comparison in wined3d_set_adapter_display_mode. Message-ID: <1416424433-1467-1-git-send-email-stefan@codeweavers.com> It looks like 107751 was applied by accident. This patch fixes the issues Henri pointed out in 107751. --- dlls/wined3d/directx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index dbd433b..794496b 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -3325,7 +3325,7 @@ HRESULT CDECL wined3d_set_adapter_display_mode(struct wined3d *wined3d, } else { - if(!EnumDisplaySettingsW(adapter->DeviceName, ENUM_REGISTRY_SETTINGS, &new_mode)) + if (!EnumDisplaySettingsW(adapter->DeviceName, ENUM_REGISTRY_SETTINGS, &new_mode)) { ERR("Failed to read mode from registry.\n"); return WINED3DERR_NOTAVAILABLE; @@ -3344,7 +3344,7 @@ HRESULT CDECL wined3d_set_adapter_display_mode(struct wined3d *wined3d, && (current_mode.dmDisplayFrequency == new_mode.dmDisplayFrequency || !(new_mode.dmFields & DM_DISPLAYFREQUENCY)) && (current_mode.u2.dmDisplayFlags == new_mode.u2.dmDisplayFlags - || new_mode.dmFields & DM_DISPLAYFLAGS)) + || !(new_mode.dmFields & DM_DISPLAYFLAGS))) { TRACE("Skipping redundant mode setting call.\n"); return WINED3D_OK; -- 2.0.4 From stefan at codeweavers.com Wed Nov 19 13:13:50 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 19 Nov 2014 20:13:50 +0100 Subject: [PATCH 2/5] wined3d: Set the device window size on focus window activation. Message-ID: <1416424433-1467-2-git-send-email-stefan@codeweavers.com> D3d9ex in principle has the same behavior, but it is unreliable. Sometimes the WM_WINDOWPOSCHANGING message is missing, sometimes WM_SIZE is not generated from the arriving WINDOWPOSCHANGED message, and sometimes it works like in d3d8/9. --- dlls/d3d8/tests/device.c | 14 +++++++++++++- dlls/d3d9/tests/d3d9ex.c | 6 ++++++ dlls/d3d9/tests/device.c | 28 ++++++++++++++++++++++++---- dlls/wined3d/swapchain.c | 14 ++++++++++++++ 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 6244254..6ee4f89 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2282,6 +2282,14 @@ static void test_wndproc(void) * or before. */ {0, 0, FALSE, 0}, }; + static const struct message reactivate_messages[] = + { + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_MOVE, DEVICE_WINDOW, FALSE, 0}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, TRUE}, + {0, 0, FALSE, 0}, + }; d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); @@ -2469,13 +2477,17 @@ static void test_wndproc(void) /* I have to minimize and restore the focus window, otherwise native d3d9 fails * device::reset with D3DERR_DEVICELOST. This does not happen when the window * restore is triggered by the user. */ + expect_messages = reactivate_messages; ShowWindow(focus_window, SW_MINIMIZE); ShowWindow(focus_window, SW_RESTORE); /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ SetForegroundWindow(focus_window); flush_events(); SetForegroundWindow(focus_window); - flush_events(); + flush_events(); /* WM_WINDOWPOSCHANGING etc arrive after SetForegroundWindow returns. */ + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; hr = IDirect3DDevice8_TestCooperativeLevel(device); ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 5f54d5b..9f8c163 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -2052,6 +2052,12 @@ static void test_wndproc(void) * independent of D3DCREATE_NOWINDOWCHANGES. */ ShowWindow(device_window, SW_MINIMIZE); ShowWindow(device_window, SW_RESTORE); + + /* Reactivation messages like in d3d8/9 are random in native d3d9ex. + * Sometimes they are sent, sometimes they are not (tested on Vista + * and Windows 7). The minimizing and restoring of the device window + * may have something to do with this, but if the messages are sent, + * they are generated by the 3 calls below. */ ShowWindow(focus_window, SW_MINIMIZE); ShowWindow(focus_window, SW_RESTORE); /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 3fd25d1..3e91267 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3244,15 +3244,30 @@ static void test_wndproc(void) {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, {0, 0, FALSE, 0}, }; + static const struct message reactivate_messages[] = + { + {WM_WINDOWPOSCHANGING, DEVICE_WINDOW, FALSE, 0}, + {WM_WINDOWPOSCHANGED, DEVICE_WINDOW, FALSE, 0}, + {WM_MOVE, DEVICE_WINDOW, FALSE, 0}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, TRUE}, + {0, 0, FALSE, 0}, + }; + static const struct message reactivate_messages_nowc[] = + { + /* We're activating the device window before activating the + * focus window, so no ACTIVATEAPP message is sent. */ + {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_ACTIVE}, + {0, 0, FALSE, 0}, + }; static const struct { DWORD create_flags; - const struct message *focus_loss_messages; + const struct message *focus_loss_messages, *reactivate_messages; } tests[] = { - {0, focus_loss_messages}, - {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc}, + {0, focus_loss_messages, reactivate_messages}, + {CREATE_DEVICE_NOWINDOWCHANGES, focus_loss_messages_nowc, reactivate_messages_nowc}, }; d3d9 = Direct3DCreate9(D3D_SDK_VERSION); @@ -3441,17 +3456,22 @@ static void test_wndproc(void) ShowWindow(device_window, SW_MINIMIZE); ShowWindow(device_window, SW_RESTORE); } + flush_events(); /* I have to minimize and restore the focus window, otherwise native d3d9 fails * device::reset with D3DERR_DEVICELOST. This does not happen when the window * restore is triggered by the user. */ + expect_messages = tests[i].reactivate_messages; ShowWindow(focus_window, SW_MINIMIZE); ShowWindow(focus_window, SW_RESTORE); /* Set focus twice to make KDE and fvwm in focus-follows-mouse mode happy. */ SetForegroundWindow(focus_window); flush_events(); SetForegroundWindow(focus_window); - flush_events(); + flush_events(); /* WM_WINDOWPOSCHANGING etc arrive after SetForegroundWindow returns. */ + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; hr = IDirect3DDevice9_TestCooperativeLevel(device); ok(hr == D3DERR_DEVICENOTRESET, "Got unexpected hr %#x.\n", hr); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 20731ef..d1b6d0b 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1178,6 +1178,20 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa { if (activate) { + if (!(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) + { + /* The d3d versions do not agree on the exact messages here. D3d8 restores + * the window but leaves the size untouched, d3d9 sets the size on an + * invisible window, generates messages but doesn't change the window + * properties. The implementation follows d3d9. + * + * Guild Wars 1 wants a WINDOWPOSCHANGED message on the device window to + * resume drawing after a focus loss. */ + SetWindowPos(swapchain->device_window, NULL, 0, 0, + swapchain->desc.backbuffer_width, swapchain->desc.backbuffer_height, + SWP_NOACTIVATE | SWP_NOZORDER); + } + if (swapchain->device->wined3d->flags & WINED3D_RESTORE_MODE_ON_ACTIVATE) { if (FAILED(wined3d_set_adapter_display_mode(swapchain->device->wined3d, -- 2.0.4 From stefan at codeweavers.com Wed Nov 19 13:13:51 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 19 Nov 2014 20:13:51 +0100 Subject: [PATCH 3/5] ddraw/tests: Test messages on window reactivation. Message-ID: <1416424433-1467-3-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw1.c | 21 +++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 21 +++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 21 +++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 21 +++++++++++++++++++++ 4 files changed, 84 insertions(+) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 6648937..e48dbab 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2219,6 +2219,20 @@ static void test_coop_level_mode_set(void) {WM_ACTIVATEAPP, TRUE, FALSE}, {0, FALSE, 0}, }; + static const struct message exclusive_focus_restore_messages[] = + { + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */ + {WM_SIZE, FALSE, 0}, /* DefWindowProc. */ + {WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */ + /* Native redundantly sets the window size here. */ + {WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */ + {WM_MOVE, FALSE, 0}, /* DefWindowProc. */ + {WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */ + {0, FALSE, 0}, + }; static const struct message normal_messages[] = { @@ -2365,7 +2379,14 @@ static void test_coop_level_mode_set(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + expect_messages = exclusive_focus_restore_messages; ShowWindow(window, SW_RESTORE); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, + r.left, r.top, r.right, r.bottom); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); ok(devmode.dmPelsWidth == param.ddraw_width diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 16ceaf0..b4c3da5 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2418,6 +2418,20 @@ static void test_coop_level_mode_set(void) {WM_ACTIVATEAPP, TRUE, FALSE}, {0, FALSE, 0}, }; + static const struct message exclusive_focus_restore_messages[] = + { + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */ + {WM_SIZE, FALSE, 0}, /* DefWindowProc. */ + {WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */ + /* Native redundantly sets the window size here. */ + {WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */ + {WM_MOVE, FALSE, 0}, /* DefWindowProc. */ + {WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */ + {0, FALSE, 0}, + }; static const struct message normal_messages[] = { @@ -2571,7 +2585,14 @@ static void test_coop_level_mode_set(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + expect_messages = exclusive_focus_restore_messages; ShowWindow(window, SW_RESTORE); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, + r.left, r.top, r.right, r.bottom); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); ok(devmode.dmPelsWidth == param.ddraw_width diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 03e7362..7e4d046 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2605,6 +2605,20 @@ static void test_coop_level_mode_set(void) {WM_ACTIVATEAPP, TRUE, FALSE}, {0, FALSE, 0}, }; + static const struct message exclusive_focus_restore_messages[] = + { + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */ + {WM_SIZE, FALSE, 0}, /* DefWindowProc. */ + {WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */ + /* Native redundantly sets the window size here. */ + {WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */ + {WM_MOVE, FALSE, 0}, /* DefWindowProc. */ + {WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */ + {0, FALSE, 0}, + }; static const struct message normal_messages[] = { @@ -2758,7 +2772,14 @@ static void test_coop_level_mode_set(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + expect_messages = exclusive_focus_restore_messages; ShowWindow(window, SW_RESTORE); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, + r.left, r.top, r.right, r.bottom); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); ok(devmode.dmPelsWidth == param.ddraw_width diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 1efd1fb..f1f394a 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2282,6 +2282,20 @@ static void test_coop_level_mode_set(void) {WM_ACTIVATEAPP, TRUE, FALSE}, {0, FALSE, 0}, }; + static const struct message exclusive_focus_restore_messages[] = + { + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* From the ShowWindow(SW_RESTORE). */ + {WM_WINDOWPOSCHANGING, FALSE, 0}, /* Generated by ddraw, matches d3d9 behavior. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching previous message. */ + {WM_SIZE, FALSE, 0}, /* DefWindowProc. */ + {WM_DISPLAYCHANGE, FALSE, 0}, /* Ddraw restores mode. */ + /* Native redundantly sets the window size here. */ + {WM_ACTIVATEAPP, TRUE, TRUE}, /* End of ddraw's hooks. */ + {WM_WINDOWPOSCHANGED, FALSE, 0}, /* Matching the one from ShowWindow. */ + {WM_MOVE, FALSE, 0}, /* DefWindowProc. */ + {WM_SIZE, TRUE, SIZE_RESTORED}, /* DefWindowProc. */ + {0, FALSE, 0}, + }; static const struct message normal_messages[] = { @@ -2435,7 +2449,14 @@ static void test_coop_level_mode_set(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + expect_messages = exclusive_focus_restore_messages; ShowWindow(window, SW_RESTORE); + ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); + + GetWindowRect(window, &r); + ok(EqualRect(&r, &ddraw_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ddraw_rect.left, ddraw_rect.top, ddraw_rect.right, ddraw_rect.bottom, + r.left, r.top, r.right, r.bottom); ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); ok(devmode.dmPelsWidth == param.ddraw_width -- 2.0.4 From stefan at codeweavers.com Wed Nov 19 13:13:53 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 19 Nov 2014 20:13:53 +0100 Subject: [PATCH 5/5] ddraw: Restore the registry display mode. Message-ID: <1416424433-1467-5-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/ddraw.c | 14 +------------- dlls/ddraw/tests/ddraw1.c | 8 ++++---- dlls/ddraw/tests/ddraw2.c | 8 ++++---- dlls/ddraw/tests/ddraw4.c | 8 ++++---- dlls/ddraw/tests/ddraw7.c | 8 ++++---- 5 files changed, 17 insertions(+), 29 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index ce9edf6..fce1c22 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -28,9 +28,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw); -static struct wined3d_display_mode original_mode; static const struct ddraw *exclusive_ddraw; -static BOOL restore_mode; /* Device identifier. Don't relay it to WineD3D */ static const DDDEVICEIDENTIFIER2 deviceidentifier = @@ -684,11 +682,8 @@ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface) return DDERR_NOEXCLUSIVEMODE; } - if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &original_mode))) - { + if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, NULL))) ddraw->flags &= ~DDRAW_RESTORE_MODE; - restore_mode = FALSE; - } wined3d_mutex_unlock(); @@ -1097,10 +1092,6 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW return DD_OK; } - if (!restore_mode && FAILED(hr = wined3d_get_adapter_display_mode(ddraw->wined3d, - WINED3DADAPTER_DEFAULT, &original_mode, NULL))) - ERR("Failed to get current display mode, hr %#x.\n", hr); - switch (bpp) { case 8: format = WINED3DFMT_P8_UINT; break; @@ -1121,10 +1112,7 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD width, DW * can't be changed if a surface is locked or some drawing is in progress. */ /* TODO: Lose the primary surface. */ if (SUCCEEDED(hr = wined3d_set_adapter_display_mode(ddraw->wined3d, WINED3DADAPTER_DEFAULT, &mode))) - { ddraw->flags |= DDRAW_RESTORE_MODE; - restore_mode = TRUE; - } wined3d_mutex_unlock(); diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index e48dbab..6ab51fa 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -2410,13 +2410,13 @@ static void test_coop_level_mode_set(void) ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; - todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth + ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2584,7 +2584,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, @@ -2740,7 +2740,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index b4c3da5..b79aed6 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -2616,13 +2616,13 @@ static void test_coop_level_mode_set(void) ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; - todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth + ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2790,7 +2790,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, @@ -2946,7 +2946,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 7e4d046..fb20d70 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -2803,13 +2803,13 @@ static void test_coop_level_mode_set(void) ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; - todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth + ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2970,7 +2970,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, @@ -3126,7 +3126,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index f1f394a..9263e1e 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -2480,13 +2480,13 @@ static void test_coop_level_mode_set(void) ok(!expect_messages->message, "Expected message %#x, but didn't receive it.\n", expect_messages->message); expect_messages = NULL; - todo_wine ok(screen_size.cx == registry_mode.dmPelsWidth + ok(screen_size.cx == registry_mode.dmPelsWidth && screen_size.cy == registry_mode.dmPelsHeight, "Expected screen size %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, screen_size.cx, screen_size.cy); GetWindowRect(window, &r); - todo_wine ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", + ok(EqualRect(&r, ®istry_rect), "Expected {%d, %d, %d, %d}, got {%d, %d, %d, %d}.\n", registry_rect.left, registry_rect.top, registry_rect.right, registry_rect.bottom, r.left, r.top, r.right, r.bottom); @@ -2647,7 +2647,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, @@ -2803,7 +2803,7 @@ static void test_coop_level_mode_set(void) ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); ok(ret, "Failed to get display mode.\n"); - todo_wine ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Expected resolution %ux%u, got %ux%u.\n", registry_mode.dmPelsWidth, registry_mode.dmPelsHeight, -- 2.0.4 From stefan at codeweavers.com Wed Nov 19 13:13:52 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 19 Nov 2014 20:13:52 +0100 Subject: [PATCH 4/5] wined3d: Don't minimize hidden Windows. Message-ID: <1416424433-1467-4-git-send-email-stefan@codeweavers.com> Maybe native uses a different kind of ShowWindow or SetWindowPos call that is a no-op on hidden windows. Suggestions are welcome. Feel free to ignore this patch. It is a leftover from an earlier test that attested a different behavior to d3d9ex that was caused by d3d9ex not making the window visible. Ddraw's behavior is the same on focus loss (window not shown, resolution restored), but I was not able to reactivate the ddraw object by showing the window and/or setting the focus to it. Thus no ddraw test is included. --- dlls/d3d8/tests/device.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++- dlls/d3d9/tests/d3d9ex.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++- dlls/d3d9/tests/device.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++- dlls/wined3d/swapchain.c | 3 ++- 4 files changed, 145 insertions(+), 4 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 6ee4f89..2733664 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2140,7 +2140,7 @@ struct message WPARAM expect_wparam; }; -static const struct message *expect_messages; +static const struct message *expect_messages, *unexpected_messages; static HWND device_window, focus_window; struct wndproc_thread_param @@ -2189,6 +2189,13 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM } } + if (unexpected_messages) + { + const struct message *i; + for (i = unexpected_messages; i->message; i++) + ok(i->message != message, "Got unexpected message %x on window %p.\n", message, hwnd); + } + return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -2290,6 +2297,21 @@ static void test_wndproc(void) {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, TRUE}, {0, 0, FALSE, 0}, }; + static const struct message focus_loss_messages_hidden[] = + { + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_hidden_unexpected[] = + { + /* KDE randomly does something with the hidden window during the + * mode change that sometimes generates a WM_WINDOWPOSCHANGING + * message. A WM_WINDOWPOSCHANGED message is not generated, so + * just flag WM_WINDOWPOSCHANGED as bad. */ + {WM_WINDOWPOSCHANGED, 0, FALSE, 0}, + {0, 0, FALSE, 0}, + }; d3d8 = Direct3DCreate8(D3D_SDK_VERSION); ok(!!d3d8, "Failed to create a D3D object.\n"); @@ -2498,6 +2520,30 @@ static void test_wndproc(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + ShowWindow(device_window, SW_HIDE); + flush_events(); + + expect_messages = focus_loss_messages_hidden; + unexpected_messages = focus_loss_messages_hidden_unexpected; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it.\n", + expect_messages->message, expect_messages->window); + expect_messages = NULL; + unexpected_messages = NULL; + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); + /* Releasing a device in lost state breaks follow-up tests on native. */ hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 9f8c163..226e338 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1706,7 +1706,7 @@ struct message WPARAM expect_wparam; }; -static const struct message *expect_messages; +static const struct message *expect_messages, *unexpected_messages; static HWND device_window, focus_window; struct wndproc_thread_param @@ -1755,6 +1755,13 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM } } + if (unexpected_messages) + { + const struct message *i; + for (i = unexpected_messages; i->message; i++) + ok(i->message != message, "Got unexpected message %x on window %p.\n", message, hwnd); + } + return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -1857,6 +1864,21 @@ static void test_wndproc(void) {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, {0, 0, FALSE, 0}, }; + static const struct message focus_loss_messages_hidden[] = + { + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_hidden_unexpected[] = + { + /* KDE randomly does something with the hidden window during the + * mode change that sometimes generates a WM_WINDOWPOSCHANGING + * message. A WM_WINDOWPOSCHANGED message is not generated, so + * just flag WM_WINDOWPOSCHANGED as bad. */ + {WM_WINDOWPOSCHANGED, 0, FALSE, 0}, + {0, 0, FALSE, 0}, + }; static const struct { DWORD create_flags; @@ -2076,6 +2098,31 @@ static void test_wndproc(void) && devmode.dmPelsHeight == d3d_height, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + ShowWindow(device_window, SW_HIDE); + flush_events(); + + expect_messages = focus_loss_messages_hidden; + unexpected_messages = focus_loss_messages_hidden_unexpected; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; + unexpected_messages = NULL; + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + + ShowWindow(device_window, SW_RESTORE); + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); + filter_messages = focus_window; ref = IDirect3DDevice9Ex_Release(device); ok(ref == 0, "The device was not properly freed: refcount %u, i=%u.\n", ref, i); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 3e91267..35dad62 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3095,7 +3095,7 @@ struct message WPARAM expect_wparam; }; -static const struct message *expect_messages; +static const struct message *expect_messages, *unexpected_messages; static HWND device_window, focus_window; struct wndproc_thread_param @@ -3144,6 +3144,13 @@ static LRESULT CALLBACK test_proc(HWND hwnd, UINT message, WPARAM wparam, LPARAM } } + if (unexpected_messages) + { + const struct message *i; + for (i = unexpected_messages; i->message; i++) + ok(i->message != message, "Got unexpected message %x on window %p.\n", message, hwnd); + } + return DefWindowProcA(hwnd, message, wparam, lparam); } @@ -3259,6 +3266,21 @@ static void test_wndproc(void) {WM_ACTIVATE, FOCUS_WINDOW, TRUE, WA_ACTIVE}, {0, 0, FALSE, 0}, }; + static const struct message focus_loss_messages_hidden[] = + { + {WM_DISPLAYCHANGE, DEVICE_WINDOW, FALSE, 0}, + {WM_ACTIVATEAPP, FOCUS_WINDOW, TRUE, FALSE}, + {0, 0, FALSE, 0}, + }; + static const struct message focus_loss_messages_hidden_unexpected[] = + { + /* KDE randomly does something with the hidden window during the + * mode change that sometimes generates a WM_WINDOWPOSCHANGING + * message. A WM_WINDOWPOSCHANGED message is not generated, so + * just flag WM_WINDOWPOSCHANGED as bad. */ + {WM_WINDOWPOSCHANGED, 0, FALSE, 0}, + {0, 0, FALSE, 0}, + }; static const struct { DWORD create_flags; @@ -3482,6 +3504,31 @@ static void test_wndproc(void) && devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect screen size %ux%u.\n", devmode.dmPelsWidth, devmode.dmPelsHeight); + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + ShowWindow(device_window, SW_HIDE); + flush_events(); + + expect_messages = focus_loss_messages_hidden; + unexpected_messages = focus_loss_messages_hidden_unexpected; + SetForegroundWindow(GetDesktopWindow()); + ok(!expect_messages->message, "Expected message %#x for window %#x, but didn't receive it, i=%u.\n", + expect_messages->message, expect_messages->window, i); + expect_messages = NULL; + unexpected_messages = NULL; + + ret = EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &devmode); + ok(ret, "Failed to get display mode.\n"); + ok(devmode.dmPelsWidth == registry_mode.dmPelsWidth, "Got unexpect width %u.\n", devmode.dmPelsWidth); + ok(devmode.dmPelsHeight == registry_mode.dmPelsHeight, "Got unexpect height %u.\n", devmode.dmPelsHeight); + + ShowWindow(device_window, SW_RESTORE); + ShowWindow(focus_window, SW_MINIMIZE); + ShowWindow(focus_window, SW_RESTORE); + SetForegroundWindow(focus_window); + flush_events(); + /* Releasing a device in lost state breaks follow-up tests on native. */ hr = reset_device(device, &device_desc); ok(SUCCEEDED(hr), "Failed to reset device, hr %#x, i=%u.\n", hr, i); diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index d1b6d0b..362f0ae 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -1207,7 +1207,8 @@ void wined3d_swapchain_activate(struct wined3d_swapchain *swapchain, BOOL activa swapchain->reapply_mode = TRUE; - if (!(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES)) + if (!(swapchain->device->create_parms.flags & WINED3DCREATE_NOWINDOWCHANGES) + && IsWindowVisible(swapchain->device_window)) ShowWindow(swapchain->device_window, SW_MINIMIZE); } } -- 2.0.4 From hellas at burntcomma.com Wed Nov 19 13:07:57 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Wed, 19 Nov 2014 19:07:57 +0000 Subject: [PATCH 2/2] winealsa: implement GetPropValue and return device path (try 3) Message-ID: <546CEA8D.5090402@burntcomma.com> --- dlls/winealsa.drv/mmdevdrv.c | 114 ++++++++++++++++++++++++++++++++++++ dlls/winealsa.drv/winealsa.drv.spec | 1 + 2 files changed, 115 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-winealsa-implement-GetPropValue-and-return-device-pa.patch Type: text/x-patch Size: 5710 bytes Desc: not available URL: From wine.dev at web.de Wed Nov 19 15:08:12 2014 From: wine.dev at web.de (Detlef Riekenberg) Date: Wed, 19 Nov 2014 22:08:12 +0100 Subject: [PATCH] scrrun/tests: Ignore case in path names Message-ID: <1416431292-3351-1-git-send-email-wine.dev@web.de> -- By by ... Detlef --- dlls/scrrun/tests/filesystem.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/dlls/scrrun/tests/filesystem.c b/dlls/scrrun/tests/filesystem.c index faa0b0c..54cf4e3 100644 --- a/dlls/scrrun/tests/filesystem.c +++ b/dlls/scrrun/tests/filesystem.c @@ -893,7 +893,7 @@ static void test_FolderCollection(void) 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)); + ok(!lstrcmpiW(buffW, str), "got %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buffW)); SysFreeString(str); lstrcpyW(pathW, buffW); -- 1.7.5.4 From nerv at dawncrow.de Wed Nov 19 15:09:11 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Wed, 19 Nov 2014 22:09:11 +0100 Subject: winedbg: Declare debug channel only when needed (Clang) Message-ID: <546D06F7.4040409@dawncrow.de> --- programs/winedbg/be_i386.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-winedbg-Declare-debug-channel-only-when-needed.txt Type: text/x-patch Size: 438 bytes Desc: not available URL: From nerv at dawncrow.de Wed Nov 19 15:09:14 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Wed, 19 Nov 2014 22:09:14 +0100 Subject: msxml3: Remove unused strings (Clang) Message-ID: <546D06FA.4050802@dawncrow.de> --- dlls/msxml3/xdr.c | 6 ------ 1 file changed, 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-msxml3-Remove-unused-strings.txt Type: text/x-patch Size: 2438 bytes Desc: not available URL: From nerv at dawncrow.de Wed Nov 19 15:09:17 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Wed, 19 Nov 2014 22:09:17 +0100 Subject: gdi32: Remove unused string (Clang) Message-ID: <546D06FD.4030305@dawncrow.de> --- dlls/gdi32/freetype.c | 4 ---- 1 file changed, 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-gdi32-Remove-unused-string.txt Type: text/x-patch Size: 803 bytes Desc: not available URL: From 00cpxxx at gmail.com Wed Nov 19 19:30:08 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Wed, 19 Nov 2014 23:30:08 -0200 Subject: dinput: Fix device type dump (try 2) Message-ID: Thanks to Michael Stefaniuc. try 2: Use a smarter way. Related to bug https://bugs.winehq.org/show_bug.cgi?id=35954 My joystick output: trace:dinput:_dump_DIDEVCAPS dwDevType: 00000214 DI8DEVTYPE_JOYSTICK -------------- next part -------------- diff --git a/dlls/dinput/joystick.c b/dlls/dinput/joystick.c index 0d61f57..edbb64e 100644 --- a/dlls/dinput/joystick.c +++ b/dlls/dinput/joystick.c @@ -400,16 +400,38 @@ HRESULT WINAPI JoystickAGenericImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface, REF return JoystickWGenericImpl_SetProperty(IDirectInputDevice8W_from_impl(This), rguid, ph); } +#define DEBUG_TYPE(x) case (x): str = #x; break void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) { + int type = GET_DIDEVICE_TYPE(lpDIDevCaps->dwDevType); + const char *str; TRACE("dwSize: %d\n", lpDIDevCaps->dwSize); TRACE("dwFlags: %08x\n", lpDIDevCaps->dwFlags); - TRACE("dwDevType: %08x %s\n", lpDIDevCaps->dwDevType, - lpDIDevCaps->dwDevType == DIDEVTYPE_DEVICE ? "DIDEVTYPE_DEVICE" : - lpDIDevCaps->dwDevType == DIDEVTYPE_MOUSE ? "DIDEVTYPE_MOUSE" : - lpDIDevCaps->dwDevType == DIDEVTYPE_KEYBOARD ? "DIDEVTYPE_KEYBOARD" : - lpDIDevCaps->dwDevType == DIDEVTYPE_JOYSTICK ? "DIDEVTYPE_JOYSTICK" : - lpDIDevCaps->dwDevType == DIDEVTYPE_HID ? "DIDEVTYPE_HID" : "UNKNOWN"); + switch(type) + { + /* Directx <= 7 definitions */ + DEBUG_TYPE(DIDEVTYPE_DEVICE); + DEBUG_TYPE(DIDEVTYPE_MOUSE); + DEBUG_TYPE(DIDEVTYPE_KEYBOARD); + DEBUG_TYPE(DIDEVTYPE_JOYSTICK); + DEBUG_TYPE(DIDEVTYPE_HID); + /* Directx >= 8 definitions */ + DEBUG_TYPE(DI8DEVTYPE_DEVICE); + DEBUG_TYPE(DI8DEVTYPE_MOUSE); + DEBUG_TYPE(DI8DEVTYPE_KEYBOARD); + DEBUG_TYPE(DI8DEVTYPE_JOYSTICK); + DEBUG_TYPE(DI8DEVTYPE_GAMEPAD); + DEBUG_TYPE(DI8DEVTYPE_DRIVING); + DEBUG_TYPE(DI8DEVTYPE_FLIGHT); + DEBUG_TYPE(DI8DEVTYPE_1STPERSON); + DEBUG_TYPE(DI8DEVTYPE_DEVICECTRL); + DEBUG_TYPE(DI8DEVTYPE_SCREENPOINTER); + DEBUG_TYPE(DI8DEVTYPE_REMOTE); + DEBUG_TYPE(DI8DEVTYPE_SUPPLEMENTAL); + default: str = "UNKNOWN"; + } + + TRACE("dwDevType: %08x %s\n", lpDIDevCaps->dwDevType, str); TRACE("dwAxes: %d\n", lpDIDevCaps->dwAxes); TRACE("dwButtons: %d\n", lpDIDevCaps->dwButtons); TRACE("dwPOVs: %d\n", lpDIDevCaps->dwPOVs); @@ -421,6 +443,7 @@ void _dump_DIDEVCAPS(const DIDEVCAPS *lpDIDevCaps) TRACE("dwFFDriverVersion: %d\n", lpDIDevCaps->dwFFDriverVersion); } } +#undef DEBUG_TYPE HRESULT WINAPI JoystickWGenericImpl_GetCapabilities(LPDIRECTINPUTDEVICE8W iface, LPDIDEVCAPS lpDIDevCaps) { From 00cpxxx at gmail.com Wed Nov 19 19:36:14 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Wed, 19 Nov 2014 23:36:14 -0200 Subject: dbghelp: Remove a dead assignment (Cppcheck) Message-ID: -------------- next part -------------- diff --git a/dlls/dbghelp/pe_module.c b/dlls/dbghelp/pe_module.c index f43d971..b793edb 100644 --- a/dlls/dbghelp/pe_module.c +++ b/dlls/dbghelp/pe_module.c @@ -515,7 +515,7 @@ static BOOL pe_load_stabs(const struct process* pcs, struct module* module) static BOOL pe_load_dwarf(struct module* module) { struct image_file_map* fmap = &module->format_info[DFI_PE]->u.pe_info->fmap; - BOOL ret = FALSE; + BOOL ret; ret = dwarf2_parse(module, module->module.BaseOfImage - fmap->u.pe.ntheader.OptionalHeader.ImageBase, From sebastian at fds-team.de Wed Nov 19 22:11:55 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 20 Nov 2014 05:11:55 +0100 Subject: [1/3] server: Avoid calling close on negative value in create_console_output handler (Coverity). Message-ID: <546D6A0B.8040903@fds-team.de> This patch fixes CID 211706 and CID 211707 --- server/console.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-server-Avoid-calling-close-on-negative-value-in-crea.patch Type: text/x-patch Size: 944 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 19 22:12:03 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 20 Nov 2014 05:12:03 +0100 Subject: [2/3] server: Always remove inflight fd if alloc_console fails. Message-ID: <546D6A13.9020907@fds-team.de> And now back to the fd cleanup ;) thread_get_inflight_fd should always be called as a first step, otherwise file descriptors could accidentially stay in the inflight fd list. --- server/console.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-server-Always-remove-inflight-fd-if-alloc_console-fa.patch Type: text/x-patch Size: 1966 bytes Desc: not available URL: From sebastian at fds-team.de Wed Nov 19 22:12:08 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 20 Nov 2014 05:12:08 +0100 Subject: [3/3] server: Fix several fd leaks on error in new_process wineserver call. Message-ID: <546D6A18.5010500@fds-team.de> --- server/process.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-server-Fix-several-fd-leaks-on-error-in-new_process-.patch Type: text/x-patch Size: 2357 bytes Desc: not available URL: From qhong at codeweavers.com Wed Nov 19 23:02:41 2014 From: qhong at codeweavers.com (Qian Hong) Date: Thu, 20 Nov 2014 13:02:41 +0800 Subject: [PATCH] comdlg32/tests: Fixed memory leak (Valgrind). Message-ID: <546D75F1.9060903@codeweavers.com> --- dlls/comdlg32/tests/printdlg.c | 1 + 1 file changed, 1 insertion(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-comdlg32-tests-Fixed-memory-leak-Valgrind.txt Type: text/x-patch Size: 426 bytes Desc: not available URL: From drew_ronneberg at yahoo.com Wed Nov 19 07:34:54 2014 From: drew_ronneberg at yahoo.com (Drew Ronneberg) Date: Wed, 19 Nov 2014 13:34:54 +0000 (UTC) Subject: [PATCH 1/2] Add tests for calling ShowWindow(SW_HIDE) on a hidden window. Message-ID: <348756995.2537482.1416404094649.JavaMail.yahoo@jws10649.mail.bf1.yahoo.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-Add-tests-for-calling-ShowWindow-SW_HIDE-on-a-hidden-w.txt URL: From drew_ronneberg at yahoo.com Wed Nov 19 07:35:01 2014 From: drew_ronneberg at yahoo.com (Drew Ronneberg) Date: Wed, 19 Nov 2014 13:35:01 +0000 (UTC) Subject: [PATCH 2/2] Do not call SendMessage() to hide a window that is already hidden (try 3) Message-ID: <1699489382.2543918.1416404101294.JavaMail.yahoo@jws106144.mail.bf1.yahoo.com> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0002-Do-not-call-SendMessage-to-hide-a-window-that-is-alrea.txt URL: From hello.wjx at gmail.com Thu Nov 20 01:29:07 2014 From: hello.wjx at gmail.com (Jiaxing Wang) Date: Thu, 20 Nov 2014 15:29:07 +0800 Subject: regedit: Avoid appending '\' and '0' to string value of imported key. Message-ID: <1416468547-18928-1-git-send-email-hello.wjx@gmail.com> After importing, string values are appended with '\' and '0'. For example, importing: [HKEY_LOCAL_MACHINE\testkey] "value"="abc" gets [HKEY_LOCAL_MACHINE\testkey] "value"="abc\0" This is because the null character after last quote is included which is not needed as the last quote has been changed to '\0' and dwLen already include the last quote. --- programs/regedit/regproc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index 80beb21..643b559 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -376,7 +376,6 @@ static LONG setValue(WCHAR* val_name, WCHAR* val_data, BOOL is_unicode) return ERROR_INVALID_DATA; val_data[dwLen-1] = '\0'; /* remove last quotes */ lpbData = (BYTE*) val_data; - dwLen++; /* include terminating null */ dwLen = dwLen * sizeof(WCHAR); /* size is in bytes */ } else if (dwParseType == REG_DWORD) /* Convert the dword types */ -- 1.9.1 From ralf.habacker at freenet.de Thu Nov 20 01:42:26 2014 From: ralf.habacker at freenet.de (Ralf Habacker) Date: Thu, 20 Nov 2014 08:42:26 +0100 Subject: Update dmFormName when changing paper size in print ui. (resend) Message-ID: <546D9B62.7000009@freenet.de> see https://bugs.winehq.org/show_bug.cgi?id=37303 for details --- dlls/comdlg32/printdlg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Update-dmFormName-when-changing-paper-size-in-print-ui.txt Type: text/x-patch Size: 1094 bytes Desc: not available URL: From ralf.habacker at freenet.de Thu Nov 20 02:00:37 2014 From: ralf.habacker at freenet.de (Ralf Habacker) Date: Thu, 20 Nov 2014 09:00:37 +0100 Subject: Update dmFormName when changing paper size in print ui.(resend, try2) Message-ID: <546D9FA5.5060200@freenet.de> see https://bugs.winehq.org/show_bug.cgi?id=37303 - fixed nMaxCount value in wchar variant --- dlls/comdlg32/printdlg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Update-dmFormName-when-changing-paper-size-in-print-ui.txt Type: text/x-patch Size: 1108 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 20 04:19:41 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 20 Nov 2014 11:19:41 +0100 Subject: mshtml: Added IHTMLDOMTextNode2 stub interface. Message-ID: <546DC03D.8050404@codeweavers.com> --- dlls/mshtml/htmltextnode.c | 119 +++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/mshtml_private.h | 1 + 2 files changed, 115 insertions(+), 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLDOMTextNode2-stub-interface.diff Type: text/x-patch Size: 6506 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 20 04:20:21 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 20 Nov 2014 11:20:21 +0100 Subject: mshtml: Added HTMLFrameBase2::allowTransparency semi-stub implementation. Message-ID: <546DC065.1030701@codeweavers.com> --- dlls/mshtml/htmlframebase.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-HTMLFrameBase2-allowTransparency-semi-st.diff Type: text/x-patch Size: 951 bytes Desc: not available URL: From hellas at burntcomma.com Thu Nov 20 06:11:21 2014 From: hellas at burntcomma.com (Mark Harmstone) Date: Thu, 20 Nov 2014 12:11:21 +0000 Subject: [PATCH] winex11.drv: call XRRSetScreenSize when changing resolution Message-ID: <546DDA69.5050804@burntcomma.com> This changes xrandr12_set_current_mode so it behaves the same way as xrandr does in 1.2 mode (e.g, `xrandr --output HDMI-0 --crtc 0 --mode 640x480`). Before XRRSetCrtcConfig is called, the CRTC is temporarily disabled, then XRRSetScreenSize is called. (XRRSetCrtcConfig will fail if the CRTC isn't disabled first.) This fixes bug 33632, incorrectly marked as resolved upstream. I think it also fixes bug 31245, which I suspect is the same bug - it solves a problem where Icewind Dale is unable to change resolution to 1024x768 if the current resolution is below that, which seems to be similar behaviour. --- dlls/winex11.drv/xrandr.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-winex11.drv-call-XRRSetScreenSize-when-changing-reso.patch Type: text/x-patch Size: 2497 bytes Desc: not available URL: From sebastian at fds-team.de Thu Nov 20 06:27:16 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 20 Nov 2014 13:27:16 +0100 Subject: [1/2] ws2_32/tests: Wait for thread termination before cleaning up winsock. Message-ID: <546DDE24.1060304@fds-team.de> Without waiting for termination the wvistau64 and w2008s64 tests randomly crash, which is not directly related to patch 2/2: https://newtestbot.winehq.org/JobDetails.pl?Key=10367 --- dlls/ws2_32/tests/sock.c | 4 ++++ 1 file changed, 4 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ws2_32-tests-Wait-for-thread-termination-before-clea.patch Type: text/x-patch Size: 886 bytes Desc: not available URL: From sebastian at fds-team.de Thu Nov 20 06:27:24 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Thu, 20 Nov 2014 13:27:24 +0100 Subject: [2/2] ws2_32: Implement returning the proper time with SO_CONNECT_TIME. Message-ID: <546DDE2C.2030108@fds-team.de> Based on a patch by Erich Hoover. To avoid calculations on the client-side, the server sends the connect time as relative (negative) value. Needs tools/make_requests. --- dlls/ws2_32/socket.c | 21 ++++++++++++++++----- dlls/ws2_32/tests/sock.c | 19 +++++++++++++++++++ server/protocol.def | 1 + server/sock.c | 1 + 4 files changed, 37 insertions(+), 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-ws2_32-Implement-returning-the-proper-time-with-SO_C.patch Type: text/x-patch Size: 4529 bytes Desc: not available URL: From jzeng at codeweavers.com Thu Nov 20 06:29:17 2014 From: jzeng at codeweavers.com (Jactry Zeng) Date: Thu, 20 Nov 2014 20:29:17 +0800 Subject: [PATCH] explorer: Fix copy_path_string() when an unnecessary \ follow the path. Message-ID: <546DDE9D.3040508@codeweavers.com> --- programs/explorer/explorer.c | 6 ++++++ 1 file changed, 6 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-explorer-Fix-copy_path_string-when-an-unnecessary-foll.txt Type: text/x-patch Size: 712 bytes Desc: not available URL: From mstefani at redhat.de Thu Nov 20 06:43:54 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 20 Nov 2014 13:43:54 +0100 Subject: shell32/tests: Fix a copy and paste error (PVS-Studio) Message-ID: <20141120124354.GA15304@redhat.com> --- dlls/shell32/tests/shlfileop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/shell32/tests/shlfileop.c b/dlls/shell32/tests/shlfileop.c index 51de635..07e4ee2 100644 --- a/dlls/shell32/tests/shlfileop.c +++ b/dlls/shell32/tests/shlfileop.c @@ -251,7 +251,7 @@ static void test_get_file_info(void) ok(rc == 1, "SHGetFileInfoA(c:\\nonexistent) should return 1, got 0x%x\n", rc); if (rc) { - ok(strcpy(shfi.szDisplayName, "dummy") != 0, "SHGetFileInfoA(c:\\nonexistent) displayname is not set\n"); + ok(strcmp(shfi.szDisplayName, "dummy"), "SHGetFileInfoA(c:\\nonexistent) displayname is not set\n"); ok(shfi.iIcon != 0xdeadbeef, "SHGetFileInfoA(c:\\nonexistent) iIcon is not set\n"); } -- 1.9.3 From ralf.habacker at freenet.de Thu Nov 20 07:03:33 2014 From: ralf.habacker at freenet.de (Ralf Habacker) Date: Thu, 20 Nov 2014 14:03:33 +0100 Subject: Update dmFormName when changing paper size in print ui. (resend, try 3) Message-ID: <546DE6A5.7050008@freenet.de> - use predefined constant for nMaxCount --- dlls/comdlg32/printdlg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Update-dmFormName-when-changing-paper-size-in-print-ui.txt Type: text/x-patch Size: 1068 bytes Desc: not available URL: From jzeng at codeweavers.com Thu Nov 20 07:22:29 2014 From: jzeng at codeweavers.com (Jactry Zeng) Date: Thu, 20 Nov 2014 21:22:29 +0800 Subject: [PATCH] explorer: Remove unnecessary backslash when parsing /select and /root. (try 2) Message-ID: <546DEB15.5010309@codeweavers.com> Hi folks, This patch is for fixing bugs of /root and /select option from explorer and this bug affects QQ 6.2. You can reproduce them by: 1. /select wine cmd: $ explorer /select,C:\windows\win.ini\ Correctly, it should open "C:\\windows\\" with explorer. But wine explorer uses notepad to open "C:\\windows\\win.ini". 2. /root wine cmd: $ explorer /root,C:\windows\win.ini\ Correctly, it should open "C:\\windows\\win.ini" with notepad. But wine explorer uses notepad to open "C:\\windows\\win.ini\\". Superseded patch 107798. Thanks Huw! --- programs/explorer/explorer.c | 1 + 1 file changed, 1 insertion(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-explorer-Remove-unnecessary-backslash-when-parsing-sel.txt Type: text/x-patch Size: 406 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 20 07:45:27 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 20 Nov 2014 14:45:27 +0100 Subject: [PATCH 1/2] mshtml: Added missing nsIHttpChannelInternal functions. Message-ID: <546DF077.8000400@codeweavers.com> --- dlls/mshtml/nsio.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-missing-nsIHttpChannelInternal-stubs.diff Type: text/x-patch Size: 2472 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 20 07:45:35 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 20 Nov 2014 14:45:35 +0100 Subject: [PATCH 2/2] mshtml: Added nsIURI::GetPrePath implementation. Message-ID: <546DF07F.1000205@codeweavers.com> --- dlls/mshtml/nsio.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-nsIURI-GetPrePath-implementation.diff Type: text/x-patch Size: 1621 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 20 09:12:39 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 20 Nov 2014 16:12:39 +0100 Subject: mshtml: Merge htmlelem3.c into htmlelem.c. Message-ID: <546E04E7.9040405@codeweavers.com> --- dlls/mshtml/Makefile.in | 1 - dlls/mshtml/htmlelem.c | 648 +++++++++++++++++++++++++++++++++++++++- dlls/mshtml/htmlelem3.c | 683 ------------------------------------------- dlls/mshtml/mshtml_private.h | 1 - 4 files changed, 646 insertions(+), 687 deletions(-) delete mode 100644 dlls/mshtml/htmlelem3.c -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Merge-htmlelem3.c-into-htmlelem.c.diff Type: text/x-patch Size: 45785 bytes Desc: not available URL: From jacek at codeweavers.com Thu Nov 20 10:59:42 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Thu, 20 Nov 2014 17:59:42 +0100 Subject: mshtml: Don't try to null terminate post data if it's not available. Message-ID: <546E1DFE.4000704@codeweavers.com> --- dlls/mshtml/navigate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Don-t-try-to-null-terminate-post-data-if-it-s-.diff Type: text/x-patch Size: 560 bytes Desc: not available URL: From YWang at esri.com Thu Nov 20 14:13:54 2014 From: YWang at esri.com (Yifu Wang) Date: Thu, 20 Nov 2014 20:13:54 +0000 Subject: [PATCH] msvcp120: Added std::locale::facet::~facet() export. Message-ID: --- dlls/msvcp120/msvcp120.spec | 6 +++--- dlls/msvcp90/locale.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcp120-Added-std-locale-facet-facet-export.patch Type: application/octet-stream Size: 1838 bytes Desc: 0001-msvcp120-Added-std-locale-facet-facet-export.patch URL: From austinenglish at gmail.com Thu Nov 20 15:04:56 2014 From: austinenglish at gmail.com (Austin English) Date: Thu, 20 Nov 2014 15:04:56 -0600 Subject: opengl32: Make sure to load dll below 2GB address space Message-ID: Fixes https://bugs.winehq.org/show_bug.cgi?id=36863 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/opengl32/Makefile.in b/dlls/opengl32/Makefile.in index 890b5b6..4df6bce 100644 --- a/dlls/opengl32/Makefile.in +++ b/dlls/opengl32/Makefile.in @@ -1,6 +1,7 @@ MODULE = opengl32.dll IMPORTLIB = opengl32 IMPORTS = user32 gdi32 advapi32 +EXTRADLLFLAGS = -Wl,--image-base,0x7a800000 C_SRCS = \ opengl_ext.c \ From nsivov at codeweavers.com Fri Nov 21 02:50:48 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 21 Nov 2014 11:50:48 +0300 Subject: [PATCH] dwrite: Load freetype on module attach, create one FT_Face per fontface Message-ID: <546EFCE8.7030508@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Load-freetype-on-module-attach-create-one-FT_.patch Type: text/x-patch Size: 8632 bytes Desc: not available URL: From sebastian at fds-team.de Fri Nov 21 04:02:47 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 21 Nov 2014 11:02:47 +0100 Subject: [1/3] ole32/tests: Add tests for CoWaitForMultipleHandles. Message-ID: <546F0DC7.2070003@fds-team.de> This patch also adds an OleUninitialize() to a previous test, where it was missing. The last test needs a separate thread because on Windows 8 the timeout argument is not working properly, and the test get stuck otherwise. The following error on the w8 testbot compobj.c:1555: Test failed: CoRevokeClassObject called from different thread to where registered should return RPC_E_WRONG_THREAD instead of 0x00000000 is not related to my patch, and is also present in https://newtestbot.winehq.org/JobDetails.pl?Key=10376 --- dlls/ole32/tests/compobj.c | 210 +++++++++++++++++++++++++++++++++++++++++++++ include/objbase.h | 5 +- 2 files changed, 213 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ole32-tests-Add-tests-for-CoWaitForMultipleHandles.patch Type: text/x-patch Size: 11204 bytes Desc: not available URL: From sebastian at fds-team.de Fri Nov 21 04:03:15 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 21 Nov 2014 11:03:15 +0100 Subject: [3/3] ole32: Don't process window events when APC calls are queued. Message-ID: <546F0DE3.3020706@fds-team.de> The recently committed tests for MsgWaitForMultipleObjectsEx show that only CoWaitForMultipleHandles behaves differently. --- dlls/ole32/compobj.c | 17 ++++++++++++++--- dlls/ole32/tests/compobj.c | 1 - 2 files changed, 14 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-ole32-Don-t-process-window-events-when-APC-calls-are.patch Type: text/x-patch Size: 2577 bytes Desc: not available URL: From sebastian at fds-team.de Fri Nov 21 04:21:42 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 21 Nov 2014 11:21:42 +0100 Subject: [2/3] ole32: Verify arguments for CoWaitForMultipleHandles, always initialize index to zero. (resend) Message-ID: <546F1236.7070408@fds-team.de> First mail seems to be lost in transit and doesn't appear on http://source.winehq.org/patches/?! --- dlls/ole32/compobj.c | 11 +++++++++++ dlls/ole32/tests/compobj.c | 13 ------------- 2 files changed, 11 insertions(+), 13 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-ole32-Verify-arguments-for-CoWaitForMultipleHandles-.patch Type: text/x-patch Size: 5222 bytes Desc: not available URL: From sebastian at fds-team.de Fri Nov 21 04:02:55 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Fri, 21 Nov 2014 11:02:55 +0100 Subject: [2/3] ole32: Verify arguments for CoWaitForMultipleHandles, always initialize index to zero. Message-ID: <546F0DCF.10506@fds-team.de> --- dlls/ole32/compobj.c | 11 +++++++++++ dlls/ole32/tests/compobj.c | 13 ------------- 2 files changed, 11 insertions(+), 13 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-ole32-Verify-arguments-for-CoWaitForMultipleHandles-.patch Type: text/x-patch Size: 5221 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 21 06:02:17 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 21 Nov 2014 13:02:17 +0100 Subject: mshtml: Added IHTMLTextNode2::appendData implementation. Message-ID: <546F29C9.6040904@codeweavers.com> --- dlls/mshtml/htmltextnode.c | 16 ++++++++++++++-- dlls/mshtml/tests/dom.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLTextNode2-appendData-implementation.diff Type: text/x-patch Size: 3259 bytes Desc: not available URL: From liuchanghui at linuxdeepin.com Fri Nov 21 08:32:28 2014 From: liuchanghui at linuxdeepin.com (=?utf-8?B?5YiY5piM6L6J?=) Date: Fri, 21 Nov 2014 22:32:28 +0800 Subject: gdiplus:GdipDrawImagePointsRect has a nosie vertical line output after resampled Message-ID: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gdiplus-GdipDrawImagePointsRect-has-a-nosie-vertical-l.txt Type: application/octet-stream Size: 5598 bytes Desc: not available URL: From jr98 at gmx.net Fri Nov 21 09:11:38 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Fri, 21 Nov 2014 16:11:38 +0100 Subject: [website] Download: Fix html tags and mailto link Message-ID: <1416582698.4934.7.camel@xpsubuntu> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Download-Fix-html-tags-and-mailto-link.patch Type: text/x-patch Size: 1521 bytes Desc: not available URL: From jr98 at gmx.net Fri Nov 21 09:12:29 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Fri, 21 Nov 2014 16:12:29 +0100 Subject: [website] Download: Update German translation Message-ID: <1416582749.4934.8.camel@xpsubuntu> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-Download-Update-German-translation.patch Type: text/x-patch Size: 9619 bytes Desc: not available URL: From stefan at codeweavers.com Fri Nov 21 11:32:27 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 21 Nov 2014 18:32:27 +0100 Subject: [PATCH 1/5] dxgi/tests: Test fullscreen and multiple swapchains. Message-ID: <1416591151-17986-1-git-send-email-stefan@codeweavers.com> Contrary to the d3d8/9 behavior, fullscreen swapchains can be created while a windowed swapchain exists. Creating a windowed (or fullscreen) swapchain while a fullscreen one exists is not allowed. Setting the swapchains to windowed mode before destroying them is necessary to avoid a segfault on native. --- dlls/dxgi/tests/device.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index 70cf3be..181b04c 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -393,7 +393,7 @@ static void test_createswapchain(void) IDXGIFactory *factory; IDXGIDevice *device; ULONG refcount; - IDXGISwapChain *swapchain; + IDXGISwapChain *swapchain, *swapchain2; DXGI_SWAP_CHAIN_DESC creation_desc, result_desc; HRESULT hr; WNDCLASSA wc = {0}; @@ -451,6 +451,38 @@ static void test_createswapchain(void) hr = IDXGISwapChain_GetDesc(swapchain, NULL); ok(hr == E_INVALIDARG, "GetDesc unexpectedly returned %#x.\n", hr); + creation_desc.Windowed = FALSE; + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain2); + ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); + hr = IDXGISwapChain_SetFullscreenState(swapchain2, TRUE, NULL); + todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr); + hr = IDXGISwapChain_SetFullscreenState(swapchain2, FALSE, NULL); + todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr); + IDXGISwapChain_Release(swapchain2); + + IDXGISwapChain_Release(swapchain); + + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain); + ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); + + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain2); + todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + if (SUCCEEDED(hr)) + IDXGISwapChain_Release(swapchain2); + + creation_desc.Windowed = TRUE; + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain2); + todo_wine ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + if (SUCCEEDED(hr)) + IDXGISwapChain_Release(swapchain2); + + hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); + todo_wine ok(SUCCEEDED(hr), "SetFullscreenState failed, hr %#x.\n", hr); + + hr = IDXGIFactory_CreateSwapChain(factory, obj, &creation_desc, &swapchain2); + ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr); + IDXGISwapChain_Release(swapchain2); + IDXGISwapChain_Release(swapchain); for (i = 0; i < sizeof(refresh_list)/sizeof(refresh_list[0]); i++) -- 2.0.4 From stefan at codeweavers.com Fri Nov 21 11:32:28 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 21 Nov 2014 18:32:28 +0100 Subject: [PATCH 2/5] d3d9/tests: Fix test_cursor(). Message-ID: <1416591151-17986-2-git-send-email-stefan@codeweavers.com> Native didn't change the GDI cursor because the window was hidden and the device not fullscreen. With a visible window native changes the cursor on ShowCursor like Wine does. The old test happened to pass on Wine because the server returned the cursor handle from a different input queue. Setting the foreground window (e.g. by calling SetForegroundWindow or by creating a fullscreen device like the next patch does before test_cursor runs) changed this behavior and caused the test to fail. --- dlls/d3d9/tests/device.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 35dad62..245fc0f 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1535,14 +1535,19 @@ static void test_cursor(void) HCURSOR cur; HWND window; HRESULT hr; + BOOL ret; + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + + ret = SetCursorPos(50, 50); + ok(ret, "Failed to set cursor position.\n"); + flush_events(); memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(GetCursorInfo(&info), "GetCursorInfo failed\n"); cur = info.hCursor; - 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"); @@ -1587,12 +1592,11 @@ static void test_cursor(void) hr = IDirect3DDevice9_ShowCursor(device, TRUE); ok(hr == TRUE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr); - /* GDI cursor unchanged */ memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(GetCursorInfo(&info), "GetCursorInfo failed\n"); 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 */ + ok(info.hCursor != cur, "The cursor handle is %p\n", info.hCursor); refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); -- 2.0.4 From stefan at codeweavers.com Fri Nov 21 11:32:29 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 21 Nov 2014 18:32:29 +0100 Subject: [PATCH 3/5] d3d9: Only one fullscreen swapchain is allowed. Message-ID: <1416591151-17986-3-git-send-email-stefan@codeweavers.com> --- dlls/d3d9/device.c | 25 +++++++++++++++++++++++++ dlls/d3d9/tests/device.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index ca902a2..d588ef3 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -503,11 +503,36 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_swapchain_desc desc; struct d3d9_swapchain *object; + UINT i, count; HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", iface, present_parameters, swapchain); + if (!present_parameters->Windowed) + { + WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + + wined3d_mutex_lock(); + count = wined3d_device_get_swapchain_count(device->wined3d_device); + for (i = 0; i < count; ++i) + { + struct wined3d_swapchain *wined3d_swapchain; + + wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, i); + wined3d_swapchain_get_desc(wined3d_swapchain, &desc); + + if(!desc.windowed) + { + wined3d_mutex_unlock(); + WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + } + wined3d_mutex_unlock(); + wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters); if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, &object))) *swapchain = (IDirect3DSwapChain9 *)&object->IDirect3DSwapChain9Ex_iface; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 245fc0f..b81cb67 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1058,12 +1058,16 @@ static void test_swapchain(void) IDirect3DDevice9 *device; IDirect3D9 *d3d; ULONG refcount; - HWND window; + HWND window, window2; HRESULT hr; + struct device_desc device_desc; 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"); + window2 = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window2, "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, NULL))) @@ -1176,10 +1180,42 @@ static void test_swapchain(void) IDirect3DSwapChain9_Release(swapchain3); IDirect3DSwapChain9_Release(swapchain2); IDirect3DSwapChain9_Release(swapchain1); + + d3dpp.Windowed = FALSE; + d3dpp.hDeviceWindow = window; + d3dpp.BackBufferCount = 1; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.device_window = window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.Windowed = TRUE; + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); cleanup: IDirect3D9_Release(d3d); + DestroyWindow(window2); DestroyWindow(window); } -- 2.0.4 From stefan at codeweavers.com Fri Nov 21 11:32:31 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 21 Nov 2014 18:32:31 +0100 Subject: [PATCH 5/5] d3d8: Only one fullscreen swapchain is allowed. Message-ID: <1416591151-17986-5-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/device.c | 25 +++++++++++++++++++++++++ dlls/d3d8/tests/device.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index dd0b9ee..9925526 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -557,11 +557,36 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_swapchain_desc desc; struct d3d8_swapchain *object; + UINT i, count; HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", iface, present_parameters, swapchain); + if (!present_parameters->Windowed) + { + WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + + wined3d_mutex_lock(); + count = wined3d_device_get_swapchain_count(device->wined3d_device); + for (i = 0; i < count; ++i) + { + struct wined3d_swapchain *wined3d_swapchain; + + wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, i); + wined3d_swapchain_get_desc(wined3d_swapchain, &desc); + + if(!desc.windowed) + { + wined3d_mutex_unlock(); + WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + } + wined3d_mutex_unlock(); + wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters); if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, &object))) *swapchain = &object->IDirect3DSwapChain8_iface; diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 337ad56..99fe70a 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -262,12 +262,16 @@ static void test_swapchain(void) IDirect3DDevice8 *device; IDirect3D8 *d3d; ULONG refcount; - HWND window; + HWND window, window2; HRESULT hr; + struct device_desc device_desc; 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"); + window2 = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window2, "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, NULL))) @@ -356,10 +360,42 @@ static void test_swapchain(void) IDirect3DSwapChain8_Release(swapchain3); IDirect3DSwapChain8_Release(swapchain2); IDirect3DSwapChain8_Release(swapchain1); + + d3dpp.Windowed = FALSE; + d3dpp.hDeviceWindow = window; + d3dpp.BackBufferCount = 1; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.device_window = window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.Windowed = TRUE; + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); cleanup: IDirect3D8_Release(d3d); + DestroyWindow(window2); DestroyWindow(window); } -- 2.0.4 From stefan at codeweavers.com Fri Nov 21 11:32:30 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 21 Nov 2014 18:32:30 +0100 Subject: [PATCH 4/5] d3d8/tests: Fix test_cursor(). Message-ID: <1416591151-17986-4-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/tests/device.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 2733664..337ad56 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -723,6 +723,7 @@ static void test_cursor(void) HCURSOR cur; HWND window; HRESULT hr; + BOOL ret; pGetCursorInfo = (void *)GetProcAddress(user32_handle, "GetCursorInfo"); if (!pGetCursorInfo) @@ -731,14 +732,19 @@ static void test_cursor(void) return; } + window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + + ret = SetCursorPos(50, 50); + ok(ret, "Failed to set cursor position.\n"); + flush_events(); + memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(pGetCursorInfo(&info), "GetCursorInfo failed\n"); cur = info.hCursor; - 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, NULL))) @@ -781,12 +787,11 @@ static void test_cursor(void) hr = IDirect3DDevice8_ShowCursor(device, TRUE); ok(hr == TRUE, "IDirect3DDevice8_ShowCursor returned %#08x\n", hr); - /* GDI cursor unchanged */ memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(pGetCursorInfo(&info), "GetCursorInfo failed\n"); 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 */ + ok(info.hCursor != cur, "The cursor handle is %p\n", info.hCursor); refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); -- 2.0.4 From nerv at dawncrow.de Fri Nov 21 13:58:37 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:37 +0100 Subject: ieframe/tests: Remove unused string (Clang) Message-ID: <546F996D.1090300@dawncrow.de> --- dlls/ieframe/tests/webbrowser.c | 1 - 1 file changed, 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0013-ieframe-tests-Remove-unused-string-Clang.txt Type: text/x-patch Size: 381 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:38 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:38 +0100 Subject: jscript: Remove unused code (Clang) Message-ID: <546F996E.3040809@dawncrow.de> --- dlls/jscript/engine.c | 5 ----- dlls/jscript/jsregexp.c | 2 -- 2 files changed, 7 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0014-jscript-Remove-unused-code-Clang.txt Type: text/x-patch Size: 967 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:39 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:39 +0100 Subject: control: Remove unused string (Clang) Message-ID: <546F996F.70905@dawncrow.de> --- programs/control/control.c | 1 - 1 file changed, 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0015-control-Remove-unused-string-Clang.txt Type: text/x-patch Size: 823 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:55 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:55 +0100 Subject: dinput: Remove unused functions (Clang) Message-ID: <546F997F.7080901@dawncrow.de> --- dlls/dinput/dinput_main.c | 4 ---- dlls/dinput/joystick_linux.c | 5 +---- dlls/dinput/joystick_linuxinput.c | 5 +---- dlls/dinput/mouse.c | 5 +---- 4 files changed, 3 insertions(+), 16 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0008-dinput-Remove-unused-functions-Clang.txt Type: text/x-patch Size: 2963 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:57 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:57 +0100 Subject: dwrite/tests: Remove unused functions (Clang) Message-ID: <546F9981.8070802@dawncrow.de> --- dlls/dwrite/tests/analyzer.c | 7 ------- dlls/dwrite/tests/layout.c | 7 ------- 2 files changed, 14 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0010-dwrite-tests-Remove-unused-functions-Clang.txt Type: text/x-patch Size: 1119 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:58 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:58 +0100 Subject: fusion: Remove unused IAssemblyCacheItem (Clang) Message-ID: <546F9982.5040200@dawncrow.de> --- dlls/fusion/asmcache.c | 94 -------------------------------------------------- 1 file changed, 94 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0011-fusion-Remove-unused-IAssemblyCacheItem-Clang.txt Type: text/x-patch Size: 3489 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:59:11 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:59:11 +0100 Subject: comctl32/tests: Remove unused structs (Clang) Message-ID: <546F998F.6090401@dawncrow.de> --- dlls/comctl32/tests/button.c | 7 ------- dlls/comctl32/tests/tab.c | 28 ---------------------------- 2 files changed, 35 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-comctl32-tests-Remove-unused-structs-Clang.txt Type: text/x-patch Size: 2046 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:59:11 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:59:11 +0100 Subject: crypt32/tests: Comment out an unused struct (Clang) Message-ID: <546F998F.8070106@dawncrow.de> --- dlls/crypt32/tests/base64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-crypt32-tests-Comment-out-an-unused-struct-Clang.txt Type: text/x-patch Size: 573 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:59:12 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:59:12 +0100 Subject: d3d10core: Remove unused struct (Clang) Message-ID: <546F9990.40105@dawncrow.de> --- dlls/d3d10core/device.c | 7 ------- 1 file changed, 7 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-d3d10core-Remove-unused-struct-Clang.txt Type: text/x-patch Size: 635 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:59:10 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:59:10 +0100 Subject: advapi32: Remove unused strings (Clang) Message-ID: <546F998E.10503@dawncrow.de> --- dlls/advapi32/security.c | 5 ----- 1 file changed, 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-advapi32-Remove-unused-strings-Clang.txt Type: text/x-patch Size: 1554 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:39 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:39 +0100 Subject: winecfg: Remove unused strings (Clang) Message-ID: <546F996F.2060905@dawncrow.de> --- programs/winecfg/x11drvdlg.c | 2 -- 1 file changed, 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0016-winecfg-Remove-unused-strings-Clang.txt Type: text/x-patch Size: 671 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:58 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:58 +0100 Subject: gdi32: Remove unused function (Clang) Message-ID: <546F9982.9010705@dawncrow.de> --- dlls/gdi32/font.c | 10 ---------- 1 file changed, 10 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0012-gdi32-Remove-unused-function-Clang.txt Type: text/x-patch Size: 571 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:58:56 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:58:56 +0100 Subject: dwrite: Remove unused code (Clang) Message-ID: <546F9980.4060106@dawncrow.de> --- dlls/dwrite/bidi.c | 6 ------ dlls/dwrite/shape.c | 2 -- 2 files changed, 8 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0009-dwrite-Remove-unused-code-Clang.txt Type: text/x-patch Size: 768 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 13:59:13 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 20:59:13 +0100 Subject: d3dx9_36/tests: Remove unused functions (Clang) Message-ID: <546F9991.80608@dawncrow.de> --- dlls/d3dx9_36/tests/surface.c | 14 -------------- 1 file changed, 14 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0007-d3dx9_36-tests-Remove-unused-functions-Clang.txt Type: text/x-patch Size: 1450 bytes Desc: not available URL: From nerv at dawncrow.de Fri Nov 21 14:30:12 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Fri, 21 Nov 2014 21:30:12 +0100 Subject: winedbg: Declare debug channel only when needed in be_x86_64 (Clang) Message-ID: <546FA0D4.7020902@dawncrow.de> --- programs/winedbg/be_x86_64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0017-winedbg-Declare-debug-channel-only-when-needed-in-be_x.txt Type: text/x-patch Size: 474 bytes Desc: not available URL: From austinenglish at gmail.com Fri Nov 21 17:28:12 2014 From: austinenglish at gmail.com (Austin English) Date: Fri, 21 Nov 2014 17:28:12 -0600 Subject: cryptext: add stubs for CryptExtAddPFX/CryptExtAddPFXW (try 2) Message-ID: Try 2: fix return values -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- From cab93eba1d563ca085adceb96c6fe29a63070891 Mon Sep 17 00:00:00 2001 From: Austin English Date: Fri, 21 Nov 2014 15:17:36 -0800 Subject: [PATCH] cryptext: add stubs for CryptExtAddPFX/CryptExtAddPFXW (try 2) --- dlls/cryptext/cryptext.spec | 4 ++-- dlls/cryptext/cryptext_main.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/dlls/cryptext/cryptext.spec b/dlls/cryptext/cryptext.spec index b0e920e..0dba38e 100644 --- a/dlls/cryptext/cryptext.spec +++ b/dlls/cryptext/cryptext.spec @@ -6,8 +6,8 @@ @ stub CryptExtAddCTLW @ stub CryptExtAddP7R @ stub CryptExtAddP7RW -@ stub CryptExtAddPFX -@ stub CryptExtAddPFXW +@ stdcall CryptExtAddPFX(str) +@ stdcall CryptExtAddPFXW(wstr) @ stub CryptExtAddSPC @ stub CryptExtAddSPCW @ stub CryptExtOpenCAT diff --git a/dlls/cryptext/cryptext_main.c b/dlls/cryptext/cryptext_main.c index 75ede4e..473c326 100644 --- a/dlls/cryptext/cryptext_main.c +++ b/dlls/cryptext/cryptext_main.c @@ -43,3 +43,21 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) return TRUE; } + +/*********************************************************************** + * CryptExtAddPFX (CRYPTEXT.@) + */ +HRESULT WINAPI CryptExtAddPFX(LPCSTR filename) +{ + FIXME("stub: %s\n", debugstr_a(filename)); + return E_NOTIMPL; +} + +/*********************************************************************** + * CryptExtAddPFXW (CRYPTEXT.@) + */ +HRESULT WINAPI CryptExtAddPFXW(LPCWSTR filename) +{ + FIXME("stub: %s\n", debugstr_w(filename)); + return E_NOTIMPL; +} -- 2.1.3 From YWang at esri.com Fri Nov 21 18:50:07 2014 From: YWang at esri.com (Yifu Wang) Date: Sat, 22 Nov 2014 00:50:07 +0000 Subject: [PATCH] msvcr120: Added wchar_t* fields to struct MSVCRT_lconv. Message-ID: --- configure.ac | 1 + dlls/msvcr120/tests/Makefile.in | 5 + dlls/msvcr120/tests/msvcr120.c | 155 +++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/locale.c | 151 ++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/msvcrt.h | 10 +++ 5 files changed, 322 insertions(+), 0 deletions(-) create mode 100644 dlls/msvcr120/tests/Makefile.in create mode 100644 dlls/msvcr120/tests/msvcr120.c -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msvcr120-Added-wchar_t-fields-to-struct-MSVCRT_lconv.patch Type: application/octet-stream Size: 17500 bytes Desc: 0001-msvcr120-Added-wchar_t-fields-to-struct-MSVCRT_lconv.patch URL: From austinenglish at gmail.com Fri Nov 21 19:29:33 2014 From: austinenglish at gmail.com (Austin English) Date: Fri, 21 Nov 2014 19:29:33 -0600 Subject: ole2disp.dll: add a stub for VARIANTCHANGETYPE Message-ID: For https://bugs.winehq.org/show_bug.cgi?id=14449 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/ole2disp.dll16/ole2disp.c b/dlls/ole2disp.dll16/ole2disp.c index 957d1bc..61a4043 100644 --- a/dlls/ole2disp.dll16/ole2disp.c +++ b/dlls/ole2disp.dll16/ole2disp.c @@ -214,6 +214,16 @@ int WINAPI SysStringLen16(BSTR16 str) } /****************************************************************************** + * VariantChangeType [OLE2DISP.12] + */ +HRESULT WINAPI VariantChangeType16(VARIANTARG *vargDest, VARIANTARG *varSrc, unsigned short flags, VARTYPE vt) +{ + FIXME("stub: (%p, %p, %d, %d)\n", vargDest, varSrc, flags, vt); + return E_NOTIMPL; +} + + +/****************************************************************************** * CreateDispTypeInfo [OLE2DISP.31] */ HRESULT WINAPI CreateDispTypeInfo16( diff --git a/dlls/ole2disp.dll16/ole2disp.dll16.spec b/dlls/ole2disp.dll16/ole2disp.dll16.spec index 0bc4bae..c027d12 100644 --- a/dlls/ole2disp.dll16/ole2disp.dll16.spec +++ b/dlls/ole2disp.dll16/ole2disp.dll16.spec @@ -9,7 +9,7 @@ 9 stub VARIANTCLEAR 10 stub VARIANTCOPY 11 stub VARIANTCOPYIND -12 stub VARIANTCHANGETYPE +12 pascal VARIANTCHANGETYPE(ptr ptr long long) VariantChangeType16 13 stub VARIANTTIMETODOSDATETIME 14 stub DOSDATETIMETOVARIANTTIME 15 stub SAFEARRAYCREATE From sebastian at fds-team.de Sat Nov 22 10:42:22 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Sat, 22 Nov 2014 17:42:22 +0100 Subject: server: Avoid sending unexpected wakeup with uninitialized cookie value. Message-ID: <5470BCEE.9030603@fds-team.de> While executing the kernel32/sync tests I noticed a couple of unexpected wakeup cookies, which looked like uninitialized wineserver memory. Here an excerpt from the log (added additional debug values): --- snip --- 0009: select( flags=2, cookie=0033faac, timeout=0, prev_apc=0000, result={}, data={SIGNAL_AND_WAIT,signal=0038,wait=0038} ) 0009: *wakeup* signaled=0 cookie=0x55555555 0009: select() = 0 { timeout=1d00663fadcfb0a (+0.0000000), call={APC_NONE}, apc_handle=0000 } [...] 0009: select( flags=2, cookie=0033faac, timeout=0, prev_apc=0000, result={}, data={SIGNAL_AND_WAIT,signal=0038,wait=0038} ) 0009: *wakeup* signaled=0 cookie=0x55555555 0009: select() = 0 { timeout=1d00663fadcfdf8 (+0.0000000), call={APC_NONE}, apc_handle=0000 } [...] 0009: select( flags=2, cookie=0033f8dc, timeout=+0.0100000, prev_apc=0000, result={}, data={WAIT,handles={0038}} ) 0009: select() = PENDING { timeout=1d00663fae61280 (+0.0100000), call={APC_NONE}, apc_handle=0000 } 0009:fixme:server:wait_select_reply cookie = 0x55555555 0009:fixme:server:wait_select_reply cookie = 0x55555555 --- snip --- Those unexpected wakeup cookies are never removed again, and could overflow the wakeup pipe sooner or later. The problem is caused when signalling and waiting on the same object. wait_on_handles(...) allocates the current->wait structure, but doesn't store a cookie yet. Afterwards the object is signalled, and wake_thread(...) is executed, which sends a wakeup cookie. This normally isn't necessary because we're still in the same wine server call, and the thread isn't waiting for any reply. --- server/thread.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-server-Avoid-sending-unexpected-wakeup-with-uninitia.patch Type: text/x-patch Size: 2424 bytes Desc: not available URL: From andrei.slavoiu at gmail.com Fri Nov 21 17:16:48 2014 From: andrei.slavoiu at gmail.com (Andrei =?utf-8?B?U2zEg3ZvaXU=?=) Date: Sat, 22 Nov 2014 01:16:48 +0200 Subject: [1/3] wined3d: Add a new enum for GL_EXT_geometry_shader4 Message-ID: <1883039.dHic3fofCD@kaveri> --- dlls/wined3d/directx.c | 1 + dlls/wined3d/wined3d_gl.h | 1 + 2 files changed, 2 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-wined3d-Add-a-new-enum-for-GL_EXT_geometry_shader4.patch Type: text/x-patch Size: 1188 bytes Desc: not available URL: From andrei.slavoiu at gmail.com Fri Nov 21 17:16:54 2014 From: andrei.slavoiu at gmail.com (Andrei =?utf-8?B?U2zEg3ZvaXU=?=) Date: Sat, 22 Nov 2014 01:16:54 +0200 Subject: [2/3] wined3d: Add WINED3D_SHADER_CAP_GEOMETRY_SHADER4 and set it when GL_EXT_geometry_shader4 is available Message-ID: <1942313.gejBnzLkjY@kaveri> --- dlls/wined3d/glsl_shader.c | 5 +++++ dlls/wined3d/wined3d_private.h | 1 + 2 files changed, 6 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-wined3d-Add-WINED3D_SHADER_CAP_GEOMETRY_SHADER4-and-.patch Type: text/x-patch Size: 1202 bytes Desc: not available URL: From andrei.slavoiu at gmail.com Fri Nov 21 17:16:56 2014 From: andrei.slavoiu at gmail.com (Andrei =?utf-8?B?U2zEg3ZvaXU=?=) Date: Sat, 22 Nov 2014 01:16:56 +0200 Subject: [3/3] wined3d: Make d3d_level_from_caps recognize cards that expose GL_EXT_geometry_shader4 as DX10 capable[3/3] Message-ID: <6812382.Foi45n2t7i@kaveri> --- dlls/wined3d/directx.c | 4 ++++ 1 file changed, 4 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-wined3d-Make-d3d_level_from_caps-recognize-cards-tha.patch Type: text/x-patch Size: 753 bytes Desc: not available URL: From drew_ronneberg at yahoo.com Sat Nov 22 12:59:20 2014 From: drew_ronneberg at yahoo.com (Drew Ronneberg) Date: Sat, 22 Nov 2014 18:59:20 +0000 (UTC) Subject: [PATCH] winemenubuilder: Do not associate a file type with a non-existent icon Message-ID: <1983242692.4067272.1416682760610.JavaMail.yahoo@jws106136.mail.bf1.yahoo.com> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: 0001-winemenubuilder-Do-not-associate-a-file-type-with-a-no.txt URL: From nsivov at codeweavers.com Mon Nov 24 03:13:57 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 24 Nov 2014 12:13:57 +0300 Subject: [PATCH 1/3] dwrite: Forward more font methods to fontface Message-ID: <5472F6D5.8090803@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Forward-more-font-methods-to-fontface.patch Type: text/x-patch Size: 2261 bytes Desc: not available URL: From nsivov at codeweavers.com Mon Nov 24 03:14:07 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 24 Nov 2014 12:14:07 +0300 Subject: [PATCH 2/3] dwrite: Update to IDWriteBitmapRenderTarget1 Message-ID: <5472F6DF.1090802@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Update-to-IDWriteBitmapRenderTarget1.patch Type: text/x-patch Size: 12385 bytes Desc: not available URL: From nsivov at codeweavers.com Mon Nov 24 03:14:24 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 24 Nov 2014 12:14:24 +0300 Subject: [PATCH 3/3] dwrite: Use usWin* values from OS/2 table as font ascent/descent Message-ID: <5472F6F0.6090006@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-Use-usWin-values-from-OS-2-table-as-font-asce.patch Type: text/x-patch Size: 1107 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 24 05:14:43 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 24 Nov 2014 12:14:43 +0100 Subject: [PATCH 1/2] mshtml: Improved IDM_RESPECTVISIBILITY_INDESIGN stub. Message-ID: <54731323.50708@codeweavers.com> --- dlls/mshtml/olecmd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Improved-IDM_RESPECTVISIBILITY_INDESIGN-stub.diff Type: text/x-patch Size: 796 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 24 05:14:50 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 24 Nov 2014 12:14:50 +0100 Subject: [PATCH 2/2] mshtml: Added IHTMLDocument2::execCommand implementation. Message-ID: <5473132A.4030803@codeweavers.com> --- dlls/mshtml/htmldoc.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/dom.c | 18 +++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-IHTMLDocument2-execCommand-implementatio.diff Type: text/x-patch Size: 4136 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 24 05:23:05 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 24 Nov 2014 12:23:05 +0100 Subject: [PATCH 2/2 try2] mshtml: Added IHTMLDocument2::execCommand implementation. Message-ID: <54731519.1010501@codeweavers.com> Please use this version instead. --- dlls/mshtml/htmldoc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/dom.c | 18 +++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-IHTMLDocument2-execCommand-implementatio.diff Type: text/x-patch Size: 4239 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 24 06:03:24 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 24 Nov 2014 13:03:24 +0100 Subject: [PATCH 1/2 try3] mshtml: Improved IDM_RESPECTVISIBILITY_INDESIGN stub. Message-ID: <54731E8C.3040009@codeweavers.com> try3: Fixed tests on some IE versions. --- dlls/mshtml/olecmd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Improved-IDM_RESPECTVISIBILITY_INDESIGN-stub.diff Type: text/x-patch Size: 796 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 24 06:03:30 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 24 Nov 2014 13:03:30 +0100 Subject: [PATCH 2/2] mshtml: Added IHTMLDocument2::execCommand implementation. Message-ID: <54731E92.6040408@codeweavers.com> --- dlls/mshtml/htmldoc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/dom.c | 18 +++++++++++++++ 2 files changed, 75 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-mshtml-Added-IHTMLDocument2-execCommand-implementatio.diff Type: text/x-patch Size: 4227 bytes Desc: not available URL: From nsivov at codeweavers.com Mon Nov 24 07:25:28 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 24 Nov 2014 16:25:28 +0300 Subject: gdi32: Remove undefs for names that are never defined Message-ID: <547331C8.6050208@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gdi32-Remove-undefs-for-names-that-are-never-defined.patch Type: text/x-patch Size: 903 bytes Desc: not available URL: From jacek at codeweavers.com Mon Nov 24 11:47:41 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Mon, 24 Nov 2014 18:47:41 +0100 Subject: mshtml: Added IHTMLTxtRange::setEndPoint imeplementation. Message-ID: <54736F3D.2030402@codeweavers.com> --- dlls/mshtml/tests/dom.c | 75 ++++++++++++++++++++++++++++++++++++++++--------- dlls/mshtml/txtrange.c | 70 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 129 insertions(+), 16 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-IHTMLTxtRange-setEndPoint-imeplementatio.diff Type: text/x-patch Size: 7577 bytes Desc: not available URL: From marc.bessieres at mykolab.com Mon Nov 24 14:18:28 2014 From: marc.bessieres at mykolab.com (marc.bessieres at mykolab.com) Date: Mon, 24 Nov 2014 21:18:28 +0100 Subject: gdi32: uninitialized biCompression in GetDIBits(valgrind) Message-ID: <1416860308-3105-1-git-send-email-marc.bessieres@mykolab.com> From: Marc Bessi?res fix for https://bugs.winehq.org/show_bug.cgi?id=37159 biCompression field was not initialized with the input bitmap while it was used in bitmapinfoheader_from_user_bitmapinfo. So: - move the code calling bitmapinfoheader_from_user_bitmapinfo after we got the bitmap from the input handler. - initialize info->bmiHeader.biCompression --- dlls/gdi32/dib.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c index 708a9a8..99b1a0e 100644 --- a/dlls/gdi32/dib.c +++ b/dlls/gdi32/dib.c @@ -1212,16 +1212,6 @@ INT WINAPI GetDIBits( struct bitblt_coords src, dst; BOOL empty_rect = FALSE; - /* Since info may be a BITMAPCOREINFO or any of the larger BITMAPINFO structures, we'll use our - own copy and transfer the colour info back at the end */ - if (!bitmapinfoheader_from_user_bitmapinfo( &dst_info->bmiHeader, &info->bmiHeader )) return 0; - if (coloruse > DIB_PAL_COLORS) return 0; - if (bits && - (dst_info->bmiHeader.biCompression == BI_JPEG || dst_info->bmiHeader.biCompression == BI_PNG)) - return 0; - dst_info->bmiHeader.biClrUsed = 0; - dst_info->bmiHeader.biClrImportant = 0; - if (!(dc = get_dc_ptr( hdc ))) { SetLastError( ERROR_INVALID_PARAMETER ); @@ -1234,6 +1224,17 @@ INT WINAPI GetDIBits( return 0; } + info->bmiHeader.biCompression = bmp->dib.dsBmih.biCompression; + /* Since info may be a BITMAPCOREINFO or any of the larger BITMAPINFO structures, we'll use our + own copy and transfer the colour info back at the end */ + if (!bitmapinfoheader_from_user_bitmapinfo( &dst_info->bmiHeader, &info->bmiHeader )) return 0; + if (coloruse > DIB_PAL_COLORS) return 0; + if (bits && + (dst_info->bmiHeader.biCompression == BI_JPEG || dst_info->bmiHeader.biCompression == BI_PNG)) + return 0; + dst_info->bmiHeader.biClrUsed = 0; + dst_info->bmiHeader.biClrImportant = 0; + src.visrect.left = 0; src.visrect.top = 0; src.visrect.right = bmp->dib.dsBm.bmWidth; -- 2.1.2 From marc.bessieres at mykolab.com Mon Nov 24 14:19:49 2014 From: marc.bessieres at mykolab.com (marc.bessieres at mykolab.com) Date: Mon, 24 Nov 2014 21:19:49 +0100 Subject: riched20/tests: use SendMessageA with char buffer(valgrind) Message-ID: <1416860389-3356-1-git-send-email-marc.bessieres@mykolab.com> From: Marc Bessi?res fixes: https://bugs.winehq.org/show_bug.cgi?id=37159 it is a copy paste from dafd6fecd1dc5cd07e8bcbcbd2acff3798406eb9 where both test_EM_FINDWORDBREAK_W and test_EM_FINDWORDBREAK_A were introduced. --- dlls/riched20/tests/editor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 244f065..101aec0 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -7379,7 +7379,7 @@ static void test_EM_FINDWORDBREAK_A(void) char buf[2]; buf[0] = delimiter_tests[i].c; buf[1] = 0; - SendMessageW(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buf); + SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)buf); result = SendMessageA(hwndRichEdit, EM_FINDWORDBREAK, WB_ISDELIMITER, 0); if (buf[0] == 0x20) todo_wine -- 2.1.2 From 00cpxxx at gmail.com Mon Nov 24 19:54:45 2014 From: 00cpxxx at gmail.com (Bruno Jesus) Date: Mon, 24 Nov 2014 23:54:45 -0200 Subject: user32/tests: Ensure ShowWindow returns false when window is already hidden Message-ID: A recent change in the code turned a ShowWindow(SW_HIDE) in an already hidden window a no-op, but the return code was not tested. Many tests failed in my attempt to run but not related to my changes: https://testbot.winehq.org/JobDetails.pl?Key=10432 -------------- next part -------------- diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 28bb35e..778b3cf 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -4626,7 +4626,7 @@ static DWORD CALLBACK show_window_thread(LPVOID arg) HWND hwnd = arg; /* function will not return if ShowWindow(SW_HIDE) calls SendMessage() */ - ShowWindow(hwnd, SW_HIDE); + ok(ShowWindow(hwnd, SW_HIDE) == FALSE, "ShowWindow(SW_HIDE) expected FALSE\n"); return 0; } @@ -4669,7 +4669,7 @@ static void test_messages(void) ok_sequence(WmHideOverlappedSeq, "ShowWindow(SW_HIDE):overlapped", FALSE); /* test ShowWindow(SW_HIDE) on a hidden window - single threaded */ - ShowWindow(hwnd, SW_HIDE); + ok(ShowWindow(hwnd, SW_HIDE) == FALSE, "ShowWindow(SW_HIDE) expected FALSE\n"); flush_events(); ok_sequence(WmEmptySeq, "ShowWindow(SW_HIDE):overlapped", FALSE); From stefan at codeweavers.com Tue Nov 25 03:16:53 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 10:16:53 +0100 Subject: [PATCH 1/3] d3d9/tests: Fix test_cursor() (v2). Message-ID: <1416907015-20481-1-git-send-email-stefan@codeweavers.com> Version 2: Move the CreateWindow ok() call to the proper place. Native didn't change the GDI cursor because the window was hidden and the device not fullscreen. With a visible window native changes the cursor on ShowCursor like Wine does. The old test happened to pass on Wine because the server returned the cursor handle from a different input queue. Setting the foreground window (e.g. by calling SetForegroundWindow or by creating a fullscreen device like the next patch does before test_cursor runs) changed this behavior and caused the test to fail. --- dlls/d3d9/tests/device.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 35dad62..33b5998 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1535,15 +1535,20 @@ static void test_cursor(void) HCURSOR cur; HWND window; HRESULT hr; + BOOL ret; + + window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window, "Failed to create a window.\n"); + ret = SetCursorPos(50, 50); + ok(ret, "Failed to set cursor position.\n"); + flush_events(); memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(GetCursorInfo(&info), "GetCursorInfo failed\n"); cur = info.hCursor; - 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, NULL))) @@ -1587,12 +1592,11 @@ static void test_cursor(void) hr = IDirect3DDevice9_ShowCursor(device, TRUE); ok(hr == TRUE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr); - /* GDI cursor unchanged */ memset(&info, 0, sizeof(info)); info.cbSize = sizeof(info); ok(GetCursorInfo(&info), "GetCursorInfo failed\n"); 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 */ + ok(info.hCursor != cur, "The cursor handle is %p\n", info.hCursor); refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); -- 2.0.4 From stefan at codeweavers.com Tue Nov 25 03:16:54 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 10:16:54 +0100 Subject: [PATCH 2/3] d3d9: Only one fullscreen swapchain is allowed (v2). Message-ID: <1416907015-20481-2-git-send-email-stefan@codeweavers.com> Version 2: Whitespace fix. --- dlls/d3d9/device.c | 25 +++++++++++++++++++++++++ dlls/d3d9/tests/device.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index ca902a2..67a5629 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -503,11 +503,36 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_CreateAdditionalSwapChain(ID struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); struct wined3d_swapchain_desc desc; struct d3d9_swapchain *object; + UINT i, count; HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", iface, present_parameters, swapchain); + if (!present_parameters->Windowed) + { + WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + + wined3d_mutex_lock(); + count = wined3d_device_get_swapchain_count(device->wined3d_device); + for (i = 0; i < count; ++i) + { + struct wined3d_swapchain *wined3d_swapchain; + + wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, i); + wined3d_swapchain_get_desc(wined3d_swapchain, &desc); + + if (!desc.windowed) + { + wined3d_mutex_unlock(); + WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + } + wined3d_mutex_unlock(); + wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters); if (SUCCEEDED(hr = d3d9_swapchain_create(device, &desc, &object))) *swapchain = (IDirect3DSwapChain9 *)&object->IDirect3DSwapChain9Ex_iface; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 33b5998..04bdf41 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -1058,12 +1058,16 @@ static void test_swapchain(void) IDirect3DDevice9 *device; IDirect3D9 *d3d; ULONG refcount; - HWND window; + HWND window, window2; HRESULT hr; + struct device_desc device_desc; 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"); + window2 = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window2, "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, NULL))) @@ -1176,10 +1180,42 @@ static void test_swapchain(void) IDirect3DSwapChain9_Release(swapchain3); IDirect3DSwapChain9_Release(swapchain2); IDirect3DSwapChain9_Release(swapchain1); + + d3dpp.Windowed = FALSE; + d3dpp.hDeviceWindow = window; + d3dpp.BackBufferCount = 1; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.device_window = window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.Windowed = TRUE; + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice9_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); cleanup: IDirect3D9_Release(d3d); + DestroyWindow(window2); DestroyWindow(window); } -- 2.0.4 From stefan at codeweavers.com Tue Nov 25 03:16:55 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 10:16:55 +0100 Subject: [PATCH 3/3] d3d8: Only one fullscreen swapchain is allowed (v2). Message-ID: <1416907015-20481-3-git-send-email-stefan@codeweavers.com> Version 2: Whitespace fix. --- dlls/d3d8/device.c | 25 +++++++++++++++++++++++++ dlls/d3d8/tests/device.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index dd0b9ee..4c17e7c 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -557,11 +557,36 @@ static HRESULT WINAPI d3d8_device_CreateAdditionalSwapChain(IDirect3DDevice8 *if struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); struct wined3d_swapchain_desc desc; struct d3d8_swapchain *object; + UINT i, count; HRESULT hr; TRACE("iface %p, present_parameters %p, swapchain %p.\n", iface, present_parameters, swapchain); + if (!present_parameters->Windowed) + { + WARN("Trying to create an additional fullscreen swapchain, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + + wined3d_mutex_lock(); + count = wined3d_device_get_swapchain_count(device->wined3d_device); + for (i = 0; i < count; ++i) + { + struct wined3d_swapchain *wined3d_swapchain; + + wined3d_swapchain = wined3d_device_get_swapchain(device->wined3d_device, i); + wined3d_swapchain_get_desc(wined3d_swapchain, &desc); + + if (!desc.windowed) + { + wined3d_mutex_unlock(); + WARN("Trying to create an additional swapchain in fullscreen mode, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } + } + wined3d_mutex_unlock(); + wined3d_swapchain_desc_from_present_parameters(&desc, present_parameters); if (SUCCEEDED(hr = d3d8_swapchain_create(device, &desc, &object))) *swapchain = &object->IDirect3DSwapChain8_iface; diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 337ad56..99fe70a 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -262,12 +262,16 @@ static void test_swapchain(void) IDirect3DDevice8 *device; IDirect3D8 *d3d; ULONG refcount; - HWND window; + HWND window, window2; HRESULT hr; + struct device_desc device_desc; 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"); + window2 = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ok(!!window2, "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, NULL))) @@ -356,10 +360,42 @@ static void test_swapchain(void) IDirect3DSwapChain8_Release(swapchain3); IDirect3DSwapChain8_Release(swapchain2); IDirect3DSwapChain8_Release(swapchain1); + + d3dpp.Windowed = FALSE; + d3dpp.hDeviceWindow = window; + d3dpp.BackBufferCount = 1; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + + device_desc.width = registry_mode.dmPelsWidth; + device_desc.height = registry_mode.dmPelsHeight; + device_desc.device_window = window; + device_desc.flags = CREATE_DEVICE_FULLSCREEN; + hr = reset_device(device, &device_desc); + ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr); + + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.Windowed = TRUE; + d3dpp.hDeviceWindow = window; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + d3dpp.hDeviceWindow = window2; + hr = IDirect3DDevice8_CreateAdditionalSwapChain(device, &d3dpp, &swapchain1); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x\n", hr); + refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); cleanup: IDirect3D8_Release(d3d); + DestroyWindow(window2); DestroyWindow(window); } -- 2.0.4 From jacek at codeweavers.com Tue Nov 25 06:22:44 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Tue, 25 Nov 2014 13:22:44 +0100 Subject: mshtml: Fixed some test failures. Message-ID: <54747494.9080604@codeweavers.com> --- dlls/mshtml/tests/htmldoc.c | 3 +++ 1 file changed, 3 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Fixed-some-test-failures.diff Type: text/x-patch Size: 449 bytes Desc: not available URL: From Stefan.Leichter at camline.com Tue Nov 25 15:07:03 2014 From: Stefan.Leichter at camline.com (Stefan Leichter) Date: Tue, 25 Nov 2014 22:07:03 +0100 Subject: difxapi: add stubs for SetDifxLogCallbackA/W Message-ID: <201411252207.03517.Stefan.Leichter@camline.com> fixes https://bugs.winehq.org/show_bug.cgi?id=35670 --- dlls/difxapi/difxapi.spec | 2 ++ dlls/difxapi/main.c | 10 ++++++++++ include/difxapi.h | 4 ++++ 3 files changed, 16 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-difxapi-add-stubs-for-SetDifxLogCallbackA-W.txt Type: text/x-patch Size: 1969 bytes Desc: not available URL: From stefan at codeweavers.com Tue Nov 25 15:34:09 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 22:34:09 +0100 Subject: [PATCH 1/5] wined3d: Vertex fog uses the absolute eye position z. Message-ID: <1416951253-16564-1-git-send-email-stefan@codeweavers.com> This is written from scratch, but inspired by the patch from Joachim Priesner. The included test tests the absolute minimum necessary to show that the abs() needs to be placed in the fixed function vertex pipeline replacement shader. It ignores vertex and pixel shader behavior. Tests for table fog will be added in patch 4. --- dlls/d3d8/tests/visual.c | 106 +++++++++++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 106 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 102 +++++++++++++++++++++++++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 6 +++ 4 files changed, 320 insertions(+) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index cbede9d..199b204 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5361,6 +5361,111 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void negative_fixedfunction_fog_test(void) +{ + HRESULT hr; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + float start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + { 0.0f, 1.0f, 0x00808000}, + {-1.0f, 0.0f, 0x0000ff00}, + }; + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + conv.f = tests[i].start; + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = tests[i].end; + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 320, 240); + ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -5412,4 +5517,5 @@ START_TEST(visual) add_dirty_rect_test(); test_3dc_formats(); fog_interpolation_test(); + negative_fixedfunction_fog_test(); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index fbab386..714a225 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16964,6 +16964,111 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void negative_fixedfunction_fog_test(void) +{ + HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + float start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + { 0.0f, 1.0f, 0x00808000}, + {-1.0f, 0.0f, 0x0000ff00}, + }; + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.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"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + 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 set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + conv.f = tests[i].start; + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = tests[i].end; + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 320, 240); + ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -17073,4 +17178,5 @@ START_TEST(visual) test_per_stage_constant(); test_3dc_formats(); fog_interpolation_test(); + negative_fixedfunction_fog_test(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9263e1e..fd24021 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8002,6 +8002,107 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void test_negative_fixedfunction_fog(void) +{ + HRESULT hr; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + ULONG refcount; + HWND window; + D3DCOLOR color; + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + float start, end; + DWORD color; + } + tests[] = + { + /* test_fog_interpolation shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + { 0.0f, 1.0f, 0x00808000}, + {-1.0f, 0.0f, 0x0000ff00}, + }; + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + conv.f = tests[i].start; + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = tests[i].end; + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, 4, 0); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = get_surface_color(rt, 0, 240); + ok(compare_color(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); @@ -8089,4 +8190,5 @@ START_TEST(ddraw7) test_resource_priority(); test_surface_desc_lock(); fog_interpolation_test(); + test_negative_fixedfunction_fog(); } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 98239ef..05a0e8e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5004,10 +5004,16 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ case WINED3D_FFP_VS_FOG_DEPTH: if (settings->ortho_fog) + { /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); + } else + { shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + if (!settings->transformed) + shader_addline(buffer, "gl_FogFragCoord = abs(gl_FogFragCoord);\n"); + } break; default: -- 2.0.4 From stefan at codeweavers.com Tue Nov 25 15:34:10 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 22:34:10 +0100 Subject: [PATCH 2/5] ddraw/tests: Rename fog_interpolation_test to be consistent with other tests. Message-ID: <1416951253-16564-2-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw7.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index fd24021..ce56990 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7878,7 +7878,7 @@ static void test_surface_desc_lock(void) DestroyWindow(window); } -static void fog_interpolation_test(void) +static void test_fog_interpolation(void) { HRESULT hr; IDirect3DDevice7 *device; @@ -8189,6 +8189,6 @@ START_TEST(ddraw7) test_lost_device(); test_resource_priority(); test_surface_desc_lock(); - fog_interpolation_test(); + test_fog_interpolation(); test_negative_fixedfunction_fog(); } -- 2.0.4 From stefan at codeweavers.com Tue Nov 25 15:34:11 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 22:34:11 +0100 Subject: [PATCH 3/5] d3d/tests: Show that the vfog abs is not a property of D3DFOG_LINEAR. Message-ID: <1416951253-16564-3-git-send-email-stefan@codeweavers.com> For EXP2 fog the abs does not make a difference. --- dlls/d3d8/tests/visual.c | 10 ++++++---- dlls/d3d9/tests/visual.c | 10 ++++++---- dlls/ddraw/tests/ddraw7.c | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 199b204..ebc8770 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5390,6 +5390,7 @@ static void negative_fixedfunction_fog_test(void) static const struct { float start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -5397,8 +5398,9 @@ static void negative_fixedfunction_fog_test(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, 0x00808000}, - {-1.0f, 0.0f, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, + {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, }; static const D3DMATRIX proj_mat = {{{ @@ -5431,8 +5433,6 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -5447,6 +5447,8 @@ static void negative_fixedfunction_fog_test(void) conv.f = tests[i].end; hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 714a225..2a84c1d 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16993,6 +16993,7 @@ static void negative_fixedfunction_fog_test(void) static const struct { float start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -17000,8 +17001,9 @@ static void negative_fixedfunction_fog_test(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, 0x00808000}, - {-1.0f, 0.0f, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, + {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, }; static const D3DMATRIX proj_mat = {{{ @@ -17034,8 +17036,6 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -17050,6 +17050,8 @@ static void negative_fixedfunction_fog_test(void) conv.f = tests[i].end; hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index ce56990..8fdddd7 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8031,6 +8031,7 @@ static void test_negative_fixedfunction_fog(void) static const struct { float start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -8038,8 +8039,9 @@ static void test_negative_fixedfunction_fog(void) /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, 0x00808000}, - {-1.0f, 0.0f, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, + {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, }; static D3DMATRIX proj_mat = { @@ -8070,8 +8072,6 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -8086,6 +8086,8 @@ static void test_negative_fixedfunction_fog(void) conv.f = tests[i].end; hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, -- 2.0.4 From stefan at codeweavers.com Tue Nov 25 15:34:12 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 22:34:12 +0100 Subject: [PATCH 4/5] d3d/tests: Table fog does not abs the fog coordinate. Message-ID: <1416951253-16564-4-git-send-email-stefan@codeweavers.com> Testing this with non-transformed vertices is pointless because z < 0.0 would be clipped anyway in the ortho_fog case. Otherwise we should use gl_Position.w (but currently don't), which can't be < 0.0 either. --- dlls/d3d8/tests/visual.c | 85 +++++++++++++++++++++++++++++++++++++---------- dlls/d3d9/tests/visual.c | 85 +++++++++++++++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw7.c | 72 ++++++++++++++++++++++++++++++--------- 3 files changed, 190 insertions(+), 52 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index ebc8770..6b2967f 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5381,34 +5381,69 @@ static void negative_fixedfunction_fog_test(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static const struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; union { DWORD d; float f; } conv; unsigned int i; + static const D3DMATRIX zero = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + /* Needed to make AMD drivers happy. Yeah, it is not supposed to + * have an effect on RHW draws. */ + 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 + }}}; static const struct { + DWORD pos_type; + const void *quad; + size_t stride; + const D3DMATRIX *matrix; float start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, - {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, - { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, -1.0f, 0.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, 0.0f, 1.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, -1.0f, 0.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, }; - static const D3DMATRIX proj_mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }}}; + D3DCAPS8 caps; window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); @@ -5423,8 +5458,11 @@ static void negative_fixedfunction_fog_test(void) return; } - hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, FALSE); @@ -5433,14 +5471,21 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetVertexShader(device, tests[i].pos_type | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); conv.f = tests[i].start; hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -5449,15 +5494,19 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); - hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tests[i].quad, tests[i].stride); ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); hr = IDirect3DDevice8_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 2a84c1d..c31957f 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16984,34 +16984,69 @@ static void negative_fixedfunction_fog_test(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static const struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; union { DWORD d; float f; } conv; unsigned int i; + static const D3DMATRIX zero = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + /* Needed to make AMD drivers happy. Yeah, it is not supposed to + * have an effect on RHW draws. */ + 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 + }}}; static const struct { + DWORD pos_type; + const void *quad; + size_t stride; + const D3DMATRIX *matrix; float start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, - {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, - { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, -1.0f, 0.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, 0.0f, 1.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, -1.0f, 0.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, }; - static const D3DMATRIX proj_mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }}}; + D3DCAPS9 caps; window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); @@ -17026,8 +17061,11 @@ static void negative_fixedfunction_fog_test(void) return; } - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, FALSE); @@ -17036,14 +17074,21 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, tests[i].pos_type | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); conv.f = tests[i].start; hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -17052,15 +17097,19 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tests[i].quad, tests[i].stride); ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); hr = IDirect3DDevice9_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 8fdddd7..0362ecb 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8022,34 +8022,61 @@ static void test_negative_fixedfunction_fog(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; union { DWORD d; float f; } conv; unsigned int i; + static D3DMATRIX zero = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + static 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 + }; static const struct { + DWORD pos_type; + void *quad; + D3DMATRIX *matrix; float start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, - {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, - { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, - }; - static D3DMATRIX proj_mat = - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f + {D3DFVF_XYZ, quad, &zero, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, &zero, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, &zero, 0.0f, 1.0f, D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, + {D3DFVF_XYZRHW, tquad, &identity, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, &identity, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, }; + D3DDEVICEDESC7 caps; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); @@ -8063,6 +8090,10 @@ static void test_negative_fixedfunction_fog(void) hr = IDirect3DDevice7_GetRenderTarget(device, &rt); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -8072,14 +8103,19 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); conv.f = tests[i].start; hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -8088,15 +8124,19 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, - D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, 4, 0); + tests[i].pos_type | D3DFVF_DIFFUSE, tests[i].quad, 4, 0); hr = IDirect3DDevice7_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = get_surface_color(rt, 0, 240); - ok(compare_color(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(compare_color(color, tests[i].color, 2) || broken(compare_color(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); } IDirectDrawSurface7_Release(rt); -- 2.0.4 From stefan at codeweavers.com Tue Nov 25 15:34:13 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Tue, 25 Nov 2014 22:34:13 +0100 Subject: [PATCH 5/5] d3d8/tests: Call TestCooperativeLevel after Present. Message-ID: <1416951253-16564-5-git-send-email-stefan@codeweavers.com> This fixes the test on my Geforce 7 Vista machine. The driver needs a Present call to notice that focus is lost. --- dlls/d3d8/tests/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 99fe70a..6a4dcc2 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -6812,10 +6812,10 @@ static void test_lost_device(void) ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - hr = IDirect3DDevice8_TestCooperativeLevel(device); - ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); ret = ShowWindow(window, SW_RESTORE); ok(ret, "Failed to restore window.\n"); -- 2.0.4 From mstefani at redhat.de Wed Nov 26 05:08:19 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 26 Nov 2014 12:08:19 +0100 Subject: msi/tests: Remove redundant if check (PVS-Studio). Message-ID: <20141126110819.GA6618@redhat.com> The ok_exception() macro already includes that check. --- dlls/msi/tests/automation.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c index beed6fd..016b1a2 100644 --- a/dlls/msi/tests/automation.c +++ b/dlls/msi/tests/automation.c @@ -1935,7 +1935,7 @@ static void test_Session(IDispatch *pSession) hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, TRUE); ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr); - if (hr == DISP_E_EXCEPTION) ok_exception(hr, szModeFlag); + ok_exception(hr, szModeFlag); hr = Session_ModeGet(pSession, MSIRUNMODE_REBOOTNOW, &bool); ok(hr == S_OK, "Session_ModeGet failed, hresult 0x%08x\n", hr); @@ -1943,7 +1943,7 @@ static void test_Session(IDispatch *pSession) hr = Session_ModePut(pSession, MSIRUNMODE_REBOOTNOW, FALSE); /* set it again so we don't reboot */ ok(hr == S_OK, "Session_ModePut failed, hresult 0x%08x\n", hr); - if (hr == DISP_E_EXCEPTION) ok_exception(hr, szModeFlag); + ok_exception(hr, szModeFlag); hr = Session_ModePut(pSession, MSIRUNMODE_MAINTENANCE, TRUE); ok(hr == DISP_E_EXCEPTION, "Session_ModePut failed, hresult 0x%08x\n", hr); -- 1.9.3 From mstefani at redhat.de Wed Nov 26 05:08:26 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 26 Nov 2014 12:08:26 +0100 Subject: shlwapi: Remove always true if-check (PVS-Studio). Message-ID: <20141126110826.GB6618@redhat.com> --- dlls/shlwapi/ordinal.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c index 8d3f1eb..0ea235c 100644 --- a/dlls/shlwapi/ordinal.c +++ b/dlls/shlwapi/ordinal.c @@ -5054,11 +5054,8 @@ INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags, { if ((fmt_flags & FDTF_LONGDATE) && (ret < size + 2)) { - if (ret < size + 2) - { - lstrcatW(&buf[ret-1], sep1); - ret += 2; - } + lstrcatW(&buf[ret-1], sep1); + ret += 2; } else { -- 1.9.3 From mstefani at redhat.de Wed Nov 26 05:08:37 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Wed, 26 Nov 2014 12:08:37 +0100 Subject: comdlg32: Remove an always true if check (PVS-Studio). Message-ID: <20141126110837.GC6618@redhat.com> Consistently indented the block to 4 spaces as it was a mess of 2, 3, 4 and 8 space indent. --- dlls/comdlg32/filedlg.c | 64 ++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 33 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 2738467..e0939ef 100644 --- a/dlls/comdlg32/filedlg.c +++ b/dlls/comdlg32/filedlg.c @@ -1586,39 +1586,37 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd) /* 2. (All platforms) If initdir is not null, then use it */ if (!handledPath && fodInfos->initdir && *fodInfos->initdir) { - /* Work out the proper path as supplied one might be relative */ - /* (Here because supplying '.' as dir browses to My Computer) */ - if (!handledPath) { - WCHAR tmpBuf[MAX_PATH]; - WCHAR tmpBuf2[MAX_PATH]; - WCHAR *nameBit; - DWORD result; - - lstrcpyW(tmpBuf, fodInfos->initdir); - if( PathFileExistsW(tmpBuf) ) { - /* initdir does not have to be a directory. If a file is - * specified, the dir part is taken */ - if( PathIsDirectoryW(tmpBuf)) { - PathAddBackslashW( tmpBuf ); - lstrcatW(tmpBuf, szwStar); - } - result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit); - if (result) { - *nameBit = 0x00; - MemFree(fodInfos->initdir); - fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf2) + 1)*sizeof(WCHAR)); - lstrcpyW(fodInfos->initdir, tmpBuf2); - handledPath = TRUE; - TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir)); - } - } - else if (fodInfos->initdir) - { - MemFree(fodInfos->initdir); - fodInfos->initdir = NULL; - TRACE("Value in InitDir is not an existing path, changed to (nil)\n"); - } - } + /* Work out the proper path as supplied one might be relative */ + /* (Here because supplying '.' as dir browses to My Computer) */ + WCHAR tmpBuf[MAX_PATH]; + WCHAR tmpBuf2[MAX_PATH]; + WCHAR *nameBit; + DWORD result; + + lstrcpyW(tmpBuf, fodInfos->initdir); + if (PathFileExistsW(tmpBuf)) { + /* initdir does not have to be a directory. If a file is + * specified, the dir part is taken */ + if (PathIsDirectoryW(tmpBuf)) { + PathAddBackslashW(tmpBuf); + lstrcatW(tmpBuf, szwStar); + } + result = GetFullPathNameW(tmpBuf, MAX_PATH, tmpBuf2, &nameBit); + if (result) { + *nameBit = 0x00; + MemFree(fodInfos->initdir); + fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf2) + 1) * sizeof(WCHAR)); + lstrcpyW(fodInfos->initdir, tmpBuf2); + handledPath = TRUE; + TRACE("Value in InitDir changed to %s\n", debugstr_w(fodInfos->initdir)); + } + } + else if (fodInfos->initdir) + { + MemFree(fodInfos->initdir); + fodInfos->initdir = NULL; + TRACE("Value in InitDir is not an existing path, changed to (nil)\n"); + } } if (!handledPath && (!fodInfos->initdir || !*fodInfos->initdir)) -- 1.9.3 From piotr at codeweavers.com Wed Nov 26 08:57:43 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Wed, 26 Nov 2014 15:57:43 +0100 Subject: ntdll: Handle ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID flag when opening manifest in RtlCreateActivationContext Message-ID: <5475EA67.7070100@codeweavers.com> --- dlls/kernel32/tests/actctx.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/actctx.c | 29 +++++++++++++++++++++- 2 files changed, 87 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ntdll-Handle-ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID-flag.txt Type: text/x-patch Size: 4330 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 26 08:13:28 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 26 Nov 2014 17:13:28 +0300 Subject: dwrite: Use file mapping for local file stream Message-ID: <5475E008.7010402@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Use-file-mapping-for-local-file-stream.patch Type: text/x-patch Size: 7762 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 26 08:12:55 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 26 Nov 2014 17:12:55 +0300 Subject: gdi32: Clarify read length values used with get_font_data() Message-ID: <5475DFE7.7010105@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gdi32-Clarify-read-length-values-used-with-get_font_.patch Type: text/x-patch Size: 1747 bytes Desc: not available URL: From jacek at codeweavers.com Wed Nov 26 07:55:45 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Wed, 26 Nov 2014 14:55:45 +0100 Subject: mshtml: Added fontname command support to execCommand. Message-ID: <5475DBE1.5000605@codeweavers.com> --- dlls/mshtml/htmldoc.c | 3 +++ 1 file changed, 3 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Added-fontname-command-support-to-execCommand.diff Type: text/x-patch Size: 755 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 26 00:02:11 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 26 Nov 2014 09:02:11 +0300 Subject: dwrite: Use file mapping for local file stream Message-ID: <54756CE3.4060507@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Use-file-mapping-for-local-file-stream.patch Type: text/x-patch Size: 7762 bytes Desc: not available URL: From nsivov at codeweavers.com Wed Nov 26 00:00:37 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Wed, 26 Nov 2014 09:00:37 +0300 Subject: gdi32: Clarify read length values used with get_font_data() Message-ID: <54756C85.5040508@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gdi32-Clarify-read-length-values-used-with-get_font_.patch Type: text/x-patch Size: 1747 bytes Desc: not available URL: From rmy at tigress.co.uk Wed Nov 26 11:29:08 2014 From: rmy at tigress.co.uk (Ron Yorston) Date: Wed, 26 Nov 2014 17:29:08 +0000 Subject: msvcrt: Fix passing of explicit environment to spawn/exec calls Message-ID: <54760de4.4HLUTGBBliPfnhhc%rmy@tigress.co.uk> Explicit sets of environment variables passed to spawn/exec are consistently converted to wide character environment blocks. Because CREATE_UNICODE_ENVIRONMENT isn't included in the process creation flags the environment block is incorrectly passed through another conversion to wide characters in create_process_impl. --- dlls/msvcrt/process.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c index b782727..9ff7dba 100644 --- a/dlls/msvcrt/process.c +++ b/dlls/msvcrt/process.c @@ -134,6 +134,7 @@ static MSVCRT_intptr_t msvcrt_spawn(int flags, const MSVCRT_wchar_t* exe, MSVCRT STARTUPINFOW si; PROCESS_INFORMATION pi; MSVCRT_wchar_t fullname[MAX_PATH]; + DWORD flg; TRACE("%x %s %s %s %d\n", flags, debugstr_w(exe), debugstr_w(cmdline), debugstr_w(env), use_path); @@ -148,8 +149,9 @@ static MSVCRT_intptr_t msvcrt_spawn(int flags, const MSVCRT_wchar_t* exe, MSVCRT memset(&si, 0, sizeof(si)); si.cb = sizeof(si); msvcrt_create_io_inherit_block(&si.cbReserved2, &si.lpReserved2); - if (!CreateProcessW(fullname, cmdline, NULL, NULL, TRUE, - flags == MSVCRT__P_DETACH ? DETACHED_PROCESS : 0, + flg = flags == MSVCRT__P_DETACH ? DETACHED_PROCESS : 0; + flg |= env ? CREATE_UNICODE_ENVIRONMENT : 0; + if (!CreateProcessW(fullname, cmdline, NULL, NULL, TRUE, flg, env, NULL, &si, &pi)) { msvcrt_set_errno(GetLastError()); -- 1.7.1 From stefan at codeweavers.com Wed Nov 26 12:08:51 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 26 Nov 2014 19:08:51 +0100 Subject: [PATCH 1/5] wined3d: Vertex fog uses the absolute eye position z (v2). Message-ID: <1417025335-31649-1-git-send-email-stefan@codeweavers.com> Version 2: Set ZENABLE to D3DZB_FALSE instead of FALSE. This series supersedes 107863-107867. This is written from scratch, but inspired by the patch from Joachim Priesner. The included test tests the absolute minimum necessary to show that the abs() needs to be placed in the fixed function vertex pipeline replacement shader. It ignores vertex and pixel shader behavior. Tests for table fog will be added in patch 4. --- dlls/d3d8/tests/visual.c | 106 +++++++++++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 106 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 102 +++++++++++++++++++++++++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 6 +++ 4 files changed, 320 insertions(+) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index cbede9d..7c6200e 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5361,6 +5361,111 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void negative_fixedfunction_fog_test(void) +{ + HRESULT hr; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + float start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + { 0.0f, 1.0f, 0x00808000}, + {-1.0f, 0.0f, 0x0000ff00}, + }; + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + conv.f = tests[i].start; + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = tests[i].end; + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 320, 240); + ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -5412,4 +5517,5 @@ START_TEST(visual) add_dirty_rect_test(); test_3dc_formats(); fog_interpolation_test(); + negative_fixedfunction_fog_test(); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index fbab386..069fec1 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16964,6 +16964,111 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void negative_fixedfunction_fog_test(void) +{ + HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + float start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + { 0.0f, 1.0f, 0x00808000}, + {-1.0f, 0.0f, 0x0000ff00}, + }; + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.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"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + 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 set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + conv.f = tests[i].start; + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = tests[i].end; + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 320, 240); + ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -17073,4 +17178,5 @@ START_TEST(visual) test_per_stage_constant(); test_3dc_formats(); fog_interpolation_test(); + negative_fixedfunction_fog_test(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9263e1e..576196d 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8002,6 +8002,107 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void test_negative_fixedfunction_fog(void) +{ + HRESULT hr; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + ULONG refcount; + HWND window; + D3DCOLOR color; + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + union + { + DWORD d; + float f; + } conv; + unsigned int i; + static const struct + { + float start, end; + DWORD color; + } + tests[] = + { + /* test_fog_interpolation shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + { 0.0f, 1.0f, 0x00808000}, + {-1.0f, 0.0f, 0x0000ff00}, + }; + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + conv.f = tests[i].start; + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + conv.f = tests[i].end; + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, conv.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, 4, 0); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = get_surface_color(rt, 0, 240); + ok(compare_color(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); @@ -8089,4 +8190,5 @@ START_TEST(ddraw7) test_resource_priority(); test_surface_desc_lock(); fog_interpolation_test(); + test_negative_fixedfunction_fog(); } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 98239ef..05a0e8e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5004,10 +5004,16 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ case WINED3D_FFP_VS_FOG_DEPTH: if (settings->ortho_fog) + { /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); + } else + { shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + if (!settings->transformed) + shader_addline(buffer, "gl_FogFragCoord = abs(gl_FogFragCoord);\n"); + } break; default: -- 2.0.4 From stefan at codeweavers.com Wed Nov 26 12:08:52 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 26 Nov 2014 19:08:52 +0100 Subject: [PATCH 2/5] ddraw/tests: Rename fog_interpolation_test to be consistent with other tests. Message-ID: <1417025335-31649-2-git-send-email-stefan@codeweavers.com> --- dlls/ddraw/tests/ddraw7.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 576196d..bf42495 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7878,7 +7878,7 @@ static void test_surface_desc_lock(void) DestroyWindow(window); } -static void fog_interpolation_test(void) +static void test_fog_interpolation(void) { HRESULT hr; IDirect3DDevice7 *device; @@ -8189,6 +8189,6 @@ START_TEST(ddraw7) test_lost_device(); test_resource_priority(); test_surface_desc_lock(); - fog_interpolation_test(); + test_fog_interpolation(); test_negative_fixedfunction_fog(); } -- 2.0.4 From stefan at codeweavers.com Wed Nov 26 12:08:53 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 26 Nov 2014 19:08:53 +0100 Subject: [PATCH 3/5] d3d/tests: Show that the vfog abs is not a property of D3DFOG_LINEAR. Message-ID: <1417025335-31649-3-git-send-email-stefan@codeweavers.com> For EXP2 fog the abs does not make a difference. --- dlls/d3d8/tests/visual.c | 10 ++++++---- dlls/d3d9/tests/visual.c | 10 ++++++---- dlls/ddraw/tests/ddraw7.c | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 7c6200e..1ef5b26 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5390,6 +5390,7 @@ static void negative_fixedfunction_fog_test(void) static const struct { float start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -5397,8 +5398,9 @@ static void negative_fixedfunction_fog_test(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, 0x00808000}, - {-1.0f, 0.0f, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, + {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, }; static const D3DMATRIX proj_mat = {{{ @@ -5431,8 +5433,6 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -5447,6 +5447,8 @@ static void negative_fixedfunction_fog_test(void) conv.f = tests[i].end; hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 069fec1..0408533 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16993,6 +16993,7 @@ static void negative_fixedfunction_fog_test(void) static const struct { float start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -17000,8 +17001,9 @@ static void negative_fixedfunction_fog_test(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, 0x00808000}, - {-1.0f, 0.0f, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, + {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, }; static const D3DMATRIX proj_mat = {{{ @@ -17034,8 +17036,6 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -17050,6 +17050,8 @@ static void negative_fixedfunction_fog_test(void) conv.f = tests[i].end; hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index bf42495..9d4ddff 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8031,6 +8031,7 @@ static void test_negative_fixedfunction_fog(void) static const struct { float start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -8038,8 +8039,9 @@ static void test_negative_fixedfunction_fog(void) /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, 0x00808000}, - {-1.0f, 0.0f, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, + {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, + { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, }; static D3DMATRIX proj_mat = { @@ -8070,8 +8072,6 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -8086,6 +8086,8 @@ static void test_negative_fixedfunction_fog(void) conv.f = tests[i].end; hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, -- 2.0.4 From stefan at codeweavers.com Wed Nov 26 12:08:54 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 26 Nov 2014 19:08:54 +0100 Subject: [PATCH 4/5] d3d/tests: Table fog does not abs the fog coordinate (v2). Message-ID: <1417025335-31649-4-git-send-email-stefan@codeweavers.com> Version 2: Fix test failures on the testbot. We have to run the depth-clamped XYZRHW tests first, otherwise depth clamping is broken on this driver. Testing this with non-transformed vertices is pointless because z < 0.0 would be clipped anyway in the ortho_fog case. Otherwise we should use gl_Position.w (but currently don't), which can't be < 0.0 either. --- dlls/d3d8/tests/visual.c | 86 +++++++++++++++++++++++++++++++++++++---------- dlls/d3d9/tests/visual.c | 86 +++++++++++++++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw7.c | 73 +++++++++++++++++++++++++++++++--------- 3 files changed, 193 insertions(+), 52 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 1ef5b26..e7fad42 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5381,34 +5381,70 @@ static void negative_fixedfunction_fog_test(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static const struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; union { DWORD d; float f; } conv; unsigned int i; + static const D3DMATRIX zero = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + /* Needed to make AMD drivers happy. Yeah, it is not supposed to + * have an effect on RHW draws. */ + 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 + }}}; static const struct { + DWORD pos_type; + const void *quad; + size_t stride; + const D3DMATRIX *matrix; float start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { + /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, 0.0f, 1.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, -1.0f, 0.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, - {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, - { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, -1.0f, 0.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, }; - static const D3DMATRIX proj_mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }}}; + D3DCAPS8 caps; window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); @@ -5423,8 +5459,11 @@ static void negative_fixedfunction_fog_test(void) return; } - hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); @@ -5433,14 +5472,21 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetVertexShader(device, tests[i].pos_type | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); conv.f = tests[i].start; hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -5449,15 +5495,19 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); - hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tests[i].quad, tests[i].stride); ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); hr = IDirect3DDevice8_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 0408533..4956572 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16984,34 +16984,70 @@ static void negative_fixedfunction_fog_test(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static const struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; union { DWORD d; float f; } conv; unsigned int i; + static const D3DMATRIX zero = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + /* Needed to make AMD drivers happy. Yeah, it is not supposed to + * have an effect on RHW draws. */ + 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 + }}}; static const struct { + DWORD pos_type; + const void *quad; + size_t stride; + const D3DMATRIX *matrix; float start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { + /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, 0.0f, 1.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, -1.0f, 0.0f, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, - {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, - { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, -1.0f, 0.0f, + D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, 0.0f, 1.0f, + D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, }; - static const D3DMATRIX proj_mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }}}; + D3DCAPS9 caps; window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); @@ -17026,8 +17062,11 @@ static void negative_fixedfunction_fog_test(void) return; } - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); @@ -17036,14 +17075,21 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, tests[i].pos_type | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); conv.f = tests[i].start; hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -17052,15 +17098,19 @@ static void negative_fixedfunction_fog_test(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tests[i].quad, tests[i].stride); ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); hr = IDirect3DDevice9_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9d4ddff..0a95dbc 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8022,34 +8022,62 @@ static void test_negative_fixedfunction_fog(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; union { DWORD d; float f; } conv; unsigned int i; + static D3DMATRIX zero = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + static 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 + }; static const struct { + DWORD pos_type; + void *quad; + D3DMATRIX *matrix; float start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { + /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */ + {D3DFVF_XYZRHW, tquad, &identity, 0.0f, 1.0f, D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, &identity, -1.0f, 0.0f, D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - { 0.0f, 1.0f, D3DFOG_LINEAR, 0x00808000}, - {-1.0f, 0.0f, D3DFOG_LINEAR, 0x0000ff00}, - { 0.0f, 1.0f, D3DFOG_EXP, 0x009b6400}, - }; - static D3DMATRIX proj_mat = - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f + {D3DFVF_XYZ, quad, &zero, 0.0f, 1.0f, D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, &zero, -1.0f, 0.0f, D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, &zero, 0.0f, 1.0f, D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, }; + D3DDEVICEDESC7 caps; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); @@ -8063,6 +8091,10 @@ static void test_negative_fixedfunction_fog(void) hr = IDirect3DDevice7_GetRenderTarget(device, &rt); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -8072,14 +8104,19 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); conv.f = tests[i].start; hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, conv.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -8088,15 +8125,19 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, - D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, 4, 0); + tests[i].pos_type | D3DFVF_DIFFUSE, tests[i].quad, 4, 0); hr = IDirect3DDevice7_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = get_surface_color(rt, 0, 240); - ok(compare_color(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(compare_color(color, tests[i].color, 2) || broken(compare_color(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); } IDirectDrawSurface7_Release(rt); -- 2.0.4 From stefan at codeweavers.com Wed Nov 26 12:08:55 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Wed, 26 Nov 2014 19:08:55 +0100 Subject: [PATCH 5/5] d3d8/tests: Call TestCooperativeLevel after Present. Message-ID: <1417025335-31649-5-git-send-email-stefan@codeweavers.com> This fixes the test on my Geforce 7 Vista machine. The driver needs a Present call to notice that focus is lost. --- dlls/d3d8/tests/device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 99fe70a..6a4dcc2 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -6812,10 +6812,10 @@ static void test_lost_device(void) ret = SetForegroundWindow(GetDesktopWindow()); ok(ret, "Failed to set foreground window.\n"); - hr = IDirect3DDevice8_TestCooperativeLevel(device); - ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_TestCooperativeLevel(device); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); ret = ShowWindow(window, SW_RESTORE); ok(ret, "Failed to restore window.\n"); -- 2.0.4 From piotr at codeweavers.com Wed Nov 26 15:10:58 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Wed, 26 Nov 2014 22:10:58 +0100 Subject: ntdll: Handle ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID flag when opening manifest in RtlCreateActivationContext (try2) Message-ID: <547641E2.2060006@codeweavers.com> try2: - fix compilation warning - change return value in out of memory case --- dlls/kernel32/tests/actctx.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/actctx.c | 31 ++++++++++++++++++++++- 2 files changed, 89 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ntdll-Handle-ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID-flag.txt Type: text/x-patch Size: 4375 bytes Desc: not available URL: From leslie_alistair at hotmail.com Wed Nov 26 21:11:59 2014 From: leslie_alistair at hotmail.com (Alistair Leslie-Hughes) Date: Thu, 27 Nov 2014 14:11:59 +1100 Subject: winetest: Skip over stub dll if detected Message-ID: Hi, Changelog: winetest: Skip over stub dll if detected Best Regards Alistair Leslie-Hughes -------------- next part -------------- >From a217e4fc63d47da273ed1b78ccf35ae71d2df7a2 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 10 Nov 2014 12:44:05 +1100 Subject: [PATCH] Skip over stub dll if detected To: wine-patches --- programs/winetest/main.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 2afa813..6854f17 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -308,6 +308,44 @@ static BOOL is_native_dll( HMODULE module ) return TRUE; } +/* + * Windows 8 has a concept of stub DLL's. When DLLMain is called the user is prompted + * to install that component. To bypass this check we need to look at the version resource. + */ +static BOOL is_stub_dll(const char *filename) +{ + DWORD size, ver; + BOOL isstub = FALSE; + + size = GetFileVersionInfoSizeA(filename, &ver); + if(size != 0) + { + LPSTR data = HeapAlloc(GetProcessHeap(), 0, size); + char *p; + + if(!data) + return isstub; + + if (GetFileVersionInfoA(filename, ver, size, data)) + { + char buf[256]; + + sprintf(buf, "\\StringFileInfo\\%04x%04x\\OriginalFilename", MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), 1200); + if (VerQueryValueA(data, buf, (LPVOID*)&p, &size)) + { + if(lstrcmpiA("wcodstub.dll", p) == 0) + { + isstub = TRUE; + } + } + } + + HeapFree(GetProcessHeap(), 0, data); + } + + return isstub; +} + static void print_version (void) { #ifdef __i386__ @@ -911,6 +949,17 @@ extract_test_proc (HMODULE hModule, LPCSTR lpszType, LPSTR lpszName, LONG_PTR lP } return TRUE; } + if(is_stub_dll(dllname)) + { + FreeLibrary(dll); + xprintf (" %s=dll is a stub\n", dllname); + if (actctx != INVALID_HANDLE_VALUE) + { + pDeactivateActCtx(0, cookie); + pReleaseActCtx(actctx); + } + return TRUE; + } if (is_native_dll(dll)) { FreeLibrary(dll); -- 1.9.1 From leslie_alistair at hotmail.com Wed Nov 26 21:48:12 2014 From: leslie_alistair at hotmail.com (Alistair Leslie-Hughes) Date: Thu, 27 Nov 2014 14:48:12 +1100 Subject: wine.inf: Add Shell Url Associations Keys (resend) Message-ID: Hi, Changelog: wine.inf: Add Shell Url Associations Keys Best Regards Alistair Leslie-Hughes From leslie_alistair at hotmail.com Wed Nov 26 23:11:36 2014 From: leslie_alistair at hotmail.com (Alistair Leslie-Hughes) Date: Thu, 27 Nov 2014 16:11:36 +1100 Subject: dpnet: Implement IDirectPlay8Address GetComponentByIndex Message-ID: Hi, Changelog: dpnet: Implement IDirectPlay8Address GetComponentByIndex Best Regards Alistair Leslie-Hughes -------------- next part -------------- >From 7c205c4c678345208cab50786d8ea64802c924ef Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Thu, 27 Nov 2014 15:57:44 +1100 Subject: [PATCH] Implement IDirectPlay8Address GetComponentByIndex To: wine-patches --- dlls/dpnet/address.c | 54 +++++++++++++++++++++++++++++++++++++++++++--- dlls/dpnet/tests/address.c | 14 ++++++------ 2 files changed, 58 insertions(+), 10 deletions(-) diff --git a/dlls/dpnet/address.c b/dlls/dpnet/address.c index 2062bc4..dfff0c6 100644 --- a/dlls/dpnet/address.c +++ b/dlls/dpnet/address.c @@ -369,9 +369,57 @@ static HRESULT WINAPI IDirectPlay8AddressImpl_GetComponentByIndex(IDirectPlay8Ad const DWORD dwComponentID, WCHAR *pwszName, DWORD *pdwNameLen, void *pvBuffer, DWORD *pdwBufferSize, DWORD *pdwDataType) { - IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface); - TRACE("(%p): stub\n", This); - return DPN_OK; + IDirectPlay8AddressImpl *This = impl_from_IDirectPlay8Address(iface); + struct component *entry; + DWORD count = 0; + + TRACE("(%p)->(%p %p %p %p)\n", This, pwszName, pvBuffer, pdwBufferSize, pdwDataType); + + if(!pdwNameLen || !pdwBufferSize) + return E_POINTER; + + if(dwComponentID > list_count(&This->components)) + return DPNERR_DOESNOTEXIST; + + LIST_FOR_EACH_ENTRY(entry, &This->components, struct component, entry) + { + if(count == dwComponentID) + { + if(*pdwBufferSize < entry->size) + { + *pdwBufferSize = entry->size; + return DPNERR_BUFFERTOOSMALL; + } + + *pdwBufferSize = entry->size; + *pdwDataType = entry->type; + + switch (entry->type) + { + case DPNA_DATATYPE_DWORD: + memcpy(pvBuffer, &entry->data.value, sizeof(DWORD)); + break; + case DPNA_DATATYPE_GUID: + memcpy(pvBuffer, &entry->data.guid, sizeof(GUID)); + break; + case DPNA_DATATYPE_STRING: + memcpy(pvBuffer, &entry->data.string, entry->size); + break; + case DPNA_DATATYPE_STRING_ANSI: + memcpy(pvBuffer, &entry->data.ansi, entry->size); + break; + case DPNA_DATATYPE_BINARY: + memcpy(pvBuffer, &entry->data.binary, entry->size); + break; + } + + return S_OK; + } + + count++; + } + + return DPNERR_DOESNOTEXIST; } static HRESULT WINAPI IDirectPlay8AddressImpl_AddComponent(IDirectPlay8Address *iface, diff --git a/dlls/dpnet/tests/address.c b/dlls/dpnet/tests/address.c index 59c5431..31fa179 100644 --- a/dlls/dpnet/tests/address.c +++ b/dlls/dpnet/tests/address.c @@ -145,13 +145,13 @@ static void address_addcomponents(void) ok(hr == S_OK, "got 0x%08x\n", hr); hr = IDirectPlay8Address_GetComponentByIndex(localaddr, 100, NULL, &namelen, NULL, &bufflen, &type); - todo_wine ok(hr == DPNERR_DOESNOTEXIST, "got 0x%08x\n", hr); + ok(hr == DPNERR_DOESNOTEXIST, "got 0x%08x\n", hr); hr = IDirectPlay8Address_GetComponentByIndex(localaddr, 100, NULL, NULL, NULL, &bufflen, &type); - todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr); + ok(hr == E_POINTER, "got 0x%08x\n", hr); hr = IDirectPlay8Address_GetComponentByIndex(localaddr, 100, NULL, &namelen, NULL, NULL, &type); - todo_wine ok(hr == E_POINTER, "got 0x%08x\n", hr); + ok(hr == E_POINTER, "got 0x%08x\n", hr); trace("GetNumComponents=%d\n", components); for(i=0; i < components; i++) @@ -163,7 +163,7 @@ static void address_addcomponents(void) namelen = 0; hr = IDirectPlay8Address_GetComponentByIndex(localaddr, i, NULL, &namelen, NULL, &bufflen, &type); - todo_wine ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); + ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, namelen * sizeof(WCHAR)); buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, bufflen); @@ -228,14 +228,14 @@ static void address_setsp(void) ok(components == 1, "components=%d\n", components); hr = IDirectPlay8Address_GetComponentByIndex(localaddr, 0, NULL, &namelen, NULL, &bufflen, &type); - todo_wine ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); + ok(hr == DPNERR_BUFFERTOOSMALL, "got 0x%08x\n", hr); name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, namelen * sizeof(WCHAR)); hr = IDirectPlay8Address_GetComponentByIndex(localaddr, 0, name, &namelen, (void*)&guid, &bufflen, &type); ok(hr == S_OK, "got 0x%08x\n", hr); - todo_wine ok(type == DPNA_DATATYPE_GUID, "wrong datatype: %d\n", type); - todo_wine ok(IsEqualGUID(&guid, &CLSID_DP8SP_TCPIP), "wrong guid\n"); + ok(type == DPNA_DATATYPE_GUID, "wrong datatype: %d\n", type); + ok(IsEqualGUID(&guid, &CLSID_DP8SP_TCPIP), "wrong guid\n"); HeapFree(GetProcessHeap(), 0, name); -- 1.9.1 From nsivov at codeweavers.com Thu Nov 27 00:31:28 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 27 Nov 2014 09:31:28 +0300 Subject: [PATCH 1/4] dwrite: Use stream fragment context when reading font tables Message-ID: <5476C540.1020803@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Use-stream-fragment-context-when-reading-font.patch Type: text/x-patch Size: 3716 bytes Desc: not available URL: From nsivov at codeweavers.com Thu Nov 27 00:31:43 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 27 Nov 2014 09:31:43 +0300 Subject: [PATCH 2/4] dwrite: Remove DLL_WINE_PREATTACH case, native module can't be used Message-ID: <5476C54F.2010700@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Remove-DLL_WINE_PREATTACH-case-native-module-.patch Type: text/x-patch Size: 761 bytes Desc: not available URL: From nsivov at codeweavers.com Thu Nov 27 00:31:55 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 27 Nov 2014 09:31:55 +0300 Subject: [PATCH 3/4] dwrite: Hide factory vtable selection in init helper Message-ID: <5476C55B.9070004@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-dwrite-Hide-factory-vtable-selection-in-init-helper.patch Type: text/x-patch Size: 1572 bytes Desc: not available URL: From nsivov at codeweavers.com Thu Nov 27 00:32:07 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 27 Nov 2014 09:32:07 +0300 Subject: [PATCH 4/4] dwrite/tests: Fix some test failures on older dwrite versions Message-ID: <5476C567.9010308@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-dwrite-tests-Fix-some-test-failures-on-older-dwrite-.patch Type: text/x-patch Size: 1044 bytes Desc: not available URL: From nsivov at codeweavers.com Thu Nov 27 03:55:55 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Thu, 27 Nov 2014 12:55:55 +0300 Subject: dwrite: Estimate x-height and cap height metrics if they're missing Message-ID: <5476F52B.3080705@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Estimate-x-height-and-cap-height-metrics-if-t.patch Type: text/x-patch Size: 3073 bytes Desc: not available URL: From mstefani at redhat.de Thu Nov 27 04:27:33 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 27 Nov 2014 11:27:33 +0100 Subject: cmd: Remove duplicated if-check (PVS-Studio). Message-ID: <20141127102733.GA10395@redhat.com> --- programs/cmd/builtins.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c index 6751d3e..992ca5c 100644 --- a/programs/cmd/builtins.c +++ b/programs/cmd/builtins.c @@ -3112,7 +3112,7 @@ void WCMD_rename (void) if (dotDst && (*(dotDst+1)=='*')) { if (dotSrc) strcatW(dest, dotSrc); } else if (dotDst) { - if (dotDst) strcatW(dest, dotDst); + strcatW(dest, dotDst); } WINE_TRACE("Source '%s'\n", wine_dbgstr_w(src)); -- 1.9.3 From mstefani at redhat.de Thu Nov 27 04:28:42 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 27 Nov 2014 11:28:42 +0100 Subject: comdlg32: RT_DIALOG is already an INTRESOURCE (PVS-Studio) Message-ID: <20141127102842.GB10395@redhat.com> --- dlls/comdlg32/printdlg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index bedd9c4..83b22c3 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -3817,16 +3817,16 @@ static void *pagesetup_get_template(pagesetup_data *data) { if(data->unicode) res = FindResourceW(data->u.dlgw->hInstance, - data->u.dlgw->lpPageSetupTemplateName, MAKEINTRESOURCEW(RT_DIALOG)); + data->u.dlgw->lpPageSetupTemplateName, (LPWSTR)RT_DIALOG); else res = FindResourceA(data->u.dlga->hInstance, - data->u.dlga->lpPageSetupTemplateName, MAKEINTRESOURCEA(RT_DIALOG)); + data->u.dlga->lpPageSetupTemplateName, (LPSTR)RT_DIALOG); tmpl_handle = LoadResource(data->u.dlgw->hInstance, res); } else { res = FindResourceW(COMDLG32_hInstance, MAKEINTRESOURCEW(PAGESETUPDLGORD), - MAKEINTRESOURCEW(RT_DIALOG)); + (LPWSTR)RT_DIALOG); tmpl_handle = LoadResource(COMDLG32_hInstance, res); } return LockResource(tmpl_handle); -- 1.9.3 From mstefani at redhat.de Thu Nov 27 04:29:40 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 27 Nov 2014 11:29:40 +0100 Subject: ieframe: IDC_ARROW is already an INTRESOURCE (PVS-Studio) Message-ID: <20141127102940.GC10395@redhat.com> --- dlls/ieframe/iexplore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ieframe/iexplore.c b/dlls/ieframe/iexplore.c index 0bdb556..08bb167 100644 --- a/dlls/ieframe/iexplore.c +++ b/dlls/ieframe/iexplore.c @@ -707,7 +707,7 @@ void register_iewindow_class(void) wc.hIcon = LoadIconW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDI_APPICON)); wc.hIconSm = LoadImageW(GetModuleHandleW(0), MAKEINTRESOURCEW(IDI_APPICON), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); - wc.hCursor = LoadCursorW(0, MAKEINTRESOURCEW(IDC_ARROW)); + wc.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); wc.hbrBackground = 0; wc.lpszClassName = szIEWinFrame; wc.lpszMenuName = NULL; -- 1.9.3 From mstefani at redhat.de Thu Nov 27 04:30:28 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Thu, 27 Nov 2014 11:30:28 +0100 Subject: msvcrt/tests: Don't open code offsetof(). Message-ID: <20141127103028.GD10395@redhat.com> --- dlls/msvcrt/tests/headers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dlls/msvcrt/tests/headers.c b/dlls/msvcrt/tests/headers.c index 7c102b4..52d739e 100644 --- a/dlls/msvcrt/tests/headers.c +++ b/dlls/msvcrt/tests/headers.c @@ -66,11 +66,10 @@ #define TYPEOF(type) int #endif #define MSVCRT(x) MSVCRT_##x -#define OFFSET(T,F) ((unsigned int)((char *)&((struct T *)0L)->F - (char *)0L)) #define CHECK_SIZE(e) ok(sizeof(e) == sizeof(MSVCRT(e)), "Element has different sizes\n") #define CHECK_TYPE(t) { TYPEOF(t) a = 0; TYPEOF(MSVCRT(t)) b = a; a = b; CHECK_SIZE(t); } #define CHECK_STRUCT(s) ok(sizeof(struct s) == sizeof(struct MSVCRT(s)), "Struct has different sizes\n") -#define CHECK_FIELD(s,e) ok(OFFSET(s,e) == OFFSET(MSVCRT(s),e), "Bad offset\n") +#define CHECK_FIELD(s,e) ok(offsetof(struct s,e) == offsetof(struct MSVCRT(s),e), "Bad offset\n") #define CHECK_DEF(d) ok(d == MSVCRT_##d, "Defines (MSVCRT_)" #d " are different: %d vs. %d\n", d, MSVCRT_##d) /************* Checking types ***************/ -- 1.9.3 From stefan at codeweavers.com Thu Nov 27 05:12:33 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 27 Nov 2014 12:12:33 +0100 Subject: [PATCH 1/4] wined3d: Vertex fog uses the absolute eye position z (v3). Message-ID: <1417086756-14596-1-git-send-email-stefan@codeweavers.com> Version 3: Code style fixes. Version 2: Set ZENABLE to D3DZB_FALSE instead of FALSE. This is written from scratch, but inspired by the patch from Joachim Priesner. The included test tests the absolute minimum necessary to show that the abs() needs to be placed in the fixed function vertex pipeline replacement shader. It ignores vertex and pixel shader behavior. Tests for table fog will be added in patch 3. --- dlls/d3d8/tests/visual.c | 103 +++++++++++++++++++++++++++++++++++++++++++++ dlls/d3d9/tests/visual.c | 103 +++++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 99 +++++++++++++++++++++++++++++++++++++++++++ dlls/wined3d/glsl_shader.c | 4 +- 4 files changed, 308 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index cbede9d..317df5a 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5361,6 +5361,108 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void test_negative_fixedfunction_fog(void) +{ + HRESULT hr; + IDirect3DDevice8 *device; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + unsigned int i; + static const struct + { + union + { + float f; + DWORD d; + } start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + {{ 0.0f}, {1.0f}, 0x00808000}, + {{-1.0f}, {0.0f}, 0x0000ff00}, + }; + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + + window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 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_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, tests[i].start.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, tests[i].end.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice8_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 320, 240); + ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER8 identifier; @@ -5412,4 +5514,5 @@ START_TEST(visual) add_dirty_rect_test(); test_3dc_formats(); fog_interpolation_test(); + test_negative_fixedfunction_fog(); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index fbab386..6ee19b0 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16964,6 +16964,108 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void test_negative_fixedfunction_fog(void) +{ + HRESULT hr; + IDirect3DDevice9 *device; + IDirect3D9 *d3d; + ULONG refcount; + HWND window; + D3DCOLOR color; + static const struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + unsigned int i; + static const struct + { + union + { + float f; + DWORD d; + } start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + {{ 0.0f}, {1.0f}, 0x00808000}, + {{-1.0f}, {0.0f}, 0x0000ff00}, + }; + static const D3DMATRIX proj_mat = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.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"); + IDirect3D9_Release(d3d); + DestroyWindow(window); + return; + } + + 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 set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, tests[i].start.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, tests[i].end.d); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = getPixelColor(device, 320, 240); + ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); + } + + refcount = IDirect3DDevice9_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + IDirect3D9_Release(d3d); + DestroyWindow(window); +} + START_TEST(visual) { D3DADAPTER_IDENTIFIER9 identifier; @@ -17073,4 +17175,5 @@ START_TEST(visual) test_per_stage_constant(); test_3dc_formats(); fog_interpolation_test(); + test_negative_fixedfunction_fog(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 9263e1e..647ec82 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8002,6 +8002,104 @@ static void fog_interpolation_test(void) DestroyWindow(window); } +static void test_negative_fixedfunction_fog(void) +{ + HRESULT hr; + IDirect3DDevice7 *device; + IDirectDrawSurface7 *rt; + ULONG refcount; + HWND window; + D3DCOLOR color; + static struct + { + struct vec3 position; + D3DCOLOR diffuse; + } + quad[] = + { + {{-1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{-1.0f, 1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, + {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, + }; + unsigned int i; + static const struct + { + union + { + float f; + DWORD d; + } start, end; + DWORD color; + } + tests[] = + { + /* fog_interpolation_test shows that vertex fog evaluates the fog + * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows + * that the abs happens before the fog equation is evaluated. */ + {{ 0.0f}, {1.0f}, 0x00808000}, + {{-1.0f}, {0.0f}, 0x0000ff00}, + }; + static D3DMATRIX proj_mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, TRUE); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_LINEAR); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) + { + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, tests[i].start.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, tests[i].end.d); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); + hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, + D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, 4, 0); + hr = IDirect3DDevice7_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); + + color = get_surface_color(rt, 0, 240); + ok(compare_color(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + } + + IDirectDrawSurface7_Release(rt); + refcount = IDirect3DDevice7_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); @@ -8089,4 +8187,5 @@ START_TEST(ddraw7) test_resource_priority(); test_surface_desc_lock(); fog_interpolation_test(); + test_negative_fixedfunction_fog(); } diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 98239ef..a71459e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -5006,8 +5006,10 @@ static GLhandleARB shader_glsl_generate_ffp_vertex_shader(struct wined3d_shader_ if (settings->ortho_fog) /* Need to undo the [0.0 - 1.0] -> [-1.0 - 1.0] transformation from D3D to GL coordinates. */ shader_addline(buffer, "gl_FogFragCoord = gl_Position.z * 0.5 + 0.5;\n"); - else + else if (settings->transformed) shader_addline(buffer, "gl_FogFragCoord = ec_pos.z;\n"); + else + shader_addline(buffer, "gl_FogFragCoord = abs(ec_pos.z);\n"); break; default: -- 2.0.4 From stefan at codeweavers.com Thu Nov 27 05:12:34 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 27 Nov 2014 12:12:34 +0100 Subject: [PATCH 2/4] d3d/tests: Show that the vfog abs is not a property of D3DFOG_LINEAR. Message-ID: <1417086756-14596-2-git-send-email-stefan@codeweavers.com> For EXP2 fog the abs does not make a difference. --- dlls/d3d8/tests/visual.c | 10 ++++++---- dlls/d3d9/tests/visual.c | 10 ++++++---- dlls/ddraw/tests/ddraw7.c | 10 ++++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 317df5a..1cd066c 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5389,6 +5389,7 @@ static void test_negative_fixedfunction_fog(void) float f; DWORD d; } start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -5396,8 +5397,9 @@ static void test_negative_fixedfunction_fog(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - {{ 0.0f}, {1.0f}, 0x00808000}, - {{-1.0f}, {0.0f}, 0x0000ff00}, + {{ 0.0f}, {1.0f}, D3DFOG_LINEAR, 0x00808000}, + {{-1.0f}, {0.0f}, D3DFOG_LINEAR, 0x0000ff00}, + {{ 0.0f}, {1.0f}, D3DFOG_EXP, 0x009b6400}, }; static const D3DMATRIX proj_mat = {{{ @@ -5430,8 +5432,6 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -5444,6 +5444,8 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, tests[i].end.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 6ee19b0..6bf9adc 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16992,6 +16992,7 @@ static void test_negative_fixedfunction_fog(void) float f; DWORD d; } start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -16999,8 +17000,9 @@ static void test_negative_fixedfunction_fog(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - {{ 0.0f}, {1.0f}, 0x00808000}, - {{-1.0f}, {0.0f}, 0x0000ff00}, + {{ 0.0f}, {1.0f}, D3DFOG_LINEAR, 0x00808000}, + {{-1.0f}, {0.0f}, D3DFOG_LINEAR, 0x0000ff00}, + {{ 0.0f}, {1.0f}, D3DFOG_EXP, 0x009b6400}, }; static const D3DMATRIX proj_mat = {{{ @@ -17033,8 +17035,6 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -17047,6 +17047,8 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, tests[i].end.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 647ec82..a1dbd5e 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8030,6 +8030,7 @@ static void test_negative_fixedfunction_fog(void) float f; DWORD d; } start, end; + D3DFOGMODE vfog; DWORD color; } tests[] = @@ -8037,8 +8038,9 @@ static void test_negative_fixedfunction_fog(void) /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - {{ 0.0f}, {1.0f}, 0x00808000}, - {{-1.0f}, {0.0f}, 0x0000ff00}, + {{ 0.0f}, {1.0f}, D3DFOG_LINEAR, 0x00808000}, + {{-1.0f}, {0.0f}, D3DFOG_LINEAR, 0x0000ff00}, + {{ 0.0f}, {1.0f}, D3DFOG_EXP, 0x009b6400}, }; static D3DMATRIX proj_mat = { @@ -8069,8 +8071,6 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, D3DFOG_LINEAR); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); @@ -8083,6 +8083,8 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, tests[i].end.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, -- 2.0.4 From stefan at codeweavers.com Thu Nov 27 05:12:35 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 27 Nov 2014 12:12:35 +0100 Subject: [PATCH 3/4] d3d/tests: Table fog does not abs the fog coordinate (v2). Message-ID: <1417086756-14596-3-git-send-email-stefan@codeweavers.com> Version 2: Fix test failures on the testbot. We have to run the depth-clamped XYZRHW tests first, otherwise depth clamping is broken on this driver. Testing this with non-transformed vertices is pointless because z < 0.0 would be clipped anyway in the ortho_fog case. Otherwise we should use gl_Position.w (but currently don't), which can't be < 0.0 either. --- dlls/d3d8/tests/visual.c | 86 +++++++++++++++++++++++++++++++++++++---------- dlls/d3d9/tests/visual.c | 86 +++++++++++++++++++++++++++++++++++++---------- dlls/ddraw/tests/ddraw7.c | 73 +++++++++++++++++++++++++++++++--------- 3 files changed, 193 insertions(+), 52 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index 1cd066c..ec406f1 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5381,33 +5381,69 @@ static void test_negative_fixedfunction_fog(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static const struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; unsigned int i; + static const D3DMATRIX zero = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + /* Needed to make AMD drivers happy. Yeah, it is not supposed to + * have an effect on RHW draws. */ + 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 + }}}; static const struct { + DWORD pos_type; + const void *quad; + size_t stride; + const D3DMATRIX *matrix; union { float f; DWORD d; } start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { + /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, { 0.0f}, {1.0f}, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, {-1.0f}, {0.0f}, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - {{ 0.0f}, {1.0f}, D3DFOG_LINEAR, 0x00808000}, - {{-1.0f}, {0.0f}, D3DFOG_LINEAR, 0x0000ff00}, - {{ 0.0f}, {1.0f}, D3DFOG_EXP, 0x009b6400}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, { 0.0f}, {1.0f}, + D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, {-1.0f}, {0.0f}, + D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, { 0.0f}, {1.0f}, + D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, }; - static const D3DMATRIX proj_mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }}}; + D3DCAPS8 caps; window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); @@ -5422,8 +5458,11 @@ static void test_negative_fixedfunction_fog(void) return; } - hr = IDirect3DDevice8_SetVertexShader(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice8_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); @@ -5432,29 +5471,40 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetTransform(device, D3DTS_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetVertexShader(device, tests[i].pos_type | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGSTART, tests[i].start.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGEND, tests[i].end.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice8_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); - hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, sizeof(*quad)); + hr = IDirect3DDevice8_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tests[i].quad, tests[i].stride); ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); hr = IDirect3DDevice8_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 6bf9adc..59f5ba8 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16984,33 +16984,69 @@ static void test_negative_fixedfunction_fog(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static const struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; unsigned int i; + static const D3DMATRIX zero = + {{{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }}}; + /* Needed to make AMD drivers happy. Yeah, it is not supposed to + * have an effect on RHW draws. */ + 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 + }}}; static const struct { + DWORD pos_type; + const void *quad; + size_t stride; + const D3DMATRIX *matrix; union { float f; DWORD d; } start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { + /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, { 0.0f}, {1.0f}, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, {-1.0f}, {0.0f}, + D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - {{ 0.0f}, {1.0f}, D3DFOG_LINEAR, 0x00808000}, - {{-1.0f}, {0.0f}, D3DFOG_LINEAR, 0x0000ff00}, - {{ 0.0f}, {1.0f}, D3DFOG_EXP, 0x009b6400}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, { 0.0f}, {1.0f}, + D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, {-1.0f}, {0.0f}, + D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, sizeof(*quad), &zero, { 0.0f}, {1.0f}, + D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, }; - static const D3DMATRIX proj_mat = - {{{ - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - }}}; + D3DCAPS9 caps; window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 640, 480, NULL, NULL, NULL, NULL); @@ -17025,8 +17061,11 @@ static void test_negative_fixedfunction_fog(void) return; } - hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_DIFFUSE); - ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); + hr = IDirect3DDevice9_GetDeviceCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, D3DZB_FALSE); @@ -17035,29 +17074,40 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.RasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetTransform(device, D3DTS_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetFVF(device, tests[i].pos_type | D3DFVF_DIFFUSE); + ok(SUCCEEDED(hr), "Failed to set fvf, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, tests[i].start.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, tests[i].end.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, 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, sizeof(*quad)); + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, tests[i].quad, tests[i].stride); ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr); hr = IDirect3DDevice9_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = getPixelColor(device, 320, 240); - ok(color_match(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index a1dbd5e..e9510c4 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -8022,33 +8022,61 @@ static void test_negative_fixedfunction_fog(void) {{ 1.0f, -1.0f, -0.5f}, 0xffff0000}, {{ 1.0f, 1.0f, -0.5f}, 0xffff0000}, }; + static struct + { + struct vec4 position; + D3DCOLOR diffuse; + } + tquad[] = + { + {{ 0.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 0.0f, -0.5f, 1.0f}, 0xffff0000}, + {{ 0.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + {{640.0f, 480.0f, -0.5f, 1.0f}, 0xffff0000}, + }; unsigned int i; + static D3DMATRIX zero = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + }; + static 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 + }; static const struct { + DWORD pos_type; + void *quad; + D3DMATRIX *matrix; union { float f; DWORD d; } start, end; - D3DFOGMODE vfog; - DWORD color; + D3DFOGMODE vfog, tfog; + DWORD color, color_broken; } tests[] = { + /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */ + {D3DFVF_XYZRHW, tquad, &identity, { 0.0f}, {1.0f}, D3DFOG_NONE, D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000}, + /* r200 GPUs and presumably all d3d8 and older HW clamp the fog + * parameters to 0.0 and 1.0 in the table fog case. */ + {D3DFVF_XYZRHW, tquad, &identity, {-1.0f}, {0.0f}, D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, /* fog_interpolation_test shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ - {{ 0.0f}, {1.0f}, D3DFOG_LINEAR, 0x00808000}, - {{-1.0f}, {0.0f}, D3DFOG_LINEAR, 0x0000ff00}, - {{ 0.0f}, {1.0f}, D3DFOG_EXP, 0x009b6400}, - }; - static D3DMATRIX proj_mat = - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f + {D3DFVF_XYZ, quad, &zero, { 0.0f}, {1.0f}, D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, + {D3DFVF_XYZ, quad, &zero, {-1.0f}, {0.0f}, D3DFOG_LINEAR, D3DFOG_NONE, 0x0000ff00, 0x0000ff00}, + {D3DFVF_XYZ, quad, &zero, { 0.0f}, {1.0f}, D3DFOG_EXP, D3DFOG_NONE, 0x009b6400, 0x009b6400}, }; + D3DDEVICEDESC7 caps; window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); @@ -8062,6 +8090,10 @@ static void test_negative_fixedfunction_fog(void) hr = IDirect3DDevice7_GetRenderTarget(device, &rt); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + hr = IDirect3DDevice7_GetCaps(device, &caps); + ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr); + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE)) + skip("D3DPRASTERCAPS_FOGTABLE not supported, skipping some fog tests.\n"); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); @@ -8071,29 +8103,38 @@ static void test_negative_fixedfunction_fog(void) ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGCOLOR, 0x0000ff00); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); - hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &proj_mat); - ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE); + ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr); for (i = 0; i < sizeof(tests) / sizeof(*tests); i++) { + if (!(caps.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_FOGTABLE) && tests[i].tfog) + continue; + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x000000ff, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, tests[i].matrix); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGSTART, tests[i].start.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGEND, tests[i].end.d); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGVERTEXMODE, tests[i].vfog); ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGTABLEMODE, tests[i].tfog); + ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + hr = IDirect3DDevice7_BeginScene(device); ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr); hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, - D3DFVF_XYZ | D3DFVF_DIFFUSE, quad, 4, 0); + tests[i].pos_type | D3DFVF_DIFFUSE, tests[i].quad, 4, 0); hr = IDirect3DDevice7_EndScene(device); ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr); color = get_surface_color(rt, 0, 240); - ok(compare_color(color, tests[i].color, 2), "Got unexpected color 0x%08x, case %u.\n", color, i); + ok(compare_color(color, tests[i].color, 2) || broken(compare_color(color, tests[i].color_broken, 2)), + "Got unexpected color 0x%08x, case %u.\n", color, i); } IDirectDrawSurface7_Release(rt); -- 2.0.4 From stefan at codeweavers.com Thu Nov 27 05:12:36 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Thu, 27 Nov 2014 12:12:36 +0100 Subject: [PATCH 4/4] d3d/tests: Rename fog_interpolation_test for consistency. Message-ID: <1417086756-14596-4-git-send-email-stefan@codeweavers.com> This keeps ddraw7.c consistent. d3d{8,9}/tests/visual.c is already inconsistent. --- dlls/d3d8/tests/visual.c | 6 +++--- dlls/d3d9/tests/visual.c | 6 +++--- dlls/ddraw/tests/ddraw7.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c index ec406f1..a8a771e 100644 --- a/dlls/d3d8/tests/visual.c +++ b/dlls/d3d8/tests/visual.c @@ -5217,7 +5217,7 @@ done: DestroyWindow(window); } -static void fog_interpolation_test(void) +static void test_fog_interpolation(void) { HRESULT hr; IDirect3DDevice8 *device; @@ -5433,7 +5433,7 @@ static void test_negative_fixedfunction_fog(void) * parameters to 0.0 and 1.0 in the table fog case. */ {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, {-1.0f}, {0.0f}, D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, - /* fog_interpolation_test shows that vertex fog evaluates the fog + /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ {D3DFVF_XYZ, quad, sizeof(*quad), &zero, { 0.0f}, {1.0f}, @@ -5565,6 +5565,6 @@ START_TEST(visual) volume_v16u16_test(); add_dirty_rect_test(); test_3dc_formats(); - fog_interpolation_test(); + test_fog_interpolation(); test_negative_fixedfunction_fog(); } diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 59f5ba8..d1aa3d4 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -16820,7 +16820,7 @@ done: DestroyWindow(window); } -static void fog_interpolation_test(void) +static void test_fog_interpolation(void) { HRESULT hr; IDirect3DDevice9 *device; @@ -17036,7 +17036,7 @@ static void test_negative_fixedfunction_fog(void) * parameters to 0.0 and 1.0 in the table fog case. */ {D3DFVF_XYZRHW, tquad, sizeof(*tquad), &identity, {-1.0f}, {0.0f}, D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, - /* fog_interpolation_test shows that vertex fog evaluates the fog + /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ {D3DFVF_XYZ, quad, sizeof(*quad), &zero, { 0.0f}, {1.0f}, @@ -17226,6 +17226,6 @@ START_TEST(visual) stencil_cull_test(); test_per_stage_constant(); test_3dc_formats(); - fog_interpolation_test(); + test_fog_interpolation(); test_negative_fixedfunction_fog(); } diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index e9510c4..0ac7d7e 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -7878,7 +7878,7 @@ static void test_surface_desc_lock(void) DestroyWindow(window); } -static void fog_interpolation_test(void) +static void test_fog_interpolation(void) { HRESULT hr; IDirect3DDevice7 *device; @@ -8069,7 +8069,7 @@ static void test_negative_fixedfunction_fog(void) /* r200 GPUs and presumably all d3d8 and older HW clamp the fog * parameters to 0.0 and 1.0 in the table fog case. */ {D3DFVF_XYZRHW, tquad, &identity, {-1.0f}, {0.0f}, D3DFOG_NONE, D3DFOG_LINEAR, 0x00808000, 0x00ff0000}, - /* fog_interpolation_test shows that vertex fog evaluates the fog + /* test_fog_interpolation shows that vertex fog evaluates the fog * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows * that the abs happens before the fog equation is evaluated. */ {D3DFVF_XYZ, quad, &zero, { 0.0f}, {1.0f}, D3DFOG_LINEAR, D3DFOG_NONE, 0x00808000, 0x00808000}, @@ -8229,6 +8229,6 @@ START_TEST(ddraw7) test_lost_device(); test_resource_priority(); test_surface_desc_lock(); - fog_interpolation_test(); + test_fog_interpolation(); test_negative_fixedfunction_fog(); } -- 2.0.4 From hans at codeweavers.com Thu Nov 27 05:15:22 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Thu, 27 Nov 2014 12:15:22 +0100 Subject: msi: Update version resource. Message-ID: <1417086922.24185.4.camel@codeweavers.com> --- dlls/msi/msi.rc | 8 ++++---- programs/msiexec/rsrc.rc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msi-Update-version-resource.txt Type: text/x-patch Size: 1417 bytes Desc: not available URL: From hans at codeweavers.com Thu Nov 27 05:15:46 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Thu, 27 Nov 2014 12:15:46 +0100 Subject: msiexec: Add support for /update. Message-ID: <1417086946.24185.5.camel@codeweavers.com> --- programs/msiexec/msiexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-msiexec-Add-support-for-update.txt Type: text/x-patch Size: 466 bytes Desc: not available URL: From hans at codeweavers.com Thu Nov 27 05:16:07 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Thu, 27 Nov 2014 12:16:07 +0100 Subject: [1/2] vssapi: New dll. (resend) Message-ID: <1417086967.24185.6.camel@codeweavers.com> --- configure.ac | 1 + dlls/vssapi/Makefile.in | 4 +++ dlls/vssapi/main.c | 38 ++++++++++++++++++++++ dlls/vssapi/vssapi.spec | 84 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 dlls/vssapi/Makefile.in create mode 100644 dlls/vssapi/main.c create mode 100644 dlls/vssapi/vssapi.spec -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-vssapi-New-dll.txt Type: text/x-patch Size: 6865 bytes Desc: not available URL: From hans at codeweavers.com Thu Nov 27 05:16:54 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Thu, 27 Nov 2014 12:16:54 +0100 Subject: [2/2] vssapi: Add stub implementations for a couple of functions. (try 2) Message-ID: <1417087014.24185.7.camel@codeweavers.com> This version builds on Mingw. --- dlls/vssapi/main.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++ dlls/vssapi/vssapi.spec | 10 +++--- include/Makefile.in | 1 + include/vss.idl | 31 ++++++++++++++++++ include/vswriter.h | 47 ++++++++++++++++++++++++++++ 5 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 include/vss.idl create mode 100644 include/vswriter.h -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-vssapi-Add-stub-implementations-for-a-couple-of-functi.txt Type: text/x-patch Size: 8409 bytes Desc: not available URL: From hans at codeweavers.com Thu Nov 27 05:17:26 2014 From: hans at codeweavers.com (Hans Leidekker) Date: Thu, 27 Nov 2014 12:17:26 +0100 Subject: user32: Add a stub implementation of IsTouchWindow. Message-ID: <1417087046.24185.8.camel@codeweavers.com> --- dlls/user32/misc.c | 11 ++++++++++- dlls/user32/user32.spec | 1 + include/winuser.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-user32-Add-a-stub-implementation-of-IsTouchWindow.txt Type: text/x-patch Size: 1644 bytes Desc: not available URL: From piotr at codeweavers.com Thu Nov 27 11:51:38 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Thu, 27 Nov 2014 18:51:38 +0100 Subject: [PATCH 1/2] ws2_32: Add support for overlapping fd_sets in select Message-ID: <547764AA.3020309@codeweavers.com> --- dlls/ws2_32/socket.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ws2_32-Add-support-for-overlapping-fd_sets-in-select.txt Type: text/x-patch Size: 2071 bytes Desc: not available URL: From piotr at codeweavers.com Thu Nov 27 11:52:15 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Thu, 27 Nov 2014 18:52:15 +0100 Subject: [PATCH 2/2] ws2_32: Add more select tests Message-ID: <547764CF.5000909@codeweavers.com> --- dlls/ws2_32/tests/sock.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-ws2_32-Add-more-select-tests.txt Type: text/x-patch Size: 3764 bytes Desc: not available URL: From leslie_alistair at hotmail.com Thu Nov 27 20:40:38 2014 From: leslie_alistair at hotmail.com (Alistair Leslie-Hughes) Date: Fri, 28 Nov 2014 13:40:38 +1100 Subject: wine.inf: Add Shell Url Associations Keys (Try 2) Message-ID: Hi, Patch attached. Changelog: wine.inf: Add Shell Url Associations Keys Best Regards Alistair Leslie-Hughes -------------- next part -------------- >From 7e023e83defaa9e4882fb9fe50a929d669e4d159 Mon Sep 17 00:00:00 2001 From: Alistair Leslie-Hughes Date: Mon, 29 Sep 2014 11:25:33 +1000 Subject: [PATCH] Add Shell Url Associations Keys To: wine-patches --- loader/wine.inf.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/loader/wine.inf.in b/loader/wine.inf.in index 2fc2362..3446374 100644 --- a/loader/wine.inf.in +++ b/loader/wine.inf.in @@ -664,6 +664,12 @@ HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components\{de5aed00-a4bf-11d1-99 HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components\{de5aed00-a4bf-11d1-9948-00c04f98bbc9},"Locale",2,"*" HKLM,SOFTWARE\Microsoft\Active Setup\Installed Components\{de5aed00-a4bf-11d1-9948-00c04f98bbc9},"Version",2,"4,74,9273,0" +;Shell Associations +HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice,"Progid",,"IE.FTP" +HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice,"Progid",,"IE.HTTP" +HKCU,Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice,"Progid",,"IE.HTTPS" + + [Nls] HKLM,System\CurrentControlSet\Control\Nls\Codepage,"37",,"" HKLM,System\CurrentControlSet\Control\Nls\Language,"0401",,"" -- 1.9.1 From piotr at codeweavers.com Fri Nov 28 01:01:26 2014 From: piotr at codeweavers.com (Piotr Caban) Date: Fri, 28 Nov 2014 08:01:26 +0100 Subject: ntdll: Handle ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID flag when opening manifest in RtlCreateActivationContext (try3) Message-ID: <54781DC6.60801@codeweavers.com> --- dlls/kernel32/tests/actctx.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ dlls/ntdll/actctx.c | 25 ++++++++++++++++++- 2 files changed, 83 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ntdll-Handle-ACTCTX_FLAG_ASSEMBLY_DIRECTORY_VALID-flag.txt Type: text/x-patch Size: 4267 bytes Desc: not available URL: From mstefani at redhat.de Fri Nov 28 03:57:45 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Fri, 28 Nov 2014 10:57:45 +0100 Subject: gdi32/tests: Don't clear a variable before it goes out of scope (PVS-Studio) Message-ID: <20141128095745.GA17725@redhat.com> --- dlls/gdi32/tests/bitmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 2a2dd3a..351a5ca 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -4540,7 +4540,6 @@ static void test_GetDIBits_scanlines(void) ok( ret == 2, "got %d\n", ret ); ok( !memcmp( data, inverted_bits + 32, 16 * 4 ), "bits differ\n"); for (i = 16; i < 128; i++) ok( data[i] == 0xaaaaaaaa, "%d: got %08x\n", i, data[i] ); - memset( data, 0xaa, sizeof(data) ); DeleteObject( dib ); -- 1.9.3 From austinenglish at gmail.com Fri Nov 28 04:02:21 2014 From: austinenglish at gmail.com (Austin English) Date: Fri, 28 Nov 2014 04:02:21 -0600 Subject: include: correct NtSetLdtEntries prototype (try 2) Message-ID: See, e.g., https://src.chromium.org/native_client/trunk/src/native_client/src/trusted/service_runtime/win/nacl_ldt.c http://downloads.securityfocus.com/vulnerabilities/exploits/localDescriptorTableLocalPrivEscExlpoit.c -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/include/winternl.h b/include/winternl.h index 5a27f94..ebb0db3 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2228,7 +2228,7 @@ NTSYSAPI NTSTATUS WINAPI NtSetInformationThread(HANDLE,THREADINFOCLASS,LPCVOID, NTSYSAPI NTSTATUS WINAPI NtSetInformationToken(HANDLE,TOKEN_INFORMATION_CLASS,PVOID,ULONG); NTSYSAPI NTSTATUS WINAPI NtSetIntervalProfile(ULONG,KPROFILE_SOURCE); NTSYSAPI NTSTATUS WINAPI NtSetIoCompletion(HANDLE,ULONG_PTR,ULONG_PTR,NTSTATUS,SIZE_T); -NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(ULONG,LDT_ENTRY,ULONG,LDT_ENTRY); +NTSYSAPI NTSTATUS WINAPI NtSetLdtEntries(DWORD,DWORD,DWORD,DWORD,DWORD,DWORD); NTSYSAPI NTSTATUS WINAPI NtSetLowEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighEventPair(HANDLE); NTSYSAPI NTSTATUS WINAPI NtSetLowWaitHighThread(VOID); From nsivov at codeweavers.com Fri Nov 28 04:13:31 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 28 Nov 2014 13:13:31 +0300 Subject: [PATCH 1/2] dwrite: Respect typographic metrics when font instructs us to Message-ID: <54784ACB.6010509@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-dwrite-Respect-typographic-metrics-when-font-instruc.patch Type: text/x-patch Size: 2825 bytes Desc: not available URL: From nsivov at codeweavers.com Fri Nov 28 04:13:50 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Fri, 28 Nov 2014 13:13:50 +0300 Subject: [PATCH 2/2] dwrite: Fix lineGap metric using 'hhea' table values Message-ID: <54784ADE.3060103@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-dwrite-Fix-lineGap-metric-using-hhea-table-values.patch Type: text/x-patch Size: 12103 bytes Desc: not available URL: From stefan at codeweavers.com Fri Nov 28 04:16:39 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 28 Nov 2014 11:16:39 +0100 Subject: [PATCH 1/5] d3d9: Refuse to reset a lost device. Message-ID: <1417169803-30971-1-git-send-email-stefan@codeweavers.com> This fixes tabbing out of Crashday. This game uses Reset instead of TestCooperativeLevel to find out if focus has been restored. I did not place the failing reset call in the first focus loss cycle because this changes some follow-up return values from D3DERR_DEVICELOST to D3DERR_INVALIDCALL on native. In d3d9ex the (successful) reset call changes some results from S_PRESENT_MODE_CHANGED to S_PRESENT_OCCLUDED. --- dlls/d3d9/device.c | 7 +++++++ dlls/d3d9/tests/d3d9ex.c | 17 +++++++++++++++++ dlls/d3d9/tests/device.c | 11 +++++++++++ 3 files changed, 35 insertions(+) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 67a5629..89f6122 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -635,6 +635,13 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_Reset(IDirect3DDevice9Ex *if TRACE("iface %p, present_parameters %p.\n", iface, present_parameters); + if (!device->d3d_parent->extended && InterlockedCompareExchange(&device->device_state, + D3D9_DEVICE_STATE_LOST, D3D9_DEVICE_STATE_LOST) == D3D9_DEVICE_STATE_LOST) + { + WARN("App not active, returning D3DERR_DEVICELOST.\n"); + return D3DERR_DEVICELOST; + } + wined3d_mutex_lock(); if (device->vertex_buffer) diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 226e338..0ac9db7 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -1374,6 +1374,23 @@ static void test_lost_device(void) hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL); ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDirect3DDevice9Ex_Present(device, NULL, NULL, NULL, NULL); + ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr); + hr = reset_device(device, &desc); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_TestCooperativeLevel(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_Present(device, NULL, NULL, NULL, NULL); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_PresentEx(device, NULL, NULL, NULL, NULL, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_CheckDeviceState(device, window); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL); + ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DDevice9Ex_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); done: diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index cd6a9bd..a5cab96 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -9751,6 +9751,17 @@ static void test_lost_device(void) hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = reset_device(device, &device_desc); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + ret = ShowWindow(window, SW_RESTORE); + ok(ret, "Failed to restore window.\n"); + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + hr = reset_device(device, &device_desc); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); done: -- 2.0.4 From stefan at codeweavers.com Fri Nov 28 04:16:40 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 28 Nov 2014 11:16:40 +0100 Subject: [PATCH 2/5] d3d8: Refuse to reset a lost device. Message-ID: <1417169803-30971-2-git-send-email-stefan@codeweavers.com> --- dlls/d3d8/device.c | 7 +++++++ dlls/d3d8/tests/device.c | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 4c17e7c..a9dc8ec 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -647,6 +647,13 @@ static HRESULT WINAPI d3d8_device_Reset(IDirect3DDevice8 *iface, TRACE("iface %p, present_parameters %p.\n", iface, present_parameters); + if (InterlockedCompareExchange(&device->device_state, D3D8_DEVICE_STATE_LOST, + D3D8_DEVICE_STATE_LOST) == D3D8_DEVICE_STATE_LOST) + { + WARN("App not active, returning D3DERR_DEVICELOST.\n"); + return D3DERR_DEVICELOST; + } + wined3d_mutex_lock(); if (device->vertex_buffer) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 6a4dcc2..33d3cd5 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -6863,6 +6863,17 @@ static void test_lost_device(void) hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); todo_wine ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = reset_device(device, &device_desc); + ok(hr == D3DERR_DEVICELOST, "Got unexpected hr %#x.\n", hr); + ret = ShowWindow(window, SW_RESTORE); + ok(ret, "Failed to restore window.\n"); + ret = SetForegroundWindow(window); + ok(ret, "Failed to set foreground window.\n"); + hr = reset_device(device, &device_desc); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); done: -- 2.0.4 From stefan at codeweavers.com Fri Nov 28 04:16:41 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 28 Nov 2014 11:16:41 +0100 Subject: [PATCH 3/5] Revert "d3d10_1.idl: Added D3D10_1_SHADER_*_VERSION constants." Message-ID: <1417169803-30971-3-git-send-email-stefan@codeweavers.com> This reverts commit 044d7e82bf915d36c2921b29f129aae303355af4. These were added later by 9e942d29 in the _D3D10_1_CONSTANTS ifdef block. The double define causes a compile error with midl. --- include/d3d10_1.idl | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/d3d10_1.idl b/include/d3d10_1.idl index ba5517b..4ee49c6 100644 --- a/include/d3d10_1.idl +++ b/include/d3d10_1.idl @@ -48,8 +48,6 @@ cpp_quote("#define D3D10_1_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP (0.6f)") import "d3d10.idl"; cpp_quote("#include ") -const UINT D3D10_1_SHADER_MAJOR_VERSION = 4; -const UINT D3D10_1_SHADER_MINOR_VERSION = 1; typedef enum D3D10_FEATURE_LEVEL1 { -- 2.0.4 From stefan at codeweavers.com Fri Nov 28 04:16:42 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 28 Nov 2014 11:16:42 +0100 Subject: [PATCH 4/5] includes: Remove some double defines in d3d11.idl. Message-ID: <1417169803-30971-4-git-send-email-stefan@codeweavers.com> --- include/d3d11.idl | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/d3d11.idl b/include/d3d11.idl index 7bd8af7..eef826f 100644 --- a/include/d3d11.idl +++ b/include/d3d11.idl @@ -89,7 +89,6 @@ cpp_quote("#define D3D11_FLOAT32_MAX (3.402823466e+38f)") const unsigned int D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT = 8; -const UINT D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION = 16384; const UINT D3D11_MAX_MAXANISOTROPY = 16; const UINT D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT = 32; const UINT D3D11_VIEWPORT_BOUNDS_MAX = 32767; @@ -156,18 +155,9 @@ const UINT D3D11_REQ_TEXTURECUBE_DIMENSION = 16384; const UINT D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = 0; -const UINT D3D11_SHADER_MAJOR_VERSION = 5; -const UINT D3D11_SHADER_MAX_INSTANCES = 65535; -const UINT D3D11_SHADER_MAX_INTERFACES = 253; -const UINT D3D11_SHADER_MAX_INTERFACE_CALL_SITES = 4096; -const UINT D3D11_SHADER_MAX_TYPES = 65535; -const UINT D3D11_SHADER_MINOR_VERSION = 0; - const UINT D3D11_SHIFT_INSTRUCTION_PAD_VALUE = 0; const UINT D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = 5; -const UINT D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT = 8; - const UINT D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES = 2048; const UINT D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = 512; const UINT D3D11_SO_BUFFER_SLOT_COUNT = 4; -- 2.0.4 From stefan at codeweavers.com Fri Nov 28 04:16:43 2014 From: stefan at codeweavers.com (=?UTF-8?q?Stefan=20D=C3=B6singer?=) Date: Fri, 28 Nov 2014 11:16:43 +0100 Subject: [PATCH 5/5] wined3d: Update fragment program constants when switching from arb ffp draws. Message-ID: <1417169803-30971-5-git-send-email-stefan@codeweavers.com> This fixes bug 37424. --- dlls/wined3d/arb_program_shader.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index f5e614e..cf27d1f 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -6536,7 +6536,11 @@ static void fragment_prog_arbfp(struct wined3d_context *context, const struct wi state_arb_specularenable(context, state, STATE_RENDER(WINED3D_RS_SPECULARENABLE)); } context->last_was_pshader = FALSE; - } else { + } + else if (!context->last_was_pshader) + { + if (device->shader_backend == &arb_program_shader_backend) + context->constant_update_mask |= WINED3D_SHADER_CONST_PS_F; context->last_was_pshader = TRUE; } -- 2.0.4 From mstefani at redhat.de Fri Nov 28 07:16:29 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Fri, 28 Nov 2014 14:16:29 +0100 Subject: ole32/tests: Simplify ok() check (PVS-Studio) Message-ID: <20141128131629.GA18409@redhat.com> --- dlls/ole32/tests/propvariant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c index 1c9c447..9052aa5 100644 --- a/dlls/ole32/tests/propvariant.c +++ b/dlls/ole32/tests/propvariant.c @@ -158,7 +158,7 @@ static void expect(HRESULT hr, VARTYPE vt, BOOL copy) } if(flags == PROP_INV) - ok(hr == copy ? DISP_E_BADVARTYPE : STG_E_INVALIDPARAMETER, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr); + ok(hr == STG_E_INVALIDPARAMETER, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr); else if(flags == PROP_V0) ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr); else if(flags & PROP_TODO) -- 1.9.3 From mstefani at redhat.de Fri Nov 28 07:38:28 2014 From: mstefani at redhat.de (Michael Stefaniuc) Date: Fri, 28 Nov 2014 14:38:28 +0100 Subject: ole32/tests: Remove unused argument from expect() helper. Message-ID: <20141128133828.GA18525@redhat.com> --- Supersedes "ole32/tests: Simplify ok() check" dlls/ole32/tests/propvariant.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c index 1c9c447..08496de 100644 --- a/dlls/ole32/tests/propvariant.c +++ b/dlls/ole32/tests/propvariant.c @@ -130,7 +130,7 @@ static const char* wine_vtypes[VT_CLSID+1] = }; -static void expect(HRESULT hr, VARTYPE vt, BOOL copy) +static void expect(HRESULT hr, VARTYPE vt) { int idx = vt & VT_TYPEMASK; BYTE flags; @@ -158,7 +158,7 @@ static void expect(HRESULT hr, VARTYPE vt, BOOL copy) } if(flags == PROP_INV) - ok(hr == copy ? DISP_E_BADVARTYPE : STG_E_INVALIDPARAMETER, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr); + ok(hr == STG_E_INVALIDPARAMETER, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr); else if(flags == PROP_V0) ok(hr == S_OK, "%s (%s): got %08x\n", wine_vtypes[idx], modifier, hr); else if(flags & PROP_TODO) @@ -210,7 +210,7 @@ static void test_validtypes(void) vt = propvar.vt = i; memset(©, 0x77, sizeof(copy)); hr = PropVariantCopy(©, &propvar); - expect(hr, vt, TRUE); + expect(hr, vt); if (hr == S_OK) { ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt); @@ -224,7 +224,7 @@ static void test_validtypes(void) ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i); } hr = PropVariantClear(&propvar); - expect(hr, vt, FALSE); + expect(hr, vt); ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt); ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n", i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart); @@ -234,7 +234,7 @@ static void test_validtypes(void) vt = propvar.vt = i | VT_ARRAY; memset(©, 0x77, sizeof(copy)); hr = PropVariantCopy(©, &propvar); - expect(hr, vt, TRUE); + expect(hr, vt); if (hr == S_OK) { ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt); @@ -247,7 +247,7 @@ static void test_validtypes(void) ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i); } hr = PropVariantClear(&propvar); - expect(hr, vt, FALSE); + expect(hr, vt); ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt); ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n", i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart); @@ -258,7 +258,7 @@ static void test_validtypes(void) vt = propvar.vt = i | VT_VECTOR; memset(©, 0x77, sizeof(copy)); hr = PropVariantCopy(©, &propvar); - expect(hr, vt, TRUE); + expect(hr, vt); if (hr == S_OK) { ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt); @@ -271,7 +271,7 @@ static void test_validtypes(void) ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i); } hr = PropVariantClear(&propvar); - expect(hr, vt, FALSE); + expect(hr, vt); ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt); ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n", i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart); @@ -281,7 +281,7 @@ static void test_validtypes(void) vt = propvar.vt = i | VT_BYREF; memset(©, 0x77, sizeof(copy)); hr = PropVariantCopy(©, &propvar); - expect(hr, vt, TRUE); + expect(hr, vt); if (hr == S_OK) { ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt); @@ -295,7 +295,7 @@ static void test_validtypes(void) ok(!ret || broken(ret) /* win2000 */, "%d: copy should stay unchanged\n", i); } hr = PropVariantClear(&propvar); - expect(hr, vt, FALSE); + expect(hr, vt); ok(propvar.vt == 0, "expected 0, got %d\n", propvar.vt); ok(U(propvar).uhVal.QuadPart == 0, "%u: expected 0, got %#x/%#x\n", i, U(propvar).uhVal.u.LowPart, U(propvar).uhVal.u.HighPart); -- 1.9.3 From jacek at codeweavers.com Fri Nov 28 09:18:18 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:18:18 +0100 Subject: [PATCH 1/8] mshtml: Always ignore DISPATCH_PROPERTYPUTREF in InvokeEx. Message-ID: <5478923A.4020908@codeweavers.com> --- dlls/mshtml/dispex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-mshtml-Always-ignore-DISPATCH_PROPERTYPUTREF-in-Invok.diff Type: text/x-patch Size: 1391 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:18:32 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:18:32 +0100 Subject: [PATCH 2/8] jscript: Use DISPATCH_PROPERTYPUTREF flag when setting a property to VT_DISPATCH. Message-ID: <54789248.90507@codeweavers.com> --- dlls/jscript/dispex.c | 8 ++++++-- dlls/jscript/tests/run.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-jscript-Use-DISPATCH_PROPERTYPUTREF-flag-when-setting.diff Type: text/x-patch Size: 5146 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:18:53 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:18:53 +0100 Subject: [PATCH 3/8] mshtml: Allow setting function properties to any VARIANT type. Message-ID: <5478925D.9070409@codeweavers.com> --- dlls/mshtml/dispex.c | 63 +++++++++++++++++++++------------------------- dlls/mshtml/tests/script.c | 2 +- 2 files changed, 29 insertions(+), 36 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-mshtml-Allow-setting-function-properties-to-any-VARIA.diff Type: text/x-patch Size: 5584 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:19:04 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:19:04 +0100 Subject: [PATCH 4/8] mshtml: Better removeAttribute implementation. Message-ID: <54789268.4000100@codeweavers.com> --- dlls/mshtml/dispex.c | 80 +++++++++++++++++++++++++++++++------------- dlls/mshtml/htmlelem.c | 13 ++++++- dlls/mshtml/htmlstyle.c | 2 +- dlls/mshtml/mshtml_private.h | 2 +- 4 files changed, 71 insertions(+), 26 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-mshtml-Better-removeAttribute-implementation.diff Type: text/x-patch Size: 5742 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:19:15 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:19:15 +0100 Subject: [PATCH 5/8] mshtml: Correctly handle flags in IHTMLElement:setAttribute. Message-ID: <54789273.5040408@codeweavers.com> --- dlls/mshtml/htmlelem.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0005-mshtml-Correctly-handle-flags-in-IHTMLElement-setAttr.diff Type: text/x-patch Size: 1231 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:19:20 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:19:20 +0100 Subject: [PATCH 6/8] mshtml: Correctly handle flags in IHTMLElement:getAttribute. Message-ID: <54789278.50901@codeweavers.com> --- dlls/mshtml/htmlelem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0006-mshtml-Correctly-handle-flags-in-IHTMLElement-getAttr.diff Type: text/x-patch Size: 1207 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:19:35 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:19:35 +0100 Subject: [PATCH 7/8] mshtml: style attribute is a special case for setAttribute and removeAttribute. Message-ID: <54789287.6040805@codeweavers.com> --- dlls/mshtml/htmlelem.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0007-mshtml-style-attribute-is-a-special-case-for-setAttri.diff Type: text/x-patch Size: 1344 bytes Desc: not available URL: From jacek at codeweavers.com Fri Nov 28 09:19:42 2014 From: jacek at codeweavers.com (Jacek Caban) Date: Fri, 28 Nov 2014 16:19:42 +0100 Subject: [PATCH 8/8] mshtml: Added more attribute and IDispatchEx tests. Message-ID: <5478928E.40005@codeweavers.com> --- dlls/mshtml/tests/jstest.html | 110 ++++++++++++++++++++++++++++++++++++++++-- dlls/mshtml/tests/script.c | 19 ++++++++ 2 files changed, 126 insertions(+), 3 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0008-mshtml-Added-more-attribute-and-IDispatchEx-tests.diff Type: text/x-patch Size: 7275 bytes Desc: not available URL: From matellanesivan at gmail.com Fri Nov 28 13:48:31 2014 From: matellanesivan at gmail.com (=?UTF-8?B?SXbDoW4gTWF0ZWxsYW5lcw==?=) Date: Fri, 28 Nov 2014 20:48:31 +0100 Subject: msvcrt: Call the _nolock variant when the file is already locked Message-ID: <5478D18F.7010705@gmail.com> --- dlls/msvcrt/file.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index b0f8735..5176f58 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -1417,7 +1417,7 @@ void CDECL MSVCRT_rewind(MSVCRT_FILE* file) TRACE(":file (%p) fd (%d)\n",file,file->_file); MSVCRT__lock_file(file); - MSVCRT_fseek(file, 0L, SEEK_SET); + MSVCRT__fseek_nolock(file, 0L, SEEK_SET); MSVCRT_clearerr(file); MSVCRT__unlock_file(file); } @@ -3586,7 +3586,7 @@ char * CDECL MSVCRT_fgets(char *s, int size, MSVCRT_FILE* file) MSVCRT__lock_file(file); - while ((size >1) && (cc = MSVCRT_fgetc(file)) != MSVCRT_EOF && cc != '\n') + while ((size >1) && (cc = MSVCRT__fgetc_nolock(file)) != MSVCRT_EOF && cc != '\n') { *s++ = (char)cc; size --; @@ -3676,7 +3676,7 @@ int CDECL MSVCRT__getw(MSVCRT_FILE* file) MSVCRT__lock_file(file); for (j=0; j_flag |= MSVCRT__IOEOF; MSVCRT__unlock_file(file); @@ -3726,7 +3726,7 @@ MSVCRT_wchar_t * CDECL MSVCRT_fgetws(MSVCRT_wchar_t *s, int size, MSVCRT_FILE* f MSVCRT__lock_file(file); - while ((size >1) && (cc = MSVCRT_fgetwc(file)) != MSVCRT_WEOF && cc != '\n') + while ((size >1) && (cc = MSVCRT__fgetwc_nolock(file)) != MSVCRT_WEOF && cc != '\n') { *s++ = cc; size --; @@ -4452,7 +4452,7 @@ int CDECL MSVCRT_fputs(const char *s, MSVCRT_FILE* file) int ret; MSVCRT__lock_file(file); - ret = MSVCRT_fwrite(s, sizeof(*s), len, file) == len ? 0 : MSVCRT_EOF; + ret = MSVCRT__fwrite_nolock(s, sizeof(*s), len, file) == len ? 0 : MSVCRT_EOF; MSVCRT__unlock_file(file); return ret; } @@ -4468,14 +4468,14 @@ int CDECL MSVCRT_fputws(const MSVCRT_wchar_t *s, MSVCRT_FILE* file) MSVCRT__lock_file(file); if (!(get_ioinfo_nolock(file->_file)->wxflag & WX_TEXT)) { - ret = MSVCRT_fwrite(s,sizeof(*s),len,file) == len ? 0 : MSVCRT_EOF; + ret = MSVCRT__fwrite_nolock(s,sizeof(*s),len,file) == len ? 0 : MSVCRT_EOF; MSVCRT__unlock_file(file); return ret; } tmp_buf = add_std_buffer(file); for (i=0; i_flag & MSVCRT__IOMYBUF) MSVCRT_free(file->_base); file->_flag &= ~(MSVCRT__IONBF | MSVCRT__IOMYBUF | MSVCRT__USERBUF); @@ -4823,13 +4823,13 @@ static int puts_clbk_file_w(void *file, int len, const MSVCRT_wchar_t *str) MSVCRT__lock_file(file); if(!(get_ioinfo_nolock(((MSVCRT_FILE*)file)->_file)->wxflag & WX_TEXT)) { - ret = MSVCRT_fwrite(str, sizeof(MSVCRT_wchar_t), len, file); + ret = MSVCRT__fwrite_nolock(str, sizeof(MSVCRT_wchar_t), len, file); MSVCRT__unlock_file(file); return ret; } for(i=0; i For https://bugs.winehq.org/show_bug.cgi?id=33623 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/ole2disp.dll16/ole2disp.c b/dlls/ole2disp.dll16/ole2disp.c index 61a4043..1850346 100644 --- a/dlls/ole2disp.dll16/ole2disp.c +++ b/dlls/ole2disp.dll16/ole2disp.c @@ -260,6 +260,15 @@ HRESULT WINAPI RegisterActiveObject16( } /****************************************************************************** + * VariantChangeTypeEx [OLE2DISP.108] + */ +HRESULT WINAPI VariantChangeTypeEx16(VARIANTARG *dest, const VARIANTARG *src, LCID lcid, USHORT flags, VARTYPE vt) +{ + FIXME("stub: %p %p %d %d %d\n", dest, src, lcid, flags, vt); + return E_INVALIDARG; +} + +/****************************************************************************** * SetErrorInfo [OLE2DISP.110] */ HRESULT WINAPI SetErrorInfo16(ULONG dwReserved, IErrorInfo *perrinfo) diff --git a/dlls/ole2disp.dll16/ole2disp.dll16.spec b/dlls/ole2disp.dll16/ole2disp.dll16.spec index c027d12..9b69d4d 100644 --- a/dlls/ole2disp.dll16/ole2disp.dll16.spec +++ b/dlls/ole2disp.dll16/ole2disp.dll16.spec @@ -105,7 +105,7 @@ 105 stub VARBOOLFROMSTR 106 stub VARBOOLFROMDISP 107 stub DOINVOKEMETHOD -108 stub VARIANTCHANGETYPEEX +108 pascal VARIANTCHANGETYPEEX(ptr ptr long long long) VariantChangeTypeEx16 109 stub SAFEARRAYPTROFINDEX 110 pascal SetErrorInfo(long ptr) SetErrorInfo16 111 stub GETERRORINFO From austinenglish at gmail.com Fri Nov 28 15:03:40 2014 From: austinenglish at gmail.com (Austin English) Date: Fri, 28 Nov 2014 15:03:40 -0600 Subject: ole2.dll16: add a stub for WRITECLASSSTG Message-ID: For https://bugs.winehq.org/show_bug.cgi?id=30471 -- -Austin -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- diff --git a/dlls/ole2.dll16/ole2.c b/dlls/ole2.dll16/ole2.c index 25fb141..3a27132 100644 --- a/dlls/ole2.dll16/ole2.c +++ b/dlls/ole2.dll16/ole2.c @@ -346,3 +346,12 @@ VOID WINAPI ReleaseStgMedium16(LPSTGMEDIUM medium) { FIXME("%p: unimplemented stub!\n", medium); } + +/*********************************************************************** + * WriteClassStg16 (OLE2.19) + */ +HRESULT WINAPI WriteClassStg16(IStorage *stg, REFCLSID clsid) +{ + FIXME("stub:%p %s\n", stg, debugstr_guid(clsid)); + return STG_E_MEDIUMFULL; +} diff --git a/dlls/ole2.dll16/ole2.dll16.spec b/dlls/ole2.dll16/ole2.dll16.spec index 5c6e9c0..057ce6b 100644 --- a/dlls/ole2.dll16/ole2.dll16.spec +++ b/dlls/ole2.dll16/ole2.dll16.spec @@ -16,7 +16,7 @@ 16 stub OLEISRUNNING 17 stub OLELOCKRUNNING 18 pascal ReadClassStg(segptr ptr) ReadClassStg16 -19 stub WRITECLASSSTG +19 pascal WRITECLASSSTG(segptr str) WriteClassStg16 20 stub READCLASSSTM 21 stub WRITECLASSSTM 22 stub BINDMONIKER From jr98 at gmx.net Fri Nov 28 17:02:12 2014 From: jr98 at gmx.net (Julian =?ISO-8859-1?Q?R=FCger?=) Date: Sat, 29 Nov 2014 00:02:12 +0100 Subject: [website] German translation for release 1.7.32 Message-ID: <1417215732.4934.34.camel@xpsubuntu> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-German-translation-for-release-1.7.32.patch Type: text/x-patch Size: 1352 bytes Desc: not available URL: From frederic.delanoy at gmail.com Sat Nov 29 02:17:25 2014 From: frederic.delanoy at gmail.com (=?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Delanoy?=) Date: Sat, 29 Nov 2014 09:17:25 +0100 Subject: [website] French translation for release 1.7.32 Message-ID: <1417249045-7527-1-git-send-email-frederic.delanoy@gmail.com> --- news/fr/2014112801.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 news/fr/2014112801.xml diff --git a/news/fr/2014112801.xml b/news/fr/2014112801.xml new file mode 100644 index 0000000..cc7f405 --- /dev/null +++ b/news/fr/2014112801.xml @@ -0,0 +1,15 @@ + +28 novembre 2014 +Sortie de Wine 1.7.32 + +

La version de d?veloppement 1.7.32 de Wine est disponible.

+

Nouveaut?s de cette version : +

    +
  • Nouvelle version du moteur Mono.
  • +
  • Quelques fonctions suppl?mentaires impl?ment?es dans MSHTML.
  • +
  • Meilleure prise en charge de la restauration du mode d'affichage.
  • +
  • Am?liorations dans les m?triques de polices dans DirectWrite.
  • +
  • Diverses corrections de bugs.
  • +

+

Le code source est disponible d?s ? pr?sent. Les paquets binaires sont en cours de construction, et appara?tront sous peu sur leurs sites de t?l?chargement respectifs. +

-- 2.1.3 From sebastian at fds-team.de Sat Nov 29 04:58:45 2014 From: sebastian at fds-team.de (Sebastian Lackner) Date: Sat, 29 Nov 2014 11:58:45 +0100 Subject: ws2_32/tests: Fix several copy and paste errors. Message-ID: <5479A6E5.9040607@fds-team.de> --- dlls/ws2_32/tests/sock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-ws2_32-tests-Fix-several-copy-and-paste-errors.patch Type: text/x-patch Size: 2700 bytes Desc: not available URL: From lukasz.wojnilowicz at gmail.com Fri Nov 28 23:48:31 2014 From: lukasz.wojnilowicz at gmail.com (=?UTF-8?q?=C5=81ukasz=20Wojni=C5=82owicz?=) Date: Sat, 29 Nov 2014 06:48:31 +0100 Subject: [website] Polish translation for release 1.7.32 Message-ID: <1417240111-2551-1-git-send-email-lukasz.wojnilowicz@gmail.com> --- news/pl/2014112801.xml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 news/pl/2014112801.xml diff --git a/news/pl/2014112801.xml b/news/pl/2014112801.xml new file mode 100644 index 0000000..df6b63d --- /dev/null +++ b/news/pl/2014112801.xml @@ -0,0 +1,16 @@ + +Listopad 28, 2014 +Wydano Wine 1.7.32 + +

Wydanie rozwojowe Wine 1.7.32 jest ju? dost?pne.

+

Co nowego w tym wydaniu: +

    +
  • Nowa wersja silnika Mono.
  • +
  • Zaimplementowano wi?cej funkcji w MSHTML.
  • +
  • Ulepszono przywracanie trybu wy?wietlania.
  • +
  • Ulepszono kroje czcionek w DirectWrite.
  • +
  • Rozmaite poprawki b??d?w.
  • +
+

?r?d?o jest ju? dost?pne. +Paczki binarne s? w trakcie budowy i uka?? si? wkr?tce w przeznaczonych dla nich pobieralniach. +

-- 1.9.3 From lukasz.wojnilowicz at gmail.com Sat Nov 29 00:35:57 2014 From: lukasz.wojnilowicz at gmail.com (=?UTF-8?q?=C5=81ukasz=20Wojni=C5=82owicz?=) Date: Sat, 29 Nov 2014 07:35:57 +0100 Subject: po: Update Polish translation. Message-ID: <1417242957-3308-1-git-send-email-lukasz.wojnilowicz@gmail.com> --- po/pl.po | 446 ++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 215 insertions(+), 231 deletions(-) diff --git a/po/pl.po b/po/pl.po index aa9a3cb..b8b3773 100644 --- a/po/pl.po +++ b/po/pl.po @@ -1,12 +1,12 @@ # Polish translations for Wine # -# ?ukasz Wojni?owicz , 2011, 2012, 2013. +# ?ukasz Wojni?owicz , 2011, 2012, 2013, 2014. msgid "" msgstr "" "Project-Id-Version: Wine\n" "Report-Msgid-Bugs-To: http://bugs.winehq.org\n" "POT-Creation-Date: N/A\n" -"PO-Revision-Date: 2013-10-05 16:55+0200\n" +"PO-Revision-Date: 2014-11-29 07:31+0100\n" "Last-Translator: ?ukasz Wojni?owicz \n" "Language-Team: Polish \n" "Language: Polish\n" @@ -31,7 +31,7 @@ msgstr "" #: appwiz.rc:62 msgid "&Install..." -msgstr "&Zainstaluj..." +msgstr "Za&instaluj..." #: appwiz.rc:65 msgid "" @@ -49,7 +49,7 @@ msgstr "Informacje o w&sparciu" #: appwiz.rc:68 regedit.rc:45 regedit.rc:90 msgid "&Modify..." -msgstr "&Modyfikuj..." +msgstr "Z&mie?..." #: appwiz.rc:69 appwiz.rc:45 cryptui.rc:346 msacm32.rc:40 winecfg.rc:194 #: winecfg.rc:231 wordpad.rc:248 @@ -110,7 +110,7 @@ msgstr "CzytajTo:" #: appwiz.rc:86 msgid "Product Updates:" -msgstr "Aktualizacje produktu:" +msgstr "Uaktualnienia produktu:" #: appwiz.rc:87 msgid "Comments:" @@ -131,16 +131,15 @@ msgid "" "details." msgstr "" "Nie znaleziono paczki Gecko potrzebnej do prawid?owego dzia?ania aplikacji " -"zawieraj?cych kod HTML. Wine mo?e automatycznie pobra? i zainstalowa? t? " +"zawieraj?cych kod HTML. Wine mo?e sam pobra? i zainstalowa? t? " "paczk? dla ciebie.\n" "\n" -"Uwaga: Lepiej jednak u?y? paczki z twojej dystrybucji. Po szczeg??y zajrzyj " -"na http://wiki.winehq.org/Gecko " -"po szczeg??y." +"Uwaga: Zalecamy u?ycie paczki z twojej dystrybucji. Po szczeg??y zajrzyj " +"na http://wiki.winehq.org/Gecko." #: appwiz.rc:109 appwiz.rc:124 msgid "&Install" -msgstr "&Zainstaluj" +msgstr "Za&instaluj" #: appwiz.rc:110 appwiz.rc:125 avifil32.rc:55 browseui.rc:40 comctl32.rc:56 #: comctl32.rc:71 comdlg32.rc:170 comdlg32.rc:192 comdlg32.rc:210 @@ -175,12 +174,12 @@ msgid "" "href=\"http://wiki.winehq.org/Mono\">http://wiki.winehq.org/Mono for " "details." msgstr "" -"Nie znaleziono paczki Mono potrzebnej do prawid?owego dzia?ania aplikacji ." -"NET. Wine mo?e automatycznie pobra? i zainstalowa? t? paczk? dla ciebie.\n" +"Nie znaleziono paczki Mono potrzebnej do prawid?owego dzia?ania aplikacji" +"NET. Wine mo?e sam pobra? i zainstalowa? t? paczk? dla ciebie.\n" "\n" -"Uwaga: Lepiej jednak u?y? paczki z twojej dystrybucji. Po szczeg??y zajrzyj " -"na http://wiki.winehq.org/Mono " -"po szczeg??y." +"Uwaga: Zalecamy u?ycie paczki z twojej dystrybucji. Po szczeg??y zajrzyj " +"na stron? " +"http://wiki.winehq.org/Mono." #: appwiz.rc:31 msgid "Add/Remove Programs" @@ -237,7 +236,7 @@ msgstr "Wszystkie pliki (*.*)" #: appwiz.rc:46 msgid "&Modify/Remove" -msgstr "&Zmie?/Usu?" +msgstr "Z&mie?/Usu?" #: appwiz.rc:51 msgid "Downloading..." @@ -305,7 +304,7 @@ msgstr "Wine AVI-domy?lna-obs?uga-pliku" #: avifil32.rc:37 msgid "uncompressed" -msgstr "nie skompresowany" +msgstr "nieskompresowany" #: browseui.rc:28 msgid "Canceling..." @@ -313,11 +312,11 @@ msgstr "Trwa anulowanie..." #: comctl32.rc:52 winefile.rc:160 msgid "Properties for %s" -msgstr "W?a?ciwo?ci: %s" +msgstr "W?a?ciwo?ci dla %s" #: comctl32.rc:57 comdlg32.rc:263 msgid "&Apply" -msgstr "&Zastosuj" +msgstr "Z&astosuj" #: comctl32.rc:58 comctl32.rc:72 comdlg32.rc:306 user32.rc:89 msgid "Help" @@ -333,7 +332,7 @@ msgstr "< &Wstecz" #: comctl32.rc:69 msgid "&Next >" -msgstr "&Dalej >" +msgstr "&Naprz?d >" #: comctl32.rc:70 msgid "Finish" @@ -468,7 +467,7 @@ msgstr "&Strony" #: comdlg32.rc:211 comdlg32.rc:233 msgid "&Setup" -msgstr "&Ustawienia" +msgstr "U&stawienia" #: comdlg32.rc:212 msgid "&From:" @@ -512,11 +511,11 @@ msgstr "&Inna drukarka" #: comdlg32.rc:234 comdlg32.rc:420 comdlg32.rc:439 wineps.rc:34 msgid "Orientation" -msgstr "Orientacja" +msgstr "Kierunek" #: comdlg32.rc:235 msgid "Po&rtrait" -msgstr "W p&ionie" +msgstr "P&ionowo" #: comdlg32.rc:236 comdlg32.rc:441 wineps.rc:37 msgid "&Landscape" @@ -528,7 +527,7 @@ msgstr "Papier" #: comdlg32.rc:240 msgid "Si&ze" -msgstr "&Wielko??" +msgstr "Ro&zmiar" #: comdlg32.rc:241 msgid "&Source" @@ -544,7 +543,7 @@ msgstr "&Czcionka:" #: comdlg32.rc:255 msgid "Font St&yle:" -msgstr "&Styl:" +msgstr "K&r?j czcionki:" #: comdlg32.rc:258 comdlg32.rc:435 winecfg.rc:283 msgid "&Size:" @@ -618,7 +617,7 @@ msgstr "&Jaskr:" #: comdlg32.rc:307 msgid "&Add to Custom Colors" -msgstr "&Dodaj do w?asnych kolor?w" +msgstr "Dod&aj do w?asnych kolor?w" #: comdlg32.rc:308 msgid "&Define Custom Colors >>" @@ -630,7 +629,7 @@ msgstr "Znajd?" #: comdlg32.rc:318 comdlg32.rc:337 msgid "Fi&nd What:" -msgstr "&Znajd?:" +msgstr "Z&najd?:" #: comdlg32.rc:320 comdlg32.rc:341 msgid "Match &Whole Word Only" @@ -691,7 +690,7 @@ msgstr "Stan:" #: comdlg32.rc:369 comdlg32.rc:407 msgid "Type:" -msgstr "Typ:" +msgstr "Rodzaj:" #: comdlg32.rc:371 comdlg32.rc:409 msgid "Where:" @@ -855,7 +854,7 @@ msgstr "Plik nie istnieje" #: comdlg32.rc:40 msgid "The selection contains a non-folder object" -msgstr "" +msgstr "Zaznaczenie zawiera obiekt, kt?ry nie jest katalogiem" #: comdlg32.rc:45 msgid "Up One Level" @@ -863,7 +862,7 @@ msgstr "Poziom w g?r?" #: comdlg32.rc:46 msgid "Create New Folder" -msgstr "Utw?rz nowy folder" +msgstr "Utw?rz nowy katalog" #: comdlg32.rc:47 msgid "List" @@ -1032,11 +1031,11 @@ msgstr "Wybierz czcionk? o rozmiarze pomi?dzy %1!d! i %2!d! punktami." #: comdlg32.rc:142 ieframe.rc:35 msgid "&Save" -msgstr "&Zapisz" +msgstr "Zapi&sz" #: comdlg32.rc:143 msgid "Save &in:" -msgstr "Zapisz &w:" +msgstr "Zap&isz w:" #: comdlg32.rc:144 msgid "Save" @@ -1047,10 +1046,9 @@ msgid "Open File" msgstr "Otw?rz plik" #: comdlg32.rc:147 -#, fuzzy #| msgid "New Folder" msgid "Select Folder" -msgstr "Nowy Folder" +msgstr "Zaznacz katalog" #: comdlg32.rc:83 oleview.rc:98 msgid "Ready" @@ -2195,7 +2193,7 @@ msgid "" "\n" "To continue, click Next." msgstr "" -"Asystent ten pomaga tobie importowa? certyfikaty, listy odwo?ania " +"Pomocnik ten pomaga tobie importowa? certyfikaty, listy odwo?ania " "certyfikat?w, i listy zaufania certyfikat?w z pliku do magazynu " "certyfikat?w.\n" "\n" @@ -2333,7 +2331,7 @@ msgid "" "\n" "To continue, click Next." msgstr "" -"Asystent ten pomaga tobie eksportowa? certyfikaty, listy odwo?ania " +"Pomocnik ten pomaga tobie eksportowa? certyfikaty, listy odwo?ania " "certyfikat?w, i listy zaufania certyfikat?w z magazynu certyfikat?w do " "pliku.\n" "\n" @@ -2964,7 +2962,7 @@ msgstr "Standardowe urz?dzenie Device" #: dinput.rc:43 msgid "Configure Devices" -msgstr "Konfiguruj Urz?dzenia" +msgstr "Ustawienia urz?dze?" #: dinput.rc:48 msgid "Reset" @@ -3424,9 +3422,7 @@ msgstr "Ustawienia internetowe" #: inetcpl.rc:32 msgid "Configure Wine Internet Browser and related settings" -msgstr "" -"Pozwala skonfigurowa? przegl?dark? internetow? Wine i odpowiadaj?ce jej " -"ustawienia" +msgstr "Ustawianie przegl?dark? internetow? Wine i zwi?zanych z ni? opcji" #: inetcpl.rc:33 msgid "Security settings for zone: " @@ -3486,7 +3482,7 @@ msgstr "" #: joy.rc:50 msgid "Test Joystick" -msgstr "Testuj Joystick" +msgstr "Pr?ba Joysticka" #: joy.rc:54 msgid "Buttons" @@ -3494,7 +3490,7 @@ msgstr "Przyciski" #: joy.rc:63 msgid "Test Force Feedback" -msgstr "Testuj odczucie si?y zwrotnej" +msgstr "Pr?ba odczucia si?y zwrotnej" #: joy.rc:67 msgid "Available Effects" @@ -3550,27 +3546,25 @@ msgstr "B??d sk?adni" #: jscript.rc:37 msgid "Expected ';'" -msgstr "Oczekiwane ';'" +msgstr "Oczekiwano ';'" #: jscript.rc:38 msgid "Expected '('" -msgstr "Oczekiwane '('" +msgstr "Oczekiwano '('" #: jscript.rc:39 msgid "Expected ')'" -msgstr "Oczekiwane ')'" +msgstr "Oczekiwano ')'" #: jscript.rc:40 -#, fuzzy #| msgid "Subject Key Identifier" msgid "Expected identifier" -msgstr "Identyfikator klucza podmiotu" +msgstr "Oczekiwano identyfikatora" #: jscript.rc:41 -#, fuzzy #| msgid "Expected ';'" msgid "Expected '='" -msgstr "Oczekiwane ';'" +msgstr "Oczekiwano ';'" #: jscript.rc:42 msgid "Invalid character" @@ -3601,20 +3595,18 @@ msgid "Label not found" msgstr "Nie znaleziono etykiety" #: jscript.rc:49 -#, fuzzy #| msgid "Expected ';'" msgid "Expected '@end'" -msgstr "Oczekiwane ';'" +msgstr "Oczekiwano '@end'" #: jscript.rc:50 msgid "Conditional compilation is turned off" msgstr "Warunkowa kompilacja jest wy??czona" #: jscript.rc:51 -#, fuzzy #| msgid "Expected ';'" msgid "Expected '@'" -msgstr "Oczekiwane ';'" +msgstr "Oczekiwano '@'" #: jscript.rc:54 msgid "Number expected" @@ -3750,7 +3742,7 @@ msgstr "Niepoprawny nap?d.\n" #: winerror.mc:106 msgid "Can't delete current directory.\n" -msgstr "Nie mo?na usun?? aktualnego folderu.\n" +msgstr "Nie mo?na usun?? aktualnego katalogu.\n" #: winerror.mc:111 msgid "Not same device.\n" @@ -4126,11 +4118,11 @@ msgstr "Ten sam nap?d.\n" #: winerror.mc:586 msgid "Not top-level directory.\n" -msgstr "Folder nienadrz?dny.\n" +msgstr "Katalog nienadrz?dny.\n" #: winerror.mc:591 msgid "Directory is not empty.\n" -msgstr "Folder nie jest pusty.\n" +msgstr "Katalog nie jest pusty.\n" #: winerror.mc:596 msgid "Path is in use as a SUBST.\n" @@ -4386,7 +4378,7 @@ msgstr "Nie mo?na u?y? Copy API.\n" #: winerror.mc:911 msgid "Directory name invalid.\n" -msgstr "Niepoprawna nazwa folderu.\n" +msgstr "Niepoprawna nazwa katalogu.\n" #: winerror.mc:916 msgid "Extended attributes didn't fit.\n" @@ -4654,7 +4646,7 @@ msgstr "Us?uga istnieje.\n" #: winerror.mc:1246 msgid "System running last-known-good config.\n" -msgstr "System uruchomiony na ostatniej dobrej konfiguracji.\n" +msgstr "System uruchomiony na ostatnich dobrych ustawieniach.\n" #: winerror.mc:1251 msgid "Service dependency deleted.\n" @@ -4662,7 +4654,7 @@ msgstr "Zale?no?? us?ugi usuni?ta.\n" #: winerror.mc:1256 msgid "Boot already accepted as last-good config.\n" -msgstr "Boot ju? zaakceptowa? jako ostatni? dobr? konfiguracj?.\n" +msgstr "Boot ju? przyj?? jako ostatnie dobre ustawienia.\n" #: winerror.mc:1261 msgid "Service not started since last boot.\n" @@ -4749,10 +4741,9 @@ msgid "No Unicode translation.\n" msgstr "Brak t?umaczenia Unicode.\n" #: winerror.mc:1366 -#, fuzzy #| msgid "DLL init failed.\n" msgid "DLL initialization failed.\n" -msgstr "Nieudana inicjalizacja biblioteki DLL.\n" +msgstr "Nieudana inicjacja biblioteki DLL.\n" #: winerror.mc:1371 msgid "Shutdown in progress.\n" @@ -4760,7 +4751,7 @@ msgstr "Zamykanie w toku.\n" #: winerror.mc:1376 msgid "No shutdown in progress.\n" -msgstr "Zamykanie nie post?puje.\n" +msgstr "Brak zamykania w toku.\n" #: winerror.mc:1381 msgid "I/O device error.\n" @@ -5540,7 +5531,7 @@ msgstr "Brak dziedzicznych komponent?w.\n" #: winerror.mc:2361 msgid "File or directory corrupt.\n" -msgstr "Plik lub folder zepsuty.\n" +msgstr "Plik lub katalog zepsuty.\n" #: winerror.mc:2366 msgid "Disk is corrupt.\n" @@ -5868,7 +5859,7 @@ msgstr "Niepoprawny stan uchwytu.\n" #: winerror.mc:2771 msgid "Bad configuration.\n" -msgstr "Z?a konfiguracja.\n" +msgstr "Z?e ustawienia.\n" #: winerror.mc:2776 msgid "Index is missing.\n" @@ -6060,7 +6051,7 @@ msgstr "Serwer RPC nie nas?uchuje.\n" #: winerror.mc:3011 msgid "Unknown manager type.\n" -msgstr "Nieznany typ mened?era.\n" +msgstr "Nieznany rodzaj programu zarz?dzaj?cego.\n" #: winerror.mc:3016 msgid "Unknown interface.\n" @@ -6639,16 +6630,14 @@ msgid "The username could not be found.\n" msgstr "Nie mo?na by?o znale?? u?ytkownika.\n" #: winerror.mc:3741 -#, fuzzy #| msgid "The site does not exist.\n" msgid "This network connection does not exist.\n" -msgstr "Strona nie istnieje.\n" +msgstr "Po??czenie sieciowe nie istnieje.\n" #: winerror.mc:3746 -#, fuzzy #| msgid "Connection refused.\n" msgid "Connection reset by peer.\n" -msgstr "Po??czenie odm?wi?o.\n" +msgstr "Po??czenie wyzerowane przez uczestnika.\n" #: localspl.rc:31 localui.rc:31 winspool.rc:30 msgid "Local Port" @@ -6668,7 +6657,7 @@ msgstr "&Nazwa nowego portu:" #: localui.rc:51 msgid "Configure LPT Port" -msgstr "Konfiguracja portu LPT" +msgstr "Ustawienia portu LPT" #: localui.rc:54 msgid "Timeout (seconds)" @@ -6676,7 +6665,7 @@ msgstr "Czasy oczekiwania (sekundy)" #: localui.rc:55 msgid "&Transmission Retry:" -msgstr "&Ponowienie transmisji:" +msgstr "Ponowienie &transmisji:" #: localui.rc:32 msgid "'%s' is not a valid port name" @@ -6688,7 +6677,7 @@ msgstr "Port %s ju? istnieje" #: localui.rc:34 msgid "This port has no options to configure" -msgstr "Ten port nie ma opcji do skonfigurowania" +msgstr "Ten port nie ma opcji do ustawienia" #: mapi32.rc:31 msgid "Mail sending failed as you do not have a MAPI mail client installed." @@ -6846,13 +6835,13 @@ msgstr "" "\t/y\n" "Wyrejestruj us?ug? MSI:\n" "\t/z\n" -"Wy?wietl t? pomoc:\n" +"Wy?wietl t? pomoc:\n" "\t/help\n" "\t/?\n" #: msi.rc:60 msgid "enter which folder contains %s" -msgstr "podaj, kt?ry folder zawiera '%s'" +msgstr "podaj, kt?ry katalog zawiera '%s'" #: msi.rc:61 msgid "install source for feature missing" @@ -6892,7 +6881,7 @@ msgstr "Typ &kompresji:" #: msvfw32.rc:42 msgid "Con&figure..." -msgstr "Kon&figuruj..." +msgstr "U&stawienia..." #: msvfw32.rc:43 msgid "&About" @@ -7183,206 +7172,185 @@ msgid "outline button" msgstr "przycisk zarysu" #: oleacc.rc:97 -#, fuzzy #| msgid "Normal" msgctxt "object state" msgid "normal" -msgstr "Normalne" +msgstr "normalny" #: oleacc.rc:98 -#, fuzzy #| msgid "Unavailable" msgctxt "object state" msgid "unavailable" -msgstr "Niedost?pny" +msgstr "niedost?pny" #: oleacc.rc:99 -#, fuzzy #| msgid "Select" msgctxt "object state" msgid "selected" -msgstr "Zaznacz" +msgstr "zaznaczony" #: oleacc.rc:100 -#, fuzzy #| msgid "Paused" msgctxt "object state" msgid "focused" -msgstr "Wstrzymano" +msgstr "uaktywniony" #: oleacc.rc:101 -#, fuzzy #| msgid "&Compressed" msgctxt "object state" msgid "pressed" -msgstr "S&kompresowany" +msgstr "naci?ni?ty" #: oleacc.rc:102 msgctxt "object state" msgid "checked" -msgstr "" +msgstr "sprawdzony" #: oleacc.rc:103 -#, fuzzy #| msgid "Mixed" msgctxt "object state" msgid "mixed" -msgstr "Mieszane" +msgstr "mieszany" #: oleacc.rc:104 -#, fuzzy #| msgid "&Read Only" msgctxt "object state" msgid "read only" -msgstr "Tylko do &odczytu" +msgstr "tylko-do-odczytu" #: oleacc.rc:105 -#, fuzzy #| msgid "Hot Tracked Item" msgctxt "object state" msgid "hot tracked" -msgstr "?ledzony element" +msgstr "?ledzony-na-gor?co" #: oleacc.rc:106 -#, fuzzy #| msgid "Defaults" msgctxt "object state" msgid "default" -msgstr "Domy?lne" +msgstr "domy?lny" #: oleacc.rc:107 msgctxt "object state" msgid "expanded" -msgstr "" +msgstr "rozwini?ty" #: oleacc.rc:108 msgctxt "object state" msgid "collapsed" -msgstr "" +msgstr "zwini?ty" #: oleacc.rc:109 msgctxt "object state" msgid "busy" -msgstr "" +msgstr "zaj?ty" #: oleacc.rc:110 msgctxt "object state" msgid "floating" -msgstr "" +msgstr "p?ywaj?cy" #: oleacc.rc:111 msgctxt "object state" msgid "marqueed" -msgstr "" +msgstr "oznaczony" #: oleacc.rc:112 -#, fuzzy #| msgid "animation" msgctxt "object state" msgid "animated" -msgstr "animacja" +msgstr "animowany" #: oleacc.rc:113 msgctxt "object state" msgid "invisible" -msgstr "" +msgstr "niewidoczny" #: oleacc.rc:114 msgctxt "object state" msgid "offscreen" -msgstr "" +msgstr "poza-ekranem" #: oleacc.rc:115 -#, fuzzy #| msgid "&enable" msgctxt "object state" msgid "sizeable" -msgstr "&Udost?pnij" +msgstr "do-skalowania" #: oleacc.rc:116 -#, fuzzy #| msgid "&enable" msgctxt "object state" msgid "moveable" -msgstr "&Udost?pnij" +msgstr "do-przesuni?cia" #: oleacc.rc:117 msgctxt "object state" msgid "self voicing" -msgstr "" +msgstr "samo-m?wi?cy" #: oleacc.rc:118 -#, fuzzy #| msgid "Paused" msgctxt "object state" msgid "focusable" -msgstr "Wstrzymano" +msgstr "do-uaktywnienia" #: oleacc.rc:119 -#, fuzzy #| msgid "table" msgctxt "object state" msgid "selectable" -msgstr "tabela" +msgstr "do-zaznaczenia" #: oleacc.rc:120 -#, fuzzy #| msgid "link" msgctxt "object state" msgid "linked" -msgstr "dowi?zanie" +msgstr "dowi?zany" #: oleacc.rc:121 msgctxt "object state" msgid "traversed" -msgstr "" +msgstr "przestawiony" #: oleacc.rc:122 -#, fuzzy #| msgid "table" msgctxt "object state" msgid "multi selectable" -msgstr "tabela" +msgstr "do-wielokrotnego-zaznaczenia" #: oleacc.rc:123 -#, fuzzy #| msgid "Please select a file." msgctxt "object state" msgid "extended selectable" -msgstr "Prosz? wybra? plik." +msgstr "do-zaznaczania-z-rozwijaniem" #: oleacc.rc:124 -#, fuzzy #| msgid "alert" msgctxt "object state" msgid "alert low" -msgstr "ostrze?enie" +msgstr "niskiej-czujno?ci" #: oleacc.rc:125 -#, fuzzy #| msgid "alert" msgctxt "object state" msgid "alert medium" -msgstr "ostrze?enie" +msgstr "?redniej-czujno?ci" #: oleacc.rc:126 -#, fuzzy #| msgid "alert" msgctxt "object state" msgid "alert high" -msgstr "ostrze?enie" +msgstr "wysokiej-czujno?ci" #: oleacc.rc:127 -#, fuzzy #| msgid "Write protected.\n" msgctxt "object state" msgid "protected" -msgstr "Zapis chroniony.\n" +msgstr "chroniony" #: oleacc.rc:128 msgctxt "object state" msgid "has popup" -msgstr "" +msgstr "ma-okno-wysuwne" #: oleaut32.rc:30 oleview.rc:147 msgid "True" @@ -7406,7 +7374,7 @@ msgstr "Wstaw obiekt" #: oledlg.rc:57 msgid "Object Type:" -msgstr "Typ obiektu:" +msgstr "Rodzaj obiektu:" #: oledlg.rc:60 oledlg.rc:98 msgid "Result" @@ -7845,11 +7813,11 @@ msgstr "Zrzu? informacje o ?ledzeniu" #: shdoclc.rc:202 msgid "Debug Break" -msgstr "Przerwanie debugowania" +msgstr "Przerwanie diagnozowania" #: shdoclc.rc:203 msgid "Debug View" -msgstr "Widok debugowania" +msgstr "Widok diagnostyczny" #: shdoclc.rc:204 msgid "Dump Tree" @@ -8008,7 +7976,7 @@ msgstr "Nowy" #: shell32.rc:69 msgid "New &Folder" -msgstr "Nowy &Folder" +msgstr "Nowy &Katalog" #: shell32.rc:70 msgid "New &Link" @@ -8054,15 +8022,15 @@ msgstr "Panel sterowania - i&nformacje" #: shell32.rc:273 shell32.rc:288 msgid "Browse for Folder" -msgstr "Wybierz folder" +msgstr "Wybierz katalog" #: shell32.rc:293 msgid "Folder:" -msgstr "Folder:" +msgstr "Katalog:" #: shell32.rc:299 msgid "&Make New Folder" -msgstr "&Utw?rz nowy folder" +msgstr "&Utw?rz nowy katalog" #: shell32.rc:306 msgid "Message" @@ -8122,7 +8090,7 @@ msgstr "Typ" #: shell32.rc:140 msgid "Modified" -msgstr "Zmodyfikowany" +msgstr "Zmieniony" #: shell32.rc:141 winefile.rc:175 winefile.rc:114 msgid "Attributes" @@ -8364,7 +8332,7 @@ msgid "" "\n" "Do you want to replace it?" msgstr "" -"Ten folder ju? zawiera plik o nazwie '%1'.\n" +"Ten katalog ju? zawiera plik o nazwie '%1'.\n" "\n" "Czy chcesz go zast?pi??" @@ -8376,7 +8344,7 @@ msgstr "Czy jeste? pewien, ?e chcesz usun?? wybrane elementy?" msgid "" "Are you sure that you want to send '%1' and all its content to the Trash?" msgstr "" -"Czy jeste? pewien, ?e chcesz umie?ci? folder '%1' i ca?? jego zawarto?? w " +"Czy jeste? pewien, ?e chcesz umie?ci? katalog '%1' i ca?? jego zawarto?? w " "koszu?" #: shell32.rc:176 @@ -8400,16 +8368,16 @@ msgid "" "selected folder they will be replaced. Do you still want to move or copy\n" "the folder?" msgstr "" -"Ten folder ju? zawiera folder o nazwie '%1'.\n" +"Ten katalog ju? zawiera katalog o nazwie '%1'.\n" "\n" -"Je?eli w docelowym folderze wyst?pi? pliki o takich samych nazwach jak\n" -"w wybranym folderze, to zostan? one zast?pione. Czy chcesz mimo to " +"Je?eli w docelowym katalogu wyst?pi? pliki o takich samych nazwach jak\n" +"w wybranym katalogu, to zostan? one zast?pione. Czy chcesz mimo to " "przenie??\n" -"lub skopiowa? folder?" +"lub skopiowa? katalog?" #: shell32.rc:238 msgid "New Folder" -msgstr "Nowy Folder" +msgstr "Nowy Katalog" #: shell32.rc:240 msgid "Wine Control Panel" @@ -8485,7 +8453,7 @@ msgid "" "Franklin St, Fifth Floor, Boston, MA 02110-1301, USA." msgstr "" "Wine jest wolnym oprogramowaniem; wolno ci je rozpowszechnia? i/lub " -"modyfikowa? zgodnie z warunkami zawartymi w GNU Lesser General Public " +"zmienia? zgodnie z warunkami zawartymi w GNU Lesser General Public " "License (z ang. Mniejsza Powszechna Licencja Publiczna GNU) opublikowanej " "przez Free Software Foundation (z ang. Fundacja Wolnego Oprogramowania); " "albo w wersji 2.1 licencji, lub (do twojego wyboru) jakiejkolwiek " @@ -9939,7 +9907,7 @@ msgstr "" "\n" "SET bez parametr?w wy?wietla wszystkie ustawione zmienne.\n" "\n" -"Sk?adnia polecenia (by utworzy? lub zmodyfikowa? zmienn?:\n" +"Sk?adnia polecenia (by utworzy? lub zmieni? zmienn?:\n" "\n" "SET =\n" "\n" @@ -9949,7 +9917,7 @@ msgstr "" "\n" "Pod Wine'em zmienne ?rodowiskowe systemu operacyjnego s? dodawane do\n" "zmiennych ?rodowiskowych Win32, z tego powodu jest wi?cej zmiennych ni?\n" -"w implementacji Win32. Wine nie modyfikuje zmiennych ?rodowiskowych\n" +"w implementacji Win32. Wine nie zmienia zmiennych ?rodowiskowych\n" "systemu.\n" #: cmd.rc:211 @@ -10017,7 +9985,7 @@ msgstr "" "/unix U?yj nazwy pliku ze ?cie?ka z Uniksa i uruchom plik tak jak " "windows explorer.\n" "/ProgIDOpen Otw?rz dokument u?ywaj?c podanego progID.\n" -"/? Wy?wietl t? pomoc i wyjd?.\n" +"/? Wy?wietl t? pomoc i wyjd?.\n" #: cmd.rc:213 msgid "TIME sets or shows the current system time.\n" @@ -10110,14 +10078,15 @@ msgid "" "Specifying no file type after the equal sign removes the current " "association, if any.\n" msgstr "" -"ASSOC pokazuje lub modyfikuje skojarzenia rozszerzenia pliku\n" +"ASSOC pokazuje lub zmienia skojarzenia rozszerzenia pliku\n" "\n" "Sk?adnia: ASSOC [.ext[=[typPliku]]]\n" "\n" "ASSOC bez parametr?w wy?wietla obecne skojarzenia pliku.\n" "Je?eli u?yte tylko z jednym rozszerzeniem pliku, to pokazuje obecne " "skojarzenie.\n" -"Nie okre?lanie typu pliku po znaku r?wno?ci usuwa obecne skojarzenie, je?li " +"Nie okre?lanie rodzaju pliku po znaku r?wno?ci usuwa obecne skojarzenie, " +"je?li " "jakiekolwiek istnieje.\n" #: cmd.rc:269 @@ -10133,16 +10102,16 @@ msgid "" "Specifying no open command after the equal sign removes the command string " "associated to the specified file type.\n" msgstr "" -"FTYPE pokazuje lub modyfikuje polecenia otwarcia skojarzone z typami plik?w\n" +"FTYPE pokazuje lub zmienia polecenia otwarcia skojarzone z typami plik?w\n" "\n" "Sk?adnia: FTYPE [typPliku[=[polecenieOtwarcia]]]\n" "\n" -"Bez parametr?w, pokazuje typy plik?w, dla kt?ry s? obecnie okre?lone " +"Bez parametr?w, pokazuje rodzaje plik?w, dla kt?rych s? obecnie okre?lone " "polecenia otwarcia.\n" -"Je?eli u?yte tylko z jednym typem pliku, to pokazuje jego skojarzone " +"Je?eli u?yte tylko z jednym rodzajem pliku, to pokazuje jego skojarzone " "polecenie otwarcia, je?li jakiekolwiek istnieje.\n" "Nie okre?lanie polecenia otwarcia po znaku r?wno?ci usuwa ci?g znak?w " -"polecenia skojarzony z okre?lonym typem pliku.\n" +"polecenia skojarzony z danym rodzajem pliku.\n" #: cmd.rc:271 msgid "MORE displays output of files or piped input in pages.\n" @@ -10208,7 +10177,7 @@ msgid "" "Enter HELP for further information on any of the above commands.\n" msgstr "" "Wbudowane polecenia CMD to:\n" -"ASSOC\t\tPokazuje lub modyfikuje skojarzenia rozszerze? plik?w\n" +"ASSOC\t\tPokazuje lub zmienia skojarzenia rozszerze? plik?w\n" "ATTRIB\t\tPokazuje lub zmienia atrybuty pliku\n" "CALL\t\tWywo?uje plik bat z innego pliku\n" "CD (CHDIR)\tZmienia bie??cy katalog\n" @@ -10221,7 +10190,7 @@ msgstr "" "DIR\t\tWy?wietla zawarto?? katalogu\n" "ECHO\t\tKopiuje tekst na wyj?cie konsoli\n" "ENDLOCAL\tKoniec zmiany ustawie? regionalnych ?rodowiska w pliku wsadowym\n" -"FTYPE\t\tPokazuje lub modyfikuje polecenia otwarcia skojarzone z typami " +"FTYPE\t\tPokazuje lub zmienia polecenia otwarcia skojarzone z typami " "plik?w\n" "HELP\t\tWy?wietla dok?adniejsz? pomoc o komendzie\n" "MD (MKDIR)\tTworzy katalog\n" @@ -10378,7 +10347,7 @@ msgstr "Wiersz Polece? Wine" #: cmd.rc:351 msgid "Microsoft Windows %1!S!\n" -msgstr "" +msgstr "Microsoft Windows %1!S!\n" #: cmd.rc:352 msgid "More? " @@ -10449,10 +10418,9 @@ msgid "Wine Explorer" msgstr "Wine Explorer" #: explorer.rc:33 -#, fuzzy #| msgid "StartUp" msgid "Start" -msgstr "Autostart" +msgstr "Start" #: explorer.rc:34 winefile.rc:36 msgid "&Run..." @@ -10600,7 +10568,7 @@ msgstr "Nie mo?na zatrzyma? us?ugi %1\n" #: net.rc:35 msgid "Could not get handle to service control manager.\n" -msgstr "Nie uda?o si? otrzyma? uchwytu do mened?era serwis?w.\n" +msgstr "Nie uda?o si? otrzyma? uchwytu do zarz?dzania us?ugami.\n" #: net.rc:36 msgid "Could not get handle to service.\n" @@ -11030,7 +10998,7 @@ msgstr "&Otw?rz bibliotek? typ?w..." #: oleview.rc:35 msgid "&System Configuration" -msgstr "Konfiguracja &systemu" +msgstr "Ustawienia &systemu" #: oleview.rc:36 msgid "&Run the Registry Editor" @@ -11126,7 +11094,7 @@ msgstr "&Nazwa komputera:" #: oleview.rc:168 msgid "System Configuration" -msgstr "Konfiguracja systemu" +msgstr "Ustawienia systemu" #: oleview.rc:171 msgid "System Settings" @@ -11424,7 +11392,7 @@ msgstr "&Rozmie?? ikony" #: progman.rc:57 msgid "&About Program Manager" -msgstr "Mened?er zada? - i&nformacje" +msgstr "Zarz?dzanie programami - i&nformacje" #: progman.rc:103 msgid "Program &group" @@ -11508,7 +11476,7 @@ msgstr "Uruchom program" #: progman.rc:63 msgid "Program Manager" -msgstr "Mened?er zada?" +msgstr "Zarz?dzanie programami" #: progman.rc:65 winhlp32.rc:83 msgid "WARNING" @@ -11693,7 +11661,7 @@ msgstr "Edytor rejestru - i&nformacje" #: regedit.rc:91 msgid "Modify Binary Data..." -msgstr "Modyfikuj dane binarne..." +msgstr "Zmie? dane binarne..." #: regedit.rc:218 msgid "Export registry" @@ -11887,7 +11855,7 @@ msgstr "" #: regedit.rc:147 msgid "Modifies the value's data" -msgstr "Pozwala zmodyfikowa? warto?? danej" +msgstr "Umo?liwia zmian? warto?ci danej" #: regedit.rc:148 msgid "Adds a new key" @@ -11927,7 +11895,7 @@ msgstr "Nie uda?o si? przeczyta? danej '%s'" #: regedit.rc:182 msgid "Can't edit keys of this type (%u)" -msgstr "Nie da si? modyfikowa? kluczy tego typu (%u)" +msgstr "Nie da si? zmienia? kluczy tego rodzaju (%u)" #: regedit.rc:183 msgid "Value is too big (%u)" @@ -11976,6 +11944,10 @@ msgid "" "Provides DLL registration services.\n" "\n" msgstr "" +"Narz?dzie rejestrowania bibliotek DLL w Wine\n" +"\n" +"Dostarcza us?ug rejestrowania bibliotek DLL.\n" +"\n" #: regsvr32.rc:40 msgid "" @@ -11990,54 +11962,65 @@ msgid "" " [/n] Do not call DllRegisterServer. This option must be used with [/i].\n" "\n" msgstr "" +"U?ycie:\n" +" regsvr32 [/u] [/s] [/n] [/i[:cmdline]] NazwaDll\n" +"\n" +"Opcje:\n" +" [/u] Wyrejestruj serwer.\n" +" [/s] Cichy tryb (nie zostan? wy?wietlone ?adne wiadomo?ci).\n" +" [/i] Wywo?aj DllInstall, dostarczaj?c opcjonalnego [cmdline].\n" +"\tGdy u?yty z [/u] to wywo?ywany jest DllInstall w trybie odinstalowywania.\n" +" [/n] Nie wywo?uj DllRegisterServer. Tej opcji nale?y u?ywa? z [/i].\n" +"\n" #: regsvr32.rc:41 msgid "" "regsvr32: Invalid or unrecognized switch [%1]\n" "\n" msgstr "" +"regsvr32: Nieprawid?owy lub nierozpoznany prze??cznik [%1]\n" +"\n" #: regsvr32.rc:42 -#, fuzzy #| msgid "Failed to open '%1'\n" msgid "regsvr32: Failed to load DLL '%1'\n" -msgstr "Nieudane otwarcie '%1'\n" +msgstr "regsvr32: Nieudane wczytywanie biblioteki DLL '%1'\n" #: regsvr32.rc:43 msgid "regsvr32: %1 not implemented in DLL '%2'\n" -msgstr "" +msgstr "regsvr32: %1 nie jest zaimplementowana w bibliotece DLL '%2'\n" #: regsvr32.rc:44 msgid "regsvr32: Failed to register DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Nieudane rejestrowanie biblioteki DLL '%1'\n" #: regsvr32.rc:45 msgid "regsvr32: Successfully registered DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Pomy?lnie zarejestrowano bibliotek? DLL '%1'\n" #: regsvr32.rc:46 msgid "regsvr32: Failed to unregister DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Nieudane wyrejestrowywanie biblioteki DLL '%1'\n" #: regsvr32.rc:47 msgid "regsvr32: Successfully unregistered DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Pomy?lnie wyrejestrowano bibliotek? DLL '%1'\n" #: regsvr32.rc:48 msgid "regsvr32: Failed to install DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Nieudane instalowanie biblioteki DLL '%1'\n" #: regsvr32.rc:49 msgid "regsvr32: Successfully installed DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Pomy?lnie zainstalowano bibliotek? DLL '%1'\n" #: regsvr32.rc:50 msgid "regsvr32: Failed to uninstall DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Nieudane odinstalowywanie biblioteki DLL '%1'\n" #: regsvr32.rc:51 msgid "regsvr32: Successfully uninstalled DLL '%1'\n" -msgstr "" +msgstr "regsvr32: Pomy?lnie odinstalowano bibliotek? DLL '%1'\n" #: start.rc:55 msgid "" @@ -12120,7 +12103,7 @@ msgstr "&Nowe zadanie (Uruchom...)" #: taskmgr.rc:39 msgid "E&xit Task Manager" -msgstr "&Zako?cz Mened?era zada?" +msgstr "&Zako?cz zarz?dzanie zadaniami" #: taskmgr.rc:45 msgid "&Minimize On Use" @@ -12200,7 +12183,7 @@ msgstr "&Przesu? na wierzch" #: taskmgr.rc:90 msgid "&About Task Manager" -msgstr "Mened?er zada? - i&nformacje" +msgstr "Zarz?dzanie zadaniami - i&nformacje" #: taskmgr.rc:120 taskmgr.rc:352 msgid "&Switch To" @@ -12224,7 +12207,7 @@ msgstr "Zamknij &drzewo proces?w" #: taskmgr.rc:152 winedbg.rc:32 msgid "&Debug" -msgstr "De&buguj" +msgstr "&Diagnostyka" #: taskmgr.rc:154 msgid "Set &Priority" @@ -12248,11 +12231,11 @@ msgstr "Ustal &koligacj?..." #: taskmgr.rc:170 msgid "Edit Debug &Channels..." -msgstr "Konfiguruj kana?y &debugowania..." +msgstr "Zmiana kana??w diagnosty&cznych..." #: taskmgr.rc:338 taskmgr.rc:180 taskmgr.rc:181 msgid "Task Manager" -msgstr "Mened?er zada?" +msgstr "Zarz?dzanie zadaniami" #: taskmgr.rc:351 msgid "&New Task..." @@ -12332,7 +12315,7 @@ msgstr "Historia u?ycia pami?ci" #: taskmgr.rc:428 taskmgr.rc:327 msgid "Debug Channels" -msgstr "Kana?y debugowania" +msgstr "Kana?y diagnostyczne" #: taskmgr.rc:439 msgid "Processor Affinity" @@ -12482,7 +12465,8 @@ msgstr "Wybierz kolumny" msgid "" "Select the columns that will appear on the Process page of the Task Manager." msgstr "" -"Wybierz kolumny, kt?re b?d? widoczne na zak?adce Procesy Mened?era Proces?w." +"Wybierz kolumny, kt?re b?d? widoczne na zak?adce Procesy w zarz?dzaniu " +"zadaniami." #: taskmgr.rc:521 msgid "&Image Name" @@ -12594,15 +12578,16 @@ msgstr "Uruchamia nowy program" #: taskmgr.rc:188 msgid "Task Manager remains in front of all other windows unless minimized" -msgstr "Mened?er zada? wy?wietlany jest na wierzchu wszystkich okien" +msgstr "Zarz?dzanie zadaniami wy?wietlane jest na wierzchu wszystkich okien" #: taskmgr.rc:190 msgid "Task Manager is minimized when a SwitchTo operation is performed" -msgstr "Mened?er zada? jest minimalizowany podczas operacji prze??czania zada?" +msgstr "" +"Zarz?dzanie zadaniami jest minimalizowane podczas operacji prze??czania zada?" #: taskmgr.rc:191 msgid "Hide the Task Manager when it is minimized" -msgstr "Ukrywa Mened?era zada?, gdy jest on zminimalizowany" +msgstr "Ukrywa zarz?dzanie zadaniami, gdy jest zminimalizowane" #: taskmgr.rc:192 msgid "Force Task Manager to update now, regardless of Update Speed setting" @@ -12663,7 +12648,7 @@ msgstr "Przenosi okno na wierzch, lecz nie prze??cza na nie" #: taskmgr.rc:211 msgid "Displays Task Manager help topics" -msgstr "Wy?wietla tematy pomocy Mened?era zada?" +msgstr "Wy?wietla tematy pomocy dotycz?ce zarz?dzania zadaniami" #: taskmgr.rc:212 msgid "Displays program information, version number, and copyright" @@ -12671,7 +12656,7 @@ msgstr "Wy?wietla informacje o programie, numerze wersji i prawach autorskich" #: taskmgr.rc:213 msgid "Exits the Task Manager application" -msgstr "Ko?czy prac? aplikacji Mened?er zada?" +msgstr "Ko?czy prac? aplikacji do zarz?dzania zadaniami" #: taskmgr.rc:215 msgid "Shows 16-bit tasks under the associated ntvdm.exe" @@ -12708,7 +12693,7 @@ msgstr "Prze??cza na proces wybranego zadania" #: taskmgr.rc:229 msgid "Restores the Task Manager from its hidden state" -msgstr "Przywraca Mened?era zada? ze stanu ukrycia" +msgstr "Przywraca zarz?dzanie zadaniami ze stanu ukrycia" #: taskmgr.rc:230 msgid "Removes the process from the system" @@ -12720,7 +12705,7 @@ msgstr "Usuwa z systemu ten proces i wszystkie procesy zale?ne" #: taskmgr.rc:233 msgid "Attaches the debugger to this process" -msgstr "Do??cza debuggera do tego procesu" +msgstr "Do??cza program diagnostyczny do tego procesu" #: taskmgr.rc:235 msgid "Controls which processors the process will be allowed to run on" @@ -12752,7 +12737,7 @@ msgstr "Ustawia priorytet procesu na NISKI" #: taskmgr.rc:247 msgid "Controls Debug Channels" -msgstr "Kontroluj kana?y debugowania" +msgstr "Kontroluje kana?ami diagnostycznymi" #: taskmgr.rc:264 msgid "Performance" @@ -12836,7 +12821,7 @@ msgstr "Priorytet podstawowy" #: taskmgr.rc:301 msgid "Task Manager Warning" -msgstr "Ostrze?enie menad?era zada?" +msgstr "Ostrze?enie zarz?dzania zadaniami" #: taskmgr.rc:304 msgid "" @@ -12875,12 +12860,12 @@ msgid "" "WARNING: Debugging this process may result in loss of data.\n" "Are you sure you wish to attach the debugger?" msgstr "" -"OSTRZE?ENIE: Debugowanie tego procesu mo?e spowodowa? utrat? danych.\n" -"Czy na pewno chcesz uruchomi? debuggera?" +"OSTRZE?ENIE: Diagnozowanie tego procesu mo?e spowodowa? utrat? danych.\n" +"Czy na pewno chcesz uruchomi? program diagnostyczny?" #: taskmgr.rc:314 msgid "Unable to Debug Process" -msgstr "Nie mo?na debugowa? procesu" +msgstr "Nie mo?na zdiagnozowa? procesu" #: taskmgr.rc:315 msgid "The process must have affinity with at least one processor" @@ -12970,7 +12955,7 @@ msgstr "Wine" #: wineboot.rc:46 msgid "The Wine configuration in %s is being updated, please wait..." -msgstr "Konfiguracja Wine w %s jest w?a?nie aktualizowana, prosz? czeka?..." +msgstr "Ustawienia Wine w %s s? w?a?nie uaktualniane, prosz? czeka?..." #: winecfg.rc:135 msgid "" @@ -12980,7 +12965,7 @@ msgid "" "option) any later version." msgstr "" "Ta biblioteka jest wolnym oprogramowaniem; mo?esz j? rozpowszechnia? i/lub " -"modyfikowa? pod warunkami licencji GNU Lesser General Public License " +"zmienia? pod warunkami licencji GNU Lesser General Public License " "opublikowanej przez Free Software Foundation; licencji w wersji 2.1, lub " "(wed?ug w?asnego uznania) dowolnej p??niejszej." @@ -13070,11 +13055,11 @@ msgstr "" #: winecfg.rc:188 msgid "&New override for library:" -msgstr "Nowa regu?a dla biblioteki:" +msgstr "&Nowa regu?a dla biblioteki:" #: winecfg.rc:190 wordpad.rc:247 msgid "&Add" -msgstr "&Dodaj" +msgstr "Dod&aj" #: winecfg.rc:191 msgid "Existing &overrides:" @@ -13113,22 +13098,21 @@ msgid "Select Drive Letter" msgstr "Wybierz liter? nap?du" #: winecfg.rc:226 -#, fuzzy #| msgid "Wine configuration" msgid "Drive configuration" -msgstr "Konfiguracje Wine" +msgstr "Ustawienia dysk?w" #: winecfg.rc:227 msgid "" "Failed to connect to the mount manager, the drive configuration cannot be " "edited." msgstr "" -"Nieudane po??czenie z mened?erem montowania, konfiguracja nap?du nie mo?e " -"by? zmodyfikowana." +"Nieudane po??czenie z programem do zarz?dzania montowaniem, nie mo?na zmieni? " +"ustawie? nap?du." #: winecfg.rc:230 msgid "&Add..." -msgstr "&Dodaj..." +msgstr "Dod&aj..." #: winecfg.rc:232 msgid "Auto&detect" @@ -13140,7 +13124,7 @@ msgstr "&?cie?ka:" #: winecfg.rc:242 winecfg.rc:38 msgid "Show &Advanced" -msgstr "Opcje zaawansowane >>" +msgstr "Opcje z&aawansowane >>" #: winecfg.rc:243 msgid "De&vice:" @@ -13156,7 +13140,7 @@ msgstr "&Etykieta:" #: winecfg.rc:249 msgid "S&erial:" -msgstr "&Numer seryjny:" +msgstr "Numer s&eryjny:" #: winecfg.rc:252 msgid "Show &dot files" @@ -13188,7 +13172,7 @@ msgstr "Urz?dzenie wej?ciowe g?osu:" #: winecfg.rc:270 msgid "&Test Sound" -msgstr "Test d?wi?ku" +msgstr "Pr?ba d?wi?ku" #: winecfg.rc:277 msgid "Appearance" @@ -13196,19 +13180,19 @@ msgstr "Wygl?d" #: winecfg.rc:278 msgid "&Theme:" -msgstr "Motyw:" +msgstr "Wys&tr?j:" #: winecfg.rc:280 msgid "&Install theme..." -msgstr "Zainstaluj motyw..." +msgstr "Za&instaluj wystr?j..." #: winecfg.rc:285 msgid "It&em:" -msgstr "Element:" +msgstr "El&ement:" #: winecfg.rc:287 msgid "C&olor:" -msgstr "Kolor:" +msgstr "K&olor:" #: winecfg.rc:293 msgid "Folders" @@ -13232,11 +13216,11 @@ msgstr "Prosz? wybra? docelowy katalog Uniksowy." #: winecfg.rc:37 msgid "Hide &Advanced" -msgstr "Ukryj zaawansowane <<" +msgstr "Ukryj z&aawansowane <<" #: winecfg.rc:39 msgid "(No Theme)" -msgstr "(brak motywu)" +msgstr "(brak wystroju)" #: winecfg.rc:40 msgid "Graphics" @@ -13256,15 +13240,15 @@ msgstr "Informacje" #: winecfg.rc:44 msgid "Wine configuration" -msgstr "Konfiguracje Wine" +msgstr "Ustawienia Wine" #: winecfg.rc:46 msgid "Theme files (*.msstyles; *.theme)" -msgstr "Pliki motywu (*.msstyles; *.theme)" +msgstr "Pliki wystroj?w (*.msstyles; *.theme)" #: winecfg.rc:47 msgid "Select a theme file" -msgstr "Wybierz plik motywu" +msgstr "Wybierz plik wystroju" #: winecfg.rc:48 msgid "Folder" @@ -13276,7 +13260,7 @@ msgstr "Dowi?zany do" #: winecfg.rc:45 msgid "Wine configuration for %s" -msgstr "Konfiguracje Wine dla %s" +msgstr "Ustawienia Wine dla %s" #: winecfg.rc:84 msgid "Selected driver: %s" @@ -13288,7 +13272,7 @@ msgstr "(Brak)" #: winecfg.rc:86 msgid "Audio test failed!" -msgstr "Nieudany test audio!" +msgstr "Nieudana pr?ba d?wi?ku!" #: winecfg.rc:88 msgid "(System default)" @@ -13395,10 +13379,9 @@ msgid "Letter" msgstr "Litera" #: winecfg.rc:78 -#, fuzzy #| msgid "New Folder" msgid "Target folder" -msgstr "Nowy Folder" +msgstr "Katalog docelowy" #: winecfg.rc:79 msgid "" @@ -13596,7 +13579,7 @@ msgstr "&Kolor" #: wineconsole.rc:100 msgid "Configuration" -msgstr "Konfiguracja" +msgstr "Ustawienia" #: wineconsole.rc:103 msgid "Buffer zone" @@ -13676,7 +13659,7 @@ msgstr "Setup - Wybrane ustawienia" #: wineconsole.rc:41 msgid "Configuration error" -msgstr "B??d konfiguracji" +msgstr "B??d ustawiania" #: wineconsole.rc:42 msgid "Screen buffer size must be greater or equal to the window's one" @@ -13688,7 +13671,7 @@ msgstr "Ka?dy znak jest szeroki na %1!u! piksele i wysoki na %2!u! piksele" #: wineconsole.rc:38 msgid "This is a test" -msgstr "To jest test" +msgstr "To jest pr?ba" #: wineconsole.rc:44 msgid "wineconsole: Couldn't parse event id\n" @@ -13767,7 +13750,7 @@ msgid "" "sorry for the inconvenience." msgstr "" "Program %s napotka? powa?ny problem i musi zako?czy? dzia?anie. Przepraszamy " -"za t? niedogodno??." +"za t? niedogodno??." #: winedbg.rc:58 msgid "" @@ -13897,7 +13880,7 @@ msgstr "&S?siaduj?co w poziomie\tCtrl+F4" #: winefile.rc:84 msgid "&About Wine File Manager" -msgstr "Menad?er plik?w Wine - i&nformacje" +msgstr "Zarz?dzanie plikami Wine - i&nformacje" #: winefile.rc:125 msgid "Select destination" @@ -13941,7 +13924,7 @@ msgstr "&Pe?na ?cie?ka:" #: winefile.rc:167 msgid "Last Change:" -msgstr "&Ostatnio modyfikowany:" +msgstr "Ostatnio zmieniony:" #: winefile.rc:171 msgid "Cop&yright:" @@ -13986,7 +13969,7 @@ msgstr "B??d przy wybieraniu czcionki." #: winefile.rc:96 msgid "Wine File Manager" -msgstr "Menad?er plik?w Wine" +msgstr "Zarz?dzanie plikami Wine" #: winefile.rc:98 msgid "root fs" @@ -14014,7 +13997,7 @@ msgstr "Data dost?pu" #: winefile.rc:111 msgid "Modification date" -msgstr "Data modyfikacji" +msgstr "Data zmiany" #: winefile.rc:112 msgid "Index/Inode" @@ -14263,7 +14246,7 @@ msgstr "Tylko do &odczytu" #: wordpad.rc:58 msgid "&Modified" -msgstr "&Zmodyfikowany" +msgstr "Z&mieniony" #: wordpad.rc:60 msgid "E&xtras" @@ -14720,8 +14703,9 @@ msgstr "" "[/A] Kopiuje tylko pliki z atrybutem archiwalny.\n" "[/M] Kopiuje tylko pliki z atrybutem archiwalny\n" "\ti usuwa ten atrybut.\n" -"[/D | /D:m-d-y] Kopiuje tylko nowe pliki lub te zmodyfikowane po podanej " +"[/D | /D:m-d-y] Kopiuje tylko nowe pliki lub te zmienione po podanej " "dacie.\n" "\t\tJe?eli nie podano ?adnej daty, to kopiowane s? pliki, kt?re s?\n" "\t\tnowsze ni? w katalogu docelowym.\n" "\n" + -- 1.9.3 From lukasz.wojnilowicz at gmail.com Sat Nov 29 00:58:41 2014 From: lukasz.wojnilowicz at gmail.com (=?UTF-8?q?=C5=81ukasz=20Wojni=C5=82owicz?=) Date: Sat, 29 Nov 2014 07:58:41 +0100 Subject: [website] Update Polish ubuntu.template Message-ID: <1417244322-3635-1-git-send-email-lukasz.wojnilowicz@gmail.com> --- templates/pl/download/ubuntu.template | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/templates/pl/download/ubuntu.template b/templates/pl/download/ubuntu.template index ca9660a..3ea93d4 100644 --- a/templates/pl/download/ubuntu.template +++ b/templates/pl/download/ubuntu.template @@ -1,5 +1,5 @@ - - + +

Ubuntu Logo Wine dla Ubuntu i jego pochodnych @@ -11,52 +11,53 @@ zawiera stabilne wydania. Najnowsze paczki Wine znajduj? si? na WineHQ. Aby z nich skorzysta? wykonaj poni?sze instrukcje.

+

Pochodne Ubuntu: Te paczki i instrukcje s? zosta?y opracowane dla Ubuntu oraz jego uznawanych odmian. U?ytkownicy system?w pochodnych do Ubuntu mog? u?ywa? tych paczek, lecz powinni by? ?wiadomi, ?e problemy wywo?ane r??nicami pomi?dzy pochodnym distro, a Ubuntu nie s? ani b??dami Wine, ani b??dami pakowania i powinny by? zg?aszane do distro, na kt?rym ten problem wyst?puje.

+

Dodawanie repozytorium WineHQ PPA:

Otw?rz ?r?d?a oprogramowania z menu Aplikacje->Centrum Oprogramowania Ubuntu, nast?pnie zaznacz Edycja->?r?d?a oprogramowania. Przejd? na zak?adk? Oprogramowanie os?b trzecich i kliknij Dodaj....

-System->Administration->Software Sources->Other Software +Software Center->Edit->Software Sources->Other Software -

Nast?pnie, wklej poni?sz? linijk?.

+

Nast?pnie, wklej poni?szy wiersz.

ppa:ubuntu-wine/ppa

Uwaga: paczki beta

-

Te paczki s? paczkami beta. Oznacza to, ?e b?d? -okresowo cierpie? z powodu +

Paczki 1.7 s? paczkami beta. Oznacza to, ?e b?d? +okresowo cierpie? z powodu regresji, a aktualizacja do nich -mo?e popsu? funkcjonalno?? Wine. Je?eli wersja stabilna {$config_stable_release} dzia?a bez problemu -to instalowanie tych paczek mo?e nie by? konieczne.

+mo?e popsu? funkcjonalno?? Wine. Je?eli wersja stabilna Wine {$config_stable_release} dzia?a bez problemu +to wgrywanie tych paczek mo?e nie by? konieczne.

-

Instalowanie Wine:

+

Wgrywanie Wine:

-

Skoro ju? doda?e?/a? repozytorium WineHQ PPA to jeste? gotowy/a do instalacji.

+

Skoro ju? doda?e?/a? repozytorium WineHQ PPA to jeste? gotowy/a do wgrywania.

-

Aby u?ywa? najnowszego Wine 1.5 beta, -kliknij na ten link, aby zainstalowa? paczk? wine1.5.

-

Aby u?ywa? ostatniej stabilnej wersji Wine 1.4, -kliknij na ten link, aby zainstalowa? paczk? wine1.4.

+

Aby u?ywa? najnowszego Wine {$config_master_release}, +naci?nij na to dowiazanie, aby wgra? paczk? wine1.7.

+

Aby u?ywa? ostatniej stabilnej wersji Wine {$config_stable_release}, +naci?nij na to dowiazanie, aby wgra? paczk? wine1.6.

-

Aktualizacja do nowej wersji Ubuntu

+

Unowocze?nienie do nowej wersji Ubuntu

-

Je?eli aktualizujesz ca?y system np. przechodzisz z -Ubuntu 10.04 na 10.10, to b?dziesz musia?/a wr?ci? do tej strony i -doda? repozytorium do nowej wersji systemu. Wbudowany menad?er -aktualizacji nie zmieni automatycznie repozytorium Wine. +

Je?eli unowocze?niasz ca?y system np. przechodzisz z +Ubuntu 13.10 na 14.04, to b?dziesz musia?/a wr?ci? do tej strony i +doda? repozytorium do nowej wersji systemu. Wbudowany program do zarz?dzania uaktualnieniami sam nie zmieni repozytorium Wine.

-

Alternatywne komendy wiersza polece? do zainstalowania Wine:

+

Alternatywne polecenia wiersza polece? do wgrana Wine:

-

Istnieje mo?liwo?? dodania repozytori?w Wine i instalowania z wiersza polece?. +

Istnieje mo?liwo?? dodania repozytori?w Wine i wgrywanie z wiersza polece?. Jest to u?yteczne w przypadku Kubuntu, Xubuntu, i innych pochodnych Ubuntu.

sudo add-apt-repository ppa:ubuntu-wine/ppa

Nast?pnie zaktualizuj informacje o paczkach APT wpisuj?c 'sudo apt-get -update'. Teraz mo?esz zainstalowa? Wine wpisuj?c w terminalu 'sudo apt-get -install wine1.5'.

+update
'. Teraz mo?esz wgra? Wine wpisuj?c w terminalu 'sudo apt-get +install wine1.7'.

-

Je?eli chcia?by? r?cznie przegl?da? PPA, mo?esz odwiedzi? jego stron? na Launchpad.

+

Aby r?cznie r?cznie przegl?da? PPA, odwied? jego stron? na Launchpad.

-- 1.9.3 From lukasz.wojnilowicz at gmail.com Sat Nov 29 00:58:42 2014 From: lukasz.wojnilowicz at gmail.com (=?UTF-8?q?=C5=81ukasz=20Wojni=C5=82owicz?=) Date: Sat, 29 Nov 2014 07:58:42 +0100 Subject: [website] Update Polish download.template In-Reply-To: <1417244322-3635-1-git-send-email-lukasz.wojnilowicz@gmail.com> References: <1417244322-3635-1-git-send-email-lukasz.wojnilowicz@gmail.com> Message-ID: <1417244322-3635-2-git-send-email-lukasz.wojnilowicz@gmail.com> --- templates/pl/download.template | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/pl/download.template b/templates/pl/download.template index f3a4d00..bbab5db 100644 --- a/templates/pl/download.template +++ b/templates/pl/download.template @@ -60,7 +60,7 @@ Ubuntu linux Pobierz paczki dla Ubuntu - - binarne i ?r?d?owe paczki .deb dla Ubuntu Precise (12.04), Quantal (12.10), i Raring (13.04) + - binarne i ?r?d?owe paczki .deb dla Ubuntu Trusty (14.04 LTS) Scott Ritchie @@ -120,7 +120,7 @@

Aplikacje os?b trzecich

-

zasami pewne modyfikacje Wine mog? sprawi?, +

Czasami pewne zmiany Wine mog? sprawi?, ?e aplikacja b?dzie dzia?a?, ale z pewnych powod?w zmiany te nie mog? by? wcielone do Wine. Stworzono r??ne aplikacje (tzw. aplikacje os?b trzecich), aby pom?c przezwyci??y? niedobory w -- 1.9.3 From gerald at pfeifer.com Sat Nov 29 05:59:26 2014 From: gerald at pfeifer.com (Gerald Pfeifer) Date: Sat, 29 Nov 2014 12:59:26 +0100 (CET) Subject: wordpad: Check for array index before using it in registry_set_filelist. registry_set_filelist. Message-ID: --- programs/wordpad/registry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/wordpad/registry.c b/programs/wordpad/registry.c index 472ed4d..5b570e7 100644 --- a/programs/wordpad/registry.c +++ b/programs/wordpad/registry.c @@ -293,7 +293,7 @@ void registry_set_filelist(LPCWSTR newFile, HWND hMainWnd) if(lstrcmpiW(newFile, pFiles[0])) { - for(i = 0; pFiles[i] && i < FILELIST_ENTRIES; i++) + for(i = 0; i < FILELIST_ENTRIES && pFiles[i]; i++) { if(!lstrcmpiW(pFiles[i], newFile)) { -- 2.1.2 From makosoft at gmail.com Sat Nov 29 10:24:46 2014 From: makosoft at gmail.com (Aidan Thornton) Date: Sat, 29 Nov 2014 16:24:46 +0000 Subject: quartz: implement IFilterGraph2::AddSourceFilterForMoniker Message-ID: Needed for webcam capture in some applications, such as FaceRig --- dlls/quartz/filtergraph.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-quartz-implement-IFilterGraph2-AddSourceFilterForMon.patch Type: text/x-patch Size: 1264 bytes Desc: not available URL: From marcus at jet.franken.de Sun Nov 30 03:45:13 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 30 Nov 2014 10:45:13 +0100 Subject: [PATCH] dwrite: avoid leaking filemapping (Coverity) Message-ID: <1417340713-8908-1-git-send-email-marcus@jet.franken.de> 1256219 Resource leak --- dlls/dwrite/font.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 1b88af0..5e82b81 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -2228,8 +2228,10 @@ static HRESULT WINAPI localfontfileloader_CreateStreamFromKey(IDWriteLocalFontFi CloseHandle(mapping); stream = heap_alloc(sizeof(*stream)); - if (!stream) + if (!stream) { + UnmapViewOfFile(file_ptr); return E_OUTOFMEMORY; + } stream->key = heap_alloc(key_size); if (!stream->key) { -- 1.8.4.5 From marcus at jet.franken.de Sun Nov 30 03:45:45 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 30 Nov 2014 10:45:45 +0100 Subject: [PATCH] dwrite: remove unused hresult assignment (Coverity) Message-ID: <1417340745-9041-1-git-send-email-marcus@jet.franken.de> 1250627 Unused value it is not checked below either. --- dlls/dwrite/font.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c index 9d11e94..1b88af0 100644 --- a/dlls/dwrite/font.c +++ b/dlls/dwrite/font.c @@ -1586,7 +1586,7 @@ HRESULT create_font_collection(IDWriteFactory* factory, IDWriteFontFileEnumerato exists = FALSE; hr = collection_find_family(collection, buffer, &index, &exists); if (exists) - hr = fontfamily_add_font(collection->family_data[index], font_data); + fontfamily_add_font(collection->family_data[index], font_data); else { struct dwrite_fontfamily_data *family_data; -- 1.8.4.5 From marcus at jet.franken.de Sun Nov 30 03:51:54 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 30 Nov 2014 10:51:54 +0100 Subject: [PATCH] ntoskrnl.exe: IoBuildSynchronousFsdRequest and IoGetAttachedDevice stub Message-ID: <1417341114-9208-1-git-send-email-marcus@jet.franken.de> Some work I have left lying around after trying to get a copy protection to work. (Stopped at how to get IoGetAttachedDevice deliver the cdrom device created by mountmgr.sys which lives in a different address space.) Ciao, Marcus --- dlls/ntoskrnl.exe/ntoskrnl.c | 51 ++++++++++++++++++++++++++++++++++++- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 4 +-- 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 47a0e0d..027734f 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -534,6 +534,43 @@ PIRP WINAPI IoBuildDeviceIoControlRequest( ULONG IoControlCode, } +/********************************************************** + * IoBuildSynchronousFsdRequest (NTOSKRNL.EXE.@) + */ +PIRP WINAPI IoBuildSynchronousFsdRequest(ULONG majorfunc, PDEVICE_OBJECT device, + PVOID buffer, ULONG length, PLARGE_INTEGER startoffset, + PKEVENT event, PIO_STATUS_BLOCK iosb) +{ + PIRP irp; + struct IrpInstance *instance; + PIO_STACK_LOCATION irpsp; + + FIXME("(%d %p %p %d %p %p %p) stub\n", majorfunc, device, buffer, length, startoffset, event, iosb); + + irp = IoAllocateIrp( device->StackSize, FALSE ); + if (irp == NULL) + return NULL; + + instance = HeapAlloc( GetProcessHeap(), 0, sizeof(struct IrpInstance) ); + if (instance == NULL) + { + IoFreeIrp( irp ); + return NULL; + } + instance->irp = irp; + list_add_tail( &Irps, &instance->entry ); + + irpsp = IoGetNextIrpStackLocation( irp ); + irpsp->MajorFunction = majorfunc; + /*irpsp->Parameters.DeviceIoControl.IoControlCode = IoControlCode;*/ + + irp->UserIosb = iosb; + irp->UserEvent = event; + irp->UserBuffer = buffer; + return irp; +} + + /*********************************************************************** * IoCreateDriver (NTOSKRNL.EXE.@) */ @@ -733,9 +770,21 @@ NTSTATUS WINAPI IoGetDeviceObjectPointer( UNICODE_STRING *name, ACCESS_MASK acc { FIXME( "stub: %s %x %p %p\n", debugstr_us(name), access, file, device ); - return STATUS_NOT_IMPLEMENTED; + *file = NULL; + *device = NULL; + + return /*STATUS_NOT_IMPLEMENTED*/STATUS_SUCCESS; } +/*********************************************************************** + * IoGetAttachedDevice (NTOSKRNL.EXE.@) + */ +PDEVICE_OBJECT WINAPI IoGetAttachedDevice( PDEVICE_OBJECT device ) +{ + FIXME( "stub: %p\n", device ); + + return device; +} /*********************************************************************** * IoGetDeviceProperty (NTOSKRNL.EXE.@) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 4ead907..3bcf21c 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -322,7 +322,7 @@ @ stub IoBuildAsynchronousFsdRequest @ stdcall IoBuildDeviceIoControlRequest(long ptr ptr long ptr long long ptr ptr) @ stub IoBuildPartialMdl -@ stub IoBuildSynchronousFsdRequest +@ stdcall IoBuildSynchronousFsdRequest(long ptr ptr long ptr ptr ptr) @ stdcall IoCallDriver(ptr ptr) @ stub IoCancelFileOpen @ stub IoCancelIrp @@ -373,7 +373,7 @@ @ stdcall IoFreeIrp(ptr) @ stdcall IoFreeMdl(ptr) @ stub IoFreeWorkItem -@ stub IoGetAttachedDevice +@ stdcall IoGetAttachedDevice(ptr) @ stub IoGetAttachedDeviceReference @ stub IoGetBaseFileSystemDeviceObject @ stub IoGetBootDiskInformation -- 1.8.4.5 From marcus at jet.franken.de Sun Nov 30 03:45:16 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 30 Nov 2014 10:45:16 +0100 Subject: [PATCH] dwrite: initialize a variable (Coverity) Message-ID: <1417340716-8961-1-git-send-email-marcus@jet.franken.de> The first goto done; exit path has "cache" uninitialized. 1248123 Uninitialized pointer read --- dlls/dwrite/analyzer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/dwrite/analyzer.c b/dlls/dwrite/analyzer.c index 3670e46..17e0351 100644 --- a/dlls/dwrite/analyzer.c +++ b/dlls/dwrite/analyzer.c @@ -845,7 +845,7 @@ static HRESULT WINAPI dwritetextanalyzer_GetGlyphs(IDWriteTextAnalyzer2 *iface, { const struct dwritescript_properties *scriptprops; struct scriptshaping_context context; - struct scriptshaping_cache *cache; + struct scriptshaping_cache *cache = NULL; WCHAR *string; BOOL update_cluster; UINT32 i, g; -- 1.8.4.5 From marcus at jet.franken.de Sun Nov 30 06:09:23 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 30 Nov 2014 13:09:23 +0100 Subject: [PATCH] oleacc: free the mapping on error (Coverity) Message-ID: <1417349363-11531-1-git-send-email-marcus@jet.franken.de> 1248117 Resource leak --- dlls/oleacc/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dlls/oleacc/main.c b/dlls/oleacc/main.c index e5fe6cd..fa7d592 100644 --- a/dlls/oleacc/main.c +++ b/dlls/oleacc/main.c @@ -219,8 +219,10 @@ HRESULT WINAPI ObjectFromLresult( LRESULT result, REFIID riid, WPARAM wParam, vo return E_FAIL; data = GlobalAlloc(GMEM_FIXED, size); - if(!data) + if(!data) { + UnmapViewOfFile(view); return E_OUTOFMEMORY; + } memcpy(data, view, size); UnmapViewOfFile(view); -- 1.8.4.5 From nerv at dawncrow.de Sun Nov 30 06:15:37 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Sun, 30 Nov 2014 13:15:37 +0100 Subject: d3dx9_36/tests: Remove unused function (Clang) Message-ID: <547B0A69.2020606@dawncrow.de> --- dlls/d3dx9_36/tests/surface.c | 6 ------ 1 file changed, 6 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0003-d3dx9_36-tests-Remove-unused-function-Clang.txt Type: text/x-patch Size: 507 bytes Desc: not available URL: From nerv at dawncrow.de Sun Nov 30 06:15:45 2014 From: nerv at dawncrow.de (=?ISO-8859-15?Q?Andr=E9_Hentschel?=) Date: Sun, 30 Nov 2014 13:15:45 +0100 Subject: fusion: Add implementation for CreateAssemblyCacheItem Message-ID: <547B0A71.6010804@dawncrow.de> --- dlls/fusion/asmcache.c | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0004-fusion-Add-implementation-for-CreateAssemblyCacheItem.txt Type: text/x-patch Size: 2727 bytes Desc: not available URL: From marcus at jet.franken.de Sun Nov 30 06:50:04 2014 From: marcus at jet.franken.de (Marcus Meissner) Date: Sun, 30 Nov 2014 13:50:04 +0100 Subject: [PATCH] server: initialize the _len parts to 0 (Coverity) Message-ID: <1417351804-13493-1-git-send-email-marcus@jet.franken.de> There is always a path where new_sd.xxx_len could be uninitialized. Initialize the 4 of them to 0 for safety reasons. 1243366 Uninitialized scalar variable 1243362 Explicit null dereferenced 1243361 Explicit null dereferenced --- server/object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/object.c b/server/object.c index ec196c1..bdb7cc3 100644 --- a/server/object.c +++ b/server/object.c @@ -436,6 +436,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri new_sd.control = sd->control & ~SE_SELF_RELATIVE; + new_sd.owner_len = 0; if (set_info & OWNER_SECURITY_INFORMATION && sd->owner_len) { owner = sd_get_owner( sd ); @@ -452,6 +453,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri new_sd.owner_len = security_sid_len( owner ); } + new_sd.group_len = 0; if (set_info & GROUP_SECURITY_INFORMATION && sd->group_len) { group = sd_get_group( sd ); @@ -470,6 +472,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri new_sd.control |= SE_SACL_PRESENT; sacl = sd_get_sacl( sd, &present ); + new_sd.sacl_len = 0; if (set_info & SACL_SECURITY_INFORMATION && present) new_sd.sacl_len = sd->sacl_len; else @@ -486,6 +489,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri new_sd.control |= SE_DACL_PRESENT; dacl = sd_get_dacl( sd, &present ); + new_sd.dacl_len = 0; if (set_info & DACL_SECURITY_INFORMATION && present) new_sd.dacl_len = sd->dacl_len; else -- 1.8.4.5 From nsivov at codeweavers.com Sun Nov 30 23:17:47 2014 From: nsivov at codeweavers.com (Nikolay Sivov) Date: Mon, 01 Dec 2014 08:17:47 +0300 Subject: comctl32/tests: Fix imagelist leak (Valgrind) Message-ID: <547BF9FB.5050200@codeweavers.com> --- -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-comctl32-tests-Fix-imagelist-leak-Valgrind.patch Type: text/x-patch Size: 738 bytes Desc: not available URL: From qhong at codeweavers.com Sun Nov 30 23:38:20 2014 From: qhong at codeweavers.com (Qian Hong) Date: Mon, 01 Dec 2014 13:38:20 +0800 Subject: [PATCH] wine.inf: Add quotes to webbrowser command key for mailto protocol. Message-ID: <547BFECC.4000307@codeweavers.com> Hi Piotr, This is a follow up of the below commit: commit 54833c9b7cf5f8f5e37b43038e1fa4c1c369deb0 Author: Piotr Caban Date: Wed May 4 13:20:41 2011 +0200 wine.inf: Add quotes to webbrowser command keys. To make sure i'm not breaking anything which is intended, would you mind have a look? Thanks! --- loader/wine.inf.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-wine.inf-Add-quotes-to-webbrowser-command-key-for-mail.txt Type: text/x-patch Size: 639 bytes Desc: not available URL: From makosoft at gmail.com Sat Nov 29 10:05:08 2014 From: makosoft at gmail.com (Aidan Thornton) Date: Sat, 29 Nov 2014 16:05:08 +0000 Subject: quartz: implement IFilterGraph2::AddSourceFilterForMoniker Message-ID: Needed for webcam capture in some applications, such as FaceRig. --- dlls/quartz/filtergraph.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-quartz-implement-IFilterGraph2-AddSourceFilterForMon.patch Type: text/x-patch Size: 1264 bytes Desc: not available URL: From nathan.fearnley at slugsource.com Sat Nov 29 10:53:32 2014 From: nathan.fearnley at slugsource.com (Nathan Fearnley) Date: Sat, 29 Nov 2014 11:53:32 -0500 Subject: ntdll: Adds support for custom serial port baudrates on Mac Message-ID: Mac OS X supports a special function call for custom baud rates. I have implemented this feature to allow non-standard baud rates. Unfortunately, setting any other parameters using tcsetattr will fail, because it does not support the higher baud rates. In order to work around this, when setting other parameters, the baud rate is temporarily set to 9600, then reset back to custom rate after the changes are complete. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Adds-support-for-custom-serial-port-baudrates-on-Mac.patch Type: application/octet-stream Size: 6156 bytes Desc: not available URL: