static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) { IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, Adapter, DeviceType, pCaps); if(NULL == pCaps){ return D3DERR_INVALIDCALL; } pWineCaps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINED3DCAPS)); if(pWineCaps == NULL){ return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/ } wined3d_mutex_lock(); hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps); wined3d_mutex_unlock(); fixup_caps(pWineCaps); WINECAPSTOD3D8CAPS(pCaps, pWineCaps) HeapFree(GetProcessHeap(), 0, pWineCaps); TRACE("(%p) returning %p\n", This, pCaps); return hrc; }
static HRESULT WINAPI d3d8_GetDeviceCaps(IDirect3D8 *iface, UINT adapter, D3DDEVTYPE device_type, D3DCAPS8 *caps) { struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); WINED3DCAPS *wined3d_caps; HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, caps %p.\n", iface, adapter, device_type, caps); if (!caps) return D3DERR_INVALIDCALL; if (!(wined3d_caps = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*wined3d_caps)))) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); hr = wined3d_get_device_caps(d3d8->wined3d, adapter, device_type, wined3d_caps); wined3d_mutex_unlock(); fixup_caps(wined3d_caps); WINECAPSTOD3D8CAPS(caps, wined3d_caps) HeapFree(GetProcessHeap(), 0, wined3d_caps); return hr; }