kernel32/tests: Tests for ProcessCookie in NtQueryInformationProcess.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2018-09-16 23:24:27 +00:00 committed by Alexandre Julliard
parent 86878fe00b
commit 0a7293a8e3
1 changed files with 34 additions and 17 deletions

View File

@ -3461,7 +3461,7 @@ static void test_session_info(void)
trace("active_session = %x\n", active_session);
}
static void test_process_info(void)
static void test_process_info(HANDLE hproc)
{
char buf[4096];
static const ULONG info_size[] =
@ -3502,7 +3502,7 @@ static void test_process_info(void)
sizeof(ULONG) /* ProcessIoPriority */,
sizeof(ULONG) /* ProcessExecuteFlags */,
0 /* FIXME: sizeof(?) ProcessTlsInformation */,
0 /* FIXME: sizeof(?) ProcessCookie */,
sizeof(ULONG) /* ProcessCookie */,
sizeof(SECTION_IMAGE_INFORMATION) /* ProcessImageInformation */,
0 /* FIXME: sizeof(PROCESS_CYCLE_TIME_INFORMATION) ProcessCycleTime */,
sizeof(ULONG) /* ProcessPagePriority */,
@ -3541,8 +3541,8 @@ static void test_process_info(void)
sizeof(PROCESS_JOB_MEMORY_INFO) /* ProcessJobMemoryInformation */,
#endif
};
HANDLE hproc;
ULONG i, status, ret_len, size;
BOOL is_current = hproc == GetCurrentProcess();
if (!pNtQueryInformationProcess)
{
@ -3550,13 +3550,6 @@ static void test_process_info(void)
return;
}
hproc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, GetCurrentProcessId());
if (!hproc)
{
win_skip("PROCESS_QUERY_LIMITED_INFORMATION is not supported on this platform\n");
return;
}
for (i = 0; i < MaxProcessInfoClass; i++)
{
size = info_size[i];
@ -3598,22 +3591,36 @@ static void test_process_info(void)
ok(status == STATUS_ACCESS_DENIED || status == STATUS_PORT_NOT_SET,
"for info %u expected STATUS_ACCESS_DENIED, got %08x (ret_len %u)\n", i, status, ret_len);
break;
case ProcessCookie:
if (is_current)
ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER /* before win8 */,
"for info %u got %08x (ret_len %u)\n", i, status, ret_len);
else
ok(status == STATUS_INVALID_PARAMETER /* before win8 */ || status == STATUS_ACCESS_DENIED,
"for info %u got %08x (ret_len %u)\n", i, status, ret_len);
break;
case ProcessExecuteFlags:
case ProcessDebugPort:
case ProcessDebugFlags:
case ProcessCookie:
if (is_current)
ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER,
"for info %u, got %08x (ret_len %u)\n", i, status, ret_len);
else
todo_wine
ok(status == STATUS_ACCESS_DENIED, "for info %u expected STATUS_ACCESS_DENIED, got %08x (ret_len %u)\n", i, status, ret_len);
ok(status == STATUS_ACCESS_DENIED,
"for info %u expected STATUS_ACCESS_DENIED, got %08x (ret_len %u)\n", i, status, ret_len);
break;
default:
ok(status == STATUS_ACCESS_DENIED, "for info %u expected STATUS_ACCESS_DENIED, got %08x (ret_len %u)\n", i, status, ret_len);
if (is_current)
ok(status == STATUS_SUCCESS || status == STATUS_UNSUCCESSFUL || status == STATUS_INVALID_PARAMETER,
"for info %u, got %08x (ret_len %u)\n", i, status, ret_len);
else
ok(status == STATUS_ACCESS_DENIED,
"for info %u expected STATUS_ACCESS_DENIED, got %08x (ret_len %u)\n", i, status, ret_len);
break;
}
}
CloseHandle(hproc);
}
static void test_GetLogicalProcessorInformationEx(void)
@ -3780,6 +3787,7 @@ static void test_ProcThreadAttributeList(void)
START_TEST(process)
{
HANDLE job;
HANDLE hproc;
BOOL b = init();
ok(b, "Basic init of CreateProcess test\n");
if (!b) return;
@ -3824,7 +3832,16 @@ START_TEST(process)
return;
}
test_process_info();
hproc = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, GetCurrentProcessId());
if (hproc)
{
test_process_info(hproc);
CloseHandle(hproc);
}
else
win_skip("PROCESS_QUERY_LIMITED_INFORMATION is not supported on this platform\n");
test_process_info(GetCurrentProcess());
test_TerminateProcess();
test_Startup();
test_CommandLine();