wbemprox: Return a BSTR from get_stringvalue.
This commit is contained in:
parent
fb81961d8b
commit
283db88d78
@ -270,24 +270,24 @@ done:
|
|||||||
static HRESULT get_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval )
|
static HRESULT get_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, VARIANT *value, VARIANT *retval )
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
WCHAR *buf = NULL;
|
BSTR str = NULL;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
LONG res;
|
LONG res;
|
||||||
|
|
||||||
TRACE("%p, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name));
|
TRACE("%p, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name));
|
||||||
|
|
||||||
if ((res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, NULL, &size ))) goto done;
|
if ((res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, NULL, &size ))) goto done;
|
||||||
if (!(buf = heap_alloc( size )))
|
if (!(str = SysAllocStringLen( NULL, size / sizeof(WCHAR) - 1 )))
|
||||||
{
|
{
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, buf, &size )))
|
if (!(res = RegGetValueW( root, subkey, name, RRF_RT_REG_SZ, NULL, str, &size )))
|
||||||
set_variant( VT_BSTR, 0, buf, value );
|
set_variant( VT_BSTR, 0, str, value );
|
||||||
|
|
||||||
done:
|
done:
|
||||||
set_variant( VT_UI4, res, NULL, retval );
|
set_variant( VT_UI4, res, NULL, retval );
|
||||||
heap_free( buf );
|
if (res) SysFreeString( str );
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user