wbemprox: Use wide character string literals.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0a35f0053a
commit
78e9b02ceb
File diff suppressed because it is too large
Load Diff
|
@ -577,7 +577,6 @@ static HRESULT WINAPI class_object_Clone(
|
|||
|
||||
static BSTR get_body_text( const struct table *table, UINT row, UINT *len )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'\n','\t','%','s',' ','=',' ','%','s',';',0};
|
||||
BSTR value, ret;
|
||||
WCHAR *p;
|
||||
UINT i;
|
||||
|
@ -587,7 +586,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len )
|
|||
{
|
||||
if ((value = get_value_bstr( table, row, i )))
|
||||
{
|
||||
*len += ARRAY_SIZE( fmtW );
|
||||
*len += ARRAY_SIZE( L"\n\t%s = %s;" );
|
||||
*len += lstrlenW( table->columns[i].name );
|
||||
*len += SysStringLen( value );
|
||||
SysFreeString( value );
|
||||
|
@ -599,7 +598,7 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len )
|
|||
{
|
||||
if ((value = get_value_bstr( table, row, i )))
|
||||
{
|
||||
p += swprintf( p, *len - (p - ret), fmtW, table->columns[i].name, value );
|
||||
p += swprintf( p, *len - (p - ret), L"\n\t%s = %s;", table->columns[i].name, value );
|
||||
SysFreeString( value );
|
||||
}
|
||||
}
|
||||
|
@ -608,19 +607,17 @@ static BSTR get_body_text( const struct table *table, UINT row, UINT *len )
|
|||
|
||||
static BSTR get_object_text( const struct view *view, UINT index )
|
||||
{
|
||||
static const WCHAR fmtW[] =
|
||||
{'\n','i','n','s','t','a','n','c','e',' ','o','f',' ','%','s','\n','{','%','s','\n','}',';',0};
|
||||
UINT len, len_body, row = view->result[index];
|
||||
struct table *table = get_view_table( view, index );
|
||||
BSTR ret, body;
|
||||
|
||||
len = ARRAY_SIZE( fmtW );
|
||||
len = ARRAY_SIZE( L"\ninstance of %s\n{%s\n};" );
|
||||
len += lstrlenW( table->name );
|
||||
if (!(body = get_body_text( table, row, &len_body ))) return NULL;
|
||||
len += len_body;
|
||||
|
||||
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
|
||||
swprintf( ret, len, fmtW, table->name, body );
|
||||
swprintf( ret, len, L"\ninstance of %s\n{%s\n};", table->name, body );
|
||||
SysFreeString( body );
|
||||
return ret;
|
||||
}
|
||||
|
@ -729,9 +726,6 @@ static void set_default_value( CIMTYPE type, UINT val, BYTE *ptr )
|
|||
static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UINT *num_cols,
|
||||
struct column **cols, BYTE **data )
|
||||
{
|
||||
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 defaultvalueW[] = {'D','e','f','a','u','l','t','V','a','l','u','e',0};
|
||||
struct column *columns;
|
||||
BYTE *row;
|
||||
IWbemClassObject *param;
|
||||
|
@ -750,16 +744,16 @@ static HRESULT create_signature_columns_and_data( IEnumWbemClassObject *iter, UI
|
|||
IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, ¶m, &count );
|
||||
if (!count) break;
|
||||
|
||||
hr = IWbemClassObject_Get( param, parameterW, 0, &val, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( param, L"Parameter", 0, &val, NULL, NULL );
|
||||
if (hr != S_OK) goto error;
|
||||
columns[i].name = heap_strdupW( V_BSTR( &val ) );
|
||||
VariantClear( &val );
|
||||
|
||||
hr = IWbemClassObject_Get( param, typeW, 0, &val, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( param, L"Type", 0, &val, NULL, NULL );
|
||||
if (hr != S_OK) goto error;
|
||||
columns[i].type = V_UI4( &val );
|
||||
|
||||
hr = IWbemClassObject_Get( param, defaultvalueW, 0, &val, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( param, L"DefaultValue", 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 );
|
||||
offset += get_type_size( columns[i].type );
|
||||
|
@ -802,36 +796,26 @@ static HRESULT create_signature_table( IEnumWbemClassObject *iter, WCHAR *name )
|
|||
|
||||
static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *method, enum param_direction dir )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0};
|
||||
static const WCHAR outW[] = {'O','U','T',0};
|
||||
static const WCHAR inW[] = {'I','N',0};
|
||||
UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + lstrlenW( class ) + lstrlenW( method );
|
||||
UINT len = ARRAY_SIZE(L"__%s_%s_%s") + ARRAY_SIZE(L"OUT") + lstrlenW( class ) + lstrlenW( method );
|
||||
WCHAR *ret;
|
||||
|
||||
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
||||
swprintf( ret, len, fmtW, class, method, dir == PARAM_IN ? inW : outW );
|
||||
swprintf( ret, len, L"__%s_%s_%s", class, method, dir == PARAM_IN ? L"IN" : L"OUT" );
|
||||
return wcsupr( ret );
|
||||
}
|
||||
|
||||
HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_direction dir,
|
||||
IWbemClassObject **sig )
|
||||
{
|
||||
static const WCHAR selectW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
|
||||
'_','_','P','A','R','A','M','E','T','E','R','S',' ','W','H','E','R','E',' ',
|
||||
'C','l','a','s','s','=','\'','%','s','\'',' ','A','N','D',' ',
|
||||
'M','e','t','h','o','d','=','\'','%','s','\'',' ','A','N','D',' ',
|
||||
'D','i','r','e','c','t','i','o','n','%','s',0};
|
||||
static const WCHAR geW[] = {'>','=','0',0};
|
||||
static const WCHAR leW[] = {'<','=','0',0};
|
||||
UINT len = ARRAY_SIZE(selectW) + ARRAY_SIZE(geW);
|
||||
static const WCHAR selectW[] = L"SELECT * FROM __PARAMETERS WHERE Class='%s' AND Method='%s' AND Direction%s";
|
||||
UINT len = ARRAY_SIZE(selectW) + ARRAY_SIZE(L">=0");
|
||||
IEnumWbemClassObject *iter;
|
||||
WCHAR *query, *name;
|
||||
HRESULT hr;
|
||||
|
||||
len += lstrlenW( class ) + lstrlenW( method );
|
||||
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
|
||||
swprintf( query, len, selectW, class, method, dir >= 0 ? geW : leW );
|
||||
swprintf( query, len, selectW, class, method, dir >= 0 ? L">=0" : L"<=0" );
|
||||
|
||||
hr = exec_query( query, &iter );
|
||||
heap_free( query );
|
||||
|
|
|
@ -70,7 +70,7 @@ HRESULT process_get_owner( IWbemClassObject *obj, IWbemClassObject *in, IWbemCla
|
|||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
||||
hr = create_signature( class_processW, method_getownerW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"Win32_Process", L"GetOwner", PARAM_OUT, &sig );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
if (out)
|
||||
|
@ -90,12 +90,12 @@ HRESULT process_get_owner( IWbemClassObject *obj, IWbemClassObject *in, IWbemCla
|
|||
{
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_userW, 0, &user, CIM_STRING );
|
||||
hr = IWbemClassObject_Put( out_params, L"User", 0, &user, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( out_params, param_domainW, 0, &domain, CIM_STRING );
|
||||
hr = IWbemClassObject_Put( out_params, L"Domain", 0, &domain, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
|
||||
done:
|
||||
|
|
|
@ -92,19 +92,9 @@ static HRESULT WINAPI qualifier_set_QueryInterface(
|
|||
static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, const WCHAR *name,
|
||||
IEnumWbemClassObject **iter )
|
||||
{
|
||||
static const WCHAR fmtW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
|
||||
'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
|
||||
'\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',' ',
|
||||
'A','N','D',' ','N','a','m','e','=','\'','%','s','\'',0};
|
||||
static const WCHAR fmt2W[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
|
||||
'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
|
||||
'\'','%','s','\'',' ','A','N','D',' ','M','e','m','b','e','r','=','\'','%','s','\'',0};
|
||||
static const WCHAR fmt3W[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','Q','U','A','L',
|
||||
'I','F','I','E','R','S',' ','W','H','E','R','E',' ','C','l','a','s','s','=',
|
||||
'\'','%','s','\'',0};
|
||||
static const WCHAR fmtW[] = L"SELECT * FROM __QUALIFIERS WHERE Class='%s' AND Member='%s' AND Name='%s'";
|
||||
static const WCHAR fmt2W[] = L"SELECT * FROM __QUALIFIERS WHERE Class='%s' AND Member='%s'";
|
||||
static const WCHAR fmt3W[] = L"SELECT * FROM __QUALIFIERS WHERE Class='%s'";
|
||||
WCHAR *query;
|
||||
HRESULT hr;
|
||||
int len;
|
||||
|
@ -136,11 +126,6 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c
|
|||
static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, const WCHAR *name,
|
||||
VARIANT *val, LONG *flavor )
|
||||
{
|
||||
static const WCHAR intvalueW[] = {'I','n','t','e','g','e','r','V','a','l','u','e',0};
|
||||
static const WCHAR strvalueW[] = {'S','t','r','i','n','g','V','a','l','u','e',0};
|
||||
static const WCHAR boolvalueW[] = {'B','o','o','l','V','a','l','u','e',0};
|
||||
static const WCHAR flavorW[] = {'F','l','a','v','o','r',0};
|
||||
static const WCHAR typeW[] = {'T','y','p','e',0};
|
||||
IEnumWbemClassObject *iter;
|
||||
IWbemClassObject *obj;
|
||||
VARIANT var;
|
||||
|
@ -155,22 +140,22 @@ static HRESULT get_qualifier_value( const WCHAR *class, const WCHAR *member, con
|
|||
|
||||
if (flavor)
|
||||
{
|
||||
hr = IWbemClassObject_Get( obj, flavorW, 0, &var, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Flavor", 0, &var, NULL, NULL );
|
||||
if (hr != S_OK) goto done;
|
||||
*flavor = V_I4( &var );
|
||||
}
|
||||
hr = IWbemClassObject_Get( obj, typeW, 0, &var, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Type", 0, &var, NULL, NULL );
|
||||
if (hr != S_OK) goto done;
|
||||
switch (V_UI4( &var ))
|
||||
{
|
||||
case CIM_STRING:
|
||||
hr = IWbemClassObject_Get( obj, strvalueW, 0, val, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"StringValue", 0, val, NULL, NULL );
|
||||
break;
|
||||
case CIM_SINT32:
|
||||
hr = IWbemClassObject_Get( obj, intvalueW, 0, val, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"IntegerValue", 0, val, NULL, NULL );
|
||||
break;
|
||||
case CIM_BOOLEAN:
|
||||
hr = IWbemClassObject_Get( obj, boolvalueW, 0, val, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"BoolValue", 0, val, NULL, NULL );
|
||||
break;
|
||||
default:
|
||||
ERR("unhandled type %u\n", V_UI4( &var ));
|
||||
|
|
|
@ -180,10 +180,8 @@ static inline BOOL is_boolcmp( const struct complex_expr *expr, UINT ltype, UINT
|
|||
|
||||
static HRESULT eval_boolcmp( UINT op, LONGLONG lval, LONGLONG rval, UINT ltype, UINT rtype, LONGLONG *val )
|
||||
{
|
||||
static const WCHAR trueW[] = {'T','r','u','e',0};
|
||||
|
||||
if (ltype == CIM_STRING) lval = !wcsicmp( (const WCHAR *)(INT_PTR)lval, trueW ) ? -1 : 0;
|
||||
else if (rtype == CIM_STRING) rval = !wcsicmp( (const WCHAR *)(INT_PTR)rval, trueW ) ? -1 : 0;
|
||||
if (ltype == CIM_STRING) lval = !wcsicmp( (const WCHAR *)(INT_PTR)lval, L"True" ) ? -1 : 0;
|
||||
else if (rtype == CIM_STRING) rval = !wcsicmp( (const WCHAR *)(INT_PTR)rval, L"True" ) ? -1 : 0;
|
||||
|
||||
switch (op)
|
||||
{
|
||||
|
@ -276,31 +274,26 @@ static UINT resolve_type( UINT left, UINT right )
|
|||
|
||||
static const WCHAR *format_int( WCHAR *buf, UINT len, CIMTYPE type, LONGLONG val )
|
||||
{
|
||||
static const WCHAR fmt_signedW[] = {'%','d',0};
|
||||
static const WCHAR fmt_unsignedW[] = {'%','u',0};
|
||||
static const WCHAR fmt_signed64W[] = {'%','I','6','4','d',0};
|
||||
static const WCHAR fmt_unsigned64W[] = {'%','I','6','4','u',0};
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case CIM_SINT8:
|
||||
case CIM_SINT16:
|
||||
case CIM_SINT32:
|
||||
swprintf( buf, len, fmt_signedW, val );
|
||||
swprintf( buf, len, L"%d", val );
|
||||
return buf;
|
||||
|
||||
case CIM_UINT8:
|
||||
case CIM_UINT16:
|
||||
case CIM_UINT32:
|
||||
swprintf( buf, len, fmt_unsignedW, val );
|
||||
swprintf( buf, len, L"%u", val );
|
||||
return buf;
|
||||
|
||||
case CIM_SINT64:
|
||||
wsprintfW( buf, fmt_signed64W, val );
|
||||
wsprintfW( buf, L"%I64d", val );
|
||||
return buf;
|
||||
|
||||
case CIM_UINT64:
|
||||
wsprintfW( buf, fmt_unsigned64W, val );
|
||||
wsprintfW( buf, L"%I64u", val );
|
||||
return buf;
|
||||
|
||||
default:
|
||||
|
@ -477,9 +470,7 @@ HRESULT eval_cond( const struct table *table, UINT row, const struct expr *cond,
|
|||
|
||||
static WCHAR *build_assoc_query( const WCHAR *class, UINT class_len )
|
||||
{
|
||||
static const WCHAR fmtW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','_','_','A','S','S','O','C','I','A','T','O','R','S',
|
||||
' ','W','H','E','R','E',' ','C','l','a','s','s','=','\'','%','s','\'',0};
|
||||
static const WCHAR fmtW[] = L"SELECT * FROM __ASSOCIATORS WHERE Class='%s'";
|
||||
UINT len = class_len + ARRAY_SIZE(fmtW);
|
||||
WCHAR *ret;
|
||||
|
||||
|
@ -501,9 +492,7 @@ static HRESULT create_assoc_enum( const WCHAR *class, UINT class_len, IEnumWbemC
|
|||
|
||||
static WCHAR *build_antecedent_query( const WCHAR *assocclass, const WCHAR *dependent )
|
||||
{
|
||||
static const WCHAR fmtW[] =
|
||||
{'S','E','L','E','C','T',' ','A','n','t','e','c','e','d','e','n','t',' ','F','R','O','M',' ','%','s',' ',
|
||||
'W','H','E','R','E',' ','D','e','p','e','n','d','e','n','t','=','\'','%','s','\'',0};
|
||||
static const WCHAR fmtW[] = L"SELECT Antecedent FROM %s WHERE Dependent='%s'";
|
||||
UINT len = lstrlenW(assocclass) + lstrlenW(dependent) + ARRAY_SIZE(fmtW);
|
||||
WCHAR *ret;
|
||||
|
||||
|
@ -524,13 +513,11 @@ static BSTR build_servername(void)
|
|||
|
||||
static BSTR build_namespace(void)
|
||||
{
|
||||
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
|
||||
return SysAllocString( cimv2W );
|
||||
return SysAllocString( L"ROOT\\CIMV2" );
|
||||
}
|
||||
|
||||
static WCHAR *build_canonical_path( const WCHAR *relpath )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'\\','\\','%','s','\\','%','s',':',0};
|
||||
BSTR server, namespace;
|
||||
WCHAR *ret;
|
||||
UINT len, i;
|
||||
|
@ -542,10 +529,10 @@ static WCHAR *build_canonical_path( const WCHAR *relpath )
|
|||
return NULL;
|
||||
}
|
||||
|
||||
len = ARRAY_SIZE( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + lstrlenW( relpath );
|
||||
len = ARRAY_SIZE( L"\\\\%s\\%s:" ) + SysStringLen( server ) + SysStringLen( namespace ) + lstrlenW( relpath );
|
||||
if ((ret = heap_alloc( len * sizeof(WCHAR ) )))
|
||||
{
|
||||
len = swprintf( ret, len, fmtW, server, namespace );
|
||||
len = swprintf( ret, len, L"\\\\%s\\%s:", server, namespace );
|
||||
for (i = 0; i < lstrlenW( relpath ); i ++)
|
||||
{
|
||||
if (relpath[i] == '\'') ret[len++] = '"';
|
||||
|
@ -561,7 +548,6 @@ static WCHAR *build_canonical_path( const WCHAR *relpath )
|
|||
|
||||
static HRESULT get_antecedent( const WCHAR *assocclass, const WCHAR *dependent, BSTR *ret )
|
||||
{
|
||||
static const WCHAR antecedentW[] = {'A','n','t','e','c','e','d','e','n','t',0};
|
||||
WCHAR *fullpath, *str;
|
||||
IEnumWbemClassObject *iter = NULL;
|
||||
IWbemClassObject *obj;
|
||||
|
@ -580,7 +566,7 @@ static HRESULT get_antecedent( const WCHAR *assocclass, const WCHAR *dependent,
|
|||
goto done;
|
||||
}
|
||||
|
||||
hr = IWbemClassObject_Get( obj, antecedentW, 0, &var, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Antecedent", 0, &var, NULL, NULL );
|
||||
IWbemClassObject_Release( obj );
|
||||
if (hr != S_OK) goto done;
|
||||
*ret = V_BSTR( &var );
|
||||
|
@ -642,7 +628,6 @@ done:
|
|||
|
||||
static HRESULT exec_assoc_view( struct view *view )
|
||||
{
|
||||
static const WCHAR assocclassW[] = {'A','s','s','o','c','C','l','a','s','s',0};
|
||||
IEnumWbemClassObject *iter = NULL;
|
||||
struct path *path;
|
||||
HRESULT hr;
|
||||
|
@ -661,7 +646,7 @@ static HRESULT exec_assoc_view( struct view *view )
|
|||
IEnumWbemClassObject_Next( iter, WBEM_INFINITE, 1, &obj, &count );
|
||||
if (!count) break;
|
||||
|
||||
if ((hr = IWbemClassObject_Get( obj, assocclassW, 0, &var, NULL, NULL )) != S_OK)
|
||||
if ((hr = IWbemClassObject_Get( obj, L"AssocClass", 0, &var, NULL, NULL )) != S_OK)
|
||||
{
|
||||
IWbemClassObject_Release( obj );
|
||||
goto done;
|
||||
|
@ -817,7 +802,6 @@ static BOOL is_system_prop( const WCHAR *name )
|
|||
|
||||
static BSTR build_proplist( const struct table *table, UINT row, UINT count, UINT *len )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'%','s','=','%','s',0};
|
||||
UINT i, j, offset;
|
||||
BSTR *values, ret = NULL;
|
||||
|
||||
|
@ -830,7 +814,7 @@ static BSTR build_proplist( const struct table *table, UINT row, UINT count, UIN
|
|||
{
|
||||
const WCHAR *name = table->columns[i].name;
|
||||
values[j] = get_value_bstr( table, row, i );
|
||||
*len += lstrlenW( fmtW ) + lstrlenW( name ) + lstrlenW( values[j] );
|
||||
*len += lstrlenW( L"%s=%s" ) + lstrlenW( name ) + lstrlenW( values[j] );
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
@ -842,7 +826,7 @@ static BSTR build_proplist( const struct table *table, UINT row, UINT count, UIN
|
|||
if (table->columns[i].type & COL_FLAG_KEY)
|
||||
{
|
||||
const WCHAR *name = table->columns[i].name;
|
||||
offset += swprintf( ret + offset, *len - offset, fmtW, name, values[j] );
|
||||
offset += swprintf( ret + offset, *len - offset, L"%s=%s", name, values[j] );
|
||||
if (j < count - 1) ret[offset++] = ',';
|
||||
j++;
|
||||
}
|
||||
|
@ -866,7 +850,6 @@ static UINT count_key_columns( const struct table *table )
|
|||
|
||||
static BSTR build_relpath( const struct view *view, UINT table_index, UINT result_index, const WCHAR *name )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'%','s','.','%','s',0};
|
||||
BSTR class, proplist, ret = NULL;
|
||||
struct table *table = view->table[table_index];
|
||||
UINT row = view->result[result_index];
|
||||
|
@ -878,9 +861,9 @@ static BSTR build_relpath( const struct view *view, UINT table_index, UINT resul
|
|||
if (!(num_keys = count_key_columns( table ))) return class;
|
||||
if (!(proplist = build_proplist( table, row, num_keys, &len ))) goto done;
|
||||
|
||||
len += lstrlenW( fmtW ) + SysStringLen( class );
|
||||
len += lstrlenW( L"%s.%s" ) + SysStringLen( class );
|
||||
if (!(ret = SysAllocStringLen( NULL, len ))) goto done;
|
||||
swprintf( ret, len, fmtW, class, proplist );
|
||||
swprintf( ret, len, L"%s.%s", class, proplist );
|
||||
|
||||
done:
|
||||
SysFreeString( class );
|
||||
|
@ -890,7 +873,6 @@ done:
|
|||
|
||||
static BSTR build_path( const struct view *view, UINT table_index, UINT result_index, const WCHAR *name )
|
||||
{
|
||||
static const WCHAR fmtW[] = {'\\','\\','%','s','\\','%','s',':','%','s',0};
|
||||
BSTR server, namespace = NULL, relpath = NULL, ret = NULL;
|
||||
UINT len;
|
||||
|
||||
|
@ -900,9 +882,9 @@ static BSTR build_path( const struct view *view, UINT table_index, UINT result_i
|
|||
if (!(namespace = build_namespace())) goto done;
|
||||
if (!(relpath = build_relpath( view, table_index, result_index, name ))) goto done;
|
||||
|
||||
len = lstrlenW( fmtW ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath );
|
||||
len = lstrlenW( L"\\\\%s\\%s:%s" ) + SysStringLen( server ) + SysStringLen( namespace ) + SysStringLen( relpath );
|
||||
if (!(ret = SysAllocStringLen( NULL, len ))) goto done;
|
||||
swprintf( ret, len, fmtW, server, namespace, relpath );
|
||||
swprintf( ret, len, L"\\\\%s\\%s:%s", server, namespace, relpath );
|
||||
|
||||
done:
|
||||
SysFreeString( server );
|
||||
|
@ -942,17 +924,9 @@ static UINT count_result_properties( const struct view *view, UINT table_index )
|
|||
static HRESULT get_system_propval( const struct view *view, UINT table_index, UINT result_index, const WCHAR *name,
|
||||
VARIANT *ret, CIMTYPE *type, LONG *flavor )
|
||||
{
|
||||
static const WCHAR classW[] = {'_','_','C','L','A','S','S',0};
|
||||
static const WCHAR genusW[] = {'_','_','G','E','N','U','S',0};
|
||||
static const WCHAR pathW[] = {'_','_','P','A','T','H',0};
|
||||
static const WCHAR namespaceW[] = {'_','_','N','A','M','E','S','P','A','C','E',0};
|
||||
static const WCHAR propcountW[] = {'_','_','P','R','O','P','E','R','T','Y','_','C','O','U','N','T',0};
|
||||
static const WCHAR relpathW[] = {'_','_','R','E','L','P','A','T','H',0};
|
||||
static const WCHAR serverW[] = {'_','_','S','E','R','V','E','R',0};
|
||||
|
||||
if (flavor) *flavor = WBEM_FLAVOR_ORIGIN_SYSTEM;
|
||||
|
||||
if (!wcsicmp( name, classW ))
|
||||
if (!wcsicmp( name, L"__CLASS" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -962,7 +936,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
|
|||
if (type) *type = CIM_STRING;
|
||||
return S_OK;
|
||||
}
|
||||
if (!wcsicmp( name, genusW ))
|
||||
if (!wcsicmp( name, L"__GENUS" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -972,7 +946,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
|
|||
if (type) *type = CIM_SINT32;
|
||||
return S_OK;
|
||||
}
|
||||
else if (!wcsicmp( name, namespaceW ))
|
||||
else if (!wcsicmp( name, L"__NAMESPACE" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -982,7 +956,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
|
|||
if (type) *type = CIM_STRING;
|
||||
return S_OK;
|
||||
}
|
||||
else if (!wcsicmp( name, pathW ))
|
||||
else if (!wcsicmp( name, L"__PATH" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -992,7 +966,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
|
|||
if (type) *type = CIM_STRING;
|
||||
return S_OK;
|
||||
}
|
||||
if (!wcsicmp( name, propcountW ))
|
||||
if (!wcsicmp( name, L"__PROPERTY_COUNT" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -1002,7 +976,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
|
|||
if (type) *type = CIM_SINT32;
|
||||
return S_OK;
|
||||
}
|
||||
else if (!wcsicmp( name, relpathW ))
|
||||
else if (!wcsicmp( name, L"__RELPATH" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
@ -1012,7 +986,7 @@ static HRESULT get_system_propval( const struct view *view, UINT table_index, UI
|
|||
if (type) *type = CIM_STRING;
|
||||
return S_OK;
|
||||
}
|
||||
else if (!wcsicmp( name, serverW ))
|
||||
else if (!wcsicmp( name, L"__SERVER" ))
|
||||
{
|
||||
if (ret)
|
||||
{
|
||||
|
|
|
@ -100,12 +100,12 @@ HRESULT reg_create_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassO
|
|||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"hDefKey", 0, &defkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"sSubKeyName", 0, &subkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_stdregprovW, method_createkeyW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"StdRegProv", L"CreateKey", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
|
@ -123,7 +123,7 @@ HRESULT reg_create_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassO
|
|||
}
|
||||
hr = create_key( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), &retval );
|
||||
if (hr == S_OK && out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
VariantClear( &subkey );
|
||||
IWbemClassObject_Release( sig );
|
||||
|
@ -199,12 +199,12 @@ HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObj
|
|||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"hDefKey", 0, &defkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"sSubKeyName", 0, &subkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_stdregprovW, method_enumkeyW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"StdRegProv", L"EnumKey", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
|
@ -227,10 +227,10 @@ HRESULT reg_enum_key( IWbemClassObject *obj, IWbemClassObject *in, IWbemClassObj
|
|||
{
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
hr = IWbemClassObject_Put( out_params, L"sNames", 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -309,12 +309,12 @@ HRESULT reg_enum_values( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"hDefKey", 0, &defkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"sSubKeyName", 0, &subkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_stdregprovW, method_enumvaluesW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"StdRegProv", L"EnumValues", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &subkey );
|
||||
|
@ -338,12 +338,12 @@ HRESULT reg_enum_values( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
{
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_namesW, 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
hr = IWbemClassObject_Put( out_params, L"sNames", 0, &names, CIM_STRING|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
hr = IWbemClassObject_Put( out_params, param_typesW, 0, &types, CIM_SINT32|CIM_FLAG_ARRAY );
|
||||
hr = IWbemClassObject_Put( out_params, L"Types", 0, &types, CIM_SINT32|CIM_FLAG_ARRAY );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
|
||||
done:
|
||||
|
@ -392,14 +392,14 @@ HRESULT reg_get_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemC
|
|||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( in, param_defkeyW, 0, &defkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"hDefKey", 0, &defkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
hr = IWbemClassObject_Get( in, param_subkeynameW, 0, &subkey, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"sSubKeyName", 0, &subkey, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
hr = IWbemClassObject_Get( in, param_valuenameW, 0, &name, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( in, L"sValueName", 0, &name, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_stdregprovW, method_getstringvalueW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"StdRegProv", L"GetStringValue", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
|
@ -424,10 +424,10 @@ HRESULT reg_get_stringvalue( IWbemClassObject *obj, IWbemClassObject *in, IWbemC
|
|||
{
|
||||
if (!V_UI4( &retval ))
|
||||
{
|
||||
hr = IWbemClassObject_Put( out_params, param_valueW, 0, &value, CIM_STRING );
|
||||
hr = IWbemClassObject_Put( out_params, L"sValue", 0, &value, CIM_STRING );
|
||||
if (hr != S_OK) goto done;
|
||||
}
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
|
||||
done:
|
||||
|
|
|
@ -119,9 +119,10 @@ static HRESULT get_sd( SECURITY_DESCRIPTOR **sd, DWORD *size )
|
|||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
if (!MakeSelfRelativeSD(&absolute_sd, *sd, size)) {
|
||||
if (!MakeSelfRelativeSD(&absolute_sd, *sd, size))
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, *sd );
|
||||
*sd = NULL;
|
||||
*sd = NULL;
|
||||
hr = E_FAIL;
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +140,7 @@ HRESULT security_get_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
|
||||
TRACE("%p, %p\n", in, out);
|
||||
|
||||
hr = create_signature( class_systemsecurityW, method_getsdW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"__SystemSecurity", L"GetSD", PARAM_OUT, &sig );
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -159,7 +160,7 @@ HRESULT security_get_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
hr = to_byte_array( sd, sd_size, &var_sd );
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
hr = IWbemClassObject_Put( out_params, param_sdW, 0, &var_sd, CIM_UINT8|CIM_FLAG_ARRAY );
|
||||
hr = IWbemClassObject_Put( out_params, L"SD", 0, &var_sd, CIM_UINT8|CIM_FLAG_ARRAY );
|
||||
|
||||
HeapFree( GetProcessHeap(), 0, sd );
|
||||
VariantClear( &var_sd );
|
||||
|
@ -168,7 +169,7 @@ HRESULT security_get_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
set_variant( VT_UI4, ret, NULL, &retval );
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
}
|
||||
|
||||
if (SUCCEEDED(hr) && out)
|
||||
|
@ -192,7 +193,7 @@ HRESULT security_set_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
|
||||
FIXME("stub\n");
|
||||
|
||||
hr = create_signature( class_systemsecurityW, method_setsdW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"__SystemSecurity", L"SetSD", PARAM_OUT, &sig );
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
|
@ -204,7 +205,7 @@ HRESULT security_set_sd( IWbemClassObject *obj, IWbemClassObject *in, IWbemClass
|
|||
if (SUCCEEDED(hr))
|
||||
{
|
||||
set_variant( VT_UI4, S_OK, NULL, &retval );
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
if (SUCCEEDED(hr) && out)
|
||||
{
|
||||
|
|
|
@ -84,10 +84,10 @@ HRESULT service_pause_service( IWbemClassObject *obj, IWbemClassObject *in, IWbe
|
|||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Name", 0, &name, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_serviceW, method_pauseserviceW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"Win32_Service", L"PauseService", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
|
@ -107,7 +107,7 @@ HRESULT service_pause_service( IWbemClassObject *obj, IWbemClassObject *in, IWbe
|
|||
if (hr != S_OK) goto done;
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
|
@ -129,10 +129,10 @@ HRESULT service_resume_service( IWbemClassObject *obj, IWbemClassObject *in, IWb
|
|||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Name", 0, &name, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_serviceW, method_resumeserviceW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"Win32_Service", L"ResumeService", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
|
@ -152,7 +152,7 @@ HRESULT service_resume_service( IWbemClassObject *obj, IWbemClassObject *in, IWb
|
|||
if (hr != S_OK) goto done;
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
|
@ -198,10 +198,10 @@ HRESULT service_start_service( IWbemClassObject *obj, IWbemClassObject *in, IWbe
|
|||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Name", 0, &name, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_serviceW, method_startserviceW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"Win32_Service", L"StartService", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
|
@ -221,7 +221,7 @@ HRESULT service_start_service( IWbemClassObject *obj, IWbemClassObject *in, IWbe
|
|||
if (hr != S_OK) goto done;
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
|
@ -243,10 +243,10 @@ HRESULT service_stop_service( IWbemClassObject *obj, IWbemClassObject *in, IWbem
|
|||
|
||||
TRACE("%p, %p, %p\n", obj, in, out);
|
||||
|
||||
hr = IWbemClassObject_Get( obj, prop_nameW, 0, &name, NULL, NULL );
|
||||
hr = IWbemClassObject_Get( obj, L"Name", 0, &name, NULL, NULL );
|
||||
if (hr != S_OK) return hr;
|
||||
|
||||
hr = create_signature( class_serviceW, method_stopserviceW, PARAM_OUT, &sig );
|
||||
hr = create_signature( L"Win32_Service", L"StopService", PARAM_OUT, &sig );
|
||||
if (hr != S_OK)
|
||||
{
|
||||
VariantClear( &name );
|
||||
|
@ -266,7 +266,7 @@ HRESULT service_stop_service( IWbemClassObject *obj, IWbemClassObject *in, IWbem
|
|||
if (hr != S_OK) goto done;
|
||||
|
||||
if (out_params)
|
||||
hr = IWbemClassObject_Put( out_params, param_returnvalueW, 0, &retval, CIM_UINT32 );
|
||||
hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
|
||||
|
||||
done:
|
||||
VariantClear( &name );
|
||||
|
|
|
@ -103,9 +103,8 @@ static HRESULT WINAPI client_security_SetBlanket(
|
|||
void *pAuthInfo,
|
||||
DWORD Capabilities )
|
||||
{
|
||||
static const OLECHAR defaultW[] =
|
||||
{'<','C','O','L','E','_','D','E','F','A','U','L','T','_','P','R','I','N','C','I','P','A','L','>',0};
|
||||
const OLECHAR *princname = (pServerPrincName == COLE_DEFAULT_PRINCIPAL) ? defaultW : pServerPrincName;
|
||||
const OLECHAR *princname = (pServerPrincName == COLE_DEFAULT_PRINCIPAL) ?
|
||||
L"<COLE_DEFAULT_PRINCIPAL>" : pServerPrincName;
|
||||
|
||||
FIXME("%p, %p, %u, %u, %s, %u, %u, %p, 0x%08x\n", iface, pProxy, AuthnSvc, AuthzSvc,
|
||||
debugstr_w(princname), AuthnLevel, ImpLevel, pAuthInfo, Capabilities);
|
||||
|
@ -270,17 +269,15 @@ static HRESULT WINAPI wbem_services_OpenNamespace(
|
|||
IWbemServices **ppWorkingNamespace,
|
||||
IWbemCallResult **ppResult )
|
||||
{
|
||||
static const WCHAR cimv2W[] = {'c','i','m','v','2',0};
|
||||
static const WCHAR defaultW[] = {'d','e','f','a','u','l','t',0};
|
||||
struct wbem_services *ws = impl_from_IWbemServices( iface );
|
||||
|
||||
TRACE("%p, %s, 0x%08x, %p, %p, %p\n", iface, debugstr_w(strNamespace), lFlags,
|
||||
pCtx, ppWorkingNamespace, ppResult);
|
||||
|
||||
if ((wcsicmp( strNamespace, cimv2W ) && wcsicmp( strNamespace, defaultW )) || ws->namespace)
|
||||
if ((wcsicmp( strNamespace, L"cimv2" ) && wcsicmp( strNamespace, L"default" )) || ws->namespace)
|
||||
return WBEM_E_INVALID_NAMESPACE;
|
||||
|
||||
return WbemServices_create( cimv2W, (void **)ppWorkingNamespace );
|
||||
return WbemServices_create( L"cimv2", (void **)ppWorkingNamespace );
|
||||
}
|
||||
|
||||
static HRESULT WINAPI wbem_services_CancelAsyncCall(
|
||||
|
@ -330,7 +327,7 @@ HRESULT parse_path( const WCHAR *str, struct path **ret )
|
|||
|
||||
if (*p == '\\')
|
||||
{
|
||||
static const WCHAR cimv2W[] = {'R','O','O','T','\\','C','I','M','V','2',0};
|
||||
static const WCHAR cimv2W[] = L"ROOT\\CIMV2";
|
||||
WCHAR server[MAX_COMPUTERNAME_LENGTH+1];
|
||||
DWORD server_len = ARRAY_SIZE(server);
|
||||
|
||||
|
@ -417,11 +414,8 @@ void free_path( struct path *path )
|
|||
|
||||
WCHAR *query_from_path( const struct path *path )
|
||||
{
|
||||
static const WCHAR selectW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','%','s',' ',
|
||||
'W','H','E','R','E',' ','%','s',0};
|
||||
static const WCHAR select_allW[] =
|
||||
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',0};
|
||||
static const WCHAR selectW[] = L"SELECT * FROM %s WHERE %s";
|
||||
static const WCHAR select_allW[] = L"SELECT * FROM ";
|
||||
WCHAR *query;
|
||||
UINT len;
|
||||
|
||||
|
@ -654,13 +648,11 @@ static HRESULT WINAPI wbem_services_ExecQuery(
|
|||
IWbemContext *pCtx,
|
||||
IEnumWbemClassObject **ppEnum )
|
||||
{
|
||||
static const WCHAR wqlW[] = {'W','Q','L',0};
|
||||
|
||||
TRACE("%p, %s, %s, 0x%08x, %p, %p\n", iface, debugstr_w(strQueryLanguage),
|
||||
debugstr_w(strQuery), lFlags, pCtx, ppEnum);
|
||||
|
||||
if (!strQueryLanguage || !strQuery || !strQuery[0]) return WBEM_E_INVALID_PARAMETER;
|
||||
if (wcsicmp( strQueryLanguage, wqlW )) return WBEM_E_INVALID_QUERY_TYPE;
|
||||
if (wcsicmp( strQueryLanguage, L"WQL" )) return WBEM_E_INVALID_QUERY_TYPE;
|
||||
return exec_query( strQuery, ppEnum );
|
||||
}
|
||||
|
||||
|
|
|
@ -154,13 +154,6 @@ HRESULT get_value( const struct table *table, UINT row, UINT column, LONGLONG *v
|
|||
|
||||
BSTR get_value_bstr( const struct table *table, UINT row, UINT column )
|
||||
{
|
||||
static const WCHAR fmt_signedW[] = {'%','d',0};
|
||||
static const WCHAR fmt_unsignedW[] = {'%','u',0};
|
||||
static const WCHAR fmt_signed64W[] = {'%','I','6','4','d',0};
|
||||
static const WCHAR fmt_unsigned64W[] = {'%','I','6','4','u',0};
|
||||
static const WCHAR fmt_strW[] = {'\"','%','s','\"',0};
|
||||
static const WCHAR trueW[] = {'T','R','U','E',0};
|
||||
static const WCHAR falseW[] = {'F','A','L','S','E',0};
|
||||
LONGLONG val;
|
||||
BSTR ret;
|
||||
WCHAR number[22];
|
||||
|
@ -176,8 +169,8 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column )
|
|||
switch (table->columns[column].type & COL_TYPE_MASK)
|
||||
{
|
||||
case CIM_BOOLEAN:
|
||||
if (val) return SysAllocString( trueW );
|
||||
else return SysAllocString( falseW );
|
||||
if (val) return SysAllocString( L"TRUE" );
|
||||
else return SysAllocString( L"FALSE" );
|
||||
|
||||
case CIM_DATETIME:
|
||||
case CIM_REFERENCE:
|
||||
|
@ -185,25 +178,25 @@ BSTR get_value_bstr( const struct table *table, UINT row, UINT column )
|
|||
if (!val) return NULL;
|
||||
len = lstrlenW( (const WCHAR *)(INT_PTR)val ) + 2;
|
||||
if (!(ret = SysAllocStringLen( NULL, len ))) return NULL;
|
||||
swprintf( ret, len, fmt_strW, (const WCHAR *)(INT_PTR)val );
|
||||
swprintf( ret, len, L"\"%s\"", (const WCHAR *)(INT_PTR)val );
|
||||
return ret;
|
||||
|
||||
case CIM_SINT16:
|
||||
case CIM_SINT32:
|
||||
swprintf( number, ARRAY_SIZE( number ), fmt_signedW, val );
|
||||
swprintf( number, ARRAY_SIZE( number ), L"%d", val );
|
||||
return SysAllocString( number );
|
||||
|
||||
case CIM_UINT16:
|
||||
case CIM_UINT32:
|
||||
swprintf( number, ARRAY_SIZE( number ), fmt_unsignedW, val );
|
||||
swprintf( number, ARRAY_SIZE( number ), L"%u", val );
|
||||
return SysAllocString( number );
|
||||
|
||||
case CIM_SINT64:
|
||||
wsprintfW( number, fmt_signed64W, val );
|
||||
wsprintfW( number, L"%I64d", val );
|
||||
return SysAllocString( number );
|
||||
|
||||
case CIM_UINT64:
|
||||
wsprintfW( number, fmt_unsigned64W, val );
|
||||
wsprintfW( number, L"%I64u", val );
|
||||
return SysAllocString( number );
|
||||
|
||||
default:
|
||||
|
|
|
@ -86,21 +86,16 @@ static HRESULT WINAPI wbem_locator_QueryInterface(
|
|||
|
||||
static BOOL is_local_machine( const WCHAR *server )
|
||||
{
|
||||
static const WCHAR dotW[] = {'.',0};
|
||||
static const WCHAR localhostW[] = {'l','o','c','a','l','h','o','s','t',0};
|
||||
WCHAR buffer[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD len = ARRAY_SIZE( buffer );
|
||||
|
||||
if (!server || !wcscmp( server, dotW ) || !wcsicmp( server, localhostW )) return TRUE;
|
||||
if (!server || !wcscmp( server, L"." ) || !wcsicmp( server, L"localhost" )) return TRUE;
|
||||
if (GetComputerNameW( buffer, &len ) && !wcsicmp( server, buffer )) return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **namespace )
|
||||
{
|
||||
static const WCHAR rootW[] = {'R','O','O','T',0};
|
||||
static const WCHAR cimv2W[] = {'C','I','M','V','2',0};
|
||||
static const WCHAR defaultW[] = {'D','E','F','A','U','L','T',0};
|
||||
HRESULT hr = WBEM_E_INVALID_NAMESPACE;
|
||||
const WCHAR *p, *q;
|
||||
unsigned int len;
|
||||
|
@ -131,7 +126,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
|
|||
p = q;
|
||||
while (*q && *q != '\\' && *q != '/') q++;
|
||||
len = q - p;
|
||||
if (len >= ARRAY_SIZE( rootW ) - 1 && wcsnicmp( rootW, p, len )) goto done;
|
||||
if (len >= ARRAY_SIZE( L"root" ) - 1 && wcsnicmp( L"root", p, len )) goto done;
|
||||
if (!*q)
|
||||
{
|
||||
hr = S_OK;
|
||||
|
@ -139,7 +134,7 @@ static HRESULT parse_resource( const WCHAR *resource, WCHAR **server, WCHAR **na
|
|||
}
|
||||
q++;
|
||||
len = lstrlenW( q );
|
||||
if (wcsicmp( q, cimv2W ) && wcsicmp( q, defaultW ))
|
||||
if (wcsicmp( q, L"cimv2" ) && wcsicmp( q, L"default" ))
|
||||
goto done;
|
||||
if (!(*namespace = heap_alloc( (len + 1) * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
|
||||
else
|
||||
|
|
|
@ -276,33 +276,3 @@ static inline BOOL is_digit(WCHAR c)
|
|||
{
|
||||
return '0' <= c && c <= '9';
|
||||
}
|
||||
|
||||
static const WCHAR class_processW[] = {'W','i','n','3','2','_','P','r','o','c','e','s','s',0};
|
||||
static const WCHAR class_serviceW[] = {'W','i','n','3','2','_','S','e','r','v','i','c','e',0};
|
||||
static const WCHAR class_stdregprovW[] = {'S','t','d','R','e','g','P','r','o','v',0};
|
||||
static const WCHAR class_systemsecurityW[] = {'_','_','S','y','s','t','e','m','S','e','c','u','r','i','t','y',0};
|
||||
|
||||
static const WCHAR prop_nameW[] = {'N','a','m','e',0};
|
||||
|
||||
static const WCHAR method_createkeyW[] = {'C','r','e','a','t','e','K','e','y',0};
|
||||
static const WCHAR method_enumkeyW[] = {'E','n','u','m','K','e','y',0};
|
||||
static const WCHAR method_enumvaluesW[] = {'E','n','u','m','V','a','l','u','e','s',0};
|
||||
static const WCHAR method_getownerW[] = {'G','e','t','O','w','n','e','r',0};
|
||||
static const WCHAR method_getsdW[] = {'G','e','t','S','D',0};
|
||||
static const WCHAR method_getstringvalueW[] = {'G','e','t','S','t','r','i','n','g','V','a','l','u','e',0};
|
||||
static const WCHAR method_pauseserviceW[] = {'P','a','u','s','e','S','e','r','v','i','c','e',0};
|
||||
static const WCHAR method_resumeserviceW[] = {'R','e','s','u','m','e','S','e','r','v','i','c','e',0};
|
||||
static const WCHAR method_setsdW[] = {'S','e','t','S','D',0};
|
||||
static const WCHAR method_startserviceW[] = {'S','t','a','r','t','S','e','r','v','i','c','e',0};
|
||||
static const WCHAR method_stopserviceW[] = {'S','t','o','p','S','e','r','v','i','c','e',0};
|
||||
|
||||
static const WCHAR param_defkeyW[] = {'h','D','e','f','K','e','y',0};
|
||||
static const WCHAR param_domainW[] = {'D','o','m','a','i','n',0};
|
||||
static const WCHAR param_namesW[] = {'s','N','a','m','e','s',0};
|
||||
static const WCHAR param_returnvalueW[] = {'R','e','t','u','r','n','V','a','l','u','e',0};
|
||||
static const WCHAR param_sdW[] = {'S','D',0};
|
||||
static const WCHAR param_subkeynameW[] = {'s','S','u','b','K','e','y','N','a','m','e',0};
|
||||
static const WCHAR param_typesW[] = {'T','y','p','e','s',0};
|
||||
static const WCHAR param_userW[] = {'U','s','e','r',0};
|
||||
static const WCHAR param_valueW[] = {'s','V','a','l','u','e',0};
|
||||
static const WCHAR param_valuenameW[] = {'s','V','a','l','u','e','N','a','m','e',0};
|
||||
|
|
Loading…
Reference in New Issue