Alexandre Julliard : kernel32/tests: Add some tests for the behavior of queries on a dead process.
Alexandre Julliard
julliard at winehq.org
Thu Mar 11 15:59:35 CST 2021
Module: wine
Branch: master
Commit: fdf6d7de2e77f0986b01532c4e1913602e006d6b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=fdf6d7de2e77f0986b01532c4e1913602e006d6b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Mar 11 18:04:48 2021 +0100
kernel32/tests: Add some tests for the behavior of queries on a dead process.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/process.c | 71 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 69 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index 0c514f816c1..108851000ff 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -4171,6 +4171,72 @@ static void test_handle_list_attribute(BOOL child, HANDLE handle1, HANDLE handle
CloseHandle(pipe[1]);
}
+static void test_dead_process(void)
+{
+ DWORD_PTR data[256];
+ PROCESS_BASIC_INFORMATION basic;
+ SYSTEM_PROCESS_INFORMATION *spi;
+ SECTION_IMAGE_INFORMATION image;
+ PROCESS_INFORMATION pi;
+ PROCESS_PRIORITY_CLASS *prio = (PROCESS_PRIORITY_CLASS *)data;
+ BYTE *buffer = NULL;
+ BOOL found;
+ ULONG size = 0;
+ DWORD offset = 0;
+ NTSTATUS status;
+
+ create_process("exit", &pi);
+ wait_child_process(pi.hProcess);
+ Sleep(100);
+
+ memset( data, 0, sizeof(data) );
+ status = NtQueryInformationProcess( pi.hProcess, ProcessImageFileName, data, sizeof(data), NULL);
+ ok( !status, "ProcessImageFileName failed %x\n", status );
+ todo_wine
+ ok( ((UNICODE_STRING *)data)->Length, "ProcessImageFileName not set\n" );
+ todo_wine
+ ok( ((UNICODE_STRING *)data)->Buffer[0] == '\\', "ProcessImageFileName not set\n" );
+
+ memset( prio, 0xcc, sizeof(*prio) );
+ status = NtQueryInformationProcess( pi.hProcess, ProcessPriorityClass, prio, sizeof(*prio), NULL);
+ ok( !status, "ProcessPriorityClass failed %x\n", status );
+ ok( prio->PriorityClass != 0xcc, "ProcessPriorityClass not set\n" );
+
+ memset( &basic, 0xcc, sizeof(basic) );
+ status = NtQueryInformationProcess( pi.hProcess, ProcessBasicInformation, &basic, sizeof(basic), NULL);
+ ok( !status, "ProcessBasicInformation failed %x\n", status );
+ ok( basic.ExitStatus == 0, "ProcessBasicInformation info modified\n" );
+
+ memset( &image, 0xcc, sizeof(image) );
+ status = NtQueryInformationProcess( pi.hProcess, ProcessImageInformation, &image, sizeof(image), NULL);
+ todo_wine
+ ok( status == STATUS_PROCESS_IS_TERMINATING, "ProcessImageInformation wrong error %x\n", status );
+ todo_wine
+ ok( image.Machine == 0xcccc, "ProcessImageInformation info modified\n" );
+
+ while ((status = NtQuerySystemInformation(SystemProcessInformation, buffer, size, &size)) == STATUS_INFO_LENGTH_MISMATCH)
+ {
+ free(buffer);
+ buffer = malloc(size);
+ }
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
+ found = FALSE;
+ do
+ {
+ spi = (SYSTEM_PROCESS_INFORMATION *)(buffer + offset);
+ if (spi->UniqueProcessId == ULongToHandle(pi.dwProcessId))
+ {
+ found = TRUE;
+ break;
+ }
+ offset += spi->NextEntryOffset;
+ } while (spi->NextEntryOffset);
+ todo_wine
+ ok( !found, "process still enumerated\n" );
+ CloseHandle(pi.hProcess);
+ CloseHandle(pi.hThread);
+}
+
START_TEST(process)
{
HANDLE job, hproc, h, h2;
@@ -4291,6 +4357,9 @@ START_TEST(process)
test_ProcThreadAttributeList();
test_SuspendProcessState();
test_SuspendProcessNewThread();
+ test_parent_process_attribute(0, NULL);
+ test_handle_list_attribute(FALSE, NULL, NULL);
+ test_dead_process();
/* things that can be tested:
* lookup: check the way program to be executed is searched
@@ -4314,6 +4383,4 @@ START_TEST(process)
test_jobInheritance(job);
test_BreakawayOk(job);
CloseHandle(job);
- test_parent_process_attribute(0, NULL);
- test_handle_list_attribute(FALSE, NULL, NULL);
}
More information about the wine-cvs
mailing list