dxdiagn: Extract the fallback display information code to a separate function.

This commit is contained in:
Andrew Nguyen 2011-06-15 07:10:58 -05:00 committed by Alexandre Julliard
parent 2d75211bd2
commit f750cf3306
1 changed files with 16 additions and 9 deletions

View File

@ -897,7 +897,7 @@ cleanup:
return hr;
}
static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container *node)
{
static const WCHAR szAdapterID[] = {'0',0};
@ -910,11 +910,6 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
DWORD tmp;
WCHAR buffer[256];
/* Try to use Direct3D to obtain the required information first. */
hr = fill_display_information_d3d(node);
if (hr != E_FAIL)
return hr;
display_adapter = allocate_information_node(szAdapterID);
if (!display_adapter)
return E_OUTOFMEMORY;
@ -933,8 +928,8 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
return hr;
}
/* For now, silently ignore a failure from DirectDrawCreateEx. */
hr = DirectDrawCreateEx(NULL, (LPVOID *)&pDirectDraw, &IID_IDirectDraw7, NULL);
/* Silently ignore a failure from DirectDrawCreateEx. */
hr = DirectDrawCreateEx(NULL, (void **)&pDirectDraw, &IID_IDirectDraw7, NULL);
if (FAILED(hr))
return S_OK;
@ -945,7 +940,7 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
{
static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0};
snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, ((float)tmp) / 1000000.0);
snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, tmp / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr))
@ -1010,6 +1005,18 @@ cleanup:
return hr;
}
static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
{
HRESULT hr;
/* Try to use Direct3D to obtain the required information first. */
hr = fill_display_information_d3d(node);
if (hr != E_FAIL)
return hr;
return fill_display_information_fallback(node);
}
static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
{
static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};