[ADVAPI32][ADVAPI32_APITEST] Fix incorrect parameter output uncovered by CORE-12333 #comment Please retest!

svn path=/trunk/; revision=73228
This commit is contained in:
Mark Jansen 2016-11-13 18:11:14 +00:00
parent a9805facab
commit 1a9744d406
2 changed files with 21 additions and 1 deletions

View file

@ -4147,11 +4147,17 @@ RegQueryValueExW(
if (!NT_SUCCESS(status) && status != STATUS_BUFFER_OVERFLOW)
{
// NT: Valid handles with inexistant/null values or invalid (but not NULL) handles sets type to REG_NONE
if ((status == STATUS_OBJECT_NAME_NOT_FOUND) ||(status == STATUS_INVALID_HANDLE && hkey))
// On windows these conditions are likely to be side effects of the implementation...
if (status == STATUS_INVALID_HANDLE && hkey)
{
if (type) *type = REG_NONE;
if (count) *count = 0;
}
else if (status == STATUS_OBJECT_NAME_NOT_FOUND)
{
if (type) *type = REG_NONE;
if (data == NULL && count) *count = 0;
}
goto done;
}

View file

@ -303,6 +303,20 @@ START_TEST(RegQueryValueExW)
ok(size == 46, "Expected size = 46, size is: %ld", size);
ok(!wcscmp(data23, string22W), "Expected same string! data23: %S, string22W: %S", data23, string22W);
/* Ask for a var that doesnt exist. */
SetLastError(0xdeadbeef);
size = sizeof(data23);
memset(data23, 0, sizeof(data23));
type = 666;
ret = RegQueryValueExW(hkey_main, L"XXXXXYYYYYZZZZZZ", NULL, &type, (LPBYTE)data23, &size);
ok(ret == ERROR_FILE_NOT_FOUND, "RegQueryValueExW returned: %lx\n", ret);
ok(GetLastError() == 0xdeadbeef, "RegQueryValueExW returned: %lx\n", GetLastError());
/* 2k3 leaves garbage */
ok(type == REG_NONE || broken(type != REG_NONE && type != 666), "Expected REG_NONE, Type is: %ld\n", type);
ok(size == 46, "Expected size = 46, size is: %ld", size);
ok(!wcscmp(data23,L""), "Expected same string! data23: %S, ''", data23);
RegCloseKey(hkey_main);
RegCloseKey(subkey);