Commit 78e9b02c authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Use wide character string literals.

parent 0a35f005
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -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, &param, &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 ));
......
......@@ -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,7 +119,8 @@ 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;
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};
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