mirror of
https://github.com/reactos/wine.git
synced 2024-12-14 23:29:44 +00:00
advapi32: Do not fail in RegQueryInfoKey if *class_len is 0.
This commit is contained in:
parent
b6c31bea3d
commit
87b6d42c12
@ -849,7 +849,7 @@ LSTATUS WINAPI RegQueryInfoKeyW( HKEY hkey, LPWSTR class, LPDWORD class_len, LPD
|
||||
status = NtQueryKey( hkey, KeyFullInformation, buffer, sizeof(buffer), &total_size );
|
||||
if (status && status != STATUS_BUFFER_OVERFLOW) goto done;
|
||||
|
||||
if (class)
|
||||
if (class && class_len && *class_len)
|
||||
{
|
||||
/* retry with a dynamically allocated buffer */
|
||||
while (status == STATUS_BUFFER_OVERFLOW)
|
||||
@ -1052,7 +1052,8 @@ LSTATUS WINAPI RegQueryInfoKeyA( HKEY hkey, LPSTR class, LPDWORD class_len, LPDW
|
||||
RtlUnicodeToMultiByteSize( &len, (WCHAR *)(buf_ptr + info->ClassOffset), info->ClassLength);
|
||||
if (class_len)
|
||||
{
|
||||
if (len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW;
|
||||
if (*class_len == 0) class = NULL;
|
||||
if (class && len + 1 > *class_len) status = STATUS_BUFFER_OVERFLOW;
|
||||
*class_len = len;
|
||||
}
|
||||
if (class && !status)
|
||||
|
@ -1747,7 +1747,7 @@ static void test_reg_query_info(void)
|
||||
|
||||
/* with subkey & default value */
|
||||
ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
|
||||
todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(classlen == strlen(subkey_class), "classlen = %u\n", classlen);
|
||||
ok(subkeys == 1, "subkeys = %u\n", subkeys);
|
||||
ok(maxsubkeylen == strlen("subsubkey"), "maxsubkeylen = %u\n", maxsubkeylen);
|
||||
@ -1780,7 +1780,7 @@ static void test_reg_query_info(void)
|
||||
|
||||
/* with named value */
|
||||
ret = RegQueryInfoKeyA(subkey, NULL, &classlen, NULL, &subkeys, &maxsubkeylen, &maxclasslen, &values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
|
||||
todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(values == 3, "values = %u\n", values);
|
||||
ok(maxvaluenamelen == strlen("value one"), "maxvaluenamelen = %u\n", maxvaluenamelen);
|
||||
ok(maxvaluelen == sizeof("second value data") * sizeof(WCHAR), "maxvaluelen = %u\n", maxvaluelen);
|
||||
@ -1795,7 +1795,7 @@ static void test_reg_query_info(void)
|
||||
memset(classbuffer, 0x55, sizeof(classbuffer));
|
||||
classlen = 0;
|
||||
ret = RegQueryInfoKeyA(subkey, classbuffer, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(classlen == strlen(subkey_class) /* win2k */ ||
|
||||
classlen == 0, "classlen = %u\n", classlen);
|
||||
memset(expectbuffer, 0x55, sizeof(expectbuffer));
|
||||
@ -1804,7 +1804,7 @@ static void test_reg_query_info(void)
|
||||
memset(classbufferW, 0x55, sizeof(classbufferW));
|
||||
classlen = 0;
|
||||
ret = RegQueryInfoKeyW(subkey, classbufferW, &classlen, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
todo_wine ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(ret == ERROR_SUCCESS, "ret = %d\n", ret);
|
||||
ok(classlen == strlen(subkey_class) /* win2k */ ||
|
||||
classlen == 0, "classlen = %u\n", classlen);
|
||||
memset(expectbufferW, 0x55, sizeof(expectbufferW));
|
||||
|
Loading…
Reference in New Issue
Block a user