ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2015
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
14 participants
457 discussions
Start a n
N
ew thread
[akhaldi] 70084: [D3DRM_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:44:34 2015 New Revision: 70084 URL:
http://svn.reactos.org/svn/reactos?rev=70084&view=rev
Log: [D3DRM_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536 Modified: trunk/rostests/winetests/d3drm/d3drm.c Modified: trunk/rostests/winetests/d3drm/d3drm.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/d3drm/d3drm.c?r…
============================================================================== --- trunk/rostests/winetests/d3drm/d3drm.c [iso-8859-1] (original) +++ trunk/rostests/winetests/d3drm/d3drm.c [iso-8859-1] Tue Nov 24 10:44:34 2015 @@ -1947,6 +1947,137 @@ IDirect3DRM_Release(d3drm1); } +static void test_device_qi(void) +{ + static const struct qi_test tests[] = + { + { &IID_IDirect3DRM3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRM2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRM, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMDevice, &IID_IUnknown, S_OK, }, + { &IID_IDirect3DRMDevice2, &IID_IUnknown, S_OK, }, + { &IID_IDirect3DRMDevice3, &IID_IUnknown, S_OK, }, + { &IID_IDirect3DRMWinDevice, &IID_IUnknown, S_OK, }, + { &IID_IDirect3DRMObject, &IID_IUnknown, S_OK, }, + { &IID_IDirect3DRMViewport, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMViewport2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFrame, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFrame2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFrame3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMVisual, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMMesh, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMMeshBuilder, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMMeshBuilder2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMMeshBuilder3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFace, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFace2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMLight, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMTexture, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMTexture2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMTexture3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMWrap, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMMaterial, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMMaterial2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMAnimation, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMAnimation2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMAnimationSet, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMAnimationSet2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMObjectArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMDeviceArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMViewportArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFrameArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMVisualArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMLightArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMPickedArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMFaceArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMAnimationArray, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMUserVisual, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMShadow, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMShadow2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMInterpolator, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMProgressiveMesh, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMPicked2Array, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DRMClippedVisual, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDrawClipper, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDrawSurface7, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDrawSurface4, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDrawSurface3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDrawSurface2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDrawSurface, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DDevice7, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DDevice3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DDevice2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DDevice, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3D7, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3D3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3D2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3D, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDraw7, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDraw4, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDraw3, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDraw2, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirectDraw, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IDirect3DLight, NULL, CLASS_E_CLASSNOTAVAILABLE}, + { &IID_IUnknown, &IID_IUnknown, S_OK, }, + }; + HRESULT hr; + IDirect3DRM *d3drm1; + IDirect3DRM2 *d3drm2; + IDirect3DRM3 *d3drm3; + IDirectDrawClipper *clipper; + IDirect3DRMDevice *device1; + IDirect3DRMDevice2 *device2; + IDirect3DRMDevice3 *device3; + IUnknown *unknown; + HWND window; + GUID driver; + RECT rc; + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); + GetClientRect(window, &rc); + hr = DirectDrawCreateClipper(0, &clipper, NULL); + ok(hr == DD_OK, "Cannot get IDirectDrawClipper interface (hr = %x)\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window); + ok(hr == DD_OK, "Cannot set HWnd to Clipper (hr = %x)\n", hr); + + hr = Direct3DRMCreate(&d3drm1); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRM interface (hr = %x)\n", hr); + memcpy(&driver, &IID_IDirect3DRGBDevice, sizeof(GUID)); + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, clipper, &driver, rc.right, rc.bottom, &device1); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMDevice interface (hr = %x)\n", hr); + hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IUnknown, (void **)&unknown); + ok(SUCCEEDED(hr), "Cannot get IUnknown interface from IDirect3DRMDevice (hr = %x)\n", hr); + IDirect3DRMDevice_Release(device1); + test_qi("device1_qi", unknown, &IID_IUnknown, tests, sizeof(tests) / sizeof(*tests)); + IUnknown_Release(unknown); + + hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM2, (void **)&d3drm2); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRM2 interface (hr = %x).\n", hr); + hr = IDirect3DRM2_CreateDeviceFromClipper(d3drm2, clipper, &driver, rc.right, rc.bottom, &device2); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMDevice2 interface (hr = %x)\n", hr); + hr = IDirect3DRMDevice2_QueryInterface(device2, &IID_IUnknown, (void **)&unknown); + ok(SUCCEEDED(hr), "Cannot get IUnknown interface from IDirect3DRMDevice2 (hr = %x)\n", hr); + IDirect3DRMDevice2_Release(device2); + test_qi("device2_qi", unknown, &IID_IUnknown, tests, sizeof(tests) / sizeof(*tests)); + IUnknown_Release(unknown); + + hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM3, (void **)&d3drm3); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRM3 interface (hr = %x).\n", hr); + hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm3, clipper, &driver, rc.right, rc.bottom, &device3); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMDevice3 interface (hr = %x)\n", hr); + IDirect3DRMDevice3_QueryInterface(device3, &IID_IUnknown, (void **)&unknown); + ok(SUCCEEDED(hr), "Cannot get IUnknown interface from IDirect3DRMDevice3 (hr = %x)\n", hr); + IDirect3DRMDevice3_Release(device3); + test_qi("device3_qi", unknown, &IID_IUnknown, tests, sizeof(tests) / sizeof(*tests)); + IUnknown_Release(unknown); + + IDirectDrawClipper_Release(clipper); + IDirect3DRM3_Release(d3drm3); + IDirect3DRM2_Release(d3drm2); + IDirect3DRM_Release(d3drm1); + DestroyWindow(window); +} + static HRESULT CALLBACK surface_callback(IDirectDrawSurface *surface, DDSURFACEDESC *desc, void *context) { IDirectDrawSurface **primary = context; @@ -1961,14 +2092,180 @@ return DDENUMRET_OK; } -static void test_create_device_from_clipper(void) +static void test_create_device_from_clipper1(void) +{ + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + IDirect3DRM *d3drm1 = NULL; + IDirectDraw *ddraw = NULL; + IUnknown *unknown = NULL; + IDirect3DRMDevice *device1 = (IDirect3DRMDevice *)0xdeadbeef; + IDirect3DDevice *d3ddevice1 = NULL; + IDirectDrawClipper *clipper = NULL, *d3drm_clipper = NULL; + IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_primary = NULL; + IDirectDrawSurface7 *surface7 = NULL; + DDSURFACEDESC desc, surface_desc; + DWORD expected_flags; + HWND window; + GUID driver = IID_IDirect3DRGBDevice; + HRESULT hr; + ULONG ref1, ref2, cref1, cref2; + RECT rc; + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 500, 400, 0, 0, 0, 0); + GetClientRect(window, &rc); + hr = DirectDrawCreateClipper(0, &clipper, NULL); + ok(hr == DD_OK, "Cannot get IDirectDrawClipper interface (hr = %x).\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window); + ok(hr == DD_OK, "Cannot set HWnd to Clipper (hr = %x).\n", hr); + + hr = Direct3DRMCreate(&d3drm1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1); + cref1 = get_refcount((IUnknown *)clipper); + + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, clipper, &driver, 0, 0, &device1); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(device1 == NULL, "Expected device returned == NULL, got %p.\n", device1); + + /* If NULL is passed for clipper, CreateDeviceFromClipper returns D3DRMERR_BADVALUE */ + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, NULL, &driver, 300, 200, &device1); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, clipper, &driver, 300, 200, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, clipper, &driver, 300, 200, &device1); + ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2); + cref2 = get_refcount((IUnknown *)clipper); + ok(cref2 > cref1, "expected cref2 > cref1, got cref1 = %u , cref2 = %u.\n", cref1, cref2); + + /* Fetch immediate mode device in order to access render target */ + hr = IDirect3DRMDevice_GetDirect3DDevice(device1, &d3ddevice1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr); + + hr = IDirect3DDevice_QueryInterface(d3ddevice1, &IID_IDirectDrawSurface, (void **)&surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + + hr = IDirectDrawSurface_GetClipper(surface, &d3drm_clipper); + ok(hr == DDERR_NOCLIPPERATTACHED, "Expected hr == DDERR_NOCLIPPERATTACHED, got %x.\n", hr); + + /* Check if CreateDeviceFromClipper creates a primary surface and attaches the clipper to it */ + hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface7, (void **)&surface7); + ok(hr == DD_OK, "Cannot get IDirectDrawSurface7 interface (hr = %x).\n", hr); + IDirectDrawSurface7_GetDDInterface(surface7, (void **)&unknown); + hr = IUnknown_QueryInterface(unknown, &IID_IDirectDraw, (void **)&ddraw); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + IUnknown_Release(unknown); + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, &d3drm_primary, surface_callback); + ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); + ok(d3drm_primary != NULL, "No primary surface was enumerated.\n"); + hr = IDirectDrawSurface_GetClipper(d3drm_primary, &d3drm_clipper); + ok(hr == DD_OK, "Cannot get attached clipper from primary surface (hr = %x).\n", hr); + ok(d3drm_clipper == clipper, "Expected clipper returned == %p, got %p.\n", clipper , d3drm_clipper); + + IDirectDrawClipper_Release(d3drm_clipper); + IDirectDrawSurface_Release(d3drm_primary); + IDirectDrawSurface7_Release(surface7); + IDirectDraw_Release(ddraw); + + /* Check properties of render target and depth surface */ + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); + + ok((surface_desc.dwWidth == 300) && (surface_desc.dwHeight == 200), "Expected surface dimensions = 300, 200, got %u, %u.\n", + surface_desc.dwWidth, surface_desc.dwHeight); + ok((surface_desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE)) == (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE), + "Expected caps containing %x, got %x.\n", DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, surface_desc.ddsCaps.dwCaps); + expected_flags = DDSD_PIXELFORMAT | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(surface_desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, surface_desc.dwFlags); + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + desc.dwSize = sizeof(desc); + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Cannot get IDirectDraw display mode (hr = %x)\n", hr); + ok(desc.ddpfPixelFormat.dwRGBBitCount == surface_desc.ddpfPixelFormat.dwRGBBitCount, "Expected %u bpp, got %u bpp.\n", + surface_desc.ddpfPixelFormat.dwRGBBitCount, desc.ddpfPixelFormat.dwRGBBitCount); + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); + + ok((desc.dwWidth == 300) && (desc.dwHeight == 200), "Expected surface dimensions = 300, 200, got %u, %u.\n", + desc.dwWidth, desc.dwHeight); + ok((desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) == DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); + expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + ok(desc.dwZBufferBitDepth == 16, "Expected 16 for Z buffer bit depth, got %u.\n", desc.dwZBufferBitDepth); + ok(desc.ddpfPixelFormat.dwStencilBitMask == 0, "Expected 0 stencil bits, got %x.\n", desc.ddpfPixelFormat.dwStencilBitMask); + + /* Release old objects and check refcount of device and clipper */ + IDirectDrawSurface_Release(ds); + ds = NULL; + IDirectDrawSurface_Release(surface); + surface = NULL; + IDirect3DDevice_Release(d3ddevice1); + d3ddevice1 = NULL; + IDirect3DRMDevice_Release(device1); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref2, "expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", ref1, ref2); + cref2 = get_refcount((IUnknown *)clipper); + ok(cref1 == cref2, "expected cref1 == cref2, got cref1 = %u, cref2 = %u.\n", cref1, cref2); + + /* Test if render target format follows the screen format */ + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Cannot get IDirectDraw display mode (hr = %x)\n", hr); + hr = IDirectDraw_SetDisplayMode(ddraw, desc.dwWidth, desc.dwHeight, 16); + ok(hr == DD_OK, "Cannot set display mode to 16bpp (hr = %x).\n", hr); + + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Cannot get IDirectDraw display mode (hr = %x)\n", hr); + ok(desc.ddpfPixelFormat.dwRGBBitCount == 16, "Expected 16 bpp, got %u.\n", desc.ddpfPixelFormat.dwRGBBitCount); + + hr = IDirect3DRM_CreateDeviceFromClipper(d3drm1, clipper, &driver, rc.right, rc.bottom, &device1); + ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice_GetDirect3DDevice(device1, &d3ddevice1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr); + + hr = IDirect3DDevice_QueryInterface(d3ddevice1, &IID_IDirectDrawSurface, (void **)&surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); + todo_wine ok(surface_desc.ddpfPixelFormat.dwRGBBitCount == 16, "Expected 16bpp, got %ubpp.\n", + surface_desc.ddpfPixelFormat.dwRGBBitCount); + + hr = IDirectDraw2_RestoreDisplayMode(ddraw); + ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); + + if (ds) + IDirectDrawSurface_Release(ds); + IDirectDrawSurface_Release(surface); + IDirect3DDevice_Release(d3ddevice1); + IDirect3DRMDevice_Release(device1); + IDirect3DRM_Release(d3drm1); + IDirectDrawClipper_Release(clipper); + IDirectDraw_Release(ddraw); + DestroyWindow(window); +} + +static void test_create_device_from_clipper2(void) { DDSCAPS caps = { DDSCAPS_ZBUFFER }; IDirect3DRM *d3drm1 = NULL; IDirect3DRM2 *d3drm2 = NULL; IDirectDraw *ddraw = NULL; IUnknown *unknown = NULL; - IDirect3DRMDevice2 *device2 = NULL; + IDirect3DRMDevice2 *device2 = (IDirect3DRMDevice2 *)0xdeadbeef; IDirect3DDevice2 *d3ddevice2 = NULL; IDirectDrawClipper *clipper = NULL, *d3drm_clipper = NULL; IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_primary = NULL; @@ -1998,26 +2295,28 @@ ref2 = get_refcount((IUnknown *)d3drm2); hr = IDirect3DRM2_CreateDeviceFromClipper(d3drm2, clipper, &driver, 0, 0, &device2); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(device2 == NULL, "Expected device returned == NULL, got %p.\n", device2); /* If NULL is passed for clipper, CreateDeviceFromClipper returns D3DRMERR_BADVALUE */ - hr = IDirect3DRM2_CreateDeviceFromClipper(d3drm2, NULL, &driver, 0, 0, &device2); - todo_wine ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM2_CreateDeviceFromClipper(d3drm2, NULL, &driver, 300, 200, &device2); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM2_CreateDeviceFromClipper(d3drm2, clipper, &driver, 300, 200, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); hr = IDirect3DRM2_CreateDeviceFromClipper(d3drm2, clipper, &driver, 300, 200, &device2); ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice2 interface (hr = %x).\n", hr); ref3 = get_refcount((IUnknown *)d3drm1); - todo_wine ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); ref3 = get_refcount((IUnknown *)d3drm2); ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); cref2 = get_refcount((IUnknown *)clipper); - todo_wine ok(cref2 > cref1, "expected cref2 > cref1, got cref1 = %u , cref2 = %u.\n", cref1, cref2); + ok(cref2 > cref1, "expected cref2 > cref1, got cref1 = %u , cref2 = %u.\n", cref1, cref2); /* Fetch immediate mode device in order to access render target */ hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); - todo_wine ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); - if (FAILED(hr)) - goto cleanup; + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &surface); ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); @@ -2033,18 +2332,15 @@ ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); IUnknown_Release(unknown); hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, - NULL, &d3drm_primary, surface_callback); + NULL, &d3drm_primary, surface_callback); ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); ok(d3drm_primary != NULL, "No primary surface was enumerated.\n"); hr = IDirectDrawSurface_GetClipper(d3drm_primary, &d3drm_clipper); ok(hr == DD_OK, "Cannot get attached clipper from primary surface (hr = %x).\n", hr); - if (SUCCEEDED(hr)) - { - ok(d3drm_clipper == clipper, "Expected clipper returned == %p, got %p.\n", clipper , d3drm_clipper); - IDirectDrawClipper_Release(d3drm_clipper); - } - if (d3drm_primary) - IDirectDrawSurface_Release(d3drm_primary); + ok(d3drm_clipper == clipper, "Expected clipper returned == %p, got %p.\n", clipper , d3drm_clipper); + + IDirectDrawClipper_Release(d3drm_clipper); + IDirectDrawSurface_Release(d3drm_primary); IDirectDrawSurface7_Release(surface7); IDirectDraw_Release(ddraw); @@ -2054,7 +2350,7 @@ ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); ok((surface_desc.dwWidth == 300) && (surface_desc.dwHeight == 200), "Expected surface dimensions = 300, 200, got %u, %u.\n", - surface_desc.dwWidth, surface_desc.dwHeight); + surface_desc.dwWidth, surface_desc.dwHeight); ok((surface_desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE)) == (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE), "Expected caps containing %x, got %x.\n", DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, surface_desc.ddsCaps.dwCaps); expected_flags = DDSD_PIXELFORMAT | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; @@ -2096,7 +2392,7 @@ ref3 = get_refcount((IUnknown *)d3drm2); ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); cref2 = get_refcount((IUnknown *)clipper); - todo_wine ok(cref1 == cref2, "expected cref1 == cref2, got cref1 = %u, cref2 = %u.\n", cref1, cref2); + ok(cref1 == cref2, "expected cref1 == cref2, got cref1 = %u, cref2 = %u.\n", cref1, cref2); /* Test if render target format follows the screen format */ hr = IDirectDraw_GetDisplayMode(ddraw, &desc); @@ -2112,9 +2408,7 @@ ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice2 interface (hr = %x).\n", hr); hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); - todo_wine ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); - if (FAILED(hr)) - goto cleanup; + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &surface); ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); @@ -2128,40 +2422,203 @@ hr = IDirectDraw2_RestoreDisplayMode(ddraw); ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); -cleanup: - if (ds) - IDirectDrawSurface_Release(ds); - if (surface) - IDirectDrawSurface_Release(surface); - if (d3ddevice2) - IDirect3DDevice2_Release(d3ddevice2); - if (device2) - IDirect3DRMDevice2_Release(device2); - if (d3drm2) - IDirect3DRM2_Release(d3drm2); - if (d3drm1) - IDirect3DRM_Release(d3drm1); - if (clipper) - IDirectDrawClipper_Release(clipper); - if (ddraw) - IDirectDraw_Release(ddraw); + IDirectDrawSurface_Release(surface); + IDirect3DDevice2_Release(d3ddevice2); + IDirect3DRMDevice2_Release(device2); + IDirect3DRM2_Release(d3drm2); + IDirect3DRM_Release(d3drm1); + IDirectDrawClipper_Release(clipper); + IDirectDraw_Release(ddraw); DestroyWindow(window); } -static void test_create_device_from_surface(void) +static void test_create_device_from_clipper3(void) +{ + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + IDirect3DRM *d3drm1 = NULL; + IDirect3DRM3 *d3drm3 = NULL; + IDirectDraw *ddraw = NULL; + IUnknown *unknown = NULL; + IDirect3DRMDevice3 *device3 = (IDirect3DRMDevice3 *)0xdeadbeef; + IDirect3DDevice2 *d3ddevice2 = NULL; + IDirectDrawClipper *clipper = NULL, *d3drm_clipper = NULL; + IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_primary = NULL; + IDirectDrawSurface7 *surface7 = NULL; + DDSURFACEDESC desc, surface_desc; + DWORD expected_flags; + HWND window; + GUID driver = IID_IDirect3DRGBDevice; + HRESULT hr; + ULONG ref1, ref2, ref3, cref1, cref2; + RECT rc; + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 500, 400, 0, 0, 0, 0); + GetClientRect(window, &rc); + hr = DirectDrawCreateClipper(0, &clipper, NULL); + ok(hr == DD_OK, "Cannot get IDirectDrawClipper interface (hr = %x).\n", hr); + hr = IDirectDrawClipper_SetHWnd(clipper, 0, window); + ok(hr == DD_OK, "Cannot set HWnd to Clipper (hr = %x).\n", hr); + + hr = Direct3DRMCreate(&d3drm1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1); + cref1 = get_refcount((IUnknown *)clipper); + + hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM3, (void **)&d3drm3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM3 interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm3); + + hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm3, clipper, &driver, 0, 0, &device3); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(device3 == NULL, "Expected device returned == NULL, got %p.\n", device3); + + /* If NULL is passed for clipper, CreateDeviceFromClipper returns D3DRMERR_BADVALUE */ + hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm3, NULL, &driver, 300, 200, &device3); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm3, clipper, &driver, 300, 200, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm3, clipper, &driver, 300, 200, &device3); + ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice3 interface (hr = %x).\n", hr); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + cref2 = get_refcount((IUnknown *)clipper); + ok(cref2 > cref1, "expected cref2 > cref1, got cref1 = %u , cref2 = %u.\n", cref1, cref2); + + /* Fetch immediate mode device in order to access render target */ + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + + hr = IDirectDrawSurface_GetClipper(surface, &d3drm_clipper); + ok(hr == DDERR_NOCLIPPERATTACHED, "Expected hr == DDERR_NOCLIPPERATTACHED, got %x.\n", hr); + + /* Check if CreateDeviceFromClipper creates a primary surface and attaches the clipper to it */ + hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface7, (void **)&surface7); + ok(hr == DD_OK, "Cannot get IDirectDrawSurface7 interface (hr = %x).\n", hr); + IDirectDrawSurface7_GetDDInterface(surface7, (void **)&unknown); + hr = IUnknown_QueryInterface(unknown, &IID_IDirectDraw, (void **)&ddraw); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + IUnknown_Release(unknown); + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, &d3drm_primary, surface_callback); + ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); + ok(d3drm_primary != NULL, "No primary surface was enumerated.\n"); + hr = IDirectDrawSurface_GetClipper(d3drm_primary, &d3drm_clipper); + ok(hr == DD_OK, "Cannot get attached clipper from primary surface (hr = %x).\n", hr); + ok(d3drm_clipper == clipper, "Expected clipper returned == %p, got %p.\n", clipper , d3drm_clipper); + + IDirectDrawClipper_Release(d3drm_clipper); + IDirectDrawSurface_Release(d3drm_primary); + IDirectDrawSurface7_Release(surface7); + IDirectDraw_Release(ddraw); + + /* Check properties of render target and depth surface */ + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); + + ok((surface_desc.dwWidth == 300) && (surface_desc.dwHeight == 200), "Expected surface dimensions = 300, 200, got %u, %u.\n", + surface_desc.dwWidth, surface_desc.dwHeight); + ok((surface_desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE)) == (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE), + "Expected caps containing %x, got %x.\n", DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, surface_desc.ddsCaps.dwCaps); + expected_flags = DDSD_PIXELFORMAT | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(surface_desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, surface_desc.dwFlags); + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + desc.dwSize = sizeof(desc); + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Cannot get IDirectDraw display mode (hr = %x)\n", hr); + ok(desc.ddpfPixelFormat.dwRGBBitCount == surface_desc.ddpfPixelFormat.dwRGBBitCount, "Expected %u bpp, got %u bpp.\n", + surface_desc.ddpfPixelFormat.dwRGBBitCount, desc.ddpfPixelFormat.dwRGBBitCount); + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); + + ok((desc.dwWidth == 300) && (desc.dwHeight == 200), "Expected surface dimensions = 300, 200, got %u, %u.\n", + desc.dwWidth, desc.dwHeight); + ok((desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) == DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); + expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + ok(desc.dwZBufferBitDepth == 16, "Expected 16 for Z buffer bit depth, got %u.\n", desc.dwZBufferBitDepth); + ok(desc.ddpfPixelFormat.dwStencilBitMask == 0, "Expected 0 stencil bits, got %x.\n", desc.ddpfPixelFormat.dwStencilBitMask); + + /* Release old objects and check refcount of device and clipper */ + IDirectDrawSurface_Release(ds); + ds = NULL; + IDirectDrawSurface_Release(surface); + surface = NULL; + IDirect3DDevice2_Release(d3ddevice2); + d3ddevice2 = NULL; + IDirect3DRMDevice3_Release(device3); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref3, "expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + cref2 = get_refcount((IUnknown *)clipper); + ok(cref1 == cref2, "expected cref1 == cref2, got cref1 = %u, cref2 = %u.\n", cref1, cref2); + + /* Test if render target format follows the screen format */ + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Cannot get IDirectDraw display mode (hr = %x)\n", hr); + hr = IDirectDraw_SetDisplayMode(ddraw, desc.dwWidth, desc.dwHeight, 16); + ok(hr == DD_OK, "Cannot set display mode to 16bpp (hr = %x).\n", hr); + + hr = IDirectDraw_GetDisplayMode(ddraw, &desc); + ok(hr == DD_OK, "Cannot get IDirectDraw display mode (hr = %x)\n", hr); + ok(desc.ddpfPixelFormat.dwRGBBitCount == 16, "Expected 16 bpp, got %u.\n", desc.ddpfPixelFormat.dwRGBBitCount); + + hr = IDirect3DRM3_CreateDeviceFromClipper(d3drm3, clipper, &driver, rc.right, rc.bottom, &device3); + ok(hr == D3DRM_OK, "Cannot create IDirect3DRMDevice3 interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &surface_desc); + ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); + todo_wine ok(surface_desc.ddpfPixelFormat.dwRGBBitCount == 16, "Expected 16bpp, got %ubpp.\n", + surface_desc.ddpfPixelFormat.dwRGBBitCount); + + hr = IDirectDraw2_RestoreDisplayMode(ddraw); + ok(SUCCEEDED(hr), "RestoreDisplayMode failed, hr %#x.\n", hr); + + IDirectDrawSurface_Release(surface); + IDirect3DDevice2_Release(d3ddevice2); + IDirect3DRMDevice3_Release(device3); + IDirect3DRM3_Release(d3drm3); + IDirect3DRM_Release(d3drm1); + IDirectDrawClipper_Release(clipper); + IDirectDraw_Release(ddraw); + DestroyWindow(window); +} + +static void test_create_device_from_surface1(void) { DDSCAPS caps = { DDSCAPS_ZBUFFER }; DDSURFACEDESC desc; IDirectDraw *ddraw = NULL; IDirect3DRM *d3drm1 = NULL; - IDirect3DRM2 *d3drm2 = NULL; - IDirect3DRMDevice2 *device2 = NULL; - IDirect3DDevice2 *d3ddevice2 = NULL; + IDirect3DRMDevice *device1 = (IDirect3DRMDevice *)0xdeadbeef; + IDirect3DDevice *d3ddevice1 = NULL; IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_surface = NULL, *d3drm_ds = NULL; DWORD expected_flags; HWND window; GUID driver = IID_IDirect3DRGBDevice; - ULONG ref1, ref2, ref3, surface_ref1, surface_ref2; + ULONG ref1, ref2, surface_ref1, surface_ref2; RECT rc; BOOL use_sysmem_zbuffer = FALSE; HRESULT hr; @@ -2178,10 +2635,6 @@ hr = Direct3DRMCreate(&d3drm1); ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); ref1 = get_refcount((IUnknown *)d3drm1); - - hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM2, (void **)&d3drm2); - ok(hr == D3DRM_OK, "Cannot get IDirect3DRM2 interface (hr = %x).\n", hr); - ref2 = get_refcount((IUnknown *)d3drm2); /* Create a surface and use it to create the retained mode device. */ memset(&desc, 0, sizeof(desc)); @@ -2194,36 +2647,40 @@ hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); - hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, &device2); - todo_wine ok(hr == DDERR_INVALIDCAPS, "Expected hr == DDERR_INVALIDCAPS, got %x.\n", hr); + hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, ddraw, surface, &device1); + ok(hr == DDERR_INVALIDCAPS, "Expected hr == DDERR_INVALIDCAPS, got %x.\n", hr); + ok(device1 == NULL, "Expected device returned == NULL, got %p.\n", device1); IDirectDrawSurface_Release(surface); desc.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE; hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); surface_ref1 = get_refcount((IUnknown *)surface); - hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, &device2); - ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice2 interface (hr = %x).\n", hr); - ref3 = get_refcount((IUnknown *)d3drm1); - todo_wine ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); - ref3 = get_refcount((IUnknown *)d3drm2); - ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + + hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, ddraw, surface, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == DDERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, ddraw, NULL, &device1); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == DDERR_BADDEVICE, got %x.\n", hr); + hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, NULL, surface, &device1); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == DDERR_BADDEVICE, got %x.\n", hr); + + hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, ddraw, surface, &device1); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2); surface_ref2 = get_refcount((IUnknown *)surface); - todo_wine ok(surface_ref2 > surface_ref1, "Expected surface_ref2 > surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", - surface_ref1, surface_ref2); + ok(surface_ref2 > surface_ref1, "Expected surface_ref2 > surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", surface_ref1, surface_ref2); /* Check if CreateDeviceFromSurface creates a primary surface */ hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, - NULL, &d3drm_surface, surface_callback); + NULL, &d3drm_surface, surface_callback); ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); ok(d3drm_surface == NULL, "No primary surface should have enumerated (%p).\n", d3drm_surface); - hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); - todo_wine ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); - if (FAILED(hr)) - goto cleanup; - - hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + hr = IDirect3DRMDevice_GetDirect3DDevice(device1, &d3ddevice1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr); + + hr = IDirect3DDevice_QueryInterface(d3ddevice1, &IID_IDirectDrawSurface, (void **)&d3drm_surface); ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); @@ -2237,32 +2694,27 @@ ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); use_sysmem_zbuffer = desc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY; - ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimentions = %u, %u, got %u, %u.\n", + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); ok(desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); IDirectDrawSurface_Release(ds); - IDirect3DDevice2_Release(d3ddevice2); + IDirect3DDevice_Release(d3ddevice1); IDirectDrawSurface_Release(d3drm_surface); - if (device2) - { - IDirect3DRMDevice2_Release(device2); - ref3 = get_refcount((IUnknown *)d3drm1); - ok(ref1 == ref3, "expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3); - ref3 = get_refcount((IUnknown *)d3drm2); - ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); - surface_ref2 = get_refcount((IUnknown *)surface); - ok(surface_ref2 == surface_ref1, "Expected surface_ref2 == surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", - surface_ref1, surface_ref2); - hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); - ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); - - /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ - ref1 = IDirectDrawSurface_Release(ds); - ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); - } + + IDirect3DRMDevice_Release(device1); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref2, "expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", ref1, ref2); + surface_ref2 = get_refcount((IUnknown *)surface); + ok(surface_ref2 == surface_ref1, "Expected surface_ref2 == surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", + surface_ref1, surface_ref2); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ + ref1 = IDirectDrawSurface_Release(ds); + ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); ref1 = IDirectDrawSurface_Release(surface); ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); @@ -2288,15 +2740,13 @@ hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, &device2); - ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice2 interface (hr = %x).\n", hr); - - hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); - todo_wine ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); - if (FAILED(hr)) - goto cleanup; - - hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + hr = IDirect3DRM_CreateDeviceFromSurface(d3drm1, &driver, ddraw, surface, &device1); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice2_GetDirect3DDevice(device1, &d3ddevice1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr); + + hr = IDirect3DDevice_QueryInterface(d3ddevice1, &IID_IDirectDrawSurface, (void **)&d3drm_surface); ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); @@ -2309,36 +2759,620 @@ IDirectDrawSurface_Release(d3drm_surface); IDirectDrawSurface_Release(ds); -cleanup: - if (d3ddevice2) - IDirect3DDevice2_Release(d3ddevice2); - if (device2) - { - IDirect3DRMDevice2_Release(device2); - hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); - todo_wine ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); - if (SUCCEEDED(hr)) - { - /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ - ref1 = IDirectDrawSurface_Release(ds); - ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); - } - } - if (surface) - { - ref1 = IDirectDrawSurface_Release(surface); - ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); - } - if (d3drm2) - IDirect3DRM2_Release(d3drm2); - if (d3drm1) - IDirect3DRM_Release(d3drm1); - if (ddraw) - IDirectDraw_Release(ddraw); + IDirect3DDevice_Release(d3ddevice1); + IDirect3DRMDevice_Release(device1); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ + ref1 = IDirectDrawSurface_Release(ds); + ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); + ref1 = IDirectDrawSurface_Release(surface); + ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + IDirect3DRM_Release(d3drm1); + IDirectDraw_Release(ddraw); DestroyWindow(window); } -static IDirect3DDevice2 *create_device(IDirectDraw2 *ddraw, HWND window, IDirectDrawSurface **ds) +static void test_create_device_from_surface2(void) +{ + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + DDSURFACEDESC desc; + IDirectDraw *ddraw = NULL; + IDirect3DRM *d3drm1 = NULL; + IDirect3DRM2 *d3drm2 = NULL; + IDirect3DRMDevice2 *device2 = (IDirect3DRMDevice2 *)0xdeadbeef; + IDirect3DDevice2 *d3ddevice2 = NULL; + IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_surface = NULL, *d3drm_ds = NULL; + DWORD expected_flags; + HWND window; + GUID driver = IID_IDirect3DRGBDevice; + ULONG ref1, ref2, ref3, surface_ref1, surface_ref2; + RECT rc; + BOOL use_sysmem_zbuffer = FALSE; + HRESULT hr; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); + GetClientRect(window, &rc); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + hr = Direct3DRMCreate(&d3drm1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1); + + hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM2, (void **)&d3drm2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM2 interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm2); + + /* Create a surface and use it to create the retained mode device. */ + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, &device2); + ok(hr == DDERR_INVALIDCAPS, "Expected hr == DDERR_INVALIDCAPS, got %x.\n", hr); + ok(device2 == NULL, "Expected device returned == NULL, got %p.\n", device2); + IDirectDrawSurface_Release(surface); + + desc.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE; + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + surface_ref1 = get_refcount((IUnknown *)surface); + + hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == DDERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, NULL, &device2); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == DDERR_BADDEVICE, got %x.\n", hr); + hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, NULL, surface, &device2); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == DDERR_BADDEVICE, got %x.\n", hr); + + hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, &device2); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice2 interface (hr = %x).\n", hr); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm2); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + surface_ref2 = get_refcount((IUnknown *)surface); + ok(surface_ref2 > surface_ref1, "Expected surface_ref2 > surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", surface_ref1, surface_ref2); + + /* Check if CreateDeviceFromSurface creates a primary surface */ + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, &d3drm_surface, surface_callback); + ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); + ok(d3drm_surface == NULL, "No primary surface should have enumerated (%p).\n", d3drm_surface); + + hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); + + /* Check properties of attached depth surface */ + hr = IDirectDrawSurface_GetAttachedSurface(d3drm_surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); + + use_sysmem_zbuffer = desc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY; + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", + rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); + ok(desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); + expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + + IDirectDrawSurface_Release(ds); + IDirect3DDevice2_Release(d3ddevice2); + IDirectDrawSurface_Release(d3drm_surface); + + IDirect3DRMDevice2_Release(device2); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref3, "expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm2); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + surface_ref2 = get_refcount((IUnknown *)surface); + ok(surface_ref2 == surface_ref1, "Expected surface_ref2 == surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", + surface_ref1, surface_ref2); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ + ref1 = IDirectDrawSurface_Release(ds); + ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); + + ref1 = IDirectDrawSurface_Release(surface); + ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | (use_sysmem_zbuffer ? DDSCAPS_SYSTEMMEMORY : 0); + desc.dwZBufferBitDepth = 16; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + hr = IDirectDraw_CreateSurface(ddraw, &desc, &ds, NULL); + ok(hr == DD_OK, "Cannot create depth surface (hr = %x).\n", hr); + hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); + + hr = IDirect3DRM2_CreateDeviceFromSurface(d3drm2, &driver, ddraw, surface, &device2); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); + + /* Check if depth surface matches the one we created */ + hr = IDirectDrawSurface_GetAttachedSurface(d3drm_surface, &caps, &d3drm_ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + ok(ds == d3drm_ds, "Expected depth surface (%p) == surface created internally (%p).\n", ds, d3drm_ds); + + IDirectDrawSurface_Release(d3drm_ds); + IDirectDrawSurface_Release(d3drm_surface); + IDirectDrawSurface_Release(ds); + + IDirect3DDevice2_Release(d3ddevice2); + IDirect3DRMDevice2_Release(device2); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ + ref1 = IDirectDrawSurface_Release(ds); + ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); + ref1 = IDirectDrawSurface_Release(surface); + ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + IDirect3DRM2_Release(d3drm2); + IDirect3DRM_Release(d3drm1); + IDirectDraw_Release(ddraw); + DestroyWindow(window); +} + +static void test_create_device_from_surface3(void) +{ + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + DDSURFACEDESC desc; + IDirectDraw *ddraw = NULL; + IDirect3DRM *d3drm1 = NULL; + IDirect3DRM3 *d3drm3 = NULL; + IDirect3DRMDevice3 *device3 = (IDirect3DRMDevice3 *)0xdeadbeef; + IDirect3DDevice2 *d3ddevice2 = NULL; + IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_surface = NULL, *d3drm_ds = NULL; + DWORD expected_flags; + HWND window; + GUID driver = IID_IDirect3DRGBDevice; + ULONG ref1, ref2, ref3, surface_ref1, surface_ref2; + RECT rc; + BOOL use_sysmem_zbuffer = FALSE; + HRESULT hr; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); + GetClientRect(window, &rc); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + hr = Direct3DRMCreate(&d3drm1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1); + + hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM3, (void **)&d3drm3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM3 interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm3); + + /* Create a surface and use it to create the retained mode device. */ + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, surface, 0, &device3); + ok(hr == DDERR_INVALIDCAPS, "Expected hr == DDERR_INVALIDCAPS, got %x.\n", hr); + ok(device3 == NULL, "Expected device returned == NULL, got %p.\n", device3); + IDirectDrawSurface_Release(surface); + + desc.ddsCaps.dwCaps |= DDSCAPS_3DDEVICE; + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + surface_ref1 = get_refcount((IUnknown *)surface); + + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, surface, 0, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == DDERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, NULL, 0, &device3); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == DDERR_BADDEVICE, got %x.\n", hr); + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, NULL, surface, 0, &device3); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == DDERR_BADDEVICE, got %x.\n", hr); + + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, surface, 0, &device3); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice3 interface (hr = %x).\n", hr); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + surface_ref2 = get_refcount((IUnknown *)surface); + ok(surface_ref2 > surface_ref1, "Expected surface_ref2 > surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", surface_ref1, surface_ref2); + + /* Check if CreateDeviceFromSurface creates a primary surface */ + hr = IDirectDraw_EnumSurfaces(ddraw, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, &d3drm_surface, surface_callback); + ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); + ok(d3drm_surface == NULL, "No primary surface should have enumerated (%p).\n", d3drm_surface); + + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); + + /* Check properties of attached depth surface */ + hr = IDirectDrawSurface_GetAttachedSurface(d3drm_surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); + + use_sysmem_zbuffer = desc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY; + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", + rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); + ok(desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); + expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + + IDirectDrawSurface_Release(ds); + IDirect3DDevice2_Release(d3ddevice2); + IDirectDrawSurface_Release(d3drm_surface); + IDirect3DRMDevice3_Release(device3); + + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref3, "expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + surface_ref2 = get_refcount((IUnknown *)surface); + ok(surface_ref2 == surface_ref1, "Expected surface_ref2 == surface_ref1, got surface_ref1 = %u, surface_ref2 = %u.\n", + surface_ref1, surface_ref2); + /* In version 3, d3drm will destroy all references of the depth surface it created internally. */ + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + todo_wine ok(hr == DDERR_NOTFOUND, "Expected hr == DDERR_NOTFOUND, got %x.\n", hr); + if (SUCCEEDED(hr)) + IDirectDrawSurface_Release(ds); + ref1 = IDirectDrawSurface_Release(surface); + ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER | (use_sysmem_zbuffer ? DDSCAPS_SYSTEMMEMORY : 0); + desc.dwZBufferBitDepth = 16; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + hr = IDirectDraw_CreateSurface(ddraw, &desc, &ds, NULL); + ok(hr == DD_OK, "Cannot create depth surface (hr = %x).\n", hr); + hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); + + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, surface, D3DRMDEVICE_NOZBUFFER, &device3); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice3 interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); + + /* Check if depth surface matches the one we created */ + hr = IDirectDrawSurface_GetAttachedSurface(d3drm_surface, &caps, &d3drm_ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + ok(ds == d3drm_ds, "Expected depth surface (%p) == surface created internally (%p).\n", ds, d3drm_ds); + + IDirectDrawSurface_Release(d3drm_ds); + IDirectDrawSurface_Release(d3drm_surface); + IDirectDrawSurface_Release(ds); + IDirect3DDevice2_Release(d3ddevice2); + IDirect3DRMDevice3_Release(device3); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + /* The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ + ref1 = IDirectDrawSurface_Release(ds); + ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); + + /* What happens if we pass no flags and still attach our own depth surface? */ + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, surface, 0, &device3); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice3 interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); + + /* Check if depth surface matches the one we created */ + hr = IDirectDrawSurface_GetAttachedSurface(d3drm_surface, &caps, &d3drm_ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + ok(ds == d3drm_ds, "Expected depth surface (%p) == surface created internally (%p).\n", ds, d3drm_ds); + + IDirectDrawSurface_Release(d3drm_ds); + IDirectDrawSurface_Release(d3drm_surface); + IDirect3DDevice2_Release(d3ddevice2); + IDirect3DRMDevice3_Release(device3); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + /*The render target still holds a reference to ds as the depth surface remains attached to it, so refcount will be 1*/ + ref1 = IDirectDrawSurface_Release(ds); + ok(ref1 == 1, "Expected ref1 == 1, got %u.\n", ref1); + ref1 = IDirectDrawSurface_Release(surface); + ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + desc.dwWidth = rc.right; + desc.dwHeight = rc.bottom; + + hr = IDirectDraw_CreateSurface(ddraw, &desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + /* What happens if we don't pass D3DRMDEVICE_NOZBUFFER and still not attach our own depth surface? */ + hr = IDirect3DRM3_CreateDeviceFromSurface(d3drm3, &driver, ddraw, surface, D3DRMDEVICE_NOZBUFFER, &device3); + ok(SUCCEEDED(hr), "Cannot create IDirect3DRMDevice3 interface (hr = %x).\n", hr); + + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + + hr = IDirect3DDevice2_GetRenderTarget(d3ddevice2, &d3drm_surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + ok(surface == d3drm_surface, "Expected surface returned == %p, got %p.\n", surface, d3drm_surface); + + /* Check if depth surface matches the one we created */ + hr = IDirectDrawSurface_GetAttachedSurface(d3drm_surface, &caps, &d3drm_ds); + ok(hr == DDERR_NOTFOUND, "Expected hr == DDERR_NOTFOUND, got %x).\n", hr); + IDirectDrawSurface_Release(d3drm_surface); + + IDirect3DDevice2_Release(d3ddevice2); + IDirect3DRMDevice3_Release(device3); + ref1 = IDirectDrawSurface_Release(surface); + ok(ref1 == 0, "Expected Render target refcount == 0, got %u.\n", ref1); + IDirect3DRM3_Release(d3drm3); + IDirect3DRM_Release(d3drm1); + IDirectDraw_Release(ddraw); + DestroyWindow(window); +} + +static IDirect3DDevice *create_device1(IDirectDraw *ddraw, HWND window, IDirectDrawSurface **ds) +{ + static const DWORD z_depths[] = { 32, 24, 16 }; + IDirectDrawSurface *surface; + IDirect3DDevice *device = NULL; + DDSURFACEDESC surface_desc; + unsigned int i; + HRESULT hr; + RECT rc; + + GetClientRect(window, &rc); + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + surface_desc.dwWidth = rc.right; + surface_desc.dwHeight = rc.bottom; + + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); + ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); + + /* We used to use EnumDevices() for this, but it seems + * D3DDEVICEDESC.dwDeviceZBufferBitDepth only has a very casual + * relationship with reality. */ + for (i = 0; i < sizeof(z_depths) / sizeof(*z_depths); ++i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + U2(surface_desc).dwZBufferBitDepth = z_depths[i]; + surface_desc.dwWidth = rc.right; + surface_desc.dwHeight = rc.bottom; + if (FAILED(IDirectDraw_CreateSurface(ddraw, &surface_desc, ds, NULL))) + continue; + + hr = IDirectDrawSurface_AddAttachedSurface(surface, *ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); + if (FAILED(hr)) + { + IDirectDrawSurface_Release(*ds); + continue; + } + + if (SUCCEEDED(IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DHALDevice, (void **)&device))) + break; + + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, *ds); + IDirectDrawSurface_Release(*ds); + *ds = NULL; + } + + IDirectDrawSurface_Release(surface); + return device; +} + +static void test_create_device_from_d3d1(void) +{ + IDirectDraw *ddraw1 = NULL; + IDirect3D *d3d1 = NULL; + IDirect3DRM *d3drm1 = NULL; + IDirect3DRMDevice *device1 = (IDirect3DRMDevice *)0xdeadbeef; + IDirect3DRMDevice2 *device2; + IDirect3DRMDevice3 *device3; + IDirect3DDevice *d3ddevice1 = NULL, *d3drm_d3ddevice1 = NULL; + IDirect3DDevice2 *d3ddevice2 = (IDirect3DDevice2 *)0xdeadbeef; + IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_ds = NULL; + DWORD expected_flags; + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + DDSURFACEDESC desc; + RECT rc; + HWND window; + ULONG ref1, ref2, device_ref1, device_ref2; + HRESULT hr; + + hr = DirectDrawCreate(NULL, &ddraw1, NULL); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); + GetClientRect(window, &rc); + + hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirect3D, (void **)&d3d1); + ok(hr == DD_OK, "Cannot get IDirect3D2 interface (hr = %x).\n", hr); + + /* Create the immediate mode device */ + d3ddevice1 = create_device1(ddraw1, window, &ds); + if (d3ddevice1 == NULL) + { + win_skip("Cannot create IM device, skipping tests.\n"); + IDirect3D_Release(d3d1); + IDirectDraw_Release(ddraw1); + return; + } + device_ref1 = get_refcount((IUnknown *)d3ddevice1); + + hr = Direct3DRMCreate(&d3drm1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1); + + hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, NULL, d3ddevice1, &device1); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(device1 == NULL, "Expected device returned == NULL, got %p.\n", device1); + hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, d3d1, NULL, &device1); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, d3d1, d3ddevice1, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM_CreateDeviceFromD3D(d3drm1, d3d1, d3ddevice1, &device1); + ok(hr == DD_OK, "Failed to create IDirect3DRMDevice interface (hr = %x)\n", hr); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref2 > ref1, "expected ref2 > ref1, got ref1 = %u , ref2 = %u.\n", ref1, ref2); + device_ref2 = get_refcount((IUnknown *)d3ddevice1); + ok(device_ref2 > device_ref1, "Expected device_ref2 > device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); + + hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice2, (void **)&device2); + ok(SUCCEEDED(hr), "Cannot get IDirect3DRMDevice2 Interface (hr = %x).\n", hr); + hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2); + ok(SUCCEEDED(hr), "Expected hr == DD_OK, got %x).\n", hr); + ok(d3ddevice2 == NULL, "Expected d3ddevice2 == NULL, got %p.\n", d3ddevice2); + IDirect3DRMDevice2_Release(device2); + + d3ddevice2 = (IDirect3DDevice2 *)0xdeadbeef; + hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice2, (void **)&device3); + ok(hr == DD_OK, "Cannot get IDirect3DRMDevice2 Interface (hr = %x).\n", hr); + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2); + ok(hr == DD_OK, "Expected hr == DD_OK, got %x).\n", hr); + ok(d3ddevice2 == NULL, "Expected d3ddevice2 == NULL, got %p.\n", d3ddevice2); + IDirect3DRMDevice3_Release(device3); + + hr = IDirectDraw_EnumSurfaces(ddraw1, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, &surface, surface_callback); + ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); + ok(surface == NULL, "No primary surface should have enumerated (%p).\n", surface); + + hr = IDirect3DRMDevice_GetDirect3DDevice(device1, &d3drm_d3ddevice1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice interface (hr = %x).\n", hr); + ok(d3ddevice1 == d3drm_d3ddevice1, "Expected Immediate Mode deivce created == %p, got %p.\n", d3ddevice1, d3drm_d3ddevice1); + + /* Check properties of render target and depth surfaces */ + hr = IDirect3DDevice_QueryInterface(d3drm_d3ddevice1, &IID_IDirectDrawSurface, (void **)&surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); + + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", + rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); + ok((desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE)) == (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE), + "Expected caps containing %x, got %x.\n", DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, desc.ddsCaps.dwCaps); + expected_flags = DDSD_PIXELFORMAT | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &d3drm_ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + ok(ds == d3drm_ds, "Expected depth surface (%p) == surface created internally (%p).\n", ds, d3drm_ds); + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); + + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", + rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); + ok((desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) == DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); + expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + + IDirectDrawSurface_Release(d3drm_ds); + IDirectDrawSurface_Release(ds); + IDirectDrawSurface_Release(surface); + IDirect3DDevice_Release(d3drm_d3ddevice1); + IDirect3DRMDevice_Release(device1); + ref2 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref2, "expected ref1 == ref2, got ref1 = %u, ref2 = %u.\n", ref1, ref2); + device_ref2 = get_refcount((IUnknown *)d3ddevice1); + ok(device_ref2 == device_ref1, "Expected device_ref2 == device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); + + IDirect3DRM_Release(d3drm1); + IDirect3DDevice_Release(d3ddevice1); + IDirect3D_Release(d3d1); + IDirectDraw_Release(ddraw1); + DestroyWindow(window); +} + +static IDirect3DDevice2 *create_device2(IDirectDraw2 *ddraw, HWND window, IDirectDrawSurface **ds) { static const DWORD z_depths[] = { 32, 24, 16 }; IDirectDrawSurface *surface; @@ -2394,7 +3428,7 @@ continue; } - if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DRGBDevice, surface, &device))) + if (SUCCEEDED(IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, surface, &device))) break; IDirectDrawSurface_DeleteAttachedSurface(surface, 0, *ds); @@ -2407,14 +3441,14 @@ return device; } -static void test_create_device_from_d3d(void) +static void test_create_device_from_d3d2(void) { IDirectDraw *ddraw1 = NULL; IDirectDraw2 *ddraw2 = NULL; IDirect3D2 *d3d2 = NULL; IDirect3DRM *d3drm1 = NULL; IDirect3DRM2 *d3drm2 = NULL; - IDirect3DRMDevice2 *device2 = NULL; + IDirect3DRMDevice2 *device2 = (IDirect3DRMDevice2 *)0xdeadbeef; IDirect3DDevice2 *d3ddevice2 = NULL, *d3drm_d3ddevice2 = NULL; IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_ds = NULL; DWORD expected_flags; @@ -2437,7 +3471,7 @@ ok(hr == DD_OK, "Cannot get IDirectDraw2 interface (hr = %x).\n", hr); /* Create the immediate mode device */ - d3ddevice2 = create_device(ddraw2, window, &ds); + d3ddevice2 = create_device2(ddraw2, window, &ds); if (d3ddevice2 == NULL) { win_skip("Cannot create IM device, skipping tests.\n"); @@ -2456,24 +3490,30 @@ ok(hr == D3DRM_OK, "Cannot get IDirect3DRM2 interface (hr = %x).\n", hr); ref2 = get_refcount((IUnknown *)d3drm2); + hr = IDirect3DRM2_CreateDeviceFromD3D(d3drm2, NULL, d3ddevice2, &device2); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(device2 == NULL, "Expected device returned == NULL, got %p.\n", device2); + hr = IDirect3DRM2_CreateDeviceFromD3D(d3drm2, d3d2, NULL, &device2); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM2_CreateDeviceFromD3D(d3drm2, d3d2, d3ddevice2, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM2_CreateDeviceFromD3D(d3drm2, d3d2, d3ddevice2, &device2); ok(hr == DD_OK, "Failed to create IDirect3DRMDevice2 interface (hr = %x)\n", hr); ref3 = get_refcount((IUnknown *)d3drm1); - todo_wine ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); ref3 = get_refcount((IUnknown *)d3drm2); ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); device_ref2 = get_refcount((IUnknown *)d3ddevice2); - todo_wine ok(device_ref2 > device_ref1, "Expected device_ref2 > device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); + ok(device_ref2 > device_ref1, "Expected device_ref2 > device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); hr = IDirectDraw_EnumSurfaces(ddraw1, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, - NULL, &surface, surface_callback); + NULL, &surface, surface_callback); ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); ok(surface == NULL, "No primary surface should have enumerated (%p).\n", surface); hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3drm_d3ddevice2); - todo_wine ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); - if (FAILED(hr)) - goto cleanup; + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); ok(d3ddevice2 == d3drm_d3ddevice2, "Expected Immediate Mode deivce created == %p, got %p.\n", d3ddevice2, d3drm_d3ddevice2); /* Check properties of render target and depth surfaces */ @@ -2485,7 +3525,7 @@ hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); - ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimentions = %u, %u, got %u, %u.\n", + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); ok((desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE)) == (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE), "Expected caps containing %x, got %x.\n", DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, desc.ddsCaps.dwCaps); @@ -2500,7 +3540,7 @@ hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); - ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimentions = %u, %u, got %u, %u.\n", + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); ok((desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) == DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; @@ -2508,13 +3548,8 @@ IDirectDrawSurface_Release(d3drm_ds); IDirectDrawSurface_Release(ds); - ds = NULL; IDirectDrawSurface_Release(surface); IDirect3DDevice2_Release(d3drm_d3ddevice2); -cleanup: - if (ds) - IDirectDrawSurface_Release(ds); - IDirect3DRMDevice2_Release(device2); ref3 = get_refcount((IUnknown *)d3drm1); ok(ref1 == ref3, "expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3); @@ -2524,6 +3559,132 @@ ok(device_ref2 == device_ref1, "Expected device_ref2 == device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); IDirect3DRM2_Release(d3drm2); + IDirect3DRM_Release(d3drm1); + IDirect3DDevice2_Release(d3ddevice2); + IDirect3D2_Release(d3d2); + IDirectDraw2_Release(ddraw2); + IDirectDraw_Release(ddraw1); + DestroyWindow(window); +} + +static void test_create_device_from_d3d3(void) +{ + IDirectDraw *ddraw1 = NULL; + IDirectDraw2 *ddraw2 = NULL; + IDirect3D2 *d3d2 = NULL; + IDirect3DRM *d3drm1 = NULL; + IDirect3DRM3 *d3drm3 = NULL; + IDirect3DRMDevice3 *device3 = (IDirect3DRMDevice3 *)0xdeadbeef; + IDirect3DDevice2 *d3ddevice2 = NULL, *d3drm_d3ddevice2 = NULL; + IDirectDrawSurface *surface = NULL, *ds = NULL, *d3drm_ds = NULL; + DWORD expected_flags; + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + DDSURFACEDESC desc; + RECT rc; + HWND window; + ULONG ref1, ref2, ref3, device_ref1, device_ref2; + HRESULT hr; + + hr = DirectDrawCreate(NULL, &ddraw1, NULL); + ok(hr == DD_OK, "Cannot get IDirectDraw interface (hr = %x).\n", hr); + + window = CreateWindowA("static", "d3drm_test", WS_OVERLAPPEDWINDOW, 0, 0, 300, 200, 0, 0, 0, 0); + GetClientRect(window, &rc); + + hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirect3D2, (void **)&d3d2); + ok(hr == DD_OK, "Cannot get IDirect3D2 interface (hr = %x).\n", hr); + hr = IDirectDraw_QueryInterface(ddraw1, &IID_IDirectDraw2, (void **)&ddraw2); + ok(hr == DD_OK, "Cannot get IDirectDraw2 interface (hr = %x).\n", hr); + + /* Create the immediate mode device */ + d3ddevice2 = create_device2(ddraw2, window, &ds); + if (d3ddevice2 == NULL) + { + win_skip("Cannot create IM device, skipping tests.\n"); + IDirect3D2_Release(d3d2); + IDirectDraw2_Release(ddraw2); + IDirectDraw_Release(ddraw1); + return; + } + device_ref1 = get_refcount((IUnknown *)d3ddevice2); + + hr = Direct3DRMCreate(&d3drm1); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + ref1 = get_refcount((IUnknown *)d3drm1); + + hr = IDirect3DRM_QueryInterface(d3drm1, &IID_IDirect3DRM3, (void **)&d3drm3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM3 interface (hr = %x).\n", hr); + ref2 = get_refcount((IUnknown *)d3drm3); + + hr = IDirect3DRM3_CreateDeviceFromD3D(d3drm3, NULL, d3ddevice2, &device3); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + ok(device3 == NULL, "Expected device returned == NULL, got %p.\n", device3); + hr = IDirect3DRM3_CreateDeviceFromD3D(d3drm3, d3d2, NULL, &device3); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + hr = IDirect3DRM3_CreateDeviceFromD3D(d3drm3, d3d2, d3ddevice2, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + hr = IDirect3DRM3_CreateDeviceFromD3D(d3drm3, d3d2, d3ddevice2, &device3); + ok(hr == DD_OK, "Failed to create IDirect3DRMDevice3 interface (hr = %x)\n", hr); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref3 > ref1, "expected ref3 > ref1, got ref1 = %u , ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + device_ref2 = get_refcount((IUnknown *)d3ddevice2); + ok(device_ref2 > device_ref1, "Expected device_ref2 > device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); + + hr = IDirectDraw_EnumSurfaces(ddraw1, DDENUMSURFACES_ALL | DDENUMSURFACES_DOESEXIST, + NULL, &surface, surface_callback); + ok(hr == DD_OK, "Failed to enumerate surfaces (hr = %x).\n", hr); + ok(surface == NULL, "No primary surface should have enumerated (%p).\n", surface); + + hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3drm_d3ddevice2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DDevice2 interface (hr = %x).\n", hr); + ok(d3ddevice2 == d3drm_d3ddevice2, "Expected Immediate Mode deivce created == %p, got %p.\n", d3ddevice2, d3drm_d3ddevice2); + + /* Check properties of render target and depth surfaces */ + hr = IDirect3DDevice2_GetRenderTarget(d3drm_d3ddevice2, &surface); + ok(hr == DD_OK, "Cannot get surface to the render target (hr = %x).\n", hr); + + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + ok(hr == DD_OK, "Cannot get surface desc structure (hr = %x).\n", hr); + + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", + rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); + ok((desc.ddsCaps.dwCaps & (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE)) == (DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE), + "Expected caps containing %x, got %x.\n", DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE, desc.ddsCaps.dwCaps); + expected_flags = DDSD_PIXELFORMAT | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &d3drm_ds); + ok(hr == DD_OK, "Cannot get attached depth surface (hr = %x).\n", hr); + ok(ds == d3drm_ds, "Expected depth surface (%p) == surface created internally (%p).\n", ds, d3drm_ds); + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &desc); + ok(hr == DD_OK, "Cannot get z surface desc structure (hr = %x).\n", hr); + + ok((desc.dwWidth == rc.right) && (desc.dwHeight == rc.bottom), "Expected surface dimensions = %u, %u, got %u, %u.\n", + rc.right, rc.bottom, desc.dwWidth, desc.dwHeight); + ok((desc.ddsCaps.dwCaps & DDSCAPS_ZBUFFER) == DDSCAPS_ZBUFFER, "Expected caps containing %x, got %x.\n", DDSCAPS_ZBUFFER, desc.ddsCaps.dwCaps); + expected_flags = DDSD_ZBUFFERBITDEPTH | DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PITCH; + ok(desc.dwFlags == expected_flags, "Expected %x for flags, got %x.\n", expected_flags, desc.dwFlags); + + IDirectDrawSurface_Release(d3drm_ds); + IDirectDrawSurface_Release(ds); + IDirectDrawSurface_Release(surface); + IDirect3DDevice2_Release(d3drm_d3ddevice2); + IDirect3DRMDevice3_Release(device3); + ref3 = get_refcount((IUnknown *)d3drm1); + ok(ref1 == ref3, "expected ref1 == ref3, got ref1 = %u, ref3 = %u.\n", ref1, ref3); + ref3 = get_refcount((IUnknown *)d3drm3); + ok(ref3 == ref2, "expected ref3 == ref2, got ref2 = %u , ref3 = %u.\n", ref2, ref3); + device_ref2 = get_refcount((IUnknown *)d3ddevice2); + ok(device_ref2 == device_ref1, "Expected device_ref2 == device_ref1, got device_ref1 = %u, device_ref2 = %u.\n", device_ref1, device_ref2); + + IDirect3DRM3_Release(d3drm3); IDirect3DRM_Release(d3drm1); IDirect3DDevice2_Release(d3ddevice2); IDirect3D2_Release(d3d2); @@ -2549,7 +3710,14 @@ test_frame_mesh_materials(); test_d3drm_qi(); test_frame_qi(); - test_create_device_from_clipper(); - test_create_device_from_surface(); - test_create_device_from_d3d(); + test_device_qi(); + test_create_device_from_clipper1(); + test_create_device_from_clipper2(); + test_create_device_from_clipper3(); + test_create_device_from_surface1(); + test_create_device_from_surface2(); + test_create_device_from_surface3(); + test_create_device_from_d3d1(); + test_create_device_from_d3d2(); + test_create_device_from_d3d3(); }
8 years, 11 months
1
0
0
0
[akhaldi] 70083: [D3DRM] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:43:48 2015 New Revision: 70083 URL:
http://svn.reactos.org/svn/reactos?rev=70083&view=rev
Log: [D3DRM] Sync with Wine Staging 1.7.55. CORE-10536 Modified: trunk/reactos/dll/directx/wine/d3drm/CMakeLists.txt trunk/reactos/dll/directx/wine/d3drm/d3drm.c trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h trunk/reactos/dll/directx/wine/d3drm/device.c trunk/reactos/dll/directx/wine/d3drm/frame.c trunk/reactos/dll/directx/wine/d3drm/texture.c trunk/reactos/dll/directx/wine/d3drm/viewport.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/directx/wine/d3drm/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/CMa…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/CMakeLists.txt [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -30,6 +30,6 @@ target_link_libraries(d3drm mingwex) endif() -add_importlibs(d3drm d3dxof msvcrt kernel32 ntdll) +add_importlibs(d3drm ddraw d3dxof msvcrt kernel32 ntdll) add_pch(d3drm d3drm_private.h SOURCE) add_cd_file(TARGET d3drm DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/directx/wine/d3drm/d3drm.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/d3d…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/d3drm.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/d3drm.c [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -220,37 +220,125 @@ static HRESULT WINAPI d3drm1_CreateDevice(IDirect3DRM *iface, DWORD width, DWORD height, IDirect3DRMDevice **device) { + struct d3drm_device *object; + HRESULT hr; FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown **)device); + hr = d3drm_device_create(&object); + if (FAILED(hr)) + return hr; + + *device = IDirect3DRMDevice_from_impl(object); + + return D3DRM_OK; } static HRESULT WINAPI d3drm1_CreateDeviceFromSurface(IDirect3DRM *iface, GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, IDirect3DRMDevice **device) { - FIXME("iface %p, guid %s, ddraw %p, backbuffer %p, device %p partial stub.\n", + struct d3drm *d3drm = impl_from_IDirect3DRM(iface); + struct d3drm_device *object; + HRESULT hr; + + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n", iface, debugstr_guid(guid), ddraw, backbuffer, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!backbuffer || !ddraw) + return D3DRMERR_BADDEVICE; + + hr = d3drm_device_create(&object); + if (FAILED(hr)) + return hr; + + hr = d3drm_device_init(object, 1, &d3drm->IDirect3DRM_iface, ddraw, backbuffer, TRUE); + if (SUCCEEDED(hr)) + *device = IDirect3DRMDevice_from_impl(object); + else + d3drm_device_destroy(object); + + return hr; } static HRESULT WINAPI d3drm1_CreateDeviceFromD3D(IDirect3DRM *iface, IDirect3D *d3d, IDirect3DDevice *d3d_device, IDirect3DRMDevice **device) { - FIXME("iface %p, d3d %p, d3d_device %p, device %p partial stub.\n", + struct d3drm_device *object; + HRESULT hr; + TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n", iface, d3d, d3d_device, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + if (!d3d || !d3d_device) + return D3DRMERR_BADVALUE; + + hr = d3drm_device_create(&object); + if (FAILED(hr)) + return hr; + + hr = d3drm_device_set_ddraw_device_d3d(object, iface, d3d, d3d_device); + if (FAILED(hr)) + { + d3drm_device_destroy(object); + return hr; + } + *device = IDirect3DRMDevice_from_impl(object); + + return D3DRM_OK; } static HRESULT WINAPI d3drm1_CreateDeviceFromClipper(IDirect3DRM *iface, IDirectDrawClipper *clipper, GUID *guid, int width, int height, IDirect3DRMDevice **device) { - FIXME("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", + struct d3drm_device *object; + IDirectDraw *ddraw; + IDirectDrawSurface *render_target; + HRESULT hr; + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", iface, clipper, debugstr_guid(guid), width, height, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!clipper || !width || !height) + return D3DRMERR_BADVALUE; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + if (FAILED(hr)) + return hr; + + hr = d3drm_device_create(&object); + if (FAILED(hr)) + { + IDirectDraw_Release(ddraw); + return hr; + } + + hr = d3drm_device_create_surfaces_from_clipper(object, ddraw, clipper, width, height, &render_target); + if (FAILED(hr)) + { + IDirectDraw_Release(ddraw); + d3drm_device_destroy(object); + return hr; + } + + hr = d3drm_device_init(object, 1, iface, ddraw, render_target, TRUE); + IDirectDraw_Release(ddraw); + IDirectDrawSurface_Release(render_target); + if (FAILED(hr)) + d3drm_device_destroy(object); + else + *device = IDirect3DRMDevice_from_impl(object); + + return hr; } static HRESULT WINAPI d3drm1_CreateTextureFromSurface(IDirect3DRM *iface, @@ -572,37 +660,103 @@ static HRESULT WINAPI d3drm2_CreateDevice(IDirect3DRM2 *iface, DWORD width, DWORD height, IDirect3DRMDevice2 **device) { - FIXME("iface %p, width %u, height %u, device %p.\n", iface, width, height, device); - - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown **)device); + struct d3drm_device *object; + HRESULT hr; + FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device); + + hr = d3drm_device_create(&object); + if (FAILED(hr)) + return hr; + + *device = IDirect3DRMDevice2_from_impl(object); + + return D3DRM_OK; } static HRESULT WINAPI d3drm2_CreateDeviceFromSurface(IDirect3DRM2 *iface, GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, IDirect3DRMDevice2 **device) { - FIXME("iface %p, guid %s, ddraw %p, backbuffer %p, device %p partial stub.\n", + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMDevice3 *device3; + HRESULT hr; + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, device %p.\n", iface, debugstr_guid(guid), ddraw, backbuffer, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + hr = IDirect3DRM3_CreateDeviceFromSurface(&d3drm->IDirect3DRM3_iface, guid, ddraw, backbuffer, 0, &device3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void**)device); + IDirect3DRMDevice3_Release(device3); + + return hr; } static HRESULT WINAPI d3drm2_CreateDeviceFromD3D(IDirect3DRM2 *iface, - IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice2 **device) -{ - FIXME("iface %p, d3d %p, d3d_device %p, device %p partial stub.\n", + IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice2 **device) +{ + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3D *d3d1; + IDirect3DDevice *d3d_device1; + IDirect3DRMDevice *device1; + HRESULT hr; + TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n", iface, d3d, d3d_device, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + if (!d3d || !d3d_device) + return D3DRMERR_BADVALUE; + + hr = IDirect3D2_QueryInterface(d3d, &IID_IDirect3D, (void **)&d3d1); + if (FAILED(hr)) + return hr; + + hr = IDirect3DDevice2_QueryInterface(d3d_device, &IID_IDirect3DDevice, (void **)&d3d_device1); + if (FAILED(hr)) + { + IDirect3D_Release(d3d1); + return hr; + } + + hr = IDirect3DRM_CreateDeviceFromD3D(&d3drm->IDirect3DRM_iface, d3d1, d3d_device1, &device1); + IDirect3D_Release(d3d1); + IDirect3DDevice_Release(d3d_device1); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice2, (void **)device); + IDirect3DRMDevice_Release(device1); + + return hr; } static HRESULT WINAPI d3drm2_CreateDeviceFromClipper(IDirect3DRM2 *iface, IDirectDrawClipper *clipper, GUID *guid, int width, int height, IDirect3DRMDevice2 **device) { - FIXME("iface %p, clipper %p, guid %s, width %d, height %d, device %p partial stub.\n", + struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); + IDirect3DRMDevice3 *device3; + HRESULT hr; + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", iface, clipper, debugstr_guid(guid), width, height, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice2, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + hr = IDirect3DRM3_CreateDeviceFromClipper(&d3drm->IDirect3DRM3_iface, clipper, guid, width, height, &device3); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice3_QueryInterface(device3, &IID_IDirect3DRMDevice2, (void**)device); + IDirect3DRMDevice3_Release(device3); + + return hr; } static HRESULT WINAPI d3drm2_CreateTextureFromSurface(IDirect3DRM2 *iface, @@ -946,37 +1100,139 @@ static HRESULT WINAPI d3drm3_CreateDevice(IDirect3DRM3 *iface, DWORD width, DWORD height, IDirect3DRMDevice3 **device) { + struct d3drm_device *object; + HRESULT hr; FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown **)device); + hr = d3drm_device_create(&object); + if (FAILED(hr)) + return hr; + + *device = IDirect3DRMDevice3_from_impl(object); + + return D3DRM_OK; } static HRESULT WINAPI d3drm3_CreateDeviceFromSurface(IDirect3DRM3 *iface, GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer, DWORD flags, IDirect3DRMDevice3 **device) { - FIXME("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#x, device %p partial stub.\n", + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_device *object; + BOOL use_z_surface; + HRESULT hr; + + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p, flags %#x, device %p.\n", iface, debugstr_guid(guid), ddraw, backbuffer, flags, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!backbuffer || !ddraw) + return D3DRMERR_BADDEVICE; + + hr = d3drm_device_create(&object); + if (FAILED(hr)) + return hr; + + use_z_surface = !(flags & D3DRMDEVICE_NOZBUFFER); + + hr = d3drm_device_init(object, 3, &d3drm->IDirect3DRM_iface, ddraw, backbuffer, use_z_surface); + if (SUCCEEDED(hr)) + *device = IDirect3DRMDevice3_from_impl(object); + else + d3drm_device_destroy(object); + + return hr; } static HRESULT WINAPI d3drm3_CreateDeviceFromD3D(IDirect3DRM3 *iface, IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device, IDirect3DRMDevice3 **device) { - FIXME("iface %p, d3d %p, d3d_device %p, device %p partial stub.\n", + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + IDirect3D *d3d1; + IDirect3DDevice *d3d_device1; + IDirect3DRMDevice *device1; + HRESULT hr; + TRACE("iface %p, d3d %p, d3d_device %p, device %p.\n", iface, d3d, d3d_device, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + if (!d3d || !d3d_device) + return D3DRMERR_BADVALUE; + + hr = IDirect3D2_QueryInterface(d3d, &IID_IDirect3D, (void **)&d3d1); + if (FAILED(hr)) + return hr; + hr = IDirect3DDevice2_QueryInterface(d3d_device, &IID_IDirect3DDevice, (void **)&d3d_device1); + if (FAILED(hr)) + { + IDirect3D_Release(d3d1); + return hr; + } + + hr = IDirect3DRM_CreateDeviceFromD3D(&d3drm->IDirect3DRM_iface, d3d1, d3d_device1, &device1); + IDirect3D_Release(d3d1); + IDirect3DDevice_Release(d3d_device1); + if (FAILED(hr)) + return hr; + + hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice3, (void **)device); + IDirect3DRMDevice_Release(device1); + + return hr; } static HRESULT WINAPI d3drm3_CreateDeviceFromClipper(IDirect3DRM3 *iface, IDirectDrawClipper *clipper, GUID *guid, int width, int height, IDirect3DRMDevice3 **device) { - FIXME("iface %p, clipper %p, guid %s, width %d, height %d, device %p partial stub.\n", + struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); + struct d3drm_device *object; + IDirectDraw *ddraw; + IDirectDrawSurface *render_target; + HRESULT hr; + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d, device %p.\n", iface, clipper, debugstr_guid(guid), width, height, device); - return Direct3DRMDevice_create(&IID_IDirect3DRMDevice3, (IUnknown **)device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; + + if (!clipper || !width || !height) + return D3DRMERR_BADVALUE; + + hr = DirectDrawCreate(NULL, &ddraw, NULL); + if (FAILED(hr)) + return hr; + + hr = d3drm_device_create(&object); + if (FAILED(hr)) + { + IDirectDraw_Release(ddraw); + return hr; + } + + hr = d3drm_device_create_surfaces_from_clipper(object, ddraw, clipper, width, height, &render_target); + if (FAILED(hr)) + { + IDirectDraw_Release(ddraw); + d3drm_device_destroy(object); + return hr; + } + + hr = d3drm_device_init(object, 3, &d3drm->IDirect3DRM_iface, ddraw, render_target, TRUE); + IDirectDraw_Release(ddraw); + IDirectDrawSurface_Release(render_target); + if (FAILED(hr)) + d3drm_device_destroy(object); + else + *device = IDirect3DRMDevice3_from_impl(object); + + return hr; } static HRESULT WINAPI d3drm3_CreateShadow(IDirect3DRM3 *iface, IUnknown *object, IDirect3DRMLight *light, Modified: trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/d3d…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/d3drm_private.h [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -38,7 +38,12 @@ #include <wine/debug.h> WINE_DEFAULT_DEBUG_CHANNEL(d3drm); -HRESULT Direct3DRMDevice_create(REFIID riid, IUnknown** ppObj) DECLSPEC_HIDDEN; +struct d3drm_device; + +HRESULT d3drm_device_create(struct d3drm_device **out) DECLSPEC_HIDDEN; +IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN; +IDirect3DRMDevice2 *IDirect3DRMDevice2_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN; +IDirect3DRMDevice3 *IDirect3DRMDevice3_from_impl(struct d3drm_device *device) DECLSPEC_HIDDEN; HRESULT Direct3DRMFace_create(REFIID riid, IUnknown** ret_iface) DECLSPEC_HIDDEN; HRESULT Direct3DRMFrame_create(REFIID riid, IUnknown* parent_frame, IUnknown** ret_iface) DECLSPEC_HIDDEN; HRESULT Direct3DRMLight_create(IUnknown** ppObj) DECLSPEC_HIDDEN; @@ -51,6 +56,16 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *data, D3DRMLOADTEXTURECALLBACK load_texture_proc, void *arg) DECLSPEC_HIDDEN; +void d3drm_device_destroy(struct d3drm_device *device) DECLSPEC_HIDDEN; + +HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw, IDirectDrawClipper *clipper, int width, int height, + IDirectDrawSurface **surface) DECLSPEC_HIDDEN; + +HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirect3DRM *d3drm, IDirectDraw *ddraw, IDirectDrawSurface *surface, + BOOL create_z_surface) DECLSPEC_HIDDEN; + +HRESULT d3drm_device_set_ddraw_device_d3d(struct d3drm_device *device, IDirect3DRM *d3drm, IDirect3D *d3d, IDirect3DDevice *d3d_device) DECLSPEC_HIDDEN; + struct d3drm_file_header { WORD major; Modified: trunk/reactos/dll/directx/wine/d3drm/device.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/dev…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/device.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/device.c [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -24,9 +24,15 @@ struct d3drm_device { + IDirect3DRMDevice IDirect3DRMDevice_iface; IDirect3DRMDevice2 IDirect3DRMDevice2_iface; IDirect3DRMDevice3 IDirect3DRMDevice3_iface; IDirect3DRMWinDevice IDirect3DRMWinDevice_iface; + IDirect3DRM *d3drm; + IDirectDraw *ddraw; + IDirectDrawSurface *primary_surface, *render_target; + IDirectDrawClipper *clipper; + IDirect3DDevice *device; LONG ref; BOOL dither; D3DRMRENDERQUALITY quality; @@ -35,6 +41,11 @@ DWORD width; }; +static inline struct d3drm_device *impl_from_IDirect3DRMDevice(IDirect3DRMDevice *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice_iface); +} + static inline struct d3drm_device *impl_from_IDirect3DRMDevice2(IDirect3DRMDevice2 *iface) { return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice2_iface); @@ -45,71 +56,570 @@ return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMDevice3_iface); } +IDirect3DRMDevice *IDirect3DRMDevice_from_impl(struct d3drm_device *device) +{ + return &device->IDirect3DRMDevice_iface; +} + +IDirect3DRMDevice2 *IDirect3DRMDevice2_from_impl(struct d3drm_device *device) +{ + return &device->IDirect3DRMDevice2_iface; +} + +IDirect3DRMDevice3 *IDirect3DRMDevice3_from_impl(struct d3drm_device *device) +{ + return &device->IDirect3DRMDevice3_iface; +} + +void d3drm_device_destroy(struct d3drm_device *device) +{ + if (device->device) + { + TRACE("Releasing attached ddraw interfaces.\n"); + IDirect3DDevice_Release(device->device); + } + if (device->render_target) + IDirectDrawSurface_Release(device->render_target); + if (device->primary_surface) + { + TRACE("Releasing primary surface and attached clipper.\n"); + IDirectDrawSurface_Release(device->primary_surface); + IDirectDrawClipper_Release(device->clipper); + } + if (device->ddraw) + { + IDirectDraw_Release(device->ddraw); + IDirect3DRM_Release(device->d3drm); + } + HeapFree(GetProcessHeap(), 0, device); +} + static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface) { return CONTAINING_RECORD(iface, struct d3drm_device, IDirect3DRMWinDevice_iface); } -static HRESULT WINAPI d3drm_device2_QueryInterface(IDirect3DRMDevice2 *iface, REFIID riid, void **out) -{ - struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); - - TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - - if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2) - || IsEqualGUID(riid, &IID_IDirect3DRMDevice) - || IsEqualGUID(riid, &IID_IUnknown)) +HRESULT d3drm_device_create_surfaces_from_clipper(struct d3drm_device *object, IDirectDraw *ddraw, IDirectDrawClipper *clipper, int width, int height, IDirectDrawSurface **surface) +{ + DDSURFACEDESC surface_desc; + IDirectDrawSurface *primary_surface, *render_target; + HWND window; + HRESULT hr; + + hr = IDirectDrawClipper_GetHWnd(clipper, &window); + if (FAILED(hr)) + return hr; + + hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); + if (FAILED(hr)) + return hr; + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS; + surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &primary_surface, NULL); + if (FAILED(hr)) + return hr; + hr = IDirectDrawSurface_SetClipper(primary_surface, clipper); + if (FAILED(hr)) { - *out = &device->IDirect3DRMDevice2_iface; + IDirectDrawSurface_Release(primary_surface); + return hr; } - else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3)) + + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + surface_desc.dwWidth = width; + surface_desc.dwHeight = height; + + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &render_target, NULL); + if (FAILED(hr)) { - *out = &device->IDirect3DRMDevice3_iface; + IDirectDrawSurface_Release(primary_surface); + return hr; } - else if (IsEqualGUID(riid, &IID_IDirect3DRMWinDevice)) + + object->primary_surface = primary_surface; + object->clipper = clipper; + IDirectDrawClipper_AddRef(clipper); + *surface = render_target; + + return D3DRM_OK; +} + +HRESULT d3drm_device_init(struct d3drm_device *device, UINT version, IDirect3DRM *d3drm, IDirectDraw *ddraw, IDirectDrawSurface *surface, + BOOL create_z_surface) +{ + DDSCAPS caps = { DDSCAPS_ZBUFFER }; + IDirectDrawSurface *ds = NULL; + IDirect3DDevice *device1 = NULL; + IDirect3DDevice2 *device2 = NULL; + IDirect3D2 *d3d2 = NULL; + DDSURFACEDESC desc, surface_desc; + HRESULT hr; + + device->ddraw = ddraw; + IDirectDraw_AddRef(ddraw); + device->d3drm = d3drm; + IDirect3DRM_AddRef(d3drm); + device->render_target = surface; + IDirectDrawSurface_AddRef(surface); + + desc.dwSize = sizeof(desc); + hr = IDirectDrawSurface_GetSurfaceDesc(surface, &desc); + if (FAILED(hr)) + return hr; + + if (!(desc.ddsCaps.dwCaps & DDSCAPS_3DDEVICE)) + return DDERR_INVALIDCAPS; + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &ds); + if (SUCCEEDED(hr)) { - *out = &device->IDirect3DRMWinDevice_iface; + create_z_surface = FALSE; + IDirectDrawSurface_Release(ds); + ds = NULL; } + + if (create_z_surface) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_ZBUFFERBITDEPTH | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + surface_desc.u2.dwZBufferBitDepth = 16; + surface_desc.dwWidth = desc.dwWidth; + surface_desc.dwHeight = desc.dwHeight; + hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &ds, NULL); + if (FAILED(hr)) + return hr; + + hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + return hr; + } + + if (version == 1) + hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirect3DRGBDevice, (void **)&device1); else { - *out = NULL; - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - return E_NOINTERFACE; + IDirectDraw_QueryInterface(ddraw, &IID_IDirect3D2, (void**)&d3d2); + hr = IDirect3D2_CreateDevice(d3d2, &IID_IDirect3DRGBDevice, surface, &device2); + IDirect3D2_Release(d3d2); } - - IUnknown_AddRef((IUnknown *)*out); - return S_OK; + if (FAILED(hr)) + { + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); + return hr; + } + + if (version != 1) + { + hr = IDirect3DDevice2_QueryInterface(device2, &IID_IDirect3DDevice, (void**)&device1); + IDirect3DDevice2_Release(device2); + if (FAILED(hr)) + { + IDirectDrawSurface_DeleteAttachedSurface(surface, 0, ds); + return hr; + } + } + device->device = device1; + + return hr; +} + +HRESULT d3drm_device_set_ddraw_device_d3d(struct d3drm_device *device, IDirect3DRM *d3drm, IDirect3D *d3d, IDirect3DDevice *d3d_device) +{ + device->d3drm = d3drm; + IDirect3DRM_AddRef(d3drm); + device->device = d3d_device; + IDirect3DDevice_AddRef(d3d_device); + + return IDirect3D_QueryInterface(d3d, &IID_IDirectDraw, (void **)&device->ddraw); +} + +static HRESULT WINAPI d3drm_device1_QueryInterface(IDirect3DRMDevice *iface, REFIID riid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return IDirect3DRMDevice3_QueryInterface(&device->IDirect3DRMDevice3_iface, riid, out); +} + +static ULONG WINAPI d3drm_device1_AddRef(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_AddRef(&device->IDirect3DRMDevice3_iface); +} + +static ULONG WINAPI d3drm_device1_Release(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_Release(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device1_Clone(IDirect3DRMDevice *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMDevice3_Clone(&device->IDirect3DRMDevice3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_device1_AddDestroyCallback(IDirect3DRMDevice *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device1_DeleteDestroyCallback(IDirect3DRMDevice *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device1_SetAppData(IDirect3DRMDevice *iface, DWORD data) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, data %#x.\n", iface, data); + + return IDirect3DRMDevice3_SetAppData(&device->IDirect3DRMDevice3_iface, data); +} + +static DWORD WINAPI d3drm_device1_GetAppData(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetAppData(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device1_SetName(IDirect3DRMDevice *iface, const char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMDevice3_SetName(&device->IDirect3DRMDevice3_iface, name); +} + +static HRESULT WINAPI d3drm_device1_GetName(IDirect3DRMDevice *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMDevice3_GetName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device1_GetClassName(IDirect3DRMDevice *iface, DWORD *size, char *name) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMDevice3_GetClassName(&device->IDirect3DRMDevice3_iface, size, name); +} + +static HRESULT WINAPI d3drm_device1_Init(IDirect3DRMDevice *iface, ULONG width, ULONG height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, width %u, height %u.\n", iface, width, height); + + return IDirect3DRMDevice3_Init(&device->IDirect3DRMDevice3_iface, width, height); +} + +static HRESULT WINAPI d3drm_device1_InitFromD3D(IDirect3DRMDevice *iface, + IDirect3D *d3d, IDirect3DDevice *d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + return IDirect3DRMDevice3_InitFromD3D(&device->IDirect3DRMDevice3_iface, d3d, d3d_device); +} + +static HRESULT WINAPI d3drm_device1_InitFromClipper(IDirect3DRMDevice *iface, + IDirectDrawClipper *clipper, GUID *guid, int width, int height) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, clipper %p, guid %s, width %d, height %d.\n", + iface, clipper, debugstr_guid(guid), width, height); + + return IDirect3DRMDevice3_InitFromClipper(&device->IDirect3DRMDevice3_iface, + clipper, guid, width, height); +} + +static HRESULT WINAPI d3drm_device1_Update(IDirect3DRMDevice *iface) +{ + FIXME("iface %p stub!\n", iface); + + return D3DRM_OK; +} + +static HRESULT WINAPI d3drm_device1_AddUpdateCallback(IDirect3DRMDevice *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device1_DeleteUpdateCallback(IDirect3DRMDevice *iface, + D3DRMUPDATECALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_device1_SetBufferCount(IDirect3DRMDevice *iface, DWORD count) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, count %u.\n", iface, count); + + return IDirect3DRMDevice3_SetBufferCount(&device->IDirect3DRMDevice3_iface, count); +} + +static DWORD WINAPI d3drm_device1_GetBufferCount(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetBufferCount(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device1_SetDither(IDirect3DRMDevice *iface, BOOL enable) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, enabled %#x.\n", iface, enable); + + return IDirect3DRMDevice3_SetDither(&device->IDirect3DRMDevice3_iface, enable); +} + +static HRESULT WINAPI d3drm_device1_SetShades(IDirect3DRMDevice *iface, DWORD count) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, count %u.\n", iface, count); + + return IDirect3DRMDevice3_SetShades(&device->IDirect3DRMDevice3_iface, count); +} + +static HRESULT WINAPI d3drm_device1_SetQuality(IDirect3DRMDevice *iface, D3DRMRENDERQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, quality %u.\n", iface, quality); + + return IDirect3DRMDevice3_SetQuality(&device->IDirect3DRMDevice3_iface, quality); +} + +static HRESULT WINAPI d3drm_device1_SetTextureQuality(IDirect3DRMDevice *iface, D3DRMTEXTUREQUALITY quality) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, quality %u.\n", iface, quality); + + return IDirect3DRMDevice3_SetTextureQuality(&device->IDirect3DRMDevice3_iface, quality); +} + +static HRESULT WINAPI d3drm_device1_GetViewports(IDirect3DRMDevice *iface, IDirect3DRMViewportArray **array) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, array %p.\n", iface, array); + + return IDirect3DRMDevice3_GetViewports(&device->IDirect3DRMDevice3_iface, array); +} + +static BOOL WINAPI d3drm_device1_GetDither(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetDither(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetShades(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetShades(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetHeight(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetHeight(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetWidth(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetWidth(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetTrianglesDrawn(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetTrianglesDrawn(&device->IDirect3DRMDevice3_iface); +} + +static DWORD WINAPI d3drm_device1_GetWireframeOptions(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetWireframeOptions(&device->IDirect3DRMDevice3_iface); +} + +static D3DRMRENDERQUALITY WINAPI d3drm_device1_GetQuality(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetQuality(&device->IDirect3DRMDevice3_iface); +} + +static D3DCOLORMODEL WINAPI d3drm_device1_GetColorModel(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p stub!\n", iface); + + return IDirect3DRMDevice3_GetColorModel(&device->IDirect3DRMDevice3_iface); +} + +static D3DRMTEXTUREQUALITY WINAPI d3drm_device1_GetTextureQuality(IDirect3DRMDevice *iface) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetTextureQuality(&device->IDirect3DRMDevice3_iface); +} + +static HRESULT WINAPI d3drm_device1_GetDirect3DDevice(IDirect3DRMDevice *iface, IDirect3DDevice **d3d_device) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + return IDirect3DRMDevice3_GetDirect3DDevice(&device->IDirect3DRMDevice3_iface, d3d_device); +} + +static const struct IDirect3DRMDeviceVtbl d3drm_device1_vtbl = +{ + d3drm_device1_QueryInterface, + d3drm_device1_AddRef, + d3drm_device1_Release, + d3drm_device1_Clone, + d3drm_device1_AddDestroyCallback, + d3drm_device1_DeleteDestroyCallback, + d3drm_device1_SetAppData, + d3drm_device1_GetAppData, + d3drm_device1_SetName, + d3drm_device1_GetName, + d3drm_device1_GetClassName, + d3drm_device1_Init, + d3drm_device1_InitFromD3D, + d3drm_device1_InitFromClipper, + d3drm_device1_Update, + d3drm_device1_AddUpdateCallback, + d3drm_device1_DeleteUpdateCallback, + d3drm_device1_SetBufferCount, + d3drm_device1_GetBufferCount, + d3drm_device1_SetDither, + d3drm_device1_SetShades, + d3drm_device1_SetQuality, + d3drm_device1_SetTextureQuality, + d3drm_device1_GetViewports, + d3drm_device1_GetDither, + d3drm_device1_GetShades, + d3drm_device1_GetHeight, + d3drm_device1_GetWidth, + d3drm_device1_GetTrianglesDrawn, + d3drm_device1_GetWireframeOptions, + d3drm_device1_GetQuality, + d3drm_device1_GetColorModel, + d3drm_device1_GetTextureQuality, + d3drm_device1_GetDirect3DDevice, +}; + +static HRESULT WINAPI d3drm_device2_QueryInterface(IDirect3DRMDevice2 *iface, REFIID riid, void **out) +{ + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return IDirect3DRMDevice3_QueryInterface(&device->IDirect3DRMDevice3_iface, riid, out); } static ULONG WINAPI d3drm_device2_AddRef(IDirect3DRMDevice2 *iface) { struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); - ULONG refcount = InterlockedIncrement(&device->ref); - - TRACE("%p increasing refcount to %u.\n", iface, refcount); - - return refcount; + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_AddRef(&device->IDirect3DRMDevice3_iface); } static ULONG WINAPI d3drm_device2_Release(IDirect3DRMDevice2 *iface) { struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); - ULONG refcount = InterlockedDecrement(&device->ref); - - TRACE("%p decreasing refcount to %u.\n", iface, refcount); - - if (!refcount) - HeapFree(GetProcessHeap(), 0, device); - - return refcount; + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_Release(&device->IDirect3DRMDevice3_iface); } static HRESULT WINAPI d3drm_device2_Clone(IDirect3DRMDevice2 *iface, IUnknown *outer, REFIID iid, void **out) { - FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, outer %p, iid %s, out %p\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMDevice3_Clone(&device->IDirect3DRMDevice3_iface, outer, iid, out); } static HRESULT WINAPI d3drm_device2_AddDestroyCallback(IDirect3DRMDevice2 *iface, @@ -130,30 +640,38 @@ static HRESULT WINAPI d3drm_device2_SetAppData(IDirect3DRMDevice2 *iface, DWORD data) { - FIXME("iface %p, data %#x stub!\n", iface, data); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, data %#x.\n", iface, data); + + return IDirect3DRMDevice3_SetAppData(&device->IDirect3DRMDevice3_iface, data); } static DWORD WINAPI d3drm_device2_GetAppData(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetAppData(&device->IDirect3DRMDevice3_iface); } static HRESULT WINAPI d3drm_device2_SetName(IDirect3DRMDevice2 *iface, const char *name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMDevice3_SetName(&device->IDirect3DRMDevice3_iface, name); } static HRESULT WINAPI d3drm_device2_GetName(IDirect3DRMDevice2 *iface, DWORD *size, char *name) { - FIXME("iface %p, size %p, name %p stub!\n", iface, size, name); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMDevice3_GetName(&device->IDirect3DRMDevice3_iface, size, name); } static HRESULT WINAPI d3drm_device2_GetClassName(IDirect3DRMDevice2 *iface, DWORD *size, char *name) @@ -177,9 +695,11 @@ static HRESULT WINAPI d3drm_device2_InitFromD3D(IDirect3DRMDevice2 *iface, IDirect3D *d3d, IDirect3DDevice *d3d_device) { - FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + return IDirect3DRMDevice3_InitFromD3D(&device->IDirect3DRMDevice3_iface, d3d, d3d_device); } static HRESULT WINAPI d3drm_device2_InitFromClipper(IDirect3DRMDevice2 *iface, @@ -219,16 +739,20 @@ static HRESULT WINAPI d3drm_device2_SetBufferCount(IDirect3DRMDevice2 *iface, DWORD count) { - FIXME("iface %p, count %u.\n", iface, count); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, count %u.\n", iface, count); + + return IDirect3DRMDevice3_SetBufferCount(&device->IDirect3DRMDevice3_iface, count); } static DWORD WINAPI d3drm_device2_GetBufferCount(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetBufferCount(&device->IDirect3DRMDevice3_iface); } static HRESULT WINAPI d3drm_device2_SetDither(IDirect3DRMDevice2 *iface, BOOL enable) @@ -242,9 +766,11 @@ static HRESULT WINAPI d3drm_device2_SetShades(IDirect3DRMDevice2 *iface, DWORD count) { - FIXME("iface %p, count %u stub!\n", iface, count); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, count %u.\n", iface, count); + + return IDirect3DRMDevice3_SetShades(&device->IDirect3DRMDevice3_iface, count); } static HRESULT WINAPI d3drm_device2_SetQuality(IDirect3DRMDevice2 *iface, D3DRMRENDERQUALITY quality) @@ -258,16 +784,20 @@ static HRESULT WINAPI d3drm_device2_SetTextureQuality(IDirect3DRMDevice2 *iface, D3DRMTEXTUREQUALITY quality) { - FIXME("iface %p, quality %u stub!\n", iface, quality); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, quality %u.\n", iface, quality); + + return IDirect3DRMDevice3_SetTextureQuality(&device->IDirect3DRMDevice3_iface, quality); } static HRESULT WINAPI d3drm_device2_GetViewports(IDirect3DRMDevice2 *iface, IDirect3DRMViewportArray **array) { - FIXME("iface %p, array %p stub!\n", iface, array); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, array %p.\n", iface, array); + + return IDirect3DRMDevice3_GetViewports(&device->IDirect3DRMDevice3_iface, array); } static BOOL WINAPI d3drm_device2_GetDither(IDirect3DRMDevice2 *iface) @@ -281,9 +811,11 @@ static DWORD WINAPI d3drm_device2_GetShades(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetShades(&device->IDirect3DRMDevice3_iface); } static DWORD WINAPI d3drm_device2_GetHeight(IDirect3DRMDevice2 *iface) @@ -306,16 +838,20 @@ static DWORD WINAPI d3drm_device2_GetTrianglesDrawn(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetTrianglesDrawn(&device->IDirect3DRMDevice3_iface); } static DWORD WINAPI d3drm_device2_GetWireframeOptions(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetWireframeOptions(&device->IDirect3DRMDevice3_iface); } static D3DRMRENDERQUALITY WINAPI d3drm_device2_GetQuality(IDirect3DRMDevice2 *iface) @@ -329,40 +865,50 @@ static D3DCOLORMODEL WINAPI d3drm_device2_GetColorModel(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetColorModel(&device->IDirect3DRMDevice3_iface); } static D3DRMTEXTUREQUALITY WINAPI d3drm_device2_GetTextureQuality(IDirect3DRMDevice2 *iface) { - FIXME("iface %p stub!\n", iface); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetTextureQuality(&device->IDirect3DRMDevice3_iface); } static HRESULT WINAPI d3drm_device2_GetDirect3DDevice(IDirect3DRMDevice2 *iface, IDirect3DDevice **d3d_device) { - FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + return IDirect3DRMDevice3_GetDirect3DDevice(&device->IDirect3DRMDevice3_iface, d3d_device); } static HRESULT WINAPI d3drm_device2_InitFromD3D2(IDirect3DRMDevice2 *iface, IDirect3D2 *d3d, IDirect3DDevice2 *d3d_device) { - FIXME("iface %p, d3d %p, d3d_device %p stub!\n", iface, d3d, d3d_device); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d %p, d3d_device %p.\n", iface, d3d, d3d_device); + + return IDirect3DRMDevice3_InitFromD3D2(&device->IDirect3DRMDevice3_iface, d3d, d3d_device); } static HRESULT WINAPI d3drm_device2_InitFromSurface(IDirect3DRMDevice2 *iface, GUID *guid, IDirectDraw *ddraw, IDirectDrawSurface *backbuffer) { - FIXME("iface %p, guid %s, ddraw %p, backbuffer %p stub!\n", + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, guid %s, ddraw %p, backbuffer %p.\n", iface, debugstr_guid(guid), ddraw, backbuffer); - return E_NOTIMPL; + return IDirect3DRMDevice3_InitFromSurface(&device->IDirect3DRMDevice3_iface, guid, ddraw, backbuffer); } static HRESULT WINAPI d3drm_device2_SetRenderMode(IDirect3DRMDevice2 *iface, DWORD flags) @@ -385,9 +931,11 @@ static HRESULT WINAPI d3drm_device2_GetDirect3DDevice2(IDirect3DRMDevice2 *iface, IDirect3DDevice2 **d3d_device) { - FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice2(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + return IDirect3DRMDevice3_GetDirect3DDevice2(&device->IDirect3DRMDevice3_iface, d3d_device); } static const struct IDirect3DRMDevice2Vtbl d3drm_device2_vtbl = @@ -437,21 +985,58 @@ { struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); - return d3drm_device2_QueryInterface(&device->IDirect3DRMDevice2_iface, riid, out); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) + || IsEqualGUID(riid, &IID_IUnknown)) + { + *out = &device->IDirect3DRMDevice3_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice2)) + { + *out = &device->IDirect3DRMDevice2_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMDevice)) + { + *out = &device->IDirect3DRMDevice_iface; + } + else if (IsEqualGUID(riid, &IID_IDirect3DRMWinDevice)) + { + *out = &device->IDirect3DRMWinDevice_iface; + } + else + { + *out = NULL; + WARN("%s not implemented, returning CLASS_E_CLASSNOTAVAILABLE.\n", debugstr_guid(riid)); + return CLASS_E_CLASSNOTAVAILABLE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; } static ULONG WINAPI d3drm_device3_AddRef(IDirect3DRMDevice3 *iface) { struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); - - return d3drm_device2_AddRef(&device->IDirect3DRMDevice2_iface); + ULONG refcount = InterlockedIncrement(&device->ref); + + TRACE("%p increasing refcount to %u.\n", iface, refcount); + + return refcount; } static ULONG WINAPI d3drm_device3_Release(IDirect3DRMDevice3 *iface) { struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); - - return d3drm_device2_Release(&device->IDirect3DRMDevice2_iface); + ULONG refcount = InterlockedDecrement(&device->ref); + + TRACE("%p decreasing refcount to %u.\n", iface, refcount); + + if (!refcount) + d3drm_device_destroy(device); + + return refcount; } static HRESULT WINAPI d3drm_device3_Clone(IDirect3DRMDevice3 *iface, @@ -706,9 +1291,13 @@ static HRESULT WINAPI d3drm_device3_GetDirect3DDevice(IDirect3DRMDevice3 *iface, IDirect3DDevice **d3d_device) { - FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + TRACE("iface %p, d3d_device %p!\n", iface, d3d_device); + + *d3d_device = device->device; + IDirect3DDevice_AddRef(*d3d_device); + + return D3DRM_OK; } static HRESULT WINAPI d3drm_device3_InitFromD3D2(IDirect3DRMDevice3 *iface, @@ -750,9 +1339,13 @@ static HRESULT WINAPI d3drm_device3_GetDirect3DDevice2(IDirect3DRMDevice3 *iface, IDirect3DDevice2 **d3d_device) { - FIXME("iface %p, d3d_device %p stub!\n", iface, d3d_device); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMDevice3(iface); + + TRACE("iface %p, d3d_device %p.\n", iface, d3d_device); + + IDirect3DDevice_QueryInterface(device->device, &IID_IDirect3DDevice2, (void**)d3d_device); + + return D3DRM_OK; } static HRESULT WINAPI d3drm_device3_FindPreferredTextureFormat(IDirect3DRMDevice3 *iface, @@ -849,29 +1442,37 @@ { struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); - return d3drm_device2_QueryInterface(&device->IDirect3DRMDevice2_iface, riid, out); + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return d3drm_device3_QueryInterface(&device->IDirect3DRMDevice3_iface, riid, out); } static ULONG WINAPI d3drm_device_win_AddRef(IDirect3DRMWinDevice *iface) { struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); - return d3drm_device2_AddRef(&device->IDirect3DRMDevice2_iface); + TRACE("iface %p.\n", iface); + + return d3drm_device3_AddRef(&device->IDirect3DRMDevice3_iface); } static ULONG WINAPI d3drm_device_win_Release(IDirect3DRMWinDevice *iface) { struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); - return d3drm_device2_Release(&device->IDirect3DRMDevice2_iface); + TRACE("iface %p.\n", iface); + + return d3drm_device3_Release(&device->IDirect3DRMDevice3_iface); } static HRESULT WINAPI d3drm_device_win_Clone(IDirect3DRMWinDevice *iface, IUnknown *outer, REFIID iid, void **out) { - FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, outer %p, iid %s, out %p\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMDevice3_Clone(&device->IDirect3DRMDevice3_iface, outer, iid, out); } static HRESULT WINAPI d3drm_device_win_AddDestroyCallback(IDirect3DRMWinDevice *iface, @@ -892,30 +1493,38 @@ static HRESULT WINAPI d3drm_device_win_SetAppData(IDirect3DRMWinDevice *iface, DWORD data) { - FIXME("iface %p, data %#x stub!\n", iface, data); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, data %#x.\n", iface, data); + + return IDirect3DRMDevice3_SetAppData(&device->IDirect3DRMDevice3_iface, data); } static DWORD WINAPI d3drm_device_win_GetAppData(IDirect3DRMWinDevice *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMDevice3_GetAppData(&device->IDirect3DRMDevice3_iface); } static HRESULT WINAPI d3drm_device_win_SetName(IDirect3DRMWinDevice *iface, const char *name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMDevice3_SetName(&device->IDirect3DRMDevice3_iface, name); } static HRESULT WINAPI d3drm_device_win_GetName(IDirect3DRMWinDevice *iface, DWORD *size, char *name) { - FIXME("iface %p, size %p, name %p stub!\n", iface, size, name); - - return E_NOTIMPL; + struct d3drm_device *device = impl_from_IDirect3DRMWinDevice(iface); + + TRACE("iface %p, size %p, name %p stub!\n", iface, size, name); + + return IDirect3DRMDevice3_GetName(&device->IDirect3DRMDevice3_iface, size, name); } static HRESULT WINAPI d3drm_device_win_GetClassName(IDirect3DRMWinDevice *iface, DWORD *size, char *name) @@ -958,24 +1567,22 @@ d3drm_device_win_HandleActivate, }; -HRESULT Direct3DRMDevice_create(REFIID riid, IUnknown **out) +HRESULT d3drm_device_create(struct d3drm_device **out) { struct d3drm_device *object; - TRACE("riid %s, out %p.\n", debugstr_guid(riid), out); + TRACE("out %p.\n", out); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; + object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl; object->IDirect3DRMDevice2_iface.lpVtbl = &d3drm_device2_vtbl; object->IDirect3DRMDevice3_iface.lpVtbl = &d3drm_device3_vtbl; object->IDirect3DRMWinDevice_iface.lpVtbl = &d3drm_device_win_vtbl; object->ref = 1; - if (IsEqualGUID(riid, &IID_IDirect3DRMDevice3)) - *out = (IUnknown*)&object->IDirect3DRMDevice3_iface; - else - *out = (IUnknown*)&object->IDirect3DRMDevice2_iface; - - return S_OK; -} + *out = object; + + return D3DRM_OK; +} Modified: trunk/reactos/dll/directx/wine/d3drm/frame.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/fra…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/frame.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/frame.c [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -1065,7 +1065,7 @@ { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return FALSE; } static HRESULT WINAPI d3drm_frame2_GetAxes(IDirect3DRMFrame2 *iface, D3DVECTOR *dir, D3DVECTOR *up) @@ -1086,7 +1086,7 @@ { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return FALSE; } static HRESULT WINAPI d3drm_frame2_GetHierarchyBox(IDirect3DRMFrame2 *iface, D3DRMBOX *box) @@ -2006,7 +2006,7 @@ { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return FALSE; } static HRESULT WINAPI d3drm_frame3_GetAxes(IDirect3DRMFrame3 *iface, D3DVECTOR *dir, D3DVECTOR *up) @@ -2027,7 +2027,7 @@ { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return FALSE; } static HRESULT WINAPI d3drm_frame3_GetHierarchyBox(IDirect3DRMFrame3 *iface, D3DRMBOX *box) Modified: trunk/reactos/dll/directx/wine/d3drm/texture.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/tex…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/texture.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/texture.c [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -22,12 +22,18 @@ struct d3drm_texture { + IDirect3DRMTexture IDirect3DRMTexture_iface; IDirect3DRMTexture2 IDirect3DRMTexture2_iface; IDirect3DRMTexture3 IDirect3DRMTexture3_iface; LONG ref; DWORD app_data; }; +static inline struct d3drm_texture *impl_from_IDirect3DRMTexture(IDirect3DRMTexture *iface) +{ + return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture_iface); +} + static inline struct d3drm_texture *impl_from_IDirect3DRMTexture2(IDirect3DRMTexture2 *iface) { return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture2_iface); @@ -38,62 +44,337 @@ return CONTAINING_RECORD(iface, struct d3drm_texture, IDirect3DRMTexture3_iface); } +static HRESULT WINAPI d3drm_texture1_QueryInterface(IDirect3DRMTexture *iface, REFIID riid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out); +} + +static ULONG WINAPI d3drm_texture1_AddRef(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface); +} + +static ULONG WINAPI d3drm_texture1_Release(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture1_Clone(IDirect3DRMTexture *iface, + IUnknown *outer, REFIID iid, void **out) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out); +} + +static HRESULT WINAPI d3drm_texture1_AddDestroyCallback(IDirect3DRMTexture *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_DeleteDestroyCallback(IDirect3DRMTexture *iface, + D3DRMOBJECTCALLBACK cb, void *ctx) +{ + FIXME("iface %p, cb %p, ctx %p stub!\n", iface, cb, ctx); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_SetAppData(IDirect3DRMTexture *iface, DWORD data) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, data %#x.\n", iface, data); + + return IDirect3DRMTexture3_SetAppData(&texture->IDirect3DRMTexture3_iface, data); +} + +static DWORD WINAPI d3drm_texture1_GetAppData(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetAppData(&texture->IDirect3DRMTexture3_iface); +} + +static HRESULT WINAPI d3drm_texture1_SetName(IDirect3DRMTexture *iface, const char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name); +} + +static HRESULT WINAPI d3drm_texture1_GetName(IDirect3DRMTexture *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name); +} + +static HRESULT WINAPI d3drm_texture1_GetClassName(IDirect3DRMTexture *iface, DWORD *size, char *name) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetClassName(&texture->IDirect3DRMTexture3_iface, size, name); +} + +static HRESULT WINAPI d3drm_texture1_InitFromFile(IDirect3DRMTexture *iface, const char *filename) +{ + FIXME("iface %p, filename %s stub!\n", iface, debugstr_a(filename)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_InitFromSurface(IDirect3DRMTexture *iface, + IDirectDrawSurface *surface) +{ + FIXME("iface %p, surface %p stub!\n", iface, surface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_InitFromResource(IDirect3DRMTexture *iface, HRSRC resource) +{ + FIXME("iface %p, resource %p stub!\n", iface, resource); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_Changed(IDirect3DRMTexture *iface, BOOL pixels, BOOL palette) +{ + FIXME("iface %p, pixels %#x, palette %#x stub!\n", iface, pixels, palette); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3drm_texture1_SetColors(IDirect3DRMTexture *iface, DWORD max_colors) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, max_colors %u.\n", iface, max_colors); + + return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors); +} + +static HRESULT WINAPI d3drm_texture1_SetShades(IDirect3DRMTexture *iface, DWORD max_shades) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, max_shades %u.\n", iface, max_shades); + + return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalSize(IDirect3DRMTexture *iface, D3DVALUE width, D3DVALUE height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, width %.8e, height %.8e stub!\n", iface, width, height); + + return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalOrigin(IDirect3DRMTexture *iface, LONG x, LONG y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, x %d, y %d.\n", iface, x, y); + + return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalScale(IDirect3DRMTexture *iface, DWORD scale) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, scale %u.\n", iface, scale); + + return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalTransparency(IDirect3DRMTexture *iface, BOOL transparency) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, transparency %#x.\n", iface, transparency); + + return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency); +} + +static HRESULT WINAPI d3drm_texture1_SetDecalTransparentColor(IDirect3DRMTexture *iface, D3DCOLOR color) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, color 0x%08x.\n", iface, color); + + return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color); +} + +static HRESULT WINAPI d3drm_texture1_GetDecalSize(IDirect3DRMTexture *iface, D3DVALUE *width, D3DVALUE *height) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, width %p, height %p.\n", iface, width, height); + + return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); +} + +static HRESULT WINAPI d3drm_texture1_GetDecalOrigin(IDirect3DRMTexture *iface, LONG *x, LONG *y) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p, x %p, y %p.\n", iface, x, y); + + return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); +} + +static D3DRMIMAGE * WINAPI d3drm_texture1_GetImage(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture1_GetShades(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture1_GetColors(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface); +} + +static DWORD WINAPI d3drm_texture1_GetDecalScale(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface); +} + +static BOOL WINAPI d3drm_texture1_GetDecalTransparency(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface); +} + +static D3DCOLOR WINAPI d3drm_texture1_GetDecalTransparentColor(IDirect3DRMTexture *iface) +{ + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface); +} + +static const struct IDirect3DRMTextureVtbl d3drm_texture1_vtbl = +{ + d3drm_texture1_QueryInterface, + d3drm_texture1_AddRef, + d3drm_texture1_Release, + d3drm_texture1_Clone, + d3drm_texture1_AddDestroyCallback, + d3drm_texture1_DeleteDestroyCallback, + d3drm_texture1_SetAppData, + d3drm_texture1_GetAppData, + d3drm_texture1_SetName, + d3drm_texture1_GetName, + d3drm_texture1_GetClassName, + d3drm_texture1_InitFromFile, + d3drm_texture1_InitFromSurface, + d3drm_texture1_InitFromResource, + d3drm_texture1_Changed, + d3drm_texture1_SetColors, + d3drm_texture1_SetShades, + d3drm_texture1_SetDecalSize, + d3drm_texture1_SetDecalOrigin, + d3drm_texture1_SetDecalScale, + d3drm_texture1_SetDecalTransparency, + d3drm_texture1_SetDecalTransparentColor, + d3drm_texture1_GetDecalSize, + d3drm_texture1_GetDecalOrigin, + d3drm_texture1_GetImage, + d3drm_texture1_GetShades, + d3drm_texture1_GetColors, + d3drm_texture1_GetDecalScale, + d3drm_texture1_GetDecalTransparency, + d3drm_texture1_GetDecalTransparentColor, +}; + static HRESULT WINAPI d3drm_texture2_QueryInterface(IDirect3DRMTexture2 *iface, REFIID riid, void **out) { struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - if (IsEqualGUID(riid, &IID_IDirect3DRMTexture2) - || IsEqualGUID(riid, &IID_IDirect3DRMTexture) - || IsEqualGUID(riid, &IID_IUnknown)) - { - *out = &texture->IDirect3DRMTexture2_iface; - } - else if (IsEqualGUID(riid, &IID_IDirect3DRMTexture3)) - { - *out = &texture->IDirect3DRMTexture3_iface; - } - else - { - *out = NULL; - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - return E_NOINTERFACE; - } - - IUnknown_AddRef((IUnknown *)*out); - return S_OK; + return IDirect3DRMTexture3_QueryInterface(&texture->IDirect3DRMTexture3_iface, riid, out); } static ULONG WINAPI d3drm_texture2_AddRef(IDirect3DRMTexture2 *iface) { struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); - ULONG refcount = InterlockedIncrement(&texture->ref); - - TRACE("%p increasing refcount to %u.\n", iface, refcount); - - return refcount; + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_AddRef(&texture->IDirect3DRMTexture3_iface); } static ULONG WINAPI d3drm_texture2_Release(IDirect3DRMTexture2 *iface) { struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); - ULONG refcount = InterlockedDecrement(&texture->ref); - - TRACE("%p decreasing refcount to %u.\n", iface, refcount); - - if (!refcount) - HeapFree(GetProcessHeap(), 0, texture); - - return refcount; + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_Release(&texture->IDirect3DRMTexture3_iface); } static HRESULT WINAPI d3drm_texture2_Clone(IDirect3DRMTexture2 *iface, IUnknown *outer, REFIID iid, void **out) { - FIXME("iface %p, outer %p, iid %s, out %p stub!\n", iface, outer, debugstr_guid(iid), out); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, outer %p, iid %s, out %p.\n", iface, outer, debugstr_guid(iid), out); + + return IDirect3DRMTexture3_Clone(&texture->IDirect3DRMTexture3_iface, outer, iid, out); } static HRESULT WINAPI d3drm_texture2_AddDestroyCallback(IDirect3DRMTexture2 *iface, @@ -132,16 +413,20 @@ static HRESULT WINAPI d3drm_texture2_SetName(IDirect3DRMTexture2 *iface, const char *name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + return IDirect3DRMTexture3_SetName(&texture->IDirect3DRMTexture3_iface, name); } static HRESULT WINAPI d3drm_texture2_GetName(IDirect3DRMTexture2 *iface, DWORD *size, char *name) { - FIXME("iface %p, size %p, name %p stub!\n", iface, size, name); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, size %p, name %p.\n", iface, size, name); + + return IDirect3DRMTexture3_GetName(&texture->IDirect3DRMTexture3_iface, size, name); } static HRESULT WINAPI d3drm_texture2_GetClassName(IDirect3DRMTexture2 *iface, DWORD *size, char *name) @@ -184,107 +469,137 @@ static HRESULT WINAPI d3drm_texture2_SetColors(IDirect3DRMTexture2 *iface, DWORD max_colors) { - FIXME("iface %p, max_colors %u stub!\n", iface, max_colors); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, max_colors %u.\n", iface, max_colors); + + return IDirect3DRMTexture3_SetColors(&texture->IDirect3DRMTexture3_iface, max_colors); } static HRESULT WINAPI d3drm_texture2_SetShades(IDirect3DRMTexture2 *iface, DWORD max_shades) { - FIXME("iface %p, max_shades %u stub!\n", iface, max_shades); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, max_shades %u.\n", iface, max_shades); + + return IDirect3DRMTexture3_SetShades(&texture->IDirect3DRMTexture3_iface, max_shades); } static HRESULT WINAPI d3drm_texture2_SetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE width, D3DVALUE height) { - FIXME("iface %p, width %.8e, height %.8e stub!\n", iface, width, height); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, width %.8e, height %.8e stub!\n", iface, width, height); + + return IDirect3DRMTexture3_SetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); } static HRESULT WINAPI d3drm_texture2_SetDecalOrigin(IDirect3DRMTexture2 *iface, LONG x, LONG y) { - FIXME("iface %p, x %d, y %d stub!\n", iface, x, y); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, x %d, y %d.\n", iface, x, y); + + return IDirect3DRMTexture3_SetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); } static HRESULT WINAPI d3drm_texture2_SetDecalScale(IDirect3DRMTexture2 *iface, DWORD scale) { - FIXME("iface %p, scale %u stub!\n", iface, scale); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, scale %u.\n", iface, scale); + + return IDirect3DRMTexture3_SetDecalScale(&texture->IDirect3DRMTexture3_iface, scale); } static HRESULT WINAPI d3drm_texture2_SetDecalTransparency(IDirect3DRMTexture2 *iface, BOOL transparency) { - FIXME("iface %p, transparency %#x stub!\n", iface, transparency); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, transparency %#x.\n", iface, transparency); + + return IDirect3DRMTexture3_SetDecalTransparency(&texture->IDirect3DRMTexture3_iface, transparency); } static HRESULT WINAPI d3drm_texture2_SetDecalTransparentColor(IDirect3DRMTexture2 *iface, D3DCOLOR color) { - FIXME("iface %p, color 0x%08x stub!\n", iface, color); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, color 0x%08x.\n", iface, color); + + return IDirect3DRMTexture3_SetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface, color); } static HRESULT WINAPI d3drm_texture2_GetDecalSize(IDirect3DRMTexture2 *iface, D3DVALUE *width, D3DVALUE *height) { - FIXME("iface %p, width %p, height %p stub!\n", iface, width, height); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, width %p, height %p.\n", iface, width, height); + + return IDirect3DRMTexture3_GetDecalSize(&texture->IDirect3DRMTexture3_iface, width, height); } static HRESULT WINAPI d3drm_texture2_GetDecalOrigin(IDirect3DRMTexture2 *iface, LONG *x, LONG *y) { - FIXME("iface %p, x %p, y %p stub!\n", iface, x, y); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, x %p, y %p.\n", iface, x, y); + + return IDirect3DRMTexture3_GetDecalOrigin(&texture->IDirect3DRMTexture3_iface, x, y); } static D3DRMIMAGE * WINAPI d3drm_texture2_GetImage(IDirect3DRMTexture2 *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetImage(&texture->IDirect3DRMTexture3_iface); } static DWORD WINAPI d3drm_texture2_GetShades(IDirect3DRMTexture2 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetShades(&texture->IDirect3DRMTexture3_iface); } static DWORD WINAPI d3drm_texture2_GetColors(IDirect3DRMTexture2 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetColors(&texture->IDirect3DRMTexture3_iface); } static DWORD WINAPI d3drm_texture2_GetDecalScale(IDirect3DRMTexture2 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalScale(&texture->IDirect3DRMTexture3_iface); } static BOOL WINAPI d3drm_texture2_GetDecalTransparency(IDirect3DRMTexture2 *iface) { - FIXME("iface %p stub!\n", iface); - - return FALSE; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparency(&texture->IDirect3DRMTexture3_iface); } static D3DCOLOR WINAPI d3drm_texture2_GetDecalTransparentColor(IDirect3DRMTexture2 *iface) { - FIXME("iface %p stub!\n", iface); - - return 0; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p.\n", iface); + + return IDirect3DRMTexture3_GetDecalTransparentColor(&texture->IDirect3DRMTexture3_iface); } static HRESULT WINAPI d3drm_texture2_InitFromImage(IDirect3DRMTexture2 *iface, D3DRMIMAGE *image) @@ -305,9 +620,11 @@ static HRESULT WINAPI d3drm_texture2_GenerateMIPMap(IDirect3DRMTexture2 *iface, DWORD flags) { - FIXME("iface %p, flags %#x stub!\n", iface, flags); - - return E_NOTIMPL; + struct d3drm_texture *texture = impl_from_IDirect3DRMTexture2(iface); + + TRACE("iface %p, flags %#x.\n", iface, flags); + + return IDirect3DRMTexture3_GenerateMIPMap(&texture->IDirect3DRMTexture3_iface, flags); } static const struct IDirect3DRMTexture2Vtbl d3drm_texture2_vtbl = @@ -710,20 +1027,20 @@ HRESULT Direct3DRMTexture_create(REFIID riid, IUnknown **out) { struct d3drm_texture *object; + HRESULT hr; TRACE("riid %s, out %p.\n", debugstr_guid(riid), out); if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)))) return E_OUTOFMEMORY; + object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl; object->IDirect3DRMTexture2_iface.lpVtbl = &d3drm_texture2_vtbl; object->IDirect3DRMTexture3_iface.lpVtbl = &d3drm_texture3_vtbl; object->ref = 1; - if (IsEqualGUID(riid, &IID_IDirect3DRMTexture3)) - *out = (IUnknown *)&object->IDirect3DRMTexture3_iface; - else - *out = (IUnknown *)&object->IDirect3DRMTexture2_iface; - - return S_OK; -} + hr = IDirect3DRMTexture3_QueryInterface(&object->IDirect3DRMTexture3_iface, riid, (void **)out); + IDirect3DRMTexture3_Release(&object->IDirect3DRMTexture3_iface); + + return hr; +} Modified: trunk/reactos/dll/directx/wine/d3drm/viewport.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/wine/d3drm/vie…
============================================================================== --- trunk/reactos/dll/directx/wine/d3drm/viewport.c [iso-8859-1] (original) +++ trunk/reactos/dll/directx/wine/d3drm/viewport.c [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -298,7 +298,7 @@ { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return FALSE; } static LONG WINAPI d3drm_viewport1_GetX(IDirect3DRMViewport *iface) @@ -663,7 +663,7 @@ { FIXME("iface %p stub!\n", iface); - return E_NOTIMPL; + return FALSE; } static LONG WINAPI d3drm_viewport2_GetX(IDirect3DRMViewport2 *iface) Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Nov 24 10:43:48 2015 @@ -25,7 +25,7 @@ reactos/dll/directx/wine/d3d8 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3d9 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-1.7.55 -reactos/dll/directx/wine/d3drm # Synced to WineStaging-1.7.47 +reactos/dll/directx/wine/d3drm # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.7.47 reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.7.55
8 years, 11 months
1
0
0
0
[akhaldi] 70082: [PSDK] Update d3drmobj.h. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:40:22 2015 New Revision: 70082 URL:
http://svn.reactos.org/svn/reactos?rev=70082&view=rev
Log: [PSDK] Update d3drmobj.h. CORE-10536 Modified: trunk/reactos/include/psdk/d3drmobj.h Modified: trunk/reactos/include/psdk/d3drmobj.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/d3drmobj.h?re…
============================================================================== --- trunk/reactos/include/psdk/d3drmobj.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/d3drmobj.h [iso-8859-1] Tue Nov 24 10:40:22 2015 @@ -360,7 +360,7 @@ #undef GetClassName #endif #define INTERFACE IDirect3DRMDevice -DECLARE_INTERFACE_(IDirect3DRMDevice,IUnknown) +DECLARE_INTERFACE_(IDirect3DRMDevice,IDirect3DRMObject) { /*** IUnknown methods ***/ STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; @@ -3284,7 +3284,7 @@ #define IDirect3DRMTexture_SetDecalOrigin(p,a,b) (p)->SetDecalOrigin(a,b) #define IDirect3DRMTexture_SetDecalScale(p,a) (p)->SetDecalScale(a) #define IDirect3DRMTexture_SetDecalTransparency(p,a) (p)->SetDecalTransparency(a) -#define IDirect3DRMTexture_SetDecalTransparencyColor(p,a) (p)->SetDecalTransparentColor(a) +#define IDirect3DRMTexture_SetDecalTransparentColor(p,a) (p)->SetDecalTransparentColor(a) #define IDirect3DRMTexture_GetDecalSize(p,a,b) (p)->GetDecalSize(a,b) #define IDirect3DRMTexture_GetDecalOrigin(p,a,b) (p)->GetDecalOrigin(a,b) #define IDirect3DRMTexture_GetImage(p) (p)->GetImage() @@ -3292,7 +3292,7 @@ #define IDirect3DRMTexture_GetColors(p) (p)->GetColors() #define IDirect3DRMTexture_GetDecalScale(p) (p)->GetDecalScale() #define IDirect3DRMTexture_GetDecalTransparency(p) (p)->GetDecalTransparency() -#define IDirect3DRMTexture_GetDecalTransparencyColor(p) (p)->GetDecalTransparencyColor() +#define IDirect3DRMTexture_GetDecalTransparentColor(p) (p)->GetDecalTransparentColor() #endif /***************************************************************************** @@ -3404,7 +3404,7 @@ #define IDirect3DRMTexture2_SetDecalOrigin(p,a,b) (p)->SetDecalOrigin(a,b) #define IDirect3DRMTexture2_SetDecalScale(p,a) (p)->SetDecalScale(a) #define IDirect3DRMTexture2_SetDecalTransparency(p,a) (p)->SetDecalTransparency(a) -#define IDirect3DRMTexture2_SetDecalTransparencyColor(p,a) (p)->SetDecalTransparentColor(a) +#define IDirect3DRMTexture2_SetDecalTransparentColor(p,a) (p)->SetDecalTransparentColor(a) #define IDirect3DRMTexture2_GetDecalSize(p,a,b) (p)->GetDecalSize(a,b) #define IDirect3DRMTexture2_GetDecalOrigin(p,a,b) (p)->GetDecalOrigin(a,b) #define IDirect3DRMTexture2_GetImage(p) (p)->GetImage() @@ -3412,7 +3412,7 @@ #define IDirect3DRMTexture2_GetColors(p) (p)->GetColors() #define IDirect3DRMTexture2_GetDecalScale(p) (p)->GetDecalScale() #define IDirect3DRMTexture2_GetDecalTransparency(p) (p)->GetDecalTransparency() -#define IDirect3DRMTexture2_GetDecalTransparencyColor(p) (p)->GetDecalTransparencyColor() +#define IDirect3DRMTexture2_GetDecalTransparentColor(p) (p)->GetDecalTransparentColor() /*** IDirect3DRMTexture2 methods ***/ #define IDirect3DRMTexture2_InitFromImage(p,a) (p)->InitFromImage(a) #define IDirect3DRMTexture2_InitFromResource2(p,a,b,c) (p)->InitFromResource2(a,b,c) @@ -3494,7 +3494,7 @@ #define IDirect3DRMTexture3_SetDecalOrigin(p,a,b) (p)->lpVtbl->SetDecalOrigin(p,a,b) #define IDirect3DRMTexture3_SetDecalScale(p,a) (p)->lpVtbl->SetDecalScale(p,a) #define IDirect3DRMTexture3_SetDecalTransparency(p,a) (p)->lpVtbl->SetDecalTransparency(p,a) -#define IDirect3DRMTexture3_SetDecalTransparencyColor(p,a) (p)->lpVtbl->SetDecalTransparentColor(p,a) +#define IDirect3DRMTexture3_SetDecalTransparentColor(p,a) (p)->lpVtbl->SetDecalTransparentColor(p,a) #define IDirect3DRMTexture3_GetDecalSize(p,a,b) (p)->lpVtbl->GetDecalSize(p,a,b) #define IDirect3DRMTexture3_GetDecalOrigin(p,a,b) (p)->lpVtbl->GetDecalOrigin(p,a,b) #define IDirect3DRMTexture3_GetImage(p) (p)->lpVtbl->GetImage(p) @@ -3502,7 +3502,7 @@ #define IDirect3DRMTexture3_GetColors(p) (p)->lpVtbl->GetColors(p) #define IDirect3DRMTexture3_GetDecalScale(p) (p)->lpVtbl->GetDecalScale(p) #define IDirect3DRMTexture3_GetDecalTransparency(p) (p)->lpVtbl->GetDecalTransparency(p) -#define IDirect3DRMTexture3_GetDecalTransparencyColor(p) (p)->lpVtbl->GetDecalTransparencyColor(p) +#define IDirect3DRMTexture3_GetDecalTransparentColor(p) (p)->lpVtbl->GetDecalTransparentColor(p) #define IDirect3DRMTexture3_InitFromImage(p,a) (p)->lpVtbl->InitFromImage(p,a) #define IDirect3DRMTexture3_InitFromResource2(p,a,b,c) (p)->lpVtbl->InitFromResource2(p,a,b,c) #define IDirect3DRMTexture3_GenerateMIPMap(p,a) (p)->lpVtbl->GenerateMIPMap(p,a)
8 years, 11 months
1
0
0
0
[akhaldi] 70081: [COMCTL32_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:38:33 2015 New Revision: 70081 URL:
http://svn.reactos.org/svn/reactos?rev=70081&view=rev
Log: [COMCTL32_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536 Modified: trunk/rostests/winetests/comctl32/imagelist.c trunk/rostests/winetests/comctl32/listview.c trunk/rostests/winetests/comctl32/misc.c trunk/rostests/winetests/comctl32/propsheet.c trunk/rostests/winetests/comctl32/status.c trunk/rostests/winetests/comctl32/toolbar.c trunk/rostests/winetests/comctl32/treeview.c trunk/rostests/winetests/comctl32/v6util.h Modified: trunk/rostests/winetests/comctl32/imagelist.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/imagel…
============================================================================== --- trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/imagelist.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -1258,7 +1258,7 @@ static void test_shell_imagelist(void) { - BOOL (WINAPI *pSHGetImageList)(INT, REFIID, void**); + HRESULT (WINAPI *pSHGetImageList)(INT, REFIID, void**); IImageList *iml = NULL; HMODULE hShell32; HRESULT hr; @@ -1278,8 +1278,7 @@ } /* Get system image list */ - hr = (pSHGetImageList)(SHIL_SYSSMALL, &IID_IImageList, (void**)&iml); - + hr = pSHGetImageList(SHIL_SYSSMALL, &IID_IImageList, (void**)&iml); ok(SUCCEEDED(hr), "SHGetImageList failed, hr=%x\n", hr); if (hr != S_OK) { Modified: trunk/rostests/winetests/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/listvi…
============================================================================== --- trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/listview.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -5345,6 +5345,7 @@ flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ITEMCHANGINGW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); parent_header_notify_seq[0].id = HDN_ITEMCHANGINGA; ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, "header notify, parent", TRUE); @@ -5353,6 +5354,7 @@ flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ITEMCHANGEDW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); parent_header_notify_seq[0].id = HDN_ITEMCHANGEDA; ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, "header notify, parent", TRUE); @@ -5363,30 +5365,35 @@ flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ITEMCLICKW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_click_seq, "header notify, parent", FALSE); ok(nmhdr.hdr.code == HDN_ITEMCLICKA, "Expected ANSI notification code\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ITEMDBLCLICKW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); ok(nmhdr.hdr.code == HDN_ITEMDBLCLICKW, "Expected Unicode notification code\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_DIVIDERDBLCLICKW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_divider_dclick_seq, "header notify, parent", TRUE); ok(nmhdr.hdr.code == HDN_DIVIDERDBLCLICKA, "Expected ANSI notification code\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_BEGINTRACKW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); ok(nmhdr.hdr.code == HDN_BEGINTRACKW, "Expected Unicode notification code\n"); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ENDTRACKW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); parent_header_notify_seq[0].id = HDN_ENDTRACKA; ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, "header notify, parent", FALSE); @@ -5394,6 +5401,7 @@ flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_TRACKW; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); parent_header_notify_seq[0].id = HDN_TRACKA; ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, "header notify, parent", FALSE); @@ -5401,17 +5409,20 @@ flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_BEGINDRAG; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 1, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ENDDRAG; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); parent_header_notify_seq[0].id = HDN_ENDDRAG; ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, "header notify, parent", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_FILTERCHANGE; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); parent_header_notify_seq[0].id = HDN_FILTERCHANGE; parent_header_notify_seq[0].flags |= optional; /* NT4 does not send this message */ ok_sequence(sequences, PARENT_SEQ_INDEX, parent_header_notify_seq, @@ -5420,21 +5431,25 @@ flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_BEGINFILTEREDIT; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ENDFILTEREDIT; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ITEMSTATEICONCLICK; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); nmhdr.hdr.code = HDN_ITEMKEYDOWN; ret = SendMessageW(list, WM_NOTIFY, 0, (LPARAM)&nmhdr); + ok(ret == 0, "got %d\n", ret); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_seq, "header notify, parent", FALSE); @@ -5745,6 +5760,76 @@ ok(proc1 == proc2, "got %p, expected %p\n", proc1, proc2); DestroyWindow(hdr); + DestroyWindow(hwnd); +} + +static void flush_events(void) +{ + MSG msg; + int diff = 200; + int min_timeout = 100; + DWORD time = GetTickCount() + diff; + + while (diff > 0) + { + if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break; + while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg ); + diff = time - GetTickCount(); + } +} + +static void test_oneclickactivate(void) +{ + TRACKMOUSEEVENT track; + char item1[] = "item1"; + LVITEMA item; + HWND hwnd, fg; + RECT rect; + INT r; + + hwnd = CreateWindowExA(0, "SysListView32", "foo", WS_VISIBLE|WS_CHILD|LVS_LIST, + 10, 10, 100, 200, hwndparent, NULL, NULL, NULL); + ok(hwnd != NULL, "failed to create listview window\n"); + r = SendMessageA(hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_ONECLICKACTIVATE); + ok(r == 0, "should return zero\n"); + + SetForegroundWindow(hwndparent); + flush_events(); + fg = GetForegroundWindow(); + if (fg != hwndparent) + { + skip("Window is not in the foreground. Skipping oneclickactivate tests.\n"); + DestroyWindow(hwnd); + return; + } + + item.mask = LVIF_TEXT; + item.iItem = 0; + item.iSubItem = 0; + item.iImage = 0; + item.pszText = item1; + r = SendMessageA(hwnd, LVM_INSERTITEMA, 0, (LPARAM) &item); + ok(r == 0, "should not fail\n"); + + GetWindowRect(hwnd, &rect); + SetCursorPos(rect.left+5, rect.top+5); + flush_events(); + r = SendMessageA(hwnd, WM_MOUSEMOVE, MAKELONG(1, 1), 0); + expect(0, r); + + track.cbSize = sizeof(track); + track.dwFlags = TME_QUERY; + _TrackMouseEvent(&track); + ok(track.hwndTrack == hwnd, "hwndTrack != hwnd\n"); + ok(track.dwFlags == TME_LEAVE, "dwFlags = %x\n", track.dwFlags); + + r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + expect(0, r); + r = SendMessageA(hwnd, WM_MOUSEHOVER, MAKELONG(1, 1), 0); + expect(0, r); + r = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0); + expect(1, r); + DestroyWindow(hwnd); } @@ -5817,6 +5902,7 @@ test_deleteitem(); test_insertitem(); test_header_proc(); + test_oneclickactivate(); if (!load_v6_module(&ctx_cookie, &hCtx)) { Modified: trunk/rostests/winetests/comctl32/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/misc.c…
============================================================================== --- trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/misc.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -37,9 +37,19 @@ static INT (WINAPI * pStr_GetPtrW)(LPCWSTR, LPWSTR, INT); static BOOL (WINAPI * pStr_SetPtrW)(LPWSTR, LPCWSTR); -static HRESULT (WINAPI * LoadIconMetric)(HINSTANCE, PCWSTR, INT, HICON*); - static HMODULE hComctl32 = 0; + +static char testicon_data[] = +{ + 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x02, 0x02, 0x00, 0x00, 0x01, 0x00, + 0x20, 0x00, 0x40, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x0b, + 0x00, 0x00, 0x12, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xde, 0xde, 0xde, 0xff, 0xde, 0xde, 0xde, 0xff, 0xde, 0xde, + 0xde, 0xff, 0xde, 0xde, 0xde, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 +}; #define COMCTL32_GET_PROC(ordinal, func) \ p ## func = (void*)GetProcAddress(hComctl32, (LPSTR)ordinal); \ @@ -215,90 +225,148 @@ ok(ptr == ptr2, "got wrong pointer for ordinal 345, %p expected %p\n", ptr2, ptr); } -static void test_LoadIconMetric(void) -{ - static const WCHAR nonExistingFile[] = {'d','o','e','s','n','o','t','e','x','i','s','t','.','i','c','o','\0'}; - HINSTANCE hinst; +static void test_LoadIconWithScaleDown(void) +{ + static const WCHAR nonexisting_fileW[] = {'n','o','n','e','x','i','s','t','i','n','g','.','i','c','o',0}; + static const WCHAR nonexisting_resourceW[] = {'N','o','n','e','x','i','s','t','i','n','g',0}; + static const WCHAR prefixW[] = {'I','C','O',0}; + HRESULT (WINAPI *pLoadIconMetric)(HINSTANCE, const WCHAR *, int, HICON *); + HRESULT (WINAPI *pLoadIconWithScaleDown)(HINSTANCE, const WCHAR *, int, int, HICON *); + WCHAR tmp_path[MAX_PATH], icon_path[MAX_PATH]; + ICONINFO info; + HMODULE hinst; + HANDLE handle; + DWORD written; + HRESULT hr; + BITMAP bmp; + HICON icon; void *ptr; - HICON icon; - HRESULT result; - ICONINFO info; + int bytes; BOOL res; - INT bytes; - BITMAP bmp; hinst = LoadLibraryA("comctl32.dll"); - - LoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric"); - if (!LoadIconMetric) + pLoadIconMetric = (void *)GetProcAddress(hinst, "LoadIconMetric"); + pLoadIconWithScaleDown = (void *)GetProcAddress(hinst, "LoadIconWithScaleDown"); + if (!pLoadIconMetric || !pLoadIconWithScaleDown) { #ifdef __REACTOS__ - /* Skipped on 2k3 */ - skip("TaskDialogIndirect not exported by name\n"); + skip("LoadIconMetric or pLoadIconWithScaleDown not exported by name\n"); #else - win_skip("LoadIconMetric not exported by name\n"); + win_skip("LoadIconMetric or pLoadIconWithScaleDown not exported by name\n"); #endif + FreeLibrary(hinst); return; } - ptr = GetProcAddress(hinst, (const CHAR*)380); - ok(ptr == LoadIconMetric, "got wrong pointer for ordinal 380, %p expected %p\n", - ptr, LoadIconMetric); - - result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_SMALL, &icon); - ok(result == S_OK, "Expected S_OK, got %x\n", result); - if (result == S_OK) - { - res = GetIconInfo(icon, &info); - ok(res, "Failed to get icon info\n"); - if (res && info.hbmColor) - { - bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); - ok(bytes > 0, "Failed to get bitmap info for icon\n"); - if (bytes > 0) - { - ok(bmp.bmWidth == GetSystemMetrics( SM_CXSMICON ), "Wrong icon width\n"); - ok(bmp.bmHeight == GetSystemMetrics( SM_CYSMICON ), "Wrong icon height\n"); - } - } - DestroyIcon(icon); - } - - result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, LIM_LARGE, &icon); - ok(result == S_OK, "Expected S_OK, got %x\n", result); - if (result == S_OK) - { - res = GetIconInfo(icon, &info); - ok(res, "Failed to get icon info\n"); - if (res && info.hbmColor) - { - bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); - ok(bytes > 0, "Failed to get bitmap info for icon\n"); - if (bytes > 0) - { - ok(bmp.bmWidth == GetSystemMetrics( SM_CXICON ), "Wrong icon width\n"); - ok(bmp.bmHeight == GetSystemMetrics( SM_CYICON ), "Wrong icon height\n"); - } - } - DestroyIcon(icon); - } - - result = LoadIconMetric(NULL, (PCWSTR)IDI_APPLICATION, 0x100, &icon); - ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result); - if (result == S_OK) DestroyIcon(icon); - + GetTempPathW(MAX_PATH, tmp_path); + GetTempFileNameW(tmp_path, prefixW, 0, icon_path); + handle = CreateFileW(icon_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + ok(handle != INVALID_HANDLE_VALUE, "CreateFileW failed with error %u\n", GetLastError()); + res = WriteFile(handle, testicon_data, sizeof(testicon_data), &written, NULL); + ok(res && written == sizeof(testicon_data), "Failed to write icon file\n"); + CloseHandle(handle); + + /* test ordinals */ + ptr = GetProcAddress(hinst, (const char *)380); + ok(ptr == pLoadIconMetric, + "got wrong pointer for ordinal 380, %p expected %p\n", ptr, pLoadIconMetric); + + ptr = GetProcAddress(hinst, (const char *)381); + ok(ptr == pLoadIconWithScaleDown, + "got wrong pointer for ordinal 381, %p expected %p\n", ptr, pLoadIconWithScaleDown); + + /* invalid arguments */ icon = (HICON)0x1234; - result = LoadIconMetric(NULL, NULL, LIM_LARGE, &icon); - ok(result == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", result); - ok(icon == (HICON)0, "Expected 0x0, got %p\n", icon); - if (result == S_OK) DestroyIcon(icon); - - result = LoadIconMetric(NULL, nonExistingFile, LIM_LARGE, &icon); - ok(result == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), - "Expected 80070715, got %x\n", result); - if (result == S_OK) DestroyIcon(icon); -} - + hr = pLoadIconMetric(NULL, (LPWSTR)IDI_APPLICATION, 0x100, &icon); + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", hr); + ok(icon == NULL, "Expected NULL, got %p\n", icon); + + icon = (HICON)0x1234; + hr = pLoadIconMetric(NULL, NULL, LIM_LARGE, &icon); + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", hr); + ok(icon == NULL, "Expected NULL, got %p\n", icon); + + icon = (HICON)0x1234; + hr = pLoadIconWithScaleDown(NULL, NULL, 32, 32, &icon); + ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %x\n", hr); + ok(icon == NULL, "Expected NULL, got %p\n", icon); + + /* non-existing filename */ + hr = pLoadIconMetric(NULL, nonexisting_fileW, LIM_LARGE, &icon); + todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), + "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); + + hr = pLoadIconWithScaleDown(NULL, nonexisting_fileW, 32, 32, &icon); + todo_wine + ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), + "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); + + /* non-existing resource name */ + hr = pLoadIconMetric(hinst, nonexisting_resourceW, LIM_LARGE, &icon); + ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), + "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); + + hr = pLoadIconWithScaleDown(hinst, nonexisting_resourceW, 32, 32, &icon); + ok(hr == HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), + "Expected HRESULT_FROM_WIN32(ERROR_RESOURCE_TYPE_NOT_FOUND), got %x\n", hr); + + /* load icon using predefined identifier */ + hr = pLoadIconMetric(NULL, (LPWSTR)IDI_APPLICATION, LIM_SMALL, &icon); + ok(hr == S_OK, "Expected S_OK, got %x\n", hr); + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info, error %u\n", GetLastError()); + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + ok(bmp.bmWidth == GetSystemMetrics(SM_CXSMICON), "Wrong icon width %d\n", bmp.bmWidth); + ok(bmp.bmHeight == GetSystemMetrics(SM_CYSMICON), "Wrong icon height %d\n", bmp.bmHeight); + DestroyIcon(icon); + + hr = pLoadIconMetric(NULL, (LPWSTR)IDI_APPLICATION, LIM_LARGE, &icon); + ok(hr == S_OK, "Expected S_OK, got %x\n", hr); + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info, error %u\n", GetLastError()); + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + ok(bmp.bmWidth == GetSystemMetrics(SM_CXICON), "Wrong icon width %d\n", bmp.bmWidth); + ok(bmp.bmHeight == GetSystemMetrics(SM_CYICON), "Wrong icon height %d\n", bmp.bmHeight); + DestroyIcon(icon); + + hr = pLoadIconWithScaleDown(NULL, (LPWSTR)IDI_APPLICATION, 42, 42, &icon); + ok(hr == S_OK, "Expected S_OK, got %x\n", hr); + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info, error %u\n", GetLastError()); + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + ok(bmp.bmWidth == 42, "Wrong icon width %d\n", bmp.bmWidth); + ok(bmp.bmHeight == 42, "Wrong icon height %d\n", bmp.bmHeight); + DestroyIcon(icon); + + /* load icon from file */ + hr = pLoadIconMetric(NULL, icon_path, LIM_SMALL, &icon); + ok(hr == S_OK, "Expected S_OK, got %x\n", hr); + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info, error %u\n", GetLastError()); + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + ok(bmp.bmWidth == GetSystemMetrics(SM_CXSMICON), "Wrong icon width %d\n", bmp.bmWidth); + ok(bmp.bmHeight == GetSystemMetrics(SM_CYSMICON), "Wrong icon height %d\n", bmp.bmHeight); + DestroyIcon(icon); + + hr = pLoadIconWithScaleDown(NULL, icon_path, 42, 42, &icon); + ok(hr == S_OK, "Expected S_OK, got %x\n", hr); + res = GetIconInfo(icon, &info); + ok(res, "Failed to get icon info, error %u\n", GetLastError()); + bytes = GetObjectA(info.hbmColor, sizeof(bmp), &bmp); + ok(bytes > 0, "Failed to get bitmap info for icon\n"); + ok(bmp.bmWidth == 42, "Wrong icon width %d\n", bmp.bmWidth); + ok(bmp.bmHeight == 42, "Wrong icon height %d\n", bmp.bmHeight); + DestroyIcon(icon); + + DeleteFileW(icon_path); + FreeLibrary(hinst); +} START_TEST(misc) { @@ -315,7 +383,7 @@ return; test_TaskDialogIndirect(); - test_LoadIconMetric(); + test_LoadIconWithScaleDown(); unload_v6_module(ctx_cookie, hCtx); } Modified: trunk/rostests/winetests/comctl32/propsheet.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/propsh…
============================================================================== --- trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/propsheet.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -303,7 +303,7 @@ CBT_CREATEWNDW *c = (CBT_CREATEWNDW *)lp; /* The first dialog created will be the parent dialog */ - if (!done && c->lpcs->lpszClass == MAKEINTRESOURCEW(WC_DIALOG)) + if (!done && c->lpcs->lpszClass == (LPWSTR)WC_DIALOG) { old_nav_dialog_proc = (WNDPROC)SetWindowLongPtrW( (HWND)wp, GWLP_WNDPROC, (LONG_PTR)new_nav_dialog_proc ); done = TRUE; @@ -809,7 +809,7 @@ psp.pfnDlgProc = page_dlg_proc_messages; psp.lParam = 0; - /* two page with the same data */ + /* multiple pages with the same data */ hpsp[0] = CreatePropertySheetPageA(&psp); hpsp[1] = CreatePropertySheetPageA(&psp); hpsp[2] = CreatePropertySheetPageA(&psp); @@ -872,6 +872,100 @@ /* test PSP_PREMATURE flag with incorrect property sheet page */ ret = SendMessageA(hdlg, PSM_ADDPAGE, 0, (LPARAM)hpsp[4]); + ok(ret == FALSE, "got %d\n", ret); + + r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); + ok(r == 3, "got %d\n", r); + + DestroyPropertySheetPage(hpsp[4]); + DestroyWindow(hdlg); +} + +static void test_PSM_INSERTPAGE(void) +{ + HPROPSHEETPAGE hpsp[5]; + PROPSHEETPAGEA psp; + PROPSHEETHEADERA psh; + HWND hdlg, tab; + BOOL ret; + DWORD r; + + memset(&psp, 0, sizeof(psp)); + psp.dwSize = sizeof(psp); + psp.dwFlags = 0; + psp.hInstance = GetModuleHandleA(NULL); + U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_MESSAGE_TEST); + U2(psp).pszIcon = NULL; + psp.pfnDlgProc = page_dlg_proc_messages; + psp.lParam = 0; + + /* multiple pages with the same data */ + hpsp[0] = CreatePropertySheetPageA(&psp); + hpsp[1] = CreatePropertySheetPageA(&psp); + hpsp[2] = CreatePropertySheetPageA(&psp); + + U(psp).pszTemplate = (LPCSTR)MAKEINTRESOURCE(IDD_PROP_PAGE_ERROR); + hpsp[3] = CreatePropertySheetPageA(&psp); + + psp.dwFlags = PSP_PREMATURE; + hpsp[4] = CreatePropertySheetPageA(&psp); + + memset(&psh, 0, sizeof(psh)); + psh.dwSize = PROPSHEETHEADERA_V1_SIZE; + psh.dwFlags = PSH_MODELESS; + psh.pszCaption = "test caption"; + psh.nPages = 1; + psh.hwndParent = GetDesktopWindow(); + U3(psh).phpage = hpsp; + + hdlg = (HWND)PropertySheetA(&psh); + ok(hdlg != INVALID_HANDLE_VALUE, "got invalid handle %p\n", hdlg); + + /* add pages one by one */ + ret = SendMessageA(hdlg, PSM_INSERTPAGE, 5, (LPARAM)hpsp[1]); + ok(ret == TRUE, "got %d\n", ret); + + /* try with invalid values */ + ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, 0); + ok(ret == FALSE, "got %d\n", ret); + +if (0) +{ + /* crashes on native */ + ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)INVALID_HANDLE_VALUE); +} + + ret = SendMessageA(hdlg, PSM_INSERTPAGE, (LPARAM)INVALID_HANDLE_VALUE, (LPARAM)hpsp[2]); + ok(ret == FALSE, "got %d\n", ret); + + /* check item count */ + tab = (HWND)SendMessageA(hdlg, PSM_GETTABCONTROL, 0, 0); + + r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); + ok(r == 2, "got %d\n", r); + + ret = SendMessageA(hdlg, PSM_INSERTPAGE, (WPARAM)hpsp[1], (LPARAM)hpsp[2]); + ok(ret == TRUE, "got %d\n", ret); + + r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); + ok(r == 3, "got %d\n", r); + + /* add property sheet page that can't be created */ + ret = SendMessageA(hdlg, PSM_INSERTPAGE, 1, (LPARAM)hpsp[3]); + ok(ret == TRUE, "got %d\n", ret); + + r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); + ok(r == 4, "got %d\n", r); + + /* select page that can't be created */ + ret = SendMessageA(hdlg, PSM_SETCURSEL, 1, 0); + ok(ret == TRUE, "got %d\n", ret); + + r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); + ok(r == 3, "got %d\n", r); + + /* test PSP_PREMATURE flag with incorrect property sheet page */ + ret = SendMessageA(hdlg, PSM_INSERTPAGE, 0, (LPARAM)hpsp[4]); ok(ret == FALSE, "got %d\n", ret); r = SendMessageA(tab, TCM_GETITEMCOUNT, 0, 0); @@ -891,4 +985,5 @@ test_custom_default_button(); test_messages(); test_PSM_ADDPAGE(); -} + test_PSM_INSERTPAGE(); +} Modified: trunk/rostests/winetests/comctl32/status.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/status…
============================================================================== --- trunk/rostests/winetests/comctl32/status.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/status.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -346,6 +346,7 @@ r = SendMessageA(hWndStatus, SB_SETTEXTA, 0, (LPARAM)chstr); expect(TRUE,r); r = SendMessageA(hWndStatus, SB_GETTEXTA, 0, (LPARAM)charArray); + ok(r == strlen(charArray), "got %d\n", r); /* substitution with single space */ if (ch > 0x00 && ch < 0x20 && ch != '\t') chstr[5] = ' '; Modified: trunk/rostests/winetests/comctl32/toolbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/toolba…
============================================================================== --- trunk/rostests/winetests/comctl32/toolbar.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/toolbar.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -1536,7 +1536,6 @@ /* Single non-BTNS_AUTOSIZE button with string with TBSTYLE_EX_MIXEDBUTTONS set. */ rebuild_toolbar(&hToolbar); SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS); - style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0); ok(SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons4[1]) == 1, "TB_ADDBUTTONSA failed\n"); ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(40, 20)) == 1, "TB_SETBUTTONSIZE failed\n"); SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 ); @@ -1545,7 +1544,6 @@ /* Single non-BTNS_AUTOSIZE, BTNS_SHOWTEXT button with string with TBSTYLE_EX_MIXEDBUTTONS set. */ rebuild_toolbar(&hToolbar); SendMessageA(hToolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS); - style = SendMessageA(hToolbar, TB_GETSTYLE, 0, 0); ok(SendMessageA(hToolbar, TB_ADDBUTTONSA, 1, (LPARAM)&buttons4[2]) == 1, "TB_ADDBUTTONSA failed\n"); ok(SendMessageA(hToolbar, TB_SETBUTTONSIZE, 0, MAKELPARAM(40, 20)) == 1, "TB_SETBUTTONSIZE failed\n"); SendMessageA(hToolbar, TB_AUTOSIZE, 0, 0 ); Modified: trunk/rostests/winetests/comctl32/treeview.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/treevi…
============================================================================== --- trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/treeview.c [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -904,6 +904,13 @@ ret = SendMessageA(hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot); expect(TRUE, ret); ok(tviRoot.state == TVIS_FOCUSED, "got state 0x%0x\n", tviRoot.state); + + /* invalid item pointer, nt4 crashes here but later versions just return 0 */ + tviRoot.hItem = (HTREEITEM)0xdeadbeef; + tviRoot.mask = TVIF_STATE; + tviRoot.state = 0; + ret = SendMessageA(hTree2, TVM_GETITEMA, 0, (LPARAM)&tviRoot); + expect(FALSE, ret); DestroyWindow(hTree); DestroyWindow(hTree2); Modified: trunk/rostests/winetests/comctl32/v6util.h URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comctl32/v6util…
============================================================================== --- trunk/rostests/winetests/comctl32/v6util.h [iso-8859-1] (original) +++ trunk/rostests/winetests/comctl32/v6util.h [iso-8859-1] Tue Nov 24 10:38:33 2015 @@ -26,6 +26,10 @@ #define ARCH "x86" #elif defined __x86_64__ #define ARCH "amd64" +#elif defined __arm__ +#define ARCH "arm" +#elif defined __aarch64__ +#define ARCH "arm64" #else #define ARCH "none" #endif
8 years, 11 months
1
0
0
0
[akhaldi] 70080: [COMCTL32] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:36:57 2015 New Revision: 70080 URL:
http://svn.reactos.org/svn/reactos?rev=70080&view=rev
Log: [COMCTL32] Sync with Wine Staging 1.7.55. CORE-10536 Removed: trunk/reactos/dll/win32/comctl32/icon.c Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt trunk/reactos/dll/win32/comctl32/commctrl.c trunk/reactos/dll/win32/comctl32/imagelist.c trunk/reactos/dll/win32/comctl32/listview.c trunk/reactos/dll/win32/comctl32/propsheet.c trunk/reactos/dll/win32/comctl32/rebar.c trunk/reactos/dll/win32/comctl32/syslink.c trunk/reactos/dll/win32/comctl32/theme_button.c trunk/reactos/dll/win32/comctl32/toolbar.c trunk/reactos/dll/win32/comctl32/treeview.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/CMakeLi…
============================================================================== --- trunk/reactos/dll/win32/comctl32/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/CMakeLists.txt [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -22,7 +22,6 @@ flatsb.c header.c hotkey.c - icon.c imagelist.c ipaddress.c listview.c Modified: trunk/reactos/dll/win32/comctl32/commctrl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctr…
============================================================================== --- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -3,6 +3,7 @@ * * Copyright 1997 Dimitrie O. Paun * Copyright 1998,2000 Eric Kohl + * Copyright 2014-2015 Michael Müller * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1811,10 +1812,49 @@ /*********************************************************************** * LoadIconWithScaleDown [COMCTL32.@] */ -HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR name, int cx, int cy, HICON *icon) -{ - FIXME("stub: %p %s %d %d %p\n", hinst, wine_dbgstr_w(name), cx, cy, icon); - return E_NOTIMPL; +HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, const WCHAR *name, int cx, int cy, HICON *icon) +{ + TRACE("(%p, %s, %d, %d, %p)\n", hinst, debugstr_w(name), cx, cy, icon); + + *icon = NULL; + + if (!name) + return E_INVALIDARG; + + *icon = LoadImageW(hinst, name, IMAGE_ICON, cx, cy, + (hinst || IS_INTRESOURCE(name)) ? 0 : LR_LOADFROMFILE); + if (!*icon) + return HRESULT_FROM_WIN32(GetLastError()); + + return S_OK; +} + +/*********************************************************************** + * LoadIconMetric [COMCTL32.@] + */ +HRESULT WINAPI LoadIconMetric(HINSTANCE hinst, const WCHAR *name, int size, HICON *icon) +{ + int cx, cy; + + TRACE("(%p, %s, %d, %p)\n", hinst, debugstr_w(name), size, icon); + + if (size == LIM_SMALL) + { + cx = GetSystemMetrics(SM_CXSMICON); + cy = GetSystemMetrics(SM_CYSMICON); + } + else if (size == LIM_LARGE) + { + cx = GetSystemMetrics(SM_CXICON); + cy = GetSystemMetrics(SM_CYICON); + } + else + { + *icon = NULL; + return E_INVALIDARG; + } + + return LoadIconWithScaleDown(hinst, name, cx, cy, icon); } /*********************************************************************** Removed: trunk/reactos/dll/win32/comctl32/icon.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/icon.c?…
============================================================================== --- trunk/reactos/dll/win32/comctl32/icon.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/icon.c (removed) @@ -1,59 +0,0 @@ -/* - * Comctl32 Icon functions - * - * Copyright 2014 Michael Müller - * - * 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 "comctl32.h" - -WINE_DEFAULT_DEBUG_CHANNEL(commctrl); - -HRESULT WINAPI -LoadIconMetric (HINSTANCE hinst, PCWSTR name, INT size, HICON *icon) -{ - INT width, height; - - TRACE("(%p %s %d %p)\n", hinst, debugstr_w(name), size, icon); - - if (!icon) - return E_INVALIDARG; - - /* windows sets it to zero in a case of failure */ - *icon = NULL; - - if (!name) - return E_INVALIDARG; - - if (size == LIM_SMALL) - { - width = GetSystemMetrics( SM_CXSMICON ); - height = GetSystemMetrics( SM_CYSMICON ); - } - else if (size == LIM_LARGE) - { - width = GetSystemMetrics( SM_CXICON ); - height = GetSystemMetrics( SM_CYICON ); - } - else - return E_INVALIDARG; - - *icon = LoadImageW( hinst, name, IMAGE_ICON, width, height, LR_SHARED ); - if (*icon) - return S_OK; - - return HRESULT_FROM_WIN32(GetLastError()); -} Modified: trunk/reactos/dll/win32/comctl32/imagelist.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/imageli…
============================================================================== --- trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/imagelist.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -3615,7 +3615,7 @@ IUnknown *punk, int iDrag, int dxHotspot, int dyHotspot) { IImageList *iml2 = NULL; - HRESULT ret; + BOOL ret; if (!punk) return E_FAIL; Modified: trunk/reactos/dll/win32/comctl32/listview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
============================================================================== --- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -63,9 +63,9 @@ * -- if list is sorted by item text LISTVIEW_InsertItemT could use * binary search to calculate item index (e.g. DPA_Search()). * This requires sorted state to be reliably tracked in item modifiers. - * -- we should keep an ordered array of coordinates in iconic mode - * this would allow to frame items (iterator_frameditems), - * and find nearest item (LVFI_NEARESTXY) a lot more efficiently + * -- we should keep an ordered array of coordinates in iconic mode. + * This would allow framing items (iterator_frameditems), + * and finding the nearest item (LVFI_NEARESTXY) a lot more efficiently. * * Flags * -- LVIF_COLUMNS @@ -571,7 +571,7 @@ int len, size = DEBUG_BUFFER_SIZE; if (pScrollInfo == NULL) return "(null)"; - len = snprintf(buf, size, "{cbSize=%d, ", pScrollInfo->cbSize); + len = snprintf(buf, size, "{cbSize=%u, ", pScrollInfo->cbSize); if (len == -1) goto end; buf += len; size -= len; if (pScrollInfo->fMask & SIF_RANGE) len = snprintf(buf, size, "nMin=%d, nMax=%d, ", pScrollInfo->nMin, pScrollInfo->nMax); @@ -4122,6 +4122,7 @@ /* see if we are supposed to be tracking mouse hovering */ if (LISTVIEW_IsHotTracking(infoPtr)) { TRACKMOUSEEVENT trackinfo; + DWORD flags; trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); trackinfo.dwFlags = TME_QUERY; @@ -4129,8 +4130,12 @@ /* see if we are already tracking this hwnd */ _TrackMouseEvent(&trackinfo); - if(!(trackinfo.dwFlags & TME_HOVER) || trackinfo.hwndTrack != infoPtr->hwndSelf) { - trackinfo.dwFlags = TME_HOVER; + flags = TME_LEAVE; + if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) + flags |= TME_HOVER; + + if((trackinfo.dwFlags & flags) != flags || trackinfo.hwndTrack != infoPtr->hwndSelf) { + trackinfo.dwFlags = flags; trackinfo.dwHoverTime = infoPtr->dwHoverTime; trackinfo.hwndTrack = infoPtr->hwndSelf; @@ -5683,11 +5688,11 @@ } /* update the other column info */ - LISTVIEW_UpdateItemSize(infoPtr); if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0) LISTVIEW_InvalidateList(infoPtr); else LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left)); + LISTVIEW_UpdateItemSize(infoPtr); return TRUE; } @@ -7855,10 +7860,18 @@ item.iItem = nItem; if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES) { - item.mask |= LVIF_STATE; - item.stateMask |= LVIS_STATEIMAGEMASK; - item.state &= ~LVIS_STATEIMAGEMASK; - item.state |= INDEXTOSTATEIMAGEMASK(1); + if (item.mask & LVIF_STATE) + { + item.stateMask |= LVIS_STATEIMAGEMASK; + item.state &= ~LVIS_STATEIMAGEMASK; + item.state |= INDEXTOSTATEIMAGEMASK(1); + } + else + { + item.mask |= LVIF_STATE; + item.stateMask = LVIS_STATEIMAGEMASK; + item.state = INDEXTOSTATEIMAGEMASK(1); + } } if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo; Modified: trunk/reactos/dll/win32/comctl32/propsheet.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propshe…
============================================================================== --- trunk/reactos/dll/win32/comctl32/propsheet.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/propsheet.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -156,6 +156,7 @@ static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo* psInfo); static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID); static BOOL PROPSHEET_RemovePage(HWND hwndDlg, int index, HPROPSHEETPAGE hpage); +static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage); static INT_PTR CALLBACK PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); @@ -2243,60 +2244,9 @@ static BOOL PROPSHEET_AddPage(HWND hwndDlg, HPROPSHEETPAGE hpage) { - PropPageInfo * ppi; PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); - HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); - TCITEMW item; - LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage; - TRACE("hpage %p\n", hpage); - /* - * Allocate and fill in a new PropPageInfo entry. - */ - ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1)); - if (!ppi) - return FALSE; - - psInfo->proppage = ppi; - if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages, FALSE)) - return FALSE; - - psInfo->proppage[psInfo->nPages].hpage = hpage; - - if (ppsp->dwFlags & PSP_PREMATURE) - { - /* Create the page but don't show it */ - if(!PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp)) - return FALSE; - } - - /* - * Add a new tab to the tab control. - */ - item.mask = TCIF_TEXT; - item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText; - item.cchTextMax = MAX_TABTEXT_LENGTH; - - if (psInfo->hImageList) - { - SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList); - } - - if ( psInfo->proppage[psInfo->nPages].hasIcon ) - { - item.mask |= TCIF_IMAGE; - item.iImage = psInfo->nPages; - } - - SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1, - (LPARAM)&item); - - psInfo->nPages++; - - /* If it is the only page - show it */ - if(psInfo->nPages == 1) - PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0); - return TRUE; + return PROPSHEET_InsertPage(hwndDlg, (HPROPSHEETPAGE)(ULONG_PTR)psInfo->nPages, hpage); } /****************************************************************************** @@ -2484,11 +2434,99 @@ */ static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter, HPROPSHEETPAGE hpage) { - if (IS_INTRESOURCE(hpageInsertAfter)) - FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter), hpage); - else - FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage); - return FALSE; + PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr); + PropPageInfo * ppi, * prev_ppi = psInfo->proppage; + HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL); + LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage; + TCITEMW item; + int index; + + TRACE("hwndDlg %p, hpageInsertAfter %p, hpage %p\n", hwndDlg, hpageInsertAfter, hpage); + + if (IS_INTRESOURCE(hpageInsertAfter)) + index = LOWORD(hpageInsertAfter); + else + { + index = PROPSHEET_GetPageIndex(hpageInsertAfter, psInfo, -1); + if (index < 0) + { + TRACE("Could not find page to insert after!\n"); + return FALSE; + } + index++; + } + + if (index > psInfo->nPages) + index = psInfo->nPages; + + /* + * Allocate a new PropPageInfo entry. + */ + ppi = Alloc(sizeof(PropPageInfo) * (psInfo->nPages + 1)); + if (!ppi) + return FALSE; + + /* + * Fill in a new PropPageInfo entry. + */ + if (index > 0) + memcpy(ppi, prev_ppi, index * sizeof(PropPageInfo)); + memset(&ppi[index], 0, sizeof(PropPageInfo)); + if (index < psInfo->nPages) + memcpy(&ppi[index + 1], &prev_ppi[index], (psInfo->nPages - index) * sizeof(PropPageInfo)); + psInfo->proppage = ppi; + + if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, index, FALSE)) + { + psInfo->proppage = prev_ppi; + Free(ppi); + return FALSE; + } + + psInfo->proppage[index].hpage = hpage; + + if (ppsp->dwFlags & PSP_PREMATURE) + { + /* Create the page but don't show it */ + if(!PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppsp)) + { + psInfo->proppage = prev_ppi; + Free(ppi); + return FALSE; + } + } + + Free(prev_ppi); + psInfo->nPages++; + if (index <= psInfo->active_page) + psInfo->active_page++; + + /* + * Add a new tab to the tab control. + */ + item.mask = TCIF_TEXT; + item.pszText = (LPWSTR) psInfo->proppage[index].pszText; + item.cchTextMax = MAX_TABTEXT_LENGTH; + + if (psInfo->hImageList) + { + SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList); + } + + if (psInfo->proppage[index].hasIcon) + { + item.mask |= TCIF_IMAGE; + item.iImage = index; + } + + SendMessageW(hwndTabControl, TCM_INSERTITEMW, index, + (LPARAM)&item); + + /* If it is the only page - show it */ + if (psInfo->nPages == 1) + PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0); + + return TRUE; } /****************************************************************************** @@ -2717,6 +2755,7 @@ MSG msg; INT ret = -1; HWND hwnd = psInfo->hwnd; + HWND parent = psInfo->ppshheader.hwndParent; while(IsWindow(hwnd) && !psInfo->ended && (ret = GetMessageW(&msg, NULL, 0, 0))) { @@ -2739,6 +2778,9 @@ if(ret != -1) ret = psInfo->result; + if(parent) + EnableWindow(parent, TRUE); + DestroyWindow(hwnd); return ret; } @@ -2765,10 +2807,7 @@ } bRet = PROPSHEET_CreateDialog(psInfo); if(!psInfo->isModeless) - { bRet = do_loop(psInfo); - if (parent) EnableWindow(parent, TRUE); - } return bRet; } Modified: trunk/reactos/dll/win32/comctl32/rebar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/rebar.c…
============================================================================== --- trunk/reactos/dll/win32/comctl32/rebar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/rebar.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -2337,7 +2337,7 @@ if (lprbbi->fMask & RBBIM_CHILDSIZE) { lprbbi->cxMinChild = lpBand->cxMinChild; lprbbi->cyMinChild = lpBand->cyMinChild; - /* to make tests pass we follow Windows behaviour and allow to read these fields only + /* to make tests pass we follow Windows' behaviour and allow reading these fields only * for RBBS_VARIABLEHEIGHTS bands */ if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE && (lpBand->fStyle & RBBS_VARIABLEHEIGHT)) { lprbbi->cyChild = lpBand->cyChild; Modified: trunk/reactos/dll/win32/comctl32/syslink.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/syslink…
============================================================================== --- trunk/reactos/dll/win32/comctl32/syslink.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/syslink.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -1377,7 +1377,7 @@ for(Current = infoPtr->Items; Current != NULL; Current = Current->Next) { if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt) && - (!MustBeEnabled || (MustBeEnabled && (Current->u.Link.state & LIS_ENABLED)))) + (!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED))) { if(LinkId != NULL) { Modified: trunk/reactos/dll/win32/comctl32/theme_button.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_b…
============================================================================== --- trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/theme_button.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -306,9 +306,6 @@ ButtonState drawState; pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ]; - if(!paint) - return FALSE; - if(IsWindowEnabled(hwnd)) { if(state & BST_PUSHED) drawState = STATE_PRESSED; @@ -319,7 +316,7 @@ else drawState = STATE_DISABLED; hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps); - paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS); + if (paint) paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS); if (!hParamDC) EndPaint(hwnd, &ps); return TRUE; } @@ -406,6 +403,14 @@ break; } + case BM_SETCHECK: + case BM_SETSTATE: + theme = GetWindowTheme(hwnd); + if (theme) { + InvalidateRect(hwnd, NULL, FALSE); + } + return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); + default: /* Call old proc */ return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam); Modified: trunk/reactos/dll/win32/comctl32/toolbar.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/toolbar…
============================================================================== --- trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/toolbar.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -3238,7 +3238,7 @@ bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0; - if (LOWORD(lParam) == FALSE) + if (!LOWORD(lParam)) btnPtr->fsState &= ~TBSTATE_CHECKED; else { if (btnPtr->fsStyle & BTNS_GROUP) { @@ -3370,7 +3370,7 @@ bState = btnPtr->fsState & TBSTATE_ENABLED; /* update the toolbar button state */ - if(LOWORD(lParam) == FALSE) { + if(!LOWORD(lParam)) { btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED); } else { btnPtr->fsState |= TBSTATE_ENABLED; @@ -5309,15 +5309,12 @@ return ret; } -/* UNDOCUMENTED MESSAGE: This appears to set some kind of size. Perhaps it - * is the maximum size of the toolbar? */ -static LRESULT TOOLBAR_Unkwn45D(HWND hwnd, WPARAM wParam, LPARAM lParam) +static LRESULT TOOLBAR_SetBoundingSize(HWND hwnd, WPARAM wParam, LPARAM lParam) { SIZE * pSize = (SIZE*)lParam; FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub!\n", hwnd, wParam, pSize->cx, pSize->cy); return 0; } - /* This is an extended version of the TB_SETHOTITEM message. It allows the * caller to specify a reason why the hot item changed (rather than just the @@ -5690,95 +5687,92 @@ nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button); if (button) + { btnPtr = &infoPtr->buttons[nHit]; - if (button && bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE)) - { - infoPtr->nButtonDrag = nHit; - SetCapture (infoPtr->hwndSelf); - - /* If drag cursor has not been loaded, load it. - * Note: it doesn't need to be freed */ - if (!hCursorDrag) - hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON); - SetCursor(hCursorDrag); - } - else if (button) - { - RECT arrowRect; - infoPtr->nOldHit = nHit; - - CopyRect(&arrowRect, &btnPtr->rect); - arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH); - - /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ - if ((btnPtr->fsState & TBSTATE_ENABLED) && - ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) || - ((btnPtr->fsStyle & BTNS_DROPDOWN) && - ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) || - (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle)))))) - { - LRESULT res; - - /* draw in pressed state */ - if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) - btnPtr->fsState |= TBSTATE_PRESSED; - else - btnPtr->bDropDownPressed = TRUE; - RedrawWindow(infoPtr->hwndSelf,&btnPtr->rect,0, - RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); - - memset(&nmtb, 0, sizeof(nmtb)); - nmtb.iItem = btnPtr->idCommand; - nmtb.rcButton = btnPtr->rect; - res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, - TBN_DROPDOWN); - TRACE("TBN_DROPDOWN responded with %ld\n", res); - - if (res != TBDDRET_TREATPRESSED) + if (bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE)) + { + infoPtr->nButtonDrag = nHit; + SetCapture (infoPtr->hwndSelf); + + /* If drag cursor has not been loaded, load it. + * Note: it doesn't need to be freed */ + if (!hCursorDrag) + hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON); + SetCursor(hCursorDrag); + } + else + { + RECT arrowRect; + infoPtr->nOldHit = nHit; + + CopyRect(&arrowRect, &btnPtr->rect); + arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH); + + /* for EX_DRAWDDARROWS style, click must be in the drop-down arrow rect */ + if ((btnPtr->fsState & TBSTATE_ENABLED) && + ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) || + ((btnPtr->fsStyle & BTNS_DROPDOWN) && + ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) && PtInRect(&arrowRect, pt)) || + (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle)))))) { - MSG msg; - - /* redraw button in unpressed state */ - if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) - btnPtr->fsState &= ~TBSTATE_PRESSED; - else - btnPtr->bDropDownPressed = FALSE; + LRESULT res; + + /* draw in pressed state */ + if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) + btnPtr->fsState |= TBSTATE_PRESSED; + else + btnPtr->bDropDownPressed = TRUE; + RedrawWindow(infoPtr->hwndSelf, &btnPtr->rect, 0, RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW); + + memset(&nmtb, 0, sizeof(nmtb)); + nmtb.iItem = btnPtr->idCommand; + nmtb.rcButton = btnPtr->rect; + res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_DROPDOWN); + TRACE("TBN_DROPDOWN responded with %ld\n", res); + + if (res != TBDDRET_TREATPRESSED) + { + MSG msg; + + /* redraw button in unpressed state */ + if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) + btnPtr->fsState &= ~TBSTATE_PRESSED; + else + btnPtr->bDropDownPressed = FALSE; + InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE); + + /* find and set hot item */ + GetCursorPos(&pt); + ScreenToClient(infoPtr->hwndSelf, &pt); + nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button); + if (!infoPtr->bAnchor || button) + TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); + + /* remove any left mouse button down or double-click messages + * so that we can get a toggle effect on the button */ + while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) || + PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE)) + ; + + return 0; + } + /* otherwise drop through and process as pushed */ + } + infoPtr->bCaptured = TRUE; + infoPtr->nButtonDown = nHit; + infoPtr->bDragOutSent = FALSE; + + btnPtr->fsState |= TBSTATE_PRESSED; + + TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE); + + if (btnPtr->fsState & TBSTATE_ENABLED) InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE); - - /* find and set hot item */ - GetCursorPos(&pt); - ScreenToClient(infoPtr->hwndSelf, &pt); - nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button); - if (!infoPtr->bAnchor || button) - TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE | HICF_LMOUSE); - - /* remove any left mouse button down or double-click messages - * so that we can get a toggle effect on the button */ - while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN, WM_LBUTTONDOWN, PM_REMOVE) || - PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK, WM_LBUTTONDBLCLK, PM_REMOVE)) - ; - - return 0; - } - /* otherwise drop through and process as pushed */ - } - infoPtr->bCaptured = TRUE; - infoPtr->nButtonDown = nHit; - infoPtr->bDragOutSent = FALSE; - - btnPtr->fsState |= TBSTATE_PRESSED; - - TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE | HICF_LMOUSE); - - if (btnPtr->fsState & TBSTATE_ENABLED) - InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE); - UpdateWindow(infoPtr->hwndSelf); - SetCapture (infoPtr->hwndSelf); - } - - if (button) - { + UpdateWindow(infoPtr->hwndSelf); + SetCapture (infoPtr->hwndSelf); + } + memset(&nmtb, 0, sizeof(nmtb)); nmtb.iItem = btnPtr->idCommand; TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG); @@ -6902,8 +6896,8 @@ case TB_SETUNICODEFORMAT: return TOOLBAR_SetUnicodeFormat (infoPtr, wParam); - case TB_UNKWN45D: - return TOOLBAR_Unkwn45D(hwnd, wParam, lParam); + case TB_SETBOUNDINGSIZE: + return TOOLBAR_SetBoundingSize(hwnd, wParam, lParam); case TB_SETHOTITEM2: return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam); Modified: trunk/reactos/dll/win32/comctl32/treeview.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/treevie…
============================================================================== --- trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -42,6 +42,8 @@ #include "comctl32.h" +#include <wine/exception.h> + WINE_DEFAULT_DEBUG_CHANNEL(treeview); /* internal structures */ @@ -2046,11 +2048,20 @@ if (!TREEVIEW_ValidItem(infoPtr, item)) { + BOOL valid_item = FALSE; if (!item) return FALSE; - TRACE("got item from different tree %p, called from %p\n", item->infoPtr, infoPtr); - infoPtr = item->infoPtr; - if (!TREEVIEW_ValidItem(infoPtr, item)) return FALSE; + __TRY + { + infoPtr = item->infoPtr; + TRACE("got item from different tree %p, called from %p\n", item->infoPtr, infoPtr); + valid_item = TREEVIEW_ValidItem(infoPtr, item); + } + __EXCEPT_PAGE_FAULT + { + } + __ENDTRY + if (!valid_item) return FALSE; } TREEVIEW_UpdateDispInfo(infoPtr, item, tvItem->mask); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Nov 24 10:36:57 2015 @@ -54,7 +54,7 @@ reactos/dll/win32/cabinet # Synced to WineStaging-1.7.47 reactos/dll/win32/clusapi # Synced to WineStaging-1.7.47 reactos/dll/win32/comcat # Synced to WineStaging-1.7.47 -reactos/dll/win32/comctl32 # Synced to WineStaging-1.7.47 +reactos/dll/win32/comctl32 # Synced to WineStaging-1.7.55 reactos/dll/win32/comdlg32 # Synced to WineStaging-1.7.47 reactos/dll/win32/compstui # Synced to WineStaging-1.7.47 reactos/dll/win32/credui # Synced to WineStaging-1.7.55
8 years, 11 months
1
0
0
0
[akhaldi] 70079: [PSDK] Add missing TB_SETBOUNDINGSIZE.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:26:50 2015 New Revision: 70079 URL:
http://svn.reactos.org/svn/reactos?rev=70079&view=rev
Log: [PSDK] Add missing TB_SETBOUNDINGSIZE. Modified: trunk/reactos/include/psdk/commctrl.h Modified: trunk/reactos/include/psdk/commctrl.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/commctrl.h?re…
============================================================================== --- trunk/reactos/include/psdk/commctrl.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/commctrl.h [iso-8859-1] Tue Nov 24 10:26:50 2015 @@ -1140,6 +1140,8 @@ #define TB_SETANCHORHIGHLIGHT (WM_USER+73) #define TB_GETANCHORHIGHLIGHT (WM_USER+74) #define TB_MAPACCELERATORA (WM_USER+78) + +#define TB_SETBOUNDINGSIZE (WM_USER+93) typedef struct { int iButton;
8 years, 11 months
1
0
0
0
[akhaldi] 70078: [USER_WINETEST::INPUT] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Tue Nov 24 10:22:52 2015 New Revision: 70078 URL:
http://svn.reactos.org/svn/reactos?rev=70078&view=rev
Log: [USER_WINETEST::INPUT] Sync with Wine Staging 1.7.55. CORE-10536 Modified: trunk/rostests/winetests/user32/input.c Modified: trunk/rostests/winetests/user32/input.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/user32/input.c?…
============================================================================== --- trunk/rostests/winetests/user32/input.c [iso-8859-1] (original) +++ trunk/rostests/winetests/user32/input.c [iso-8859-1] Tue Nov 24 10:22:52 2015 @@ -77,6 +77,7 @@ static UINT (WINAPI *pSendInput) (UINT, INPUT*, size_t); static int (WINAPI *pGetMouseMovePointsEx) (UINT, LPMOUSEMOVEPOINT, LPMOUSEMOVEPOINT, int, DWORD); +static UINT (WINAPI *pGetRawInputDeviceList) (PRAWINPUTDEVICELIST, PUINT, UINT); #define MAXKEYEVENTS 12 #define MAXKEYMESSAGES MAXKEYEVENTS /* assuming a key event generates one @@ -160,6 +161,7 @@ GET_PROC(SendInput) GET_PROC(GetMouseMovePointsEx) + GET_PROC(GetRawInputDeviceList) #undef GET_PROC } @@ -1486,6 +1488,53 @@ #undef MYERROR } +static void test_GetRawInputDeviceList(void) +{ + RAWINPUTDEVICELIST devices[32]; + UINT ret, oret, devcount, odevcount; + DWORD err; + + SetLastError(0xdeadbeef); + ret = pGetRawInputDeviceList(NULL, NULL, 0); + err = GetLastError(); + ok(ret == -1, "expected -1, got %d\n", ret); + ok(err == ERROR_INVALID_PARAMETER, "expected 87, got %d\n", err); + + SetLastError(0xdeadbeef); + ret = pGetRawInputDeviceList(NULL, NULL, sizeof(devices[0])); + err = GetLastError(); + ok(ret == -1, "expected -1, got %d\n", ret); + ok(err == ERROR_NOACCESS, "expected 998, got %d\n", err); + + devcount = 0; + ret = pGetRawInputDeviceList(NULL, &devcount, sizeof(devices[0])); + ok(ret == 0, "expected 0, got %d\n", ret); + ok(devcount > 0, "expected non-zero\n"); + + SetLastError(0xdeadbeef); + devcount = 0; + ret = pGetRawInputDeviceList(devices, &devcount, sizeof(devices[0])); + err = GetLastError(); + ok(ret == -1, "expected -1, got %d\n", ret); + ok(err == ERROR_INSUFFICIENT_BUFFER, "expected 122, got %d\n", err); + ok(devcount > 0, "expected non-zero\n"); + + /* devcount contains now the correct number of devices */ + ret = pGetRawInputDeviceList(devices, &devcount, sizeof(devices[0])); + ok(ret > 0, "expected non-zero\n"); + + /* check if variable changes from larger to smaller value */ + devcount = odevcount = sizeof(devices) / sizeof(devices[0]); + oret = ret = pGetRawInputDeviceList(devices, &odevcount, sizeof(devices[0])); + ok(ret > 0, "expected non-zero\n"); + ok(devcount == odevcount, "expected %d, got %d\n", devcount, odevcount); + devcount = odevcount; + odevcount = sizeof(devices) / sizeof(devices[0]); + ret = pGetRawInputDeviceList(NULL, &odevcount, sizeof(devices[0])); + ok(ret == 0, "expected 0, got %d\n", ret); + ok(odevcount == oret, "expected %d, got %d\n", oret, odevcount); +} + static void test_key_map(void) { HKL kl = GetKeyboardLayout(0); @@ -1538,6 +1587,56 @@ } } +#define shift 1 +#define ctrl 2 + +static const struct tounicode_tests +{ + UINT vk; + DWORD modifiers; + WCHAR chr; /* if vk is 0, lookup vk using this char */ + int expect_ret; + WCHAR expect_buf[4]; +} utests[] = +{ + { 'A', 0, 0, 1, {'a',0}}, + { 'A', ctrl, 0, 1, {1, 0}}, + { 'A', shift|ctrl, 0, 1, {1, 0}}, + { VK_TAB, ctrl, 0, 0, {0}}, + { VK_TAB, shift|ctrl, 0, 0, {0}}, + { VK_RETURN, ctrl, 0, 1, {'\n', 0}}, + { VK_RETURN, shift|ctrl, 0, 0, {0}}, + { '4', ctrl, 0, 0, {0}}, + { '4', shift|ctrl, 0, 0, {0}}, + { 0, ctrl, '!', 0, {0}}, + { 0, ctrl, '\"', 0, {0}}, + { 0, ctrl, '#', 0, {0}}, + { 0, ctrl, '$', 0, {0}}, + { 0, ctrl, '%', 0, {0}}, + { 0, ctrl, '\'', 0, {0}}, + { 0, ctrl, '(', 0, {0}}, + { 0, ctrl, ')', 0, {0}}, + { 0, ctrl, '*', 0, {0}}, + { 0, ctrl, '+', 0, {0}}, + { 0, ctrl, ',', 0, {0}}, + { 0, ctrl, '-', 0, {0}}, + { 0, ctrl, '.', 0, {0}}, + { 0, ctrl, '/', 0, {0}}, + { 0, ctrl, ':', 0, {0}}, + { 0, ctrl, ';', 0, {0}}, + { 0, ctrl, '<', 0, {0}}, + { 0, ctrl, '=', 0, {0}}, + { 0, ctrl, '>', 0, {0}}, + { 0, ctrl, '?', 0, {0}}, + { 0, ctrl, '@', 1, {0}}, + { 0, ctrl, '[', 1, {0x1b}}, + { 0, ctrl, '\\', 1, {0x1c}}, + { 0, ctrl, ']', 1, {0x1d}}, + { 0, ctrl, '^', 1, {0x1e}}, + { 0, ctrl, '_', 1, {0x1f}}, + { 0, ctrl, '`', 0, {0}}, +}; + static void test_ToUnicode(void) { WCHAR wStr[4]; @@ -1565,30 +1664,32 @@ "ToUnicode didn't null-terminate the buffer when there was room.\n"); } - ret = ToUnicode('A', SC_A, state, wStr, 4, 0); - ok(ret == 1, "ToUnicode for character A didn't return 1 (was %i)\n", ret); - ok(wStr[0] == 'a', "ToUnicode for character 'A' was %i (expected %i)\n", wStr[0], 'a'); - - state[VK_CONTROL] |= HIGHEST_BIT; - state[VK_LCONTROL] |= HIGHEST_BIT; - ret = ToUnicode(VK_TAB, SC_TAB, state, wStr, 2, 0); - ok(ret == 0, "ToUnicode for CTRL + Tab didn't return 0 (was %i)\n", ret); - - ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0); - ok(ret == 1, "ToUnicode for CTRL + Return didn't return 1 (was %i)\n", ret); - if(ret == 1) - ok(wStr[0]=='\n', "ToUnicode for CTRL + Return was %i (expected 10)\n", wStr[0]); - - ret = ToUnicode('A', SC_A, state, wStr, 4, 0); - ok(ret == 1, "ToUnicode for CTRL + character A didn't return 1 (was %i)\n", ret); - ok(wStr[0] == 1, "ToUnicode for CTRL + character 'A' was %i (expected 1)\n", wStr[0]); - - state[VK_SHIFT] |= HIGHEST_BIT; - state[VK_LSHIFT] |= HIGHEST_BIT; - ret = ToUnicode(VK_TAB, SC_TAB, state, wStr, 2, 0); - ok(ret == 0, "ToUnicode for CTRL + SHIFT + Tab didn't return 0 (was %i)\n", ret); - ret = ToUnicode(VK_RETURN, SC_RETURN, state, wStr, 2, 0); - todo_wine ok(ret == 0, "ToUnicode for CTRL + SHIFT + Return didn't return 0 (was %i)\n", ret); + for (i = 0; i < sizeof(utests) / sizeof(utests[0]); i++) + { + UINT vk = utests[i].vk, mod = utests[i].modifiers, scan; + + if(!vk) + { + short vk_ret = VkKeyScanW(utests[i].chr); + if (vk_ret == -1) continue; + vk = vk_ret & 0xff; + if (vk_ret & 0x100) mod |= shift; + if (vk_ret & 0x200) mod |= ctrl; + } + scan = MapVirtualKeyW(vk, MAPVK_VK_TO_VSC); + + state[VK_SHIFT] = state[VK_LSHIFT] = (mod & shift) ? HIGHEST_BIT : 0; + state[VK_CONTROL] = state[VK_LCONTROL] = (mod & ctrl) ? HIGHEST_BIT : 0; + + ret = ToUnicode(vk, scan, state, wStr, 4, 0); + ok(ret == utests[i].expect_ret, "%d: got %d expected %d\n", i, ret, utests[i].expect_ret); + if (ret) + ok(!lstrcmpW(wStr, utests[i].expect_buf), "%d: got %s expected %s\n", i, wine_dbgstr_w(wStr), + wine_dbgstr_w(utests[i].expect_buf)); + + } + state[VK_SHIFT] = state[VK_LSHIFT] = 0; + state[VK_CONTROL] = state[VK_LCONTROL] = 0; ret = ToUnicode(VK_TAB, SC_TAB, NULL, wStr, 4, 0); ok(ret == 0, "ToUnicode with NULL keystate didn't return 0 (was %i)\n", ret); @@ -1639,7 +1740,7 @@ state[VK_SHIFT] |= HIGHEST_BIT; state[VK_LSHIFT] |= HIGHEST_BIT; ret = ToAscii(VK_RETURN, SC_RETURN, state, &character, 0); - todo_wine ok(ret == 0, "ToAscii for CTRL + Shift + Return key didn't return 0 (was %i)\n", ret); + ok(ret == 0, "ToAscii for CTRL + Shift + Return key didn't return 0 (was %i)\n", ret); ret = ToAscii(VK_RETURN, SC_RETURN, NULL, &character, 0); ok(ret == 0, "ToAscii for NULL keystate didn't return 0 (was %i)\n", ret); @@ -2326,6 +2427,69 @@ DestroyWindow(Wnd2); } +static DWORD WINAPI get_key_state_thread(void *arg) +{ + HANDLE *semaphores = arg; + DWORD result; + + ReleaseSemaphore(semaphores[0], 1, NULL); + result = WaitForSingleObject(semaphores[1], 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + + result = GetKeyState('X'); + ok((result & 0x8000) || broken(!(result & 0x8000)), /* > Win 2003 */ + "expected that highest bit is set, got %x\n", result); + + ReleaseSemaphore(semaphores[0], 1, NULL); + result = WaitForSingleObject(semaphores[1], 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + + result = GetKeyState('X'); + ok(!(result & 0x8000), "expected that highest bit is unset, got %x\n", result); + + return 0; +} + +static void test_GetKeyState(void) +{ + HANDLE semaphores[2]; + HANDLE thread; + DWORD result; + HWND hwnd; + + semaphores[0] = CreateSemaphoreA(NULL, 0, 1, NULL); + ok(semaphores[0] != NULL, "CreateSemaphoreA failed %u\n", GetLastError()); + semaphores[1] = CreateSemaphoreA(NULL, 0, 1, NULL); + ok(semaphores[1] != NULL, "CreateSemaphoreA failed %u\n", GetLastError()); + + hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 10, 10, 200, 200, NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "CreateWindowA failed %u\n", GetLastError()); + + thread = CreateThread(NULL, 0, get_key_state_thread, semaphores, 0, NULL); + ok(thread != NULL, "CreateThread failed %u\n", GetLastError()); + result = WaitForSingleObject(semaphores[0], 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + + SetFocus(hwnd); + keybd_event('X', 0, 0, 0); + + ReleaseSemaphore(semaphores[1], 1, NULL); + result = WaitForSingleObject(semaphores[0], 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + + keybd_event('X', 0, KEYEVENTF_KEYUP, 0); + + ReleaseSemaphore(semaphores[1], 1, NULL); + result = WaitForSingleObject(thread, 1000); + ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result); + CloseHandle(thread); + + DestroyWindow(hwnd); + CloseHandle(semaphores[0]); + CloseHandle(semaphores[1]); +} + START_TEST(input) { init_function_pointers(); @@ -2348,9 +2512,15 @@ test_keyboard_layout_name(); test_key_names(); test_attach_input(); + test_GetKeyState(); if(pGetMouseMovePointsEx) test_GetMouseMovePointsEx(); else win_skip("GetMouseMovePointsEx is not available\n"); -} + + if(pGetRawInputDeviceList) + test_GetRawInputDeviceList(); + else + win_skip("GetRawInputDeviceList is not available\n"); +}
8 years, 11 months
1
0
0
0
[akhaldi] 70077: [MSCTF_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 23 20:49:33 2015 New Revision: 70077 URL:
http://svn.reactos.org/svn/reactos?rev=70077&view=rev
Log: [MSCTF_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536 Modified: trunk/rostests/winetests/msctf/inputprocessor.c Modified: trunk/rostests/winetests/msctf/inputprocessor.c URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msctf/inputproc…
============================================================================== --- trunk/rostests/winetests/msctf/inputprocessor.c [iso-8859-1] (original) +++ trunk/rostests/winetests/msctf/inputprocessor.c [iso-8859-1] Mon Nov 23 20:49:33 2015 @@ -921,6 +921,7 @@ if(IsEqualGUID(&g,&CLSID_FakeService)) found = TRUE; } + IEnumGUID_Release(ppEnum); } ok(found,"Did not find registered text service\n"); } @@ -943,6 +944,7 @@ ok(IsEqualGUID(&profile.guidProfile,&CLSID_FakeService), "guidProfile Incorrect\n"); } } + IEnumTfLanguageProfiles_Release(ppEnum); } ok(found,"Registered text service not found\n"); } @@ -1407,6 +1409,7 @@ ITfContext *cxt,*cxt2,*cxt3,*cxtTest; ITextStoreACP *ts; TfClientId cid2 = 0; + ITfThreadMgrEx *tmex; hr = ITfThreadMgr_Deactivate(g_tm); ok(hr == E_UNEXPECTED,"Deactivate should have failed with E_UNEXPECTED\n"); @@ -1419,10 +1422,21 @@ test_ShouldActivate = FALSE; hr = ITfThreadMgr_Activate(g_tm,&cid2); ok(SUCCEEDED(hr),"Failed to Activate\n"); - ok (cid == cid2, "Second activate client ID does not match\n"); + ok(cid == cid2, "Second activate client ID does not match\n"); + + hr = ITfThreadMgr_QueryInterface(g_tm, &IID_ITfThreadMgrEx, (void **)&tmex); + ok(SUCCEEDED(hr), "Unable to acquire ITfThreadMgrEx interface\n"); + + hr = ITfThreadMgrEx_ActivateEx(tmex, &cid2, 0); + ok(SUCCEEDED(hr), "Failed to Activate\n"); + ok(cid == cid2, "ActivateEx client ID does not match\n"); + + ITfThreadMgrEx_Release(tmex); hr = ITfThreadMgr_Deactivate(g_tm); - ok(SUCCEEDED(hr),"Failed to Deactivate\n"); + ok(SUCCEEDED(hr), "Failed to Deactivate\n"); + hr = ITfThreadMgr_Deactivate(g_tm); + ok(SUCCEEDED(hr), "Failed to Deactivate\n"); test_EnumDocumentMgr(g_tm,NULL,NULL);
8 years, 11 months
1
0
0
0
[akhaldi] 70076: [MSCTF] Sync with Wine Staging 1.7.55. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 23 20:49:01 2015 New Revision: 70076 URL:
http://svn.reactos.org/svn/reactos?rev=70076&view=rev
Log: [MSCTF] Sync with Wine Staging 1.7.55. CORE-10536 Modified: trunk/reactos/dll/win32/msctf/CMakeLists.txt trunk/reactos/dll/win32/msctf/categorymgr.c trunk/reactos/dll/win32/msctf/inputprocessor.c trunk/reactos/dll/win32/msctf/threadmgr.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/msctf/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/CMakeLists…
============================================================================== --- trunk/reactos/dll/win32/msctf/CMakeLists.txt [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/CMakeLists.txt [iso-8859-1] Mon Nov 23 20:49:01 2015 @@ -1,3 +1,6 @@ + +remove_definitions(-D_WIN32_WINNT=0x502) +add_definitions(-D_WIN32_WINNT=0x600) add_definitions(-D__WINESRC__) include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/wine) @@ -24,6 +27,6 @@ set_module_type(msctf win32dll) target_link_libraries(msctf uuid wine) -add_importlibs(msctf ole32 oleaut32 user32 advapi32 shlwapi msvcrt kernel32 ntdll) +add_importlibs(msctf ole32 oleaut32 user32 advapi32 advapi32_vista msvcrt kernel32 ntdll) add_pch(msctf msctf_internal.h SOURCE) add_cd_file(TARGET msctf DESTINATION reactos/system32 FOR all) Modified: trunk/reactos/dll/win32/msctf/categorymgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/categorymg…
============================================================================== --- trunk/reactos/dll/win32/msctf/categorymgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/categorymgr.c [iso-8859-1] Mon Nov 23 20:49:01 2015 @@ -154,9 +154,9 @@ sprintfW(fullkey,fmt2,ctg,ctg,buf,buf2); sprintfW(fullkey,fmt2,ctg,itm,buf2,buf); - SHDeleteKeyW(tipkey, fullkey); + RegDeleteTreeW(tipkey, fullkey); sprintfW(fullkey,fmt2,ctg,itm,buf2,buf); - SHDeleteKeyW(tipkey, fullkey); + RegDeleteTreeW(tipkey, fullkey); RegCloseKey(tipkey); return S_OK; Modified: trunk/reactos/dll/win32/msctf/inputprocessor.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/inputproce…
============================================================================== --- trunk/reactos/dll/win32/msctf/inputprocessor.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/inputprocessor.c [iso-8859-1] Mon Nov 23 20:49:01 2015 @@ -328,8 +328,8 @@ StringFromGUID2(rclsid, buf, 39); sprintfW(fullkey,szwTipfmt,szwSystemTIPKey,buf); - SHDeleteKeyW(HKEY_LOCAL_MACHINE, fullkey); - SHDeleteKeyW(HKEY_CURRENT_USER, fullkey); + RegDeleteTreeW(HKEY_LOCAL_MACHINE, fullkey); + RegDeleteTreeW(HKEY_CURRENT_USER, fullkey); return S_OK; } Modified: trunk/reactos/dll/win32/msctf/threadmgr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/threadmgr.…
============================================================================== --- trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] Mon Nov 23 20:49:01 2015 @@ -57,7 +57,7 @@ } AssociatedWindow; typedef struct tagACLMulti { - ITfThreadMgr ITfThreadMgr_iface; + ITfThreadMgrEx ITfThreadMgrEx_iface; ITfSource ITfSource_iface; ITfKeystrokeMgr ITfKeystrokeMgr_iface; ITfMessagePump ITfMessagePump_iface; @@ -65,7 +65,7 @@ /* const ITfThreadMgrExVtbl *ThreadMgrExVtbl; */ /* const ITfConfigureSystemKeystrokeFeedVtbl *ConfigureSystemKeystrokeFeedVtbl; */ /* const ITfLangBarItemMgrVtbl *LangBarItemMgrVtbl; */ - /* const ITfUIElementMgrVtbl *UIElementMgrVtbl; */ + ITfUIElementMgr ITfUIElementMgr_iface; ITfSourceSingle ITfSourceSingle_iface; LONG refCount; @@ -105,9 +105,9 @@ static HRESULT EnumTfDocumentMgr_Constructor(struct list* head, IEnumTfDocumentMgrs **ppOut); -static inline ThreadMgr *impl_from_ITfThreadMgr(ITfThreadMgr *iface) -{ - return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgr_iface); +static inline ThreadMgr *impl_from_ITfThreadMgrEx(ITfThreadMgrEx *iface) +{ + return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEx_iface); } static inline ThreadMgr *impl_from_ITfSource(ITfSource *iface) @@ -133,6 +133,11 @@ static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface) { return CONTAINING_RECORD(iface, ThreadMgr, ITfThreadMgrEventSink_iface); +} + +static inline ThreadMgr *impl_from_ITfUIElementMgr(ITfUIElementMgr *iface) +{ + return CONTAINING_RECORD(iface, ThreadMgr, ITfUIElementMgr_iface); } static inline ThreadMgr *impl_from_ITfSourceSingle(ITfSourceSingle *iface) @@ -230,14 +235,15 @@ HeapFree(GetProcessHeap(),0,This); } -static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgr *iface, REFIID iid, LPVOID *ppvOut) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_QueryInterface(ITfThreadMgrEx *iface, REFIID iid, LPVOID *ppvOut) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); *ppvOut = NULL; - if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr)) - { - *ppvOut = &This->ITfThreadMgr_iface; + if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfThreadMgr) + || IsEqualIID(iid, &IID_ITfThreadMgrEx)) + { + *ppvOut = &This->ITfThreadMgrEx_iface; } else if (IsEqualIID(iid, &IID_ITfSource)) { @@ -259,6 +265,10 @@ { *ppvOut = This->CompartmentMgr; } + else if (IsEqualIID(iid, &IID_ITfUIElementMgr)) + { + *ppvOut = &This->ITfUIElementMgr_iface; + } else if (IsEqualIID(iid, &IID_ITfSourceSingle)) { *ppvOut = &This->ITfSourceSingle_iface; @@ -266,7 +276,7 @@ if (*ppvOut) { - ITfThreadMgr_AddRef(iface); + ITfThreadMgrEx_AddRef(iface); return S_OK; } @@ -274,15 +284,15 @@ return E_NOINTERFACE; } -static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgr *iface) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static ULONG WINAPI ThreadMgr_AddRef(ITfThreadMgrEx *iface) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); return InterlockedIncrement(&This->refCount); } -static ULONG WINAPI ThreadMgr_Release(ITfThreadMgr *iface) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static ULONG WINAPI ThreadMgr_Release(ITfThreadMgrEx *iface) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); ULONG ret; ret = InterlockedDecrement(&This->refCount); @@ -295,31 +305,17 @@ * ITfThreadMgr functions *****************************************************/ -static HRESULT WINAPI ThreadMgr_fnActivate( ITfThreadMgr* iface, TfClientId *ptid) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); - - TRACE("(%p) %p\n",This, ptid); - - if (!ptid) - return E_INVALIDARG; - - if (!processId) - { - GUID guid; - CoCreateGuid(&guid); - ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId); - } - - activate_textservices(iface); - This->activationCount++; - *ptid = processId; - return S_OK; -} - -static HRESULT WINAPI ThreadMgr_fnDeactivate( ITfThreadMgr* iface) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_Activate(ITfThreadMgrEx *iface, TfClientId *id) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); + + TRACE("(%p) %p\n", This, id); + return ITfThreadMgrEx_ActivateEx(iface, id, 0); +} + +static HRESULT WINAPI ThreadMgr_Deactivate(ITfThreadMgrEx *iface) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); TRACE("(%p)\n",This); if (This->activationCount == 0) @@ -342,9 +338,9 @@ return S_OK; } -static HRESULT WINAPI ThreadMgr_CreateDocumentMgr(ITfThreadMgr* iface, ITfDocumentMgr **ppdim) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_CreateDocumentMgr(ITfThreadMgrEx *iface, ITfDocumentMgr **ppdim) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); DocumentMgrEntry *mgrentry; HRESULT hr; @@ -366,9 +362,9 @@ return hr; } -static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs( ITfThreadMgr* iface, IEnumTfDocumentMgrs **ppEnum) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_EnumDocumentMgrs(ITfThreadMgrEx *iface, IEnumTfDocumentMgrs **ppEnum) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); TRACE("(%p) %p\n",This,ppEnum); if (!ppEnum) @@ -377,10 +373,9 @@ return EnumTfDocumentMgr_Constructor(&This->CreatedDocumentMgrs, ppEnum); } -static HRESULT WINAPI ThreadMgr_GetFocus( ITfThreadMgr* iface, ITfDocumentMgr -**ppdimFocus) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_GetFocus(ITfThreadMgrEx *iface, ITfDocumentMgr **ppdimFocus) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); TRACE("(%p)\n",This); if (!ppdimFocus) @@ -398,9 +393,9 @@ return S_OK; } -static HRESULT WINAPI ThreadMgr_SetFocus( ITfThreadMgr* iface, ITfDocumentMgr *pdimFocus) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_SetFocus(ITfThreadMgrEx *iface, ITfDocumentMgr *pdimFocus) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); ITfDocumentMgr *check; TRACE("(%p) %p\n",This,pdimFocus); @@ -446,7 +441,7 @@ { TRACE("Triggering Associated window focus\n"); if (This->focus != wnd->docmgr) - ThreadMgr_SetFocus((ITfThreadMgr*)This, wnd->docmgr); + ThreadMgr_SetFocus(&This->ITfThreadMgrEx_iface, wnd->docmgr); break; } } @@ -471,10 +466,10 @@ return S_FALSE; } -static HRESULT WINAPI ThreadMgr_AssociateFocus( ITfThreadMgr* iface, HWND hwnd, +static HRESULT WINAPI ThreadMgr_AssociateFocus(ITfThreadMgrEx *iface, HWND hwnd, ITfDocumentMgr *pdimNew, ITfDocumentMgr **ppdimPrev) { - ThreadMgr *This = impl_from_ITfThreadMgr(iface); + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); struct list *cursor, *cursor2; AssociatedWindow *wnd; @@ -513,9 +508,9 @@ return S_OK; } -static HRESULT WINAPI ThreadMgr_IsThreadFocus( ITfThreadMgr* iface, BOOL *pfThreadFocus) -{ - ThreadMgr *This = impl_from_ITfThreadMgr(iface); +static HRESULT WINAPI ThreadMgr_IsThreadFocus(ITfThreadMgrEx *iface, BOOL *pfThreadFocus) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); HWND focus; TRACE("(%p) %p\n",This,pfThreadFocus); @@ -524,26 +519,26 @@ return S_OK; } -static HRESULT WINAPI ThreadMgr_GetFunctionProvider( ITfThreadMgr* iface, REFCLSID clsid, +static HRESULT WINAPI ThreadMgr_GetFunctionProvider(ITfThreadMgrEx *iface, REFCLSID clsid, ITfFunctionProvider **ppFuncProv) { - ThreadMgr *This = impl_from_ITfThreadMgr(iface); + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static HRESULT WINAPI ThreadMgr_EnumFunctionProviders( ITfThreadMgr* iface, +static HRESULT WINAPI ThreadMgr_EnumFunctionProviders(ITfThreadMgrEx *iface, IEnumTfFunctionProviders **ppEnum) { - ThreadMgr *This = impl_from_ITfThreadMgr(iface); + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); FIXME("STUB:(%p)\n",This); return E_NOTIMPL; } -static HRESULT WINAPI ThreadMgr_GetGlobalCompartment( ITfThreadMgr* iface, +static HRESULT WINAPI ThreadMgr_GetGlobalCompartment(ITfThreadMgrEx *iface, ITfCompartmentMgr **ppCompMgr) { - ThreadMgr *This = impl_from_ITfThreadMgr(iface); + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); HRESULT hr; TRACE("(%p) %p\n",This, ppCompMgr); @@ -562,13 +557,46 @@ return S_OK; } -static const ITfThreadMgrVtbl ThreadMgrVtbl = +static HRESULT WINAPI ThreadMgr_ActivateEx(ITfThreadMgrEx *iface, TfClientId *id, DWORD flags) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); + + TRACE("(%p) %p, %#x\n", This, id, flags); + + if (!id) + return E_INVALIDARG; + + if (flags) + FIXME("Unimplemented flags %#x\n", flags); + + if (!processId) + { + GUID guid; + CoCreateGuid(&guid); + ITfClientId_GetClientId(&This->ITfClientId_iface, &guid, &processId); + } + + activate_textservices((ITfThreadMgr *)iface); + This->activationCount++; + *id = processId; + return S_OK; +} + +static HRESULT WINAPI ThreadMgr_GetActiveFlags(ITfThreadMgrEx *iface, DWORD *flags) +{ + ThreadMgr *This = impl_from_ITfThreadMgrEx(iface); + + FIXME("STUB:(%p)\n", This); + return E_NOTIMPL; +} + +static const ITfThreadMgrExVtbl ThreadMgrExVtbl = { ThreadMgr_QueryInterface, ThreadMgr_AddRef, ThreadMgr_Release, - ThreadMgr_fnActivate, - ThreadMgr_fnDeactivate, + ThreadMgr_Activate, + ThreadMgr_Deactivate, ThreadMgr_CreateDocumentMgr, ThreadMgr_EnumDocumentMgrs, ThreadMgr_GetFocus, @@ -577,25 +605,28 @@ ThreadMgr_IsThreadFocus, ThreadMgr_GetFunctionProvider, ThreadMgr_EnumFunctionProviders, - ThreadMgr_GetGlobalCompartment + ThreadMgr_GetGlobalCompartment, + + ThreadMgr_ActivateEx, + ThreadMgr_GetActiveFlags }; static HRESULT WINAPI Source_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfSource(iface); - return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, ppvOut); } static ULONG WINAPI Source_AddRef(ITfSource *iface) { ThreadMgr *This = impl_from_ITfSource(iface); - return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); } static ULONG WINAPI Source_Release(ITfSource *iface) { ThreadMgr *This = impl_from_ITfSource(iface); - return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); } /***************************************************** @@ -672,19 +703,19 @@ static HRESULT WINAPI KeystrokeMgr_QueryInterface(ITfKeystrokeMgr *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); - return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, ppvOut); } static ULONG WINAPI KeystrokeMgr_AddRef(ITfKeystrokeMgr *iface) { ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); - return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); } static ULONG WINAPI KeystrokeMgr_Release(ITfKeystrokeMgr *iface) { ThreadMgr *This = impl_from_ITfKeystrokeMgr(iface); - return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); } static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, @@ -964,19 +995,19 @@ static HRESULT WINAPI MessagePump_QueryInterface(ITfMessagePump *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfMessagePump(iface); - return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, ppvOut); } static ULONG WINAPI MessagePump_AddRef(ITfMessagePump *iface) { ThreadMgr *This = impl_from_ITfMessagePump(iface); - return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); } static ULONG WINAPI MessagePump_Release(ITfMessagePump *iface) { ThreadMgr *This = impl_from_ITfMessagePump(iface); - return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); } static HRESULT WINAPI MessagePump_PeekMessageA(ITfMessagePump *iface, @@ -1037,19 +1068,19 @@ static HRESULT WINAPI ClientId_QueryInterface(ITfClientId *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfClientId(iface); - return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, ppvOut); } static ULONG WINAPI ClientId_AddRef(ITfClientId *iface) { ThreadMgr *This = impl_from_ITfClientId(iface); - return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); } static ULONG WINAPI ClientId_Release(ITfClientId *iface) { ThreadMgr *This = impl_from_ITfClientId(iface); - return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); } static HRESULT WINAPI ClientId_GetClientId(ITfClientId *iface, @@ -1083,19 +1114,19 @@ static HRESULT WINAPI ThreadMgrEventSink_QueryInterface(ITfThreadMgrEventSink *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, ppvOut); } static ULONG WINAPI ThreadMgrEventSink_AddRef(ITfThreadMgrEventSink *iface) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); } static ULONG WINAPI ThreadMgrEventSink_Release(ITfThreadMgrEventSink *iface) { ThreadMgr *This = impl_from_ITfThreadMgrEventSink(iface); - return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); } @@ -1198,24 +1229,104 @@ }; /***************************************************** + * ITfUIElementMgr functions + *****************************************************/ +static HRESULT WINAPI UIElementMgr_QueryInterface(ITfUIElementMgr *iface, REFIID iid, void **ppvOut) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, *ppvOut); +} + +static ULONG WINAPI UIElementMgr_AddRef(ITfUIElementMgr *iface) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); +} + +static ULONG WINAPI UIElementMgr_Release(ITfUIElementMgr *iface) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); +} + +static HRESULT WINAPI UIElementMgr_BeginUIElement(ITfUIElementMgr *iface, ITfUIElement *element, + BOOL *show, DWORD *id) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + FIXME("STUB:(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI UIElementMgr_UpdateUIElement(ITfUIElementMgr *iface, DWORD id) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + FIXME("STUB:(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI UIElementMgr_EndUIElement(ITfUIElementMgr *iface, DWORD id) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + FIXME("STUB:(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI UIElementMgr_GetUIElement(ITfUIElementMgr *iface, DWORD id, + ITfUIElement **element) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + FIXME("STUB:(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI UIElementMgr_EnumUIElements(ITfUIElementMgr *iface, + IEnumTfUIElements **enum_elements) +{ + ThreadMgr *This = impl_from_ITfUIElementMgr(iface); + + FIXME("STUB:(%p)\n", This); + return E_NOTIMPL; +} + +static const ITfUIElementMgrVtbl ThreadMgrUIElementMgrVtbl = +{ + UIElementMgr_QueryInterface, + UIElementMgr_AddRef, + UIElementMgr_Release, + + UIElementMgr_BeginUIElement, + UIElementMgr_UpdateUIElement, + UIElementMgr_EndUIElement, + UIElementMgr_GetUIElement, + UIElementMgr_EnumUIElements +}; + +/***************************************************** * ITfSourceSingle functions *****************************************************/ static HRESULT WINAPI ThreadMgrSourceSingle_QueryInterface(ITfSourceSingle *iface, REFIID iid, LPVOID *ppvOut) { ThreadMgr *This = impl_from_ITfSourceSingle(iface); - return ITfThreadMgr_QueryInterface(&This->ITfThreadMgr_iface, iid, ppvOut); + return ITfThreadMgrEx_QueryInterface(&This->ITfThreadMgrEx_iface, iid, ppvOut); } static ULONG WINAPI ThreadMgrSourceSingle_AddRef(ITfSourceSingle *iface) { ThreadMgr *This = impl_from_ITfSourceSingle(iface); - return ITfThreadMgr_AddRef(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_AddRef(&This->ITfThreadMgrEx_iface); } static ULONG WINAPI ThreadMgrSourceSingle_Release(ITfSourceSingle *iface) { ThreadMgr *This = impl_from_ITfSourceSingle(iface); - return ITfThreadMgr_Release(&This->ITfThreadMgr_iface); + return ITfThreadMgrEx_Release(&This->ITfThreadMgrEx_iface); } static HRESULT WINAPI ThreadMgrSourceSingle_AdviseSingleSink( ITfSourceSingle *iface, @@ -1253,8 +1364,8 @@ This = TlsGetValue(tlsIndex); if (This) { - ThreadMgr_AddRef(&This->ITfThreadMgr_iface); - *ppOut = (IUnknown*)&This->ITfThreadMgr_iface; + ThreadMgr_AddRef(&This->ITfThreadMgrEx_iface); + *ppOut = (IUnknown*)&This->ITfThreadMgrEx_iface; return S_OK; } @@ -1262,12 +1373,13 @@ if (This == NULL) return E_OUTOFMEMORY; - This->ITfThreadMgr_iface.lpVtbl= &ThreadMgrVtbl; + This->ITfThreadMgrEx_iface.lpVtbl = &ThreadMgrExVtbl; This->ITfSource_iface.lpVtbl = &ThreadMgrSourceVtbl; - This->ITfKeystrokeMgr_iface.lpVtbl= &KeystrokeMgrVtbl; + This->ITfKeystrokeMgr_iface.lpVtbl = &KeystrokeMgrVtbl; This->ITfMessagePump_iface.lpVtbl = &MessagePumpVtbl; This->ITfClientId_iface.lpVtbl = &ClientIdVtbl; This->ITfThreadMgrEventSink_iface.lpVtbl = &ThreadMgrEventSinkVtbl; + This->ITfUIElementMgr_iface.lpVtbl = &ThreadMgrUIElementMgrVtbl; This->ITfSourceSingle_iface.lpVtbl = &SourceSingleVtbl; This->refCount = 1; TlsSetValue(tlsIndex,This); @@ -1286,7 +1398,7 @@ list_init(&This->ThreadMgrEventSink); TRACE("returning %p\n", This); - *ppOut = (IUnknown *)&This->ITfThreadMgr_iface; + *ppOut = (IUnknown *)&This->ITfThreadMgrEx_iface; return S_OK; } @@ -1437,7 +1549,7 @@ void ThreadMgr_OnDocumentMgrDestruction(ITfThreadMgr *iface, ITfDocumentMgr *mgr) { - ThreadMgr *This = impl_from_ITfThreadMgr(iface); + ThreadMgr *This = impl_from_ITfThreadMgrEx((ITfThreadMgrEx *)iface); struct list *cursor; LIST_FOR_EACH(cursor, &This->CreatedDocumentMgrs) { Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Mon Nov 23 20:49:01 2015 @@ -109,7 +109,7 @@ reactos/dll/win32/mscat32 # Synced to WineStaging-1.7.47 reactos/dll/win32/mscms # Synced to WineStaging-1.7.55 reactos/dll/win32/mscoree # Synced to Wine-1.5.4 -reactos/dll/win32/msctf # Synced to WineStaging-1.7.47 +reactos/dll/win32/msctf # Synced to WineStaging-1.7.55 reactos/dll/win32/msftedit # Synced to WineStaging-1.7.47 reactos/dll/win32/msg711.acm # Synced to WineStaging-1.7.47 reactos/dll/win32/msgsm32.acm # Synced to WineStaging-1.7.47
8 years, 11 months
1
0
0
0
[akhaldi] 70075: [PSDK] Update msctf.idl. CORE-10536
by akhaldi@svn.reactos.org
Author: akhaldi Date: Mon Nov 23 20:47:28 2015 New Revision: 70075 URL:
http://svn.reactos.org/svn/reactos?rev=70075&view=rev
Log: [PSDK] Update msctf.idl. CORE-10536 Modified: trunk/reactos/include/psdk/msctf.idl Modified: trunk/reactos/include/psdk/msctf.idl URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/msctf.idl?rev…
============================================================================== --- trunk/reactos/include/psdk/msctf.idl [iso-8859-1] (original) +++ trunk/reactos/include/psdk/msctf.idl [iso-8859-1] Mon Nov 23 20:47:28 2015 @@ -22,7 +22,6 @@ import "textstor.idl"; import "ctfutb.idl"; #endif -cpp_quote("#include <winuser.h>") cpp_quote("#define TF_E_STACKFULL MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0501)") cpp_quote("#define TF_E_DISCONNECTED MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0504)") @@ -90,19 +89,12 @@ interface ITfContext; interface IEnumTfDocumentMgrs; interface IEnumTfContexts; -interface ITfFunctionProvider; -interface IEnumTfFunctionProviders; interface ITfCompartmentMgr; interface ITfEditSession; interface ITfRange; -interface ITfContextView; -interface IEnumTfContextViews; interface ITfProperty; interface ITfReadOnlyProperty; -interface IEnumTfProperties; -interface ITfRangeBackup; interface IEnumTfLanguageProfiles; -interface ITfEditRecord; interface ITfCompositionView; interface ITfKeyEventSink; @@ -139,6 +131,46 @@ [ object, + uuid(101d6610-0990-11d3-8df0-00105a2799b5), + pointer_default(unique) +] +interface ITfFunctionProvider : IUnknown +{ + HRESULT GetType( + [out] GUID *guid); + + HRESULT GetDescription( + [out] BSTR *desc); + + HRESULT GetFunction( + [in] REFGUID guid, + [in] REFIID riid, + [out, iid_is(riid)] IUnknown **func); +} + +[ + object, + uuid(e4b24db0-0990-11d3-8df0-00105a2799b5), + pointer_default(unique) +] +interface IEnumTfFunctionProviders : IUnknown +{ + HRESULT Clone( + [out] IEnumTfFunctionProviders **ret); + + HRESULT Next( + [in] ULONG count, + [out, size_is(count), length_is(*fetched)] ITfFunctionProvider **prov, + [out] ULONG *fetched); + + HRESULT Reset(); + + HRESULT Skip( + [in] ULONG count); +} + +[ + object, uuid(aa80e801-2021-11d2-93e0-0060b067b86e), pointer_default(unique) ] @@ -178,7 +210,21 @@ HRESULT GetGlobalCompartment( [out] ITfCompartmentMgr **ppCompMgr); -}; +} + +[ + object, + uuid(3e90ade3-7594-4cb0-bb58-69628f5f458c), + pointer_default(unique) +] +interface ITfThreadMgrEx : ITfThreadMgr +{ + HRESULT ActivateEx( + [out] TfClientId *id, + [in] DWORD flags); + HRESULT GetActiveFlags( + [out] DWORD *flags); +} [ object, @@ -222,7 +268,87 @@ HRESULT EnumContexts( [out] IEnumTfContexts **ppEnum); -}; +} + +[ + object, + uuid(2433bf8e-0f9b-435c-ba2c-180611978c30), + pointer_default(unique) +] +interface ITfContextView : IUnknown +{ + HRESULT GetRangeFromPoint( + [in] TfEditCookie cookie, + [in] const POINT *pt, + [in] DWORD flags, + [out] ITfRange **range); + + HRESULT GetTextExt( + [in] TfEditCookie cookie, + [in] ITfRange *range, + [out] RECT *rect, + [out] BOOL *clipped); + + HRESULT GetScreenExt( + [out] RECT *rect); + + HRESULT GetWnd( + [out] HWND *hwnd); +} + +[ + object, + uuid(f0c0f8dd-cf38-44e1-bb0f-68cf0d551c78), + pointer_default(unique) +] +interface IEnumTfContextViews : IUnknown +{ + HRESULT Clone( + [out] IEnumTfContextViews **ret); + + HRESULT Next( + [in] ULONG count, + [out, size_is(count), length_is(*fetched)] ITfContextView **views, + [out] ULONG *fetched); + + HRESULT Reset(); + + HRESULT Skip( + [in] ULONG count); +} + +[ + object, + uuid(19188cb0-aca9-11d2-afc5-00105a2799b5), + pointer_default(unique) +] +interface IEnumTfProperties : IUnknown +{ + HRESULT Clone( + [out] IEnumTfProperties **ret); + + HRESULT Next( + [in] ULONG count, + [out, size_is(count), length_is(*fetched)] ITfProperty **props, + [out] ULONG *fetched); + + HRESULT Reset(); + + HRESULT Skip( + [in] ULONG count); +} + +[ + object, + uuid(463a506d-6992-49d2-9b88-93d55e70bb16), + pointer_default(unique) +] +interface ITfRangeBackup : IUnknown +{ + HRESULT Restore( + [in] TfEditCookie cookie, + [in] ITfRange *range); +} [ object, @@ -325,8 +451,7 @@ [in] TfEditCookie ec, [in] ITfRange *pRange, [out] ITfRangeBackup **ppBackup); - -}; +} const DWORD TF_INVALID_COOKIE = 0xffffffff; @@ -344,7 +469,7 @@ HRESULT UnadviseSink( [in] DWORD dwCookie); -}; +} [ object, @@ -442,7 +567,7 @@ [in] LANGID langid, [in] REFGUID guidProfile, [in] HKL hKL); -}; +} typedef [uuid(44d2825a-10e5-43b2-877f-6cb2f43b7e7e)] struct TF_INPUTPROCESSORPROFILE { @@ -703,7 +828,45 @@ HRESULT IsEqualTfGuidAtom([in] TfGuidAtom guidatom, [in] REFGUID rguid, [out] BOOL *pfEqual); -}; +} + +[ + object, + uuid(f99d3f40-8e32-11d2-bf46-00105a2799b5), + pointer_default(unique) +] +interface IEnumTfRanges : IUnknown +{ + HRESULT Clone([out] IEnumTfRanges **ppEnum); + + HRESULT Next( + [in] ULONG ulCount, + [out, size_is(ulCount), length_is(*pcFetched)] ITfRange **ppRange, + [out] ULONG *pcFetched); + + HRESULT Reset(); + + HRESULT Skip(ULONG ulCount); +} + +[ + object, + uuid(42d4d099-7c1a-4a89-b836-6c6f22160df0), + pointer_default(unique) +] +interface ITfEditRecord : IUnknown +{ + const DWORD TF_GTP_INCL_TEXT = 0x1; + + HRESULT GetSelectionStatus( + [out] BOOL *changed); + + HRESULT GetTextAndPropertyUpdates( + [in] DWORD flags, + [in, size_is(count)] const GUID **props, + [in] ULONG count, + [out] IEnumTfRanges **ret); +} [ object, @@ -716,7 +879,7 @@ [in] ITfContext *pic, [in] TfEditCookie ecReadOnly, [in] ITfEditRecord *pEditRecord); -}; +} [ object, @@ -735,7 +898,7 @@ HRESULT OnEndComposition( [in] ITfCompositionView *pComposition); -}; +} [ object, @@ -769,7 +932,7 @@ HRESULT Skip( [in] ULONG ulCount); -}; +} [ object, @@ -784,7 +947,7 @@ [in] TfClientId tid); HRESULT Deactivate(); -}; +} [ object, @@ -808,7 +971,7 @@ HRESULT OnPopContext( [in] ITfContext *pic); -}; +} [ object, @@ -883,7 +1046,7 @@ [in] ITfContext *pic, [in] REFGUID rguid, [out] BOOL *pfEaten); -}; +} [ object, @@ -924,7 +1087,7 @@ [in] ITfContext *pic, [in] REFGUID rguid, [out] BOOL *pfEaten); -}; +} [ object, @@ -963,7 +1126,7 @@ [in] UINT wMsgFilterMin, [in] UINT wMsgFilterMax, [out] BOOL *pfResult); -}; +} [ object, @@ -976,7 +1139,7 @@ HRESULT GetClientId( [in] REFCLSID rclsid, [out] TfClientId *ptid); -}; +} [ object, @@ -1140,7 +1303,7 @@ HRESULT GetContext( [out] ITfContext **ppContext); -}; +} [ object, @@ -1179,7 +1342,7 @@ [in] DWORD dwFlags, [in] IDataObject *pDataObject, [out] ITfRange **ppRange); -}; +} [ object, @@ -1219,25 +1382,6 @@ HRESULT Serialize( [in] IStream *pStream, [out] ULONG *pcb); -} - -[ - object, - uuid(f99d3f40-8e32-11d2-bf46-00105a2799b5), - pointer_default(unique) -] -interface IEnumTfRanges : IUnknown -{ - HRESULT Clone([out] IEnumTfRanges **ppEnum); - - HRESULT Next( - [in] ULONG ulCount, - [out, size_is(ulCount), length_is(*pcFetched)] ITfRange **ppRange, - [out] ULONG *pcFetched); - - HRESULT Reset(); - - HRESULT Skip(ULONG ulCount); } [ @@ -1436,7 +1580,7 @@ HRESULT GetValue( [out] VARIANT *pvarValue); -}; +} [ object, @@ -1455,7 +1599,7 @@ HRESULT EnumCompartments( [out] IEnumGUID **ppEnum); -}; +} [ object, @@ -1487,7 +1631,7 @@ HRESULT Skip( [in] ULONG ulCount); -}; +} [ object, @@ -1508,7 +1652,77 @@ HRESULT Skip( [in] ULONG ulCount); -}; +} + +[ + object, + local, + uuid(ea1ea137-19df-11d7-a6d2-00065b84435c), + pointer_default(unique) +] +interface ITfUIElement : IUnknown +{ + HRESULT GetDescription( + [out] BSTR *description); + + HRESULT GetGUID( + [out] GUID *guid); + + HRESULT Show( + [in] BOOL show); + + HRESULT IsShown( + [out] BOOL *show); +} + +[ + object, + local, + uuid(887aa91e-acba-4931-84da-3c5208cf543f), + pointer_default(unique) +] +interface IEnumTfUIElements : IUnknown +{ + HRESULT Clone( + [out] IEnumTfUIElements **enum_elements); + + HRESULT Next( + [in] ULONG count, + [out, size_is(count), length_is(fetched)] ITfUIElement **element, + [out] ULONG fetched); + + HRESULT Reset(); + + HRESULT Skip( + [in] ULONG count); +} + +[ + object, + local, + uuid(ea1ea135-19df-11d7-a6d2-00065b84435c), + pointer_default(unique) +] +interface ITfUIElementMgr : IUnknown +{ + HRESULT BeginUIElement( + [in] ITfUIElement *element, + [in, out] BOOL *show, + [out] DWORD *id); + + HRESULT UpdateUIElement( + [in] DWORD id); + + HRESULT EndUIElement( + [in] DWORD id); + + HRESULT GetUIElement( + [in] DWORD id, + [out] ITfUIElement **element); + + HRESULT EnumUIElements( + [out] IEnumTfUIElements **enum_elements); +} [ object, @@ -1525,7 +1739,7 @@ HRESULT UnadviseSingleSink( [in] TfClientId tid, [in] REFIID riid); -}; +} [ object, @@ -1538,7 +1752,7 @@ HRESULT OnSetThreadFocus(); HRESULT OnKillThreadFocus(); -}; +} [ object,
8 years, 11 months
1
0
0
0
← Newer
1
...
12
13
14
15
16
17
18
...
46
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Results per page:
10
25
50
100
200