Commit 283db88d authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wbemprox: Return a BSTR from get_stringvalue.

parent fb81961d
...@@ -270,24 +270,24 @@ done: ...@@ -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;
} }
......
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