In attribute list test: - current test tries to ensure that a handle, valid in process' parent, hasn't been inherited - but nothing guarantees that a valid handle isn't present in child process with same value - so harden test to verify that the handle isn't the parent's pipe handle
Signed-off-by: Eric Pouech eric.pouech@gmail.com
From: Eric Pouech eric.pouech@gmail.com
In attribute list test: - current test tries to ensure that a handle, valid in process' parent, hasn't been inherited - but nothing guarantees that a valid handle isn't present in child process with same value - so harden test to verify that the handle isn't the parent's pipe handle
Signed-off-by: Eric Pouech eric.pouech@gmail.com --- dlls/kernel32/tests/process.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index 287e84642be..b582727f93b 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -4280,16 +4280,26 @@ static void test_handle_list_attribute(BOOL child, HANDLE handle1, HANDLE handle
if (child) { + char name1[256], name2[256]; DWORD flags;
flags = 0; ret = GetHandleInformation(handle1, &flags); ok(ret, "Failed to get handle info, error %ld.\n", GetLastError()); ok(flags == HANDLE_FLAG_INHERIT, "Unexpected flags %#lx.\n", flags); + ret = GetFileInformationByHandleEx(handle1, FileNameInfo, name1, sizeof(name1)); + ok(ret, "Failed to get pipe name, error %ld\n", GetLastError()); CloseHandle(handle1); - + flags = 0; ret = GetHandleInformation(handle2, &flags); - ok(!ret && GetLastError() == ERROR_INVALID_HANDLE, "Unexpected return value, error %ld.\n", GetLastError()); + if (ret) + { + ok(!(flags & HANDLE_FLAG_INHERIT), "Parent's handle shouldn't have been inherited\n"); + ret = GetFileInformationByHandleEx(handle2, FileNameInfo, name2, sizeof(name2)); + ok(!ret || strcmp(name1, name2), "Parent's handle shouldn't have been inherited\n"); + } + else + ok(GetLastError() == ERROR_INVALID_HANDLE, "Unexpected return value, error %ld.\n", GetLastError());
return; }