From: Marc-Aurel Zent mzent@codeweavers.com
--- dlls/ntdll/unix/thread.c | 16 ++++++++++++++-- server/protocol.def | 13 +++++++------ server/thread.c | 12 ++++++++++++ server/thread.h | 1 + 4 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c index 995498f8ff7..fb17bb61330 100644 --- a/dlls/ntdll/unix/thread.c +++ b/dlls/ntdll/unix/thread.c @@ -2550,8 +2550,20 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, }
case ThreadPriorityBoost: - WARN("Unimplemented class ThreadPriorityBoost.\n"); - return STATUS_SUCCESS; + { + const DWORD *disable_boost = data; + if (length != sizeof(DWORD)) return STATUS_INVALID_PARAMETER; + if (!disable_boost) return STATUS_ACCESS_VIOLATION; + SERVER_START_REQ( set_thread_info ) + { + req->handle = wine_server_obj_handle( handle ); + req->disable_boost = *disable_boost; + req->mask = SET_THREAD_INFO_DISABLE_BOOST; + status = wine_server_call( req ); + } + SERVER_END_REQ; + return status; + }
case ThreadManageWritesToExecutableMemory: { diff --git a/server/protocol.def b/server/protocol.def index 9a9f1baba50..542bf812a18 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -1253,6 +1253,7 @@ struct obj_locator obj_handle_t handle; /* thread handle */ int priority; /* current thread priority */ int base_priority;/* base priority level (relative to process base priority class) */ + int disable_boost;/* disable thread priority boost */ affinity_t affinity; /* affinity mask */ client_ptr_t entry_point; /* thread entry point */ obj_handle_t token; /* impersonation token */ @@ -1261,12 +1262,12 @@ struct obj_locator @END #define SET_THREAD_INFO_PRIORITY 0x01 #define SET_THREAD_INFO_BASE_PRIORITY 0x02 -#define SET_THREAD_INFO_AFFINITY 0x04 -#define SET_THREAD_INFO_TOKEN 0x08 -#define SET_THREAD_INFO_ENTRYPOINT 0x10 -#define SET_THREAD_INFO_DESCRIPTION 0x20 -#define SET_THREAD_INFO_DBG_HIDDEN 0x40 - +#define SET_THREAD_INFO_DISABLE_BOOST 0x04 +#define SET_THREAD_INFO_AFFINITY 0x08 +#define SET_THREAD_INFO_TOKEN 0x10 +#define SET_THREAD_INFO_ENTRYPOINT 0x20 +#define SET_THREAD_INFO_DESCRIPTION 0x40 +#define SET_THREAD_INFO_DBG_HIDDEN 0x80
/* Suspend a thread */ @REQ(suspend_thread) diff --git a/server/thread.c b/server/thread.c index 29659d91f15..bc27bbcca57 100644 --- a/server/thread.c +++ b/server/thread.c @@ -826,6 +826,13 @@ unsigned int set_thread_base_priority( struct thread *thread, int base_priority return set_thread_priority( thread, priority ); }
+unsigned int set_thread_disable_boost( struct thread *thread, int disable_boost ) +{ + thread->disable_boost = disable_boost; + set_thread_priority( thread, thread->priority ); + return STATUS_SUCCESS; +} + /* set all information about a thread */ static void set_thread_info( struct thread *thread, const struct set_thread_info_request *req ) @@ -840,6 +847,11 @@ static void set_thread_info( struct thread *thread, unsigned int status = set_thread_base_priority( thread, req->base_priority ); if (status) set_error( status ); } + if (req->mask & SET_THREAD_INFO_DISABLE_BOOST) + { + unsigned int status = set_thread_disable_boost( thread, req->disable_boost ); + if (status) set_error( status ); + } if (req->mask & SET_THREAD_INFO_AFFINITY) { if ((req->affinity & thread->process->affinity) != req->affinity) diff --git a/server/thread.h b/server/thread.h index 03b0b547c2f..e4ac3b8050a 100644 --- a/server/thread.h +++ b/server/thread.h @@ -126,6 +126,7 @@ extern int thread_get_inflight_fd( struct thread *thread, int client ); extern struct token *thread_get_impersonation_token( struct thread *thread ); extern unsigned int set_thread_priority( struct thread *thread, int priority ); extern unsigned int set_thread_base_priority( struct thread *thread, int base_priority ); +extern unsigned int set_thread_disable_boost( struct thread *thread, int disable_boost ); extern int set_thread_affinity( struct thread *thread, affinity_t affinity ); extern int suspend_thread( struct thread *thread ); extern int resume_thread( struct thread *thread );