Added patch to return correct thread creation time in SystemProcessInformation.

This commit is contained in:
Sebastian Lackner 2017-03-11 00:21:26 +01:00
parent 05a282feff
commit ce5620a1a4
5 changed files with 112 additions and 10 deletions

View File

@ -0,0 +1,74 @@
From e6832d1b0f923e7589424ade7571cc67dc768c4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Thu, 9 Mar 2017 00:00:46 +0100
Subject: ntdll: Set correct thread creation time for SystemProcessInformation
in NtQuerySystemInformation.
---
dlls/ntdll/nt.c | 2 +-
server/protocol.def | 1 +
server/snapshot.c | 11 ++++++-----
server/thread.h | 1 +
4 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 86beb031e9c..fc8e3b1eb4e 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -2012,7 +2012,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
memset(&spi->ti[i], 0, sizeof(spi->ti));
- spi->ti[i].CreateTime.QuadPart = 0xdeadbeef;
+ spi->ti[i].CreateTime.QuadPart = reply->creation_time;
spi->ti[i].ClientId.UniqueProcess = UlongToHandle(reply->pid);
spi->ti[i].ClientId.UniqueThread = UlongToHandle(reply->tid);
spi->ti[i].dwCurrentPriority = reply->base_pri + reply->delta_pri;
diff --git a/server/protocol.def b/server/protocol.def
index 60865a6ffc2..15adc51462f 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -1783,6 +1783,7 @@ enum char_info_mode
int count; /* thread usage count */
process_id_t pid; /* process id */
thread_id_t tid; /* thread id */
+ timeout_t creation_time; /* thread creation time */
int base_pri; /* base priority */
int delta_pri; /* delta priority */
@END
diff --git a/server/snapshot.c b/server/snapshot.c
index e35588a136c..858fca898a7 100644
--- a/server/snapshot.c
+++ b/server/snapshot.c
@@ -144,11 +144,12 @@ static int snapshot_next_thread( struct snapshot *snapshot, struct next_thread_r
return 0;
}
ptr = &snapshot->threads[snapshot->thread_pos++];
- reply->count = ptr->count;
- reply->pid = get_process_id( ptr->thread->process );
- reply->tid = get_thread_id( ptr->thread );
- reply->base_pri = ptr->priority;
- reply->delta_pri = 0; /* FIXME */
+ reply->count = ptr->count;
+ reply->pid = get_process_id( ptr->thread->process );
+ reply->tid = get_thread_id( ptr->thread );
+ reply->creation_time = get_thread_creation_time( ptr->thread );
+ reply->base_pri = ptr->priority;
+ reply->delta_pri = 0; /* FIXME */
return 1;
}
diff --git a/server/thread.h b/server/thread.h
index 282199149e6..2098c76a472 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -145,5 +145,6 @@ static inline void clear_error(void) { set_error(0); }
static inline void set_win32_error( unsigned int err ) { set_error( 0xc0010000 | err ); }
static inline thread_id_t get_thread_id( struct thread *thread ) { return thread->id; }
+static inline timeout_t get_thread_creation_time( struct thread *thread ) { return thread->creation_time; }
#endif /* __WINE_SERVER_THREAD_H */
--
2.11.0

View File

@ -0,0 +1 @@
Fixes: Return correct thread creation time in SystemProcessInformation

View File

@ -261,6 +261,7 @@ patch_enable_all ()
enable_ntdll_SystemRecommendedSharedDataAlignment="$1"
enable_ntdll_SystemRoot_Symlink="$1"
enable_ntdll_ThreadTime="$1"
enable_ntdll_Thread_Creation_Time="$1"
enable_ntdll_Threading="$1"
enable_ntdll_User_Shared_Data="$1"
enable_ntdll_WRITECOPY="$1"
@ -1001,6 +1002,9 @@ patch_enable ()
ntdll-ThreadTime)
enable_ntdll_ThreadTime="$2"
;;
ntdll-Thread_Creation_Time)
enable_ntdll_Thread_Creation_Time="$2"
;;
ntdll-Threading)
enable_ntdll_Threading="$2"
;;
@ -2145,6 +2149,13 @@ if test "$enable_server_Shared_Memory" -eq 1; then
enable_server_Signal_Thread=1
fi
if test "$enable_server_Realtime_Priority" -eq 1; then
if test "$enable_ntdll_Thread_Creation_Time" -gt 1; then
abort "Patchset ntdll-Thread_Creation_Time disabled, but server-Realtime_Priority depends on that."
fi
enable_ntdll_Thread_Creation_Time=1
fi
if test "$enable_server_Pipe_ObjectName" -eq 1; then
if test "$enable_kernel32_Named_Pipe" -gt 1; then
abort "Patchset kernel32-Named_Pipe disabled, but server-Pipe_ObjectName depends on that."
@ -5794,6 +5805,18 @@ if test "$enable_ntdll_ThreadTime" -eq 1; then
) >> "$patchlist"
fi
# Patchset ntdll-Thread_Creation_Time
# |
# | Modified files:
# | * dlls/ntdll/nt.c, server/protocol.def, server/snapshot.c, server/thread.h
# |
if test "$enable_ntdll_Thread_Creation_Time" -eq 1; then
patch_apply ntdll-Thread_Creation_Time/0001-ntdll-Set-correct-thread-creation-time-for-SystemPro.patch
(
printf '%s\n' '+ { "Michael Müller", "ntdll: Set correct thread creation time for SystemProcessInformation in NtQuerySystemInformation.", 1 },';
) >> "$patchlist"
fi
# Patchset ntdll-Threading
# |
# | Modified files:
@ -6651,6 +6674,9 @@ fi
# Patchset server-Realtime_Priority
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ntdll-Thread_Creation_Time
# |
# | Modified files:
# | * server/Makefile.in, server/main.c, server/scheduler.c, server/thread.c, server/thread.h
# |

View File

@ -1,4 +1,4 @@
From c7c204c978e86e796091166249bcf077835efab2 Mon Sep 17 00:00:00 2001
From ba09eea1a2a4de1e182d1d74ee09fde4c10ee275 Mon Sep 17 00:00:00 2001
From: Joakim Hernberg <jhernberg@alchemy.lu>
Date: Tue, 31 Mar 2015 20:58:20 +0200
Subject: wineserver: Draft to implement priority levels through POSIX
@ -19,7 +19,7 @@ Changes by Sebastian Lackner <sebastian@fds-team.de>:
create mode 100644 server/scheduler.c
diff --git a/server/Makefile.in b/server/Makefile.in
index 75ba199..e539110 100644
index 75ba1997c80..e539110cf35 100644
--- a/server/Makefile.in
+++ b/server/Makefile.in
@@ -30,6 +30,7 @@ C_SRCS = \
@ -31,7 +31,7 @@ index 75ba199..e539110 100644
serial.c \
signal.c \
diff --git a/server/main.c b/server/main.c
index 7aed338..ee8cadd 100644
index 7aed338e968..ee8cadde5da 100644
--- a/server/main.c
+++ b/server/main.c
@@ -44,6 +44,7 @@ int foreground = 0;
@ -52,7 +52,7 @@ index 7aed338..ee8cadd 100644
init_registry();
diff --git a/server/scheduler.c b/server/scheduler.c
new file mode 100644
index 0000000..2fca966
index 00000000000..2fca9661925
--- /dev/null
+++ b/server/scheduler.c
@@ -0,0 +1,163 @@
@ -220,10 +220,10 @@ index 0000000..2fca966
+
+#endif
diff --git a/server/thread.c b/server/thread.c
index 5f8405b..b1c6616 100644
index 67f976d33c3..3e6dc1491f1 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -491,7 +491,10 @@ static void set_thread_info( struct thread *thread,
@@ -490,7 +490,10 @@ static void set_thread_info( struct thread *thread,
if ((req->priority >= min && req->priority <= max) ||
req->priority == THREAD_PRIORITY_IDLE ||
req->priority == THREAD_PRIORITY_TIME_CRITICAL)
@ -235,12 +235,12 @@ index 5f8405b..b1c6616 100644
set_error( STATUS_INVALID_PARAMETER );
}
diff --git a/server/thread.h b/server/thread.h
index 2821991..92a0ba9 100644
index 2098c76a472..25f705b2838 100644
--- a/server/thread.h
+++ b/server/thread.h
@@ -146,4 +146,9 @@ static inline void set_win32_error( unsigned int err ) { set_error( 0xc0010000 |
@@ -147,4 +147,9 @@ static inline void set_win32_error( unsigned int err ) { set_error( 0xc0010000 |
static inline thread_id_t get_thread_id( struct thread *thread ) { return thread->id; }
static inline timeout_t get_thread_creation_time( struct thread *thread ) { return thread->creation_time; }
+/* scheduler functions */
+
@ -249,5 +249,5 @@ index 2821991..92a0ba9 100644
+
#endif /* __WINE_SERVER_THREAD_H */
--
2.8.0
2.11.0

View File

@ -1 +1,2 @@
Fixes: Support for linux priority levels for faster performance
Depends: ntdll-Thread_Creation_Time