static HRESULT WINAPI d3d8_GetAdapterIdentifier(IDirect3D8 *iface, UINT adapter, DWORD flags, D3DADAPTER_IDENTIFIER8 *identifier) { struct d3d8 *d3d8 = impl_from_IDirect3D8(iface); struct wined3d_adapter_identifier adapter_id; HRESULT hr; TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n", iface, adapter, flags, identifier); adapter_id.driver = identifier->Driver; adapter_id.driver_size = sizeof(identifier->Driver); adapter_id.description = identifier->Description; adapter_id.description_size = sizeof(identifier->Description); adapter_id.device_name = NULL; /* d3d9 only */ adapter_id.device_name_size = 0; /* d3d9 only */ wined3d_mutex_lock(); hr = wined3d_get_adapter_identifier(d3d8->wined3d, adapter, flags, &adapter_id); wined3d_mutex_unlock(); identifier->DriverVersion = adapter_id.driver_version; identifier->VendorId = adapter_id.vendor_id; identifier->DeviceId = adapter_id.device_id; identifier->SubSysId = adapter_id.subsystem_id; identifier->Revision = adapter_id.revision; memcpy(&identifier->DeviceIdentifier, &adapter_id.device_identifier, sizeof(identifier->DeviceIdentifier)); identifier->WHQLLevel = adapter_id.whql_level; return hr; }
static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8 *pIdentifier) { IDirect3D8Impl *This = impl_from_IDirect3D8(iface); WINED3DADAPTER_IDENTIFIER adapter_id; HRESULT hr; TRACE("iface %p, adapter %u, flags %#x, identifier %p.\n", iface, Adapter, Flags, pIdentifier); adapter_id.driver = pIdentifier->Driver; adapter_id.driver_size = sizeof(pIdentifier->Driver); adapter_id.description = pIdentifier->Description; adapter_id.description_size = sizeof(pIdentifier->Description); adapter_id.device_name = NULL; /* d3d9 only */ adapter_id.device_name_size = 0; /* d3d9 only */ wined3d_mutex_lock(); hr = wined3d_get_adapter_identifier(This->WineD3D, Adapter, Flags, &adapter_id); wined3d_mutex_unlock(); pIdentifier->DriverVersion = adapter_id.driver_version; pIdentifier->VendorId = adapter_id.vendor_id; pIdentifier->DeviceId = adapter_id.device_id; pIdentifier->SubSysId = adapter_id.subsystem_id; pIdentifier->Revision = adapter_id.revision; memcpy(&pIdentifier->DeviceIdentifier, &adapter_id.device_identifier, sizeof(pIdentifier->DeviceIdentifier)); pIdentifier->WHQLLevel = adapter_id.whql_level; return hr; }
static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMCALLBACKEXA callback, void *context) { struct wined3d_adapter_identifier adapter_id; struct wined3d_output_desc output_desc; BOOL cont_enum = TRUE; HRESULT hr = S_OK; UINT adapter = 0; for (adapter = 0; SUCCEEDED(hr) && cont_enum; adapter++) { char DriverName[512] = "", DriverDescription[512] = ""; /* The Battle.net System Checker expects the GetAdapterIdentifier DeviceName to match the * Driver Name, so obtain the DeviceName and GUID from D3D. */ memset(&adapter_id, 0x0, sizeof(adapter_id)); adapter_id.device_name = DriverName; adapter_id.device_name_size = sizeof(DriverName); adapter_id.description = DriverDescription; adapter_id.description_size = sizeof(DriverDescription); wined3d_mutex_lock(); if (SUCCEEDED(hr = wined3d_get_adapter_identifier(wined3d, adapter, 0x0, &adapter_id))) hr = wined3d_get_output_desc(wined3d, adapter, &output_desc); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) { TRACE("Interface %d: %s\n", adapter, wine_dbgstr_guid(&adapter_id.device_identifier)); cont_enum = callback(&adapter_id.device_identifier, adapter_id.description, adapter_id.device_name, context, output_desc.monitor); } } }
static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc) { struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface); struct wined3d_adapter_identifier adapter_id; char description[128]; struct wined3d *wined3d; HRESULT hr; TRACE("iface %p, desc %p.\n", iface, desc); if (!desc) return E_INVALIDARG; wined3d = IWineDXGIFactory_get_wined3d(adapter->parent); adapter_id.driver_size = 0; adapter_id.description = description; adapter_id.description_size = sizeof(description); adapter_id.device_name_size = 0; EnterCriticalSection(&dxgi_cs); hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id); wined3d_decref(wined3d); LeaveCriticalSection(&dxgi_cs); if (FAILED(hr)) return hr; if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128)) { DWORD err = GetLastError(); ERR("Failed to translate description %s (%#x).\n", debugstr_a(description), err); hr = E_FAIL; } desc->VendorId = adapter_id.vendor_id; desc->DeviceId = adapter_id.device_id; desc->SubSysId = adapter_id.subsystem_id; desc->Revision = adapter_id.revision; desc->DedicatedVideoMemory = adapter_id.video_memory; desc->DedicatedSystemMemory = 0; /* FIXME */ desc->SharedSystemMemory = 0; /* FIXME */ memcpy(&desc->AdapterLuid, &adapter_id.adapter_luid, sizeof(desc->AdapterLuid)); desc->Flags = 0; return hr; }
static HRESULT WINAPI d3d9_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUID *luid) { struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface); struct wined3d_adapter_identifier adapter_id; HRESULT hr; TRACE("iface %p, adapter %u, luid %p.\n", iface, adapter, luid); adapter_id.driver_size = 0; adapter_id.description_size = 0; adapter_id.device_name_size = 0; wined3d_mutex_lock(); hr = wined3d_get_adapter_identifier(d3d9->wined3d, adapter, 0, &adapter_id); wined3d_mutex_unlock(); memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid)); return hr; }
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUID *luid) { IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); WINED3DADAPTER_IDENTIFIER adapter_id; HRESULT hr; TRACE("iface %p, adapter %u, luid %p.\n", iface, adapter, luid); adapter_id.driver_size = 0; adapter_id.description_size = 0; adapter_id.device_name_size = 0; wined3d_mutex_lock(); hr = wined3d_get_adapter_identifier(This->WineD3D, adapter, 0, &adapter_id); wined3d_mutex_unlock(); memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid)); return hr; }