advapi32/tests: Test for last error after RegQueryValueEx

Alexandre Julliard julliard at winehq.org
Fri Feb 26 07:38:31 CST 2010


Nikolay Sivov <nsivov at codeweavers.com> writes:

> @@ -626,15 +627,22 @@ static void test_query_value_ex(void)
>          trace("test_query_value_ex: type set to: 0x%08x\n", type);
>          ok(size == 0, "size should have been set to 0 instead of %d\n", size);
>      }
> +    todo_wine ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", GetLastError());
>  
>      size = sizeof(buffer);
> +    /* this last error check could be removed after setting it properly is fixed,
> +       it's to prevent regressions from current state */
> +    SetLastError(ERROR_SUCCESS);
>      ret = RegQueryValueExA(HKEY_CLASSES_ROOT, "Nonexistent Value", NULL, &type, buffer, &size);
>      ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n", ret);
>      ok(size == sizeof(buffer), "size shouldn't have been changed to %d\n", size);
> +    ok(GetLastError() == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", GetLastError());

This is confusing. You should set it to 0xdeadbeef before each call for
the check to be meaningful.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list