Added patch to fix implementation of NtQueryInformationProcess for ProcessDebugFlags.

This commit is contained in:
Sebastian Lackner
2015-12-05 22:48:34 +01:00
parent af4ac5433d
commit dea2594156
5 changed files with 124 additions and 1 deletions

View File

@ -0,0 +1,103 @@
From 20e3383c70146e8220f08ebc379895139c9eb496 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Dec 2015 22:47:17 +0100
Subject: ntdll: Fix implementation of NtQueryInformationProcess for
ProcessDebugFlags.
---
dlls/ntdll/process.c | 5 ++++-
dlls/ntdll/tests/info.c | 12 ++++++++----
server/process.c | 1 +
server/protocol.def | 3 ++-
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index ca9462a..636c294 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -339,7 +339,10 @@ NTSTATUS WINAPI NtQueryInformationProcess(
req->handle = wine_server_obj_handle( ProcessHandle );
if ((ret = wine_server_call( req )) == STATUS_SUCCESS)
{
- *(DWORD *)ProcessInformation = !reply->debugger_present;
+ if (!reply->debugger_present)
+ *(DWORD *)ProcessInformation = TRUE;
+ else
+ *(DWORD *)ProcessInformation = reply->debug_children;
}
}
SERVER_END_REQ;
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 21b2e6c..18a73ab 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -1271,8 +1271,9 @@ static void test_query_process_debug_object_handle(int argc, char **argv)
ok(ret, "CloseHandle failed with last error %u\n", GetLastError());
}
-static void test_query_process_debug_flags(int argc, char **argv)
+static void test_query_process_debug_flags(int argc, char **argv, DWORD flags)
{
+ DWORD expected_flags = !(flags & DEBUG_ONLY_THIS_PROCESS);
DWORD debug_flags = 0xdeadbeef;
char cmdline[MAX_PATH];
PROCESS_INFORMATION pi;
@@ -1283,7 +1284,7 @@ static void test_query_process_debug_flags(int argc, char **argv)
sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
si.cb = sizeof(si);
- ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS, NULL, NULL, &si, &pi);
+ ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, flags, NULL, NULL, &si, &pi);
ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
if (!ret) return;
@@ -1320,7 +1321,8 @@ static void test_query_process_debug_flags(int argc, char **argv)
status = pNtQueryInformationProcess(pi.hProcess, ProcessDebugFlags,
&debug_flags, sizeof(debug_flags), NULL);
ok(!status || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "NtQueryInformationProcess failed, status %#x.\n", status);
- ok(debug_flags == FALSE || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected flag FALSE, got %x.\n", debug_flags);
+ ok(debug_flags == expected_flags || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */,
+ "Expected flag %u, got %x.\n", expected_flags, debug_flags);
for (;;)
{
@@ -1871,7 +1873,9 @@ START_TEST(info)
/* 0x1F ProcessDebugFlags */
trace("Starting test_process_debug_flags()\n");
- test_query_process_debug_flags(argc, argv);
+ test_query_process_debug_flags(argc, argv, DEBUG_PROCESS);
+ test_query_process_debug_flags(argc, argv, DEBUG_ONLY_THIS_PROCESS);
+ test_query_process_debug_flags(argc, argv, DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS);
/* belongs to its own file */
trace("Starting test_readvirtualmemory()\n");
diff --git a/server/process.c b/server/process.c
index e00b429..c738de6 100644
--- a/server/process.c
+++ b/server/process.c
@@ -1359,6 +1359,7 @@ DECL_HANDLER(get_process_info)
reply->end_time = process->end_time;
reply->cpu = process->cpu;
reply->debugger_present = !!process->debugger;
+ reply->debug_children = process->debug_children;
release_object( process );
}
}
diff --git a/server/protocol.def b/server/protocol.def
index 04814c9..b5f5457 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -818,7 +818,8 @@ struct rawinput_device
int exit_code; /* process exit code */
int priority; /* priority class */
cpu_type_t cpu; /* CPU that this process is running on */
- int debugger_present; /* process is being debugged */
+ short int debugger_present; /* process is being debugged */
+ short int debug_children; /* debug child processes */
@END
--
2.6.2

View File

@ -0,0 +1 @@
Fixes: Fix implementation of NtQueryInformationProcess for ProcessDebugFlags