wbemprox: Map CIM_UINT16 and CIM_UINT32 to VT_I4 by default.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47782
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2019-09-19 19:33:29 +02:00 committed by Alexandre Julliard
parent 58572fc916
commit 34bd6a9cf3
5 changed files with 148 additions and 156 deletions

View File

@ -441,8 +441,6 @@ static const WCHAR prop_usernameW[] =
{'U','s','e','r','N','a','m','e',0};
static const WCHAR prop_uuidW[] =
{'U','U','I','D',0};
static const WCHAR prop_varianttypeW[] =
{'V','a','r','i','a','n','t','T','y','p','e',0};
static const WCHAR prop_vendorW[] =
{'V','e','n','d','o','r',0};
static const WCHAR prop_versionW[] =
@ -493,8 +491,8 @@ static const struct column col_bios[] =
{ prop_releasedateW, CIM_DATETIME|COL_FLAG_DYNAMIC },
{ prop_serialnumberW, CIM_STRING },
{ prop_smbiosbiosversionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_smbiosmajorversionW, CIM_UINT16, VT_I4 },
{ prop_smbiosminorversionW, CIM_UINT16, VT_I4 },
{ prop_smbiosmajorversionW, CIM_UINT16 },
{ prop_smbiosminorversionW, CIM_UINT16 },
{ prop_versionW, CIM_STRING|COL_FLAG_KEY }
};
static const struct column col_cdromdrive[] =
@ -509,12 +507,12 @@ static const struct column col_compsys[] =
{
{ prop_descriptionW, CIM_STRING },
{ prop_domainW, CIM_STRING },
{ prop_domainroleW, CIM_UINT16, VT_I4 },
{ prop_domainroleW, CIM_UINT16 },
{ prop_manufacturerW, CIM_STRING },
{ prop_modelW, CIM_STRING },
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
{ prop_numprocessorsW, CIM_UINT32, VT_I4 },
{ prop_numlogicalprocessorsW, CIM_UINT32 },
{ prop_numprocessorsW, CIM_UINT32 },
{ prop_totalphysicalmemoryW, CIM_UINT64 },
{ prop_usernameW, CIM_STRING|COL_FLAG_DYNAMIC }
};
@ -544,7 +542,7 @@ static const struct column col_directory[] =
static const struct column col_diskdrive[] =
{
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
{ prop_indexW, CIM_UINT32, VT_I4 },
{ prop_indexW, CIM_UINT32 },
{ prop_interfacetypeW, CIM_STRING },
{ prop_manufacturerW, CIM_STRING },
{ prop_mediatypeW, CIM_STRING },
@ -563,8 +561,8 @@ static const struct column col_diskpartition[] =
{ prop_bootableW, CIM_BOOLEAN },
{ prop_bootpartitionW, CIM_BOOLEAN },
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
{ prop_diskindexW, CIM_UINT32, VT_I4 },
{ prop_indexW, CIM_UINT32, VT_I4 },
{ prop_diskindexW, CIM_UINT32 },
{ prop_indexW, CIM_UINT32 },
{ prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_sizeW, CIM_UINT64 },
{ prop_startingoffsetW, CIM_UINT64 },
@ -579,7 +577,7 @@ static const struct column col_ip4routetable[] =
static const struct column col_logicaldisk[] =
{
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
{ prop_drivetypeW, CIM_UINT32, VT_I4 },
{ prop_drivetypeW, CIM_UINT32 },
{ prop_filesystemW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_freespaceW, CIM_UINT64 },
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
@ -595,15 +593,15 @@ static const struct column col_logicaldisktopartition[] =
static const struct column col_networkadapter[] =
{
{ prop_adaptertypeW, CIM_STRING },
{ prop_adaptertypeidW, CIM_UINT16, VT_I4 },
{ prop_adaptertypeidW, CIM_UINT16 },
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
{ prop_indexW, CIM_UINT32, VT_I4 },
{ prop_interfaceindexW, CIM_UINT32, VT_I4 },
{ prop_indexW, CIM_UINT32 },
{ prop_interfaceindexW, CIM_UINT32 },
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_manufacturerW, CIM_STRING },
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_netconnectionstatusW, CIM_UINT16, VT_I4 },
{ prop_netconnectionstatusW, CIM_UINT16 },
{ prop_physicaladapterW, CIM_BOOLEAN },
{ prop_pnpdeviceidW, CIM_STRING },
{ prop_speedW, CIM_UINT64 }
@ -615,9 +613,9 @@ static const struct column col_networkadapterconfig[] =
{ prop_dhcpenabledW, CIM_BOOLEAN },
{ prop_dnshostnameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_dnsserversearchorderW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_indexW, CIM_UINT32|COL_FLAG_KEY, VT_I4 },
{ prop_indexW, CIM_UINT32|COL_FLAG_KEY },
{ prop_ipaddressW, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_ipconnectionmetricW, CIM_UINT32, VT_I4 },
{ prop_ipconnectionmetricW, CIM_UINT32 },
{ prop_ipenabledW, CIM_BOOLEAN },
{ prop_ipsubnet, CIM_STRING|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_macaddressW, CIM_STRING|COL_FLAG_DYNAMIC },
@ -639,16 +637,16 @@ static const struct column col_operatingsystem[] =
{ prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_manufacturerW, CIM_STRING },
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_operatingsystemskuW, CIM_UINT32, VT_I4 },
{ prop_operatingsystemskuW, CIM_UINT32 },
{ prop_osarchitectureW, CIM_STRING },
{ prop_oslanguageW, CIM_UINT32, VT_I4 },
{ prop_osproductsuiteW, CIM_UINT32, VT_I4 },
{ prop_ostypeW, CIM_UINT16, VT_I4 },
{ prop_oslanguageW, CIM_UINT32 },
{ prop_osproductsuiteW, CIM_UINT32 },
{ prop_ostypeW, CIM_UINT16 },
{ prop_primaryW, CIM_BOOLEAN },
{ prop_serialnumberW, CIM_STRING },
{ prop_servicepackmajorW, CIM_UINT16, VT_I4 },
{ prop_servicepackminorW, CIM_UINT16, VT_I4 },
{ prop_suitemaskW, CIM_UINT32, VT_I4 },
{ prop_servicepackmajorW, CIM_UINT16 },
{ prop_servicepackminorW, CIM_UINT16 },
{ prop_suitemaskW, CIM_UINT32 },
{ prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_systemdriveW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_totalvirtualmemorysizeW, CIM_UINT64 },
@ -662,7 +660,6 @@ static const struct column col_param[] =
{ prop_directionW, CIM_SINT32 },
{ prop_parameterW, CIM_STRING },
{ prop_typeW, CIM_UINT32 },
{ prop_varianttypeW, CIM_UINT32 },
{ prop_defaultvalueW, CIM_UINT32 }
};
static const struct column col_physicalmedia[] =
@ -673,9 +670,9 @@ static const struct column col_physicalmedia[] =
static const struct column col_physicalmemory[] =
{
{ prop_capacityW, CIM_UINT64 },
{ prop_configuredclockspeedW, CIM_UINT32, VT_I4 },
{ prop_configuredclockspeedW, CIM_UINT32 },
{ prop_devicelocatorW, CIM_STRING },
{ prop_memorytypeW, CIM_UINT16, VT_I4 },
{ prop_memorytypeW, CIM_UINT16 },
{ prop_partnumberW, CIM_STRING }
};
static const struct column col_pnpentity[] =
@ -701,33 +698,33 @@ static const struct column col_process[] =
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_handleW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_pprocessidW, CIM_UINT32, VT_I4 },
{ prop_processidW, CIM_UINT32, VT_I4 },
{ prop_threadcountW, CIM_UINT32, VT_I4 },
{ prop_pprocessidW, CIM_UINT32 },
{ prop_processidW, CIM_UINT32 },
{ prop_threadcountW, CIM_UINT32 },
{ prop_workingsetsizeW, CIM_UINT64 },
/* methods */
{ method_getownerW, CIM_FLAG_ARRAY|COL_FLAG_METHOD }
};
static const struct column col_processor[] =
{
{ prop_addresswidthW, CIM_UINT16, VT_I4 },
{ prop_architectureW, CIM_UINT16, VT_I4 },
{ prop_addresswidthW, CIM_UINT16 },
{ prop_architectureW, CIM_UINT16 },
{ prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_cpustatusW, CIM_UINT16 },
{ prop_currentclockspeedW, CIM_UINT32, VT_I4 },
{ prop_datawidthW, CIM_UINT16, VT_I4 },
{ prop_currentclockspeedW, CIM_UINT32 },
{ prop_datawidthW, CIM_UINT16 },
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_deviceidW, CIM_STRING|COL_FLAG_DYNAMIC|COL_FLAG_KEY },
{ prop_familyW, CIM_UINT16, VT_I4 },
{ prop_levelW, CIM_UINT16, VT_I4 },
{ prop_familyW, CIM_UINT16 },
{ prop_levelW, CIM_UINT16 },
{ prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_maxclockspeedW, CIM_UINT32, VT_I4 },
{ prop_maxclockspeedW, CIM_UINT32 },
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_numcoresW, CIM_UINT32, VT_I4 },
{ prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
{ prop_numcoresW, CIM_UINT32 },
{ prop_numlogicalprocessorsW, CIM_UINT32 },
{ prop_processoridW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_processortypeW, CIM_UINT16, VT_I4 },
{ prop_revisionW, CIM_UINT16, VT_I4 },
{ prop_processortypeW, CIM_UINT16 },
{ prop_revisionW, CIM_UINT16 },
{ prop_uniqueidW, CIM_STRING },
{ prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC }
};
@ -771,7 +768,7 @@ static const struct column col_sounddevice[] =
{
{ prop_nameW, CIM_STRING },
{ prop_productnameW, CIM_STRING },
{ prop_statusinfoW, CIM_UINT16, VT_I4 }
{ prop_statusinfoW, CIM_UINT16 }
};
static const struct column col_stdregprov[] =
{
@ -783,7 +780,7 @@ static const struct column col_stdregprov[] =
static const struct column col_systemenclosure[] =
{
{ prop_captionW, CIM_STRING },
{ prop_chassistypesW, CIM_UINT16|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC, VT_I4|VT_ARRAY },
{ prop_chassistypesW, CIM_UINT16|CIM_FLAG_ARRAY|COL_FLAG_DYNAMIC },
{ prop_descriptionW, CIM_STRING },
{ prop_lockpresentW, CIM_BOOLEAN },
{ prop_manufacturerW, CIM_STRING|COL_FLAG_DYNAMIC },
@ -798,15 +795,15 @@ static const struct column col_systemsecurity[] =
static const struct column col_videocontroller[] =
{
{ prop_adapterdactypeW, CIM_STRING },
{ prop_adapterramW, CIM_UINT32, VT_I4 },
{ prop_adapterramW, CIM_UINT32 },
{ prop_availabilityW, CIM_UINT16 },
{ prop_captionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_configmanagererrorcodeW, CIM_UINT32, VT_I4 },
{ prop_currentbitsperpixelW, CIM_UINT32, VT_I4 },
{ prop_currenthorizontalresW, CIM_UINT32, VT_I4 },
{ prop_currentrefreshrateW, CIM_UINT32, VT_I4 },
{ prop_currentscanmodeW, CIM_UINT16, VT_I4 },
{ prop_currentverticalresW, CIM_UINT32, VT_I4 },
{ prop_configmanagererrorcodeW, CIM_UINT32 },
{ prop_currentbitsperpixelW, CIM_UINT32 },
{ prop_currenthorizontalresW, CIM_UINT32 },
{ prop_currentrefreshrateW, CIM_UINT32 },
{ prop_currentscanmodeW, CIM_UINT16 },
{ prop_currentverticalresW, CIM_UINT32 },
{ prop_descriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_deviceidW, CIM_STRING|COL_FLAG_KEY },
{ prop_driverdateW, CIM_DATETIME },
@ -815,8 +812,8 @@ static const struct column col_videocontroller[] =
{ prop_nameW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_pnpdeviceidW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_statusW, CIM_STRING },
{ prop_videoarchitectureW, CIM_UINT16, VT_I4 },
{ prop_videomemorytypeW, CIM_UINT16, VT_I4 },
{ prop_videoarchitectureW, CIM_UINT16 },
{ prop_videomemorytypeW, CIM_UINT16 },
{ prop_videomodedescriptionW, CIM_STRING|COL_FLAG_DYNAMIC },
{ prop_videoprocessorW, CIM_STRING|COL_FLAG_DYNAMIC },
};
@ -828,7 +825,7 @@ static const struct column col_winsat[] =
{ prop_graphicsscoreW, CIM_REAL32 },
{ prop_memoryscoreW, CIM_REAL32 },
{ prop_timetakenW, CIM_STRING|COL_FLAG_KEY },
{ prop_winsatassessmentstateW, CIM_UINT32, VT_I4 },
{ prop_winsatassessmentstateW, CIM_UINT32 },
{ prop_winsprlevelW, CIM_REAL32 },
};
@ -1125,7 +1122,6 @@ struct record_param
INT32 direction;
const WCHAR *parameter;
UINT32 type;
UINT32 varianttype;
UINT32 defaultvalue;
};
struct record_physicalmedia
@ -1303,34 +1299,34 @@ static const struct record_associator data_associator[] =
};
static const struct record_param data_param[] =
{
{ class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_processW, method_getownerW, -1, param_returnvalueW, CIM_UINT32 },
{ class_processW, method_getownerW, -1, param_userW, CIM_STRING },
{ class_processW, method_getownerW, -1, param_domainW, CIM_STRING },
{ class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_stdregprovW, method_createkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
{ class_serviceW, method_pauseserviceW, -1, param_returnvalueW, CIM_UINT32 },
{ class_serviceW, method_resumeserviceW, -1, param_returnvalueW, CIM_UINT32 },
{ class_serviceW, method_startserviceW, -1, param_returnvalueW, CIM_UINT32 },
{ class_serviceW, method_stopserviceW, -1, param_returnvalueW, CIM_UINT32 },
{ class_stdregprovW, method_createkeyW, 1, param_defkeyW, CIM_SINT32, 0x80000002 },
{ class_stdregprovW, method_createkeyW, 1, param_subkeynameW, CIM_STRING },
{ class_stdregprovW, method_createkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
{ class_stdregprovW, method_createkeyW, -1, param_returnvalueW, CIM_UINT32 },
{ class_stdregprovW, method_enumkeyW, 1, param_defkeyW, CIM_SINT32, 0x80000002 },
{ class_stdregprovW, method_enumkeyW, 1, param_subkeynameW, CIM_STRING },
{ class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_stdregprovW, method_enumkeyW, -1, param_returnvalueW, CIM_UINT32 },
{ class_stdregprovW, method_enumkeyW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
{ class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
{ class_stdregprovW, method_enumvaluesW, 1, param_defkeyW, CIM_SINT32, 0x80000002 },
{ class_stdregprovW, method_enumvaluesW, 1, param_subkeynameW, CIM_STRING },
{ class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_stdregprovW, method_enumvaluesW, -1, param_returnvalueW, CIM_UINT32 },
{ class_stdregprovW, method_enumvaluesW, -1, param_namesW, CIM_STRING|CIM_FLAG_ARRAY },
{ class_stdregprovW, method_enumvaluesW, -1, param_typesW, CIM_SINT32|CIM_FLAG_ARRAY },
{ class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0, 0x80000002 },
{ class_stdregprovW, method_getstringvalueW, 1, param_defkeyW, CIM_SINT32, 0x80000002 },
{ class_stdregprovW, method_getstringvalueW, 1, param_subkeynameW, CIM_STRING },
{ class_stdregprovW, method_getstringvalueW, 1, param_valuenameW, CIM_STRING },
{ class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_stdregprovW, method_getstringvalueW, -1, param_returnvalueW, CIM_UINT32 },
{ class_stdregprovW, method_getstringvalueW, -1, param_valueW, CIM_STRING },
{ class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_systemsecurityW, method_getsdW, -1, param_returnvalueW, CIM_UINT32 },
{ class_systemsecurityW, method_getsdW, -1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
{ class_systemsecurityW, method_setsdW, 1, param_sdW, CIM_UINT8|CIM_FLAG_ARRAY },
{ class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32, VT_I4 },
{ class_systemsecurityW, method_setsdW, -1, param_returnvalueW, CIM_UINT32 },
};
#define FLAVOR_ID (WBEM_FLAVOR_FLAG_PROPAGATE_TO_INSTANCE | WBEM_FLAVOR_NOT_OVERRIDABLE |\

View File

@ -227,7 +227,6 @@ static struct record *create_record( struct table *table )
for (i = 0; i < table->num_cols; i++)
{
record->fields[i].type = table->columns[i].type;
record->fields[i].vartype = table->columns[i].vartype;
record->fields[i].u.ival = 0;
}
record->count = table->num_cols;
@ -347,13 +346,13 @@ static HRESULT WINAPI class_object_GetQualifierSet(
static HRESULT record_get_value( const struct record *record, UINT index, VARIANT *var, CIMTYPE *type )
{
VARTYPE vartype = record->fields[index].vartype;
VARTYPE vartype = to_vartype( record->fields[index].type & CIM_TYPE_MASK );
if (type) *type = record->fields[index].type;
if (record->fields[index].type & CIM_FLAG_ARRAY)
{
V_VT( var ) = vartype ? vartype : to_vartype( record->fields[index].type & CIM_TYPE_MASK ) | VT_ARRAY;
V_VT( var ) = vartype | VT_ARRAY;
V_ARRAY( var ) = to_safearray( record->fields[index].u.aval, record->fields[index].type & CIM_TYPE_MASK );
return S_OK;
}
@ -362,15 +361,12 @@ static HRESULT record_get_value( const struct record *record, UINT index, VARIAN
case CIM_STRING:
case CIM_DATETIME:
case CIM_REFERENCE:
if (!vartype) vartype = VT_BSTR;
V_BSTR( var ) = SysAllocString( record->fields[index].u.sval );
break;
case CIM_SINT32:
if (!vartype) vartype = VT_I4;
V_I4( var ) = record->fields[index].u.ival;
break;
case CIM_UINT32:
if (!vartype) vartype = VT_UI4;
V_UI4( var ) = record->fields[index].u.ival;
break;
default:
@ -735,7 +731,6 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
{
static const WCHAR parameterW[] = {'P','a','r','a','m','e','t','e','r',0};
static const WCHAR typeW[] = {'T','y','p','e',0};
static const WCHAR varianttypeW[] = {'V','a','r','i','a','n','t','T','y','p','e',0};
static const WCHAR defaultvalueW[] = {'D','e','f','a','u','l','t','V','a','l','u','e',0};
struct column *columns;
BYTE *row;
@ -764,10 +759,6 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
if (hr != S_OK) goto error;
columns[i].type = V_UI4( &val );
hr = IWbemClassObject_Get( param, varianttypeW, 0, &val, NULL, NULL );
if (hr != S_OK) goto error;
columns[i].vartype = V_UI4( &val );
hr = IWbemClassObject_Get( param, defaultvalueW, 0, &val, NULL, NULL );
if (hr != S_OK) goto error;
if (V_UI4( &val )) set_default_value( columns[i].type, V_UI4( &val ), row + offset );

View File

@ -1025,18 +1025,25 @@ VARTYPE to_vartype( CIMTYPE type )
{
switch (type)
{
case CIM_BOOLEAN: return VT_BOOL;
case CIM_BOOLEAN: return VT_BOOL;
case CIM_STRING:
case CIM_REFERENCE:
case CIM_DATETIME: return VT_BSTR;
case CIM_SINT8: return VT_I1;
case CIM_UINT8: return VT_UI1;
case CIM_SINT16: return VT_I2;
case CIM_UINT16: return VT_UI2;
case CIM_SINT32: return VT_I4;
case CIM_UINT32: return VT_UI4;
case CIM_SINT64: return VT_I8;
case CIM_UINT64: return VT_UI8;
case CIM_DATETIME: return VT_BSTR;
case CIM_SINT8: return VT_I1;
case CIM_UINT8: return VT_UI1;
case CIM_SINT16: return VT_I2;
case CIM_UINT16:
case CIM_SINT32:
case CIM_UINT32: return VT_I4;
case CIM_SINT64: return VT_I8;
case CIM_UINT64: return VT_UI8;
case CIM_REAL32: return VT_R4;
default:
ERR("unhandled type %u\n", type);
break;
@ -1044,10 +1051,10 @@ VARTYPE to_vartype( CIMTYPE type )
return 0;
}
SAFEARRAY *to_safearray( const struct array *array, CIMTYPE type )
SAFEARRAY *to_safearray( const struct array *array, CIMTYPE basetype )
{
SAFEARRAY *ret;
VARTYPE vartype = to_vartype( type );
VARTYPE vartype = to_vartype( basetype );
LONG i;
if (!array || !(ret = SafeArrayCreateVector( vartype, 0, array->count ))) return NULL;
@ -1187,23 +1194,20 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
if (!ret) return S_OK;
vartype = table->columns[column].vartype;
vartype = to_vartype( table->columns[column].type & CIM_TYPE_MASK );
if (table->columns[column].type & CIM_FLAG_ARRAY)
{
CIMTYPE basetype = table->columns[column].type & CIM_TYPE_MASK;
val_ptr = to_safearray( (const struct array *)(INT_PTR)val, basetype );
if (!val_ptr) vartype = VT_NULL;
else if (!vartype) vartype = to_vartype( basetype ) | VT_ARRAY;
else vartype |= VT_ARRAY;
set_variant( vartype, val, val_ptr, ret );
return S_OK;
}
switch (table->columns[column].type & COL_TYPE_MASK)
{
case CIM_BOOLEAN:
if (!vartype) vartype = VT_BOOL;
break;
case CIM_STRING:
case CIM_REFERENCE:
case CIM_DATETIME:
@ -1215,24 +1219,6 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
else
vartype = VT_NULL;
break;
case CIM_SINT8:
if (!vartype) vartype = VT_I1;
break;
case CIM_UINT8:
if (!vartype) vartype = VT_UI1;
break;
case CIM_SINT16:
if (!vartype) vartype = VT_I2;
break;
case CIM_UINT16:
if (!vartype) vartype = VT_UI2;
break;
case CIM_SINT32:
if (!vartype) vartype = VT_I4;
break;
case CIM_UINT32:
if (!vartype) vartype = VT_UI4;
break;
case CIM_SINT64:
vartype = VT_BSTR;
val_ptr = get_value_bstr( table, row, column );
@ -1241,8 +1227,14 @@ HRESULT get_propval( const struct view *view, UINT index, const WCHAR *name, VAR
vartype = VT_BSTR;
val_ptr = get_value_bstr( table, row, column );
break;
case CIM_BOOLEAN:
case CIM_SINT8:
case CIM_UINT8:
case CIM_SINT16:
case CIM_UINT16:
case CIM_SINT32:
case CIM_UINT32:
case CIM_REAL32:
if (!vartype) vartype = VT_R4;
break;
default:
ERR("unhandled column type %u\n", table->columns[column].type);

View File

@ -216,17 +216,50 @@ static void test_associators( IWbemServices *services )
}
}
static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *prop, VARTYPE vartype, CIMTYPE cimtype )
{
CIMTYPE type = 0xdeadbeef;
VARIANT val;
HRESULT hr;
VariantInit( &val );
hr = IWbemClassObject_Get( obj, prop, 0, &val, &type, NULL );
ok( hr == S_OK, "%u: failed to get description %08x\n", line, hr );
ok( V_VT( &val ) == vartype, "%u: unexpected variant type 0x%x\n", line, V_VT(&val) );
ok( type == cimtype, "%u: unexpected type 0x%x\n", line, type );
switch (V_VT(&val))
{
case VT_BSTR:
trace( "%s: %s\n", wine_dbgstr_w(prop), wine_dbgstr_w(V_BSTR(&val)) );
break;
case VT_I2:
trace( "%s: %d\n", wine_dbgstr_w(prop), V_I2(&val) );
break;
case VT_I4:
trace( "%s: %d\n", wine_dbgstr_w(prop), V_I4(&val) );
break;
case VT_R4:
trace( "%s: %f\n", wine_dbgstr_w(prop), V_R4(&val) );
break;
default:
break;
}
VariantClear( &val );
}
#define check_property(a,b,c,d) _check_property(__LINE__,a,b,c,d)
static void test_Win32_Service( IWbemServices *services )
{
static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0};
static const WCHAR pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0};
static const WCHAR processidW[] = {'P','r','o','c','e','s','s','I','D',0};
static const WCHAR resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0};
static const WCHAR startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0};
static const WCHAR stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0};
static const WCHAR stateW[] = {'S','t','a','t','e',0};
static const WCHAR stoppedW[] = {'S','t','o','p','p','e','d',0};
static const WCHAR returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0};
static const WCHAR serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e','.',
'N','a','m','e','=','"','S','p','o','o','l','e','r','"',0};
static const WCHAR startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0};
static const WCHAR stateW[] = {'S','t','a','t','e',0};
static const WCHAR stoppedW[] = {'S','t','o','p','p','e','d',0};
static const WCHAR stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0};
static const WCHAR emptyW[] = {0};
BSTR class = SysAllocString( serviceW ), empty = SysAllocString( emptyW ), method;
IWbemClassObject *service, *out;
@ -240,6 +273,8 @@ static void test_Win32_Service( IWbemServices *services )
win_skip( "Win32_Service not available\n" );
goto out;
}
check_property( service, processidW, VT_I4, CIM_UINT32 );
type = 0xdeadbeef;
VariantInit( &state );
hr = IWbemClassObject_Get( service, stateW, 0, &state, &type, NULL );
@ -317,38 +352,6 @@ out:
SysFreeString( class );
}
static void _check_property( ULONG line, IWbemClassObject *obj, const WCHAR *prop, VARTYPE vartype, CIMTYPE cimtype )
{
CIMTYPE type = 0xdeadbeef;
VARIANT val;
HRESULT hr;
VariantInit( &val );
hr = IWbemClassObject_Get( obj, prop, 0, &val, &type, NULL );
ok( hr == S_OK, "%u: failed to get description %08x\n", line, hr );
ok( V_VT( &val ) == vartype, "%u: unexpected variant type 0x%x\n", line, V_VT(&val) );
ok( type == cimtype, "%u: unexpected type 0x%x\n", line, type );
switch (V_VT(&val))
{
case VT_BSTR:
trace( "%s: %s\n", wine_dbgstr_w(prop), wine_dbgstr_w(V_BSTR(&val)) );
break;
case VT_I2:
trace( "%s: %d\n", wine_dbgstr_w(prop), V_I2(&val) );
break;
case VT_I4:
trace( "%s: %d\n", wine_dbgstr_w(prop), V_I4(&val) );
break;
case VT_R4:
trace( "%s: %f\n", wine_dbgstr_w(prop), V_R4(&val) );
break;
default:
break;
}
VariantClear( &val );
}
#define check_property(a,b,c,d) _check_property(__LINE__,a,b,c,d)
static void test_Win32_Bios( IWbemServices *services )
{
static const WCHAR queryW[] =
@ -1414,6 +1417,8 @@ static void test_Win32_Processor( IWbemServices *services )
{'A','r','c','h','i','t','e','c','t','u','r','e',0};
static const WCHAR captionW[] =
{'C','a','p','t','i','o','n',0};
static const WCHAR cpustatusW[] =
{'C','p','u','S','t','a','t','u','s',0};
static const WCHAR familyW[] =
{'F','a','m','i','l','y',0};
static const WCHAR levelW[] =
@ -1451,8 +1456,9 @@ static void test_Win32_Processor( IWbemServices *services )
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
check_property( obj, captionW, VT_BSTR, CIM_STRING );
check_property( obj, architectureW, VT_I4, CIM_UINT16 );
check_property( obj, captionW, VT_BSTR, CIM_STRING );
check_property( obj, cpustatusW, VT_I4, CIM_UINT16 );
check_property( obj, familyW, VT_I4, CIM_UINT16 );
check_property( obj, levelW, VT_I4, CIM_UINT16 );
check_property( obj, manufacturerW, VT_BSTR, CIM_STRING );
@ -1493,6 +1499,8 @@ static void test_Win32_Processor( IWbemServices *services )
static void test_Win32_VideoController( IWbemServices *services )
{
static const WCHAR availabilityW[] =
{'A','v','a','i','l','a','b','i','l','i','t','y',0};
static const WCHAR configmanagererrorcodeW[] =
{'C','o','n','f','i','g','M','a','n','a','g','e','r','E','r','r','o','r','C','o','d','e',0};
static const WCHAR driverdateW[] =
@ -1524,6 +1532,7 @@ static void test_Win32_VideoController( IWbemServices *services )
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
check_property( obj, availabilityW, VT_I4, CIM_UINT16 );
check_property( obj, configmanagererrorcodeW, VT_I4, CIM_UINT32 );
check_property( obj, driverdateW, VT_BSTR, CIM_DATETIME );
@ -1547,8 +1556,12 @@ static void test_Win32_VideoController( IWbemServices *services )
static void test_Win32_Printer( IWbemServices *services )
{
static const WCHAR attributesW[] =
{'A','t','t','r','i','b','u','t','e','s',0};
static const WCHAR deviceidW[] =
{'D','e','v','i','c','e','I','d',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 locationW[] =
{'L','o','c','a','t','i','o','n',0};
static const WCHAR portnameW[] =
@ -1576,7 +1589,9 @@ static void test_Win32_Printer( IWbemServices *services )
hr = IEnumWbemClassObject_Next( result, 10000, 1, &obj, &count );
if (hr != S_OK) break;
check_property( obj, attributesW, VT_I4, CIM_UINT32 );
check_property( obj, deviceidW, VT_BSTR, CIM_STRING );
check_property( obj, horizontalresolutionW, VT_I4, CIM_UINT32 );
type = 0xdeadbeef;
memset( &val, 0, sizeof(val) );

View File

@ -89,7 +89,6 @@ struct column
{
const WCHAR *name;
UINT type;
VARTYPE vartype; /* 0 for default mapping */
};
enum fill_status
@ -132,7 +131,6 @@ struct array
struct field
{
UINT type;
VARTYPE vartype; /* 0 for default mapping */
union
{
LONGLONG ival;