mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 11:03:38 +00:00
setupapi: Create the registry value if it doesn't exist in append_multi_sz_value().
This commit is contained in:
parent
0ab56b88df
commit
38e36e8fda
|
@ -233,8 +233,27 @@ static bool append_multi_sz_value( HKEY hkey, const WCHAR *value, const WCHAR *s
|
|||
{
|
||||
DWORD size, type, total;
|
||||
WCHAR *buffer, *p;
|
||||
LONG ret;
|
||||
|
||||
if ((ret = RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )))
|
||||
{
|
||||
if (ret != ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
ERR( "failed to query value %s, error %lu\n", debugstr_w(value), ret );
|
||||
SetLastError( ret );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((ret = RegSetValueExW( hkey, value, 0, REG_MULTI_SZ, (BYTE *)strings, str_size * sizeof(WCHAR) )))
|
||||
{
|
||||
ERR( "failed to set value %s, error %lu\n", debugstr_w(value), ret );
|
||||
SetLastError( ret );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (RegQueryValueExW( hkey, value, NULL, &type, NULL, &size )) return true;
|
||||
if (type != REG_MULTI_SZ)
|
||||
{
|
||||
WARN( "value %s exists but has wrong type %#lx\n", debugstr_w(value), type );
|
||||
|
|
|
@ -2332,13 +2332,10 @@ static void test_append_reg(void)
|
|||
ok(!l, "Got error %lu.\n", l);
|
||||
size = sizeof(value);
|
||||
l = RegQueryValueExA(key, "value", NULL, &type, (BYTE *)value, &size);
|
||||
todo_wine ok(!l, "Got error %lu.\n", l);
|
||||
if (!l)
|
||||
{
|
||||
ok(type == REG_MULTI_SZ, "Got type %#lx.\n", type);
|
||||
ok(size == sizeof("data\0"), "Got size %lu.\n", size);
|
||||
ok(!memcmp(value, "data\0", size), "Got data %s.\n", debugstr_an(value, size));
|
||||
}
|
||||
ok(!l, "Got error %lu.\n", l);
|
||||
ok(type == REG_MULTI_SZ, "Got type %#lx.\n", type);
|
||||
ok(size == sizeof("data\0"), "Got size %lu.\n", size);
|
||||
ok(!memcmp(value, "data\0", size), "Got data %s.\n", debugstr_an(value, size));
|
||||
|
||||
/* Key exists and already has a value. */
|
||||
|
||||
|
|
Loading…
Reference in a new issue