Commit 31c0cb48 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Implement Win32_DisplayControllerConfiguration.

parent 01d21250
......@@ -74,6 +74,9 @@ static const WCHAR class_diskdrivetodiskpartitionW[] =
{'W','i','n','3','2','_','D','i','s','k','D','r','i','v','e','T','o','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
static const WCHAR class_diskpartitionW[] =
{'W','i','n','3','2','_','D','i','s','k','P','a','r','t','i','t','i','o','n',0};
static const WCHAR class_displaycontrollerconfigW[] =
{'W','i','n','3','2','_','D','i','s','p','l','a','y','C','o','n','t','r','o','l','l','e','r',
'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
static const WCHAR class_ip4routetableW[] =
{'W','i','n','3','2','_','I','P','4','R','o','u','t','e','T','a','b','l','e',0};
static const WCHAR class_logicaldiskW[] =
......@@ -151,6 +154,8 @@ static const WCHAR prop_availabilityW[] =
{'A','v','a','i','l','a','b','i','l','i','t','y',0};
static const WCHAR prop_binaryrepresentationW[] =
{'B','i','n','a','r','y','R','e','p','r','e','s','e','n','t','a','t','i','o','n',0};
static const WCHAR prop_bitsperpixelW[] =
{'B','i','t','s','P','e','r','P','i','x','e','l',0};
static const WCHAR prop_boolvalueW[] =
{'B','o','o','l','V','a','l','u','e',0};
static const WCHAR prop_bootableW[] =
......@@ -445,6 +450,8 @@ static const WCHAR prop_vendorW[] =
{'V','e','n','d','o','r',0};
static const WCHAR prop_versionW[] =
{'V','e','r','s','i','o','n',0};
static const WCHAR prop_verticalresolutionW[] =
{'V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0};
static const WCHAR prop_videoarchitectureW[] =
{'V','i','d','e','o','A','r','c','h','i','t','e','c','t','u','r','e',0};
static const WCHAR prop_videomemorytypeW[] =
......@@ -568,6 +575,14 @@ static const struct column col_diskpartition[] =
{ prop_startingoffsetW, CIM_UINT64 },
{ prop_typeW, CIM_STRING|COL_FLAG_DYNAMIC }
};
static const struct column col_displaycontrollerconfig[] =
{
{ prop_bitsperpixelW, CIM_UINT32 },
{ prop_captionW, CIM_STRING },
{ prop_horizontalresolutionW, CIM_UINT32 },
{ prop_nameW, CIM_STRING|COL_FLAG_KEY },
{ prop_verticalresolutionW, CIM_UINT32 }
};
static const struct column col_ip4routetable[] =
{
{ prop_destinationW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
......@@ -1030,6 +1045,14 @@ struct record_diskpartition
UINT64 startingoffset;
const WCHAR *type;
};
struct record_displaycontrollerconfig
{
UINT32 bitsperpixel;
const WCHAR *caption;
UINT32 horizontalresolution;
const WCHAR *name;
UINT32 verticalresolution;
};
struct record_ip4routetable
{
const WCHAR *destination;
......@@ -2699,6 +2722,41 @@ static enum fill_status fill_diskpartition( struct table *table, const struct ex
return status;
}
static UINT32 get_bitsperpixel( UINT *hres, UINT *vres )
{
HDC hdc = GetDC( NULL );
UINT32 ret;
if (!hdc) return 32;
ret = GetDeviceCaps( hdc, BITSPIXEL );
*hres = GetDeviceCaps( hdc, HORZRES );
*vres = GetDeviceCaps( hdc, VERTRES );
ReleaseDC( NULL, hdc );
return ret;
}
static enum fill_status fill_displaycontrollerconfig( struct table *table, const struct expr *cond )
{
struct record_displaycontrollerconfig *rec;
UINT row = 0, hres = 1024, vres = 768;
enum fill_status status = FILL_STATUS_UNFILTERED;
if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
rec = (struct record_displaycontrollerconfig *)table->data;
rec->bitsperpixel = get_bitsperpixel( &hres, &vres );
rec->caption = videocontroller_deviceidW;
rec->horizontalresolution = hres;
rec->name = videocontroller_deviceidW;
rec->verticalresolution = vres;
if (!match_row( table, row, cond, &status )) free_row_values( table, row );
else row++;
TRACE("created %u rows\n", row);
table->num_rows = row;
return status;
}
static WCHAR *get_ip4_string( DWORD addr )
{
static const WCHAR fmtW[] = {'%','u','.','%','u','.','%','u','.','%','u',0};
......@@ -4250,18 +4308,6 @@ static enum fill_status fill_systemenclosure( struct table *table, const struct
return status;
}
static UINT32 get_bits_per_pixel( UINT *hres, UINT *vres )
{
HDC hdc = GetDC( NULL );
UINT32 ret;
if (!hdc) return 32;
ret = GetDeviceCaps( hdc, BITSPIXEL );
*hres = GetDeviceCaps( hdc, HORZRES );
*vres = GetDeviceCaps( hdc, VERTRES );
ReleaseDC( NULL, hdc );
return ret;
}
static WCHAR *get_pnpdeviceid( DXGI_ADAPTER_DESC *desc )
{
static const WCHAR fmtW[] =
......@@ -4335,7 +4381,7 @@ done:
rec->availability = 3; /* Running or Full Power */
rec->config_errorcode = 0; /* no error */
rec->caption = heap_strdupW( name );
rec->current_bitsperpixel = get_bits_per_pixel( &hres, &vres );
rec->current_bitsperpixel = get_bitsperpixel( &hres, &vres );
rec->current_horizontalres = hres;
rec->current_refreshrate = 0; /* default refresh rate */
rec->current_scanmode = 2; /* Unknown */
......@@ -4380,6 +4426,7 @@ static struct table builtin_classes[] =
{ class_diskdriveW, C(col_diskdrive), 0, 0, NULL, fill_diskdrive },
{ class_diskdrivetodiskpartitionW, C(col_diskdrivetodiskpartition), 0, 0, NULL, fill_diskdrivetodiskpartition },
{ class_diskpartitionW, C(col_diskpartition), 0, 0, NULL, fill_diskpartition },
{ class_displaycontrollerconfigW, C(col_displaycontrollerconfig), 0, 0, NULL, fill_displaycontrollerconfig },
{ class_ip4routetableW, C(col_ip4routetable), 0, 0, NULL, fill_ip4routetable },
{ class_logicaldiskW, C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk },
{ class_logicaldisk2W, C(col_logicaldisk), 0, 0, NULL, fill_logicaldisk },
......
......@@ -1713,6 +1713,49 @@ static void test_Win32_WinSAT( IWbemServices *services )
SysFreeString( wql );
}
static void test_Win32_DisplayControllerConfiguration( IWbemServices *services )
{
static const WCHAR bitsperpixelW[] =
{'B','i','t','s','P','e','r','P','i','x','e','l',0};
static const WCHAR captionW[] =
{'C','a','p','t','i','o','n',0};
static const WCHAR horizontalresolutionW[] =
{'H','o','r','i','z','o','n','t','a','l','R','e','s','o','l','u','t','i','o','n',0};
static const WCHAR nameW[] =
{'N','a','m','e',0};
static const WCHAR queryW[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','W','i','n','3','2','_',
'D','i','s','p','l','a','y','C','o','n','t','r','o','l','l','e','r',
'C','o','n','f','i','g','u','r','a','t','i','o','n',0};
static const WCHAR verticalresolutionW[] =
{'V','e','r','t','i','c','a','l','R','e','s','o','l','u','t','i','o','n',0};
BSTR wql = SysAllocString( wqlW ), query = SysAllocString( queryW );
IEnumWbemClassObject *result;
IWbemClassObject *obj;
HRESULT hr;
DWORD count;
hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
ok( hr == S_OK, "got %08x\n", hr );
for (;;)
{
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
check_property( obj, bitsperpixelW, VT_I4, CIM_UINT32 );
check_property( obj, captionW, VT_BSTR, CIM_STRING );
check_property( obj, horizontalresolutionW, VT_I4, CIM_UINT32 );
check_property( obj, nameW, VT_BSTR, CIM_STRING );
check_property( obj, verticalresolutionW, VT_I4, CIM_UINT32 );
IWbemClassObject_Release( obj );
}
IEnumWbemClassObject_Release( result );
SysFreeString( query );
SysFreeString( wql );
}
START_TEST(query)
{
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
......@@ -1752,6 +1795,7 @@ START_TEST(query)
test_Win32_ComputerSystem( services );
test_Win32_ComputerSystemProduct( services );
test_Win32_Bios( services );
test_Win32_DisplayControllerConfiguration( services );
test_Win32_IP4RouteTable( services );
test_Win32_OperatingSystem( services );
test_Win32_PhysicalMemory( services );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment