Nikolay Sivov : kernelbase: Add SetThreadInformation().

Alexandre Julliard julliard at winehq.org
Fri May 20 15:26:48 CDT 2022


Module: wine
Branch: master
Commit: 15aa8c6fb81921811cb2c7f99ae43f31930b4c10
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=15aa8c6fb81921811cb2c7f99ae43f31930b4c10

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri May 20 15:20:27 2022 +0300

kernelbase: Add SetThreadInformation().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52956
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/kernel32.spec     |  1 +
 dlls/kernelbase/kernelbase.spec |  2 +-
 dlls/kernelbase/thread.c        | 19 +++++++++++++++++++
 include/processthreadsapi.h     | 15 +++++++++++++++
 4 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index ca339181e32..cbba3abdba0 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -1470,6 +1470,7 @@
 @ stdcall -import SetThreadGroupAffinity(long ptr ptr)
 @ stdcall -import SetThreadIdealProcessor(long long)
 @ stdcall -import SetThreadIdealProcessorEx(long ptr ptr)
+@ stdcall -import SetThreadInformation(long long ptr long)
 @ stdcall -import SetThreadLocale(long)
 @ stdcall -import SetThreadPreferredUILanguages(long ptr ptr)
 @ stdcall -import SetThreadPriority(long long)
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec
index 791c3603918..fd9701dd20b 100644
--- a/dlls/kernelbase/kernelbase.spec
+++ b/dlls/kernelbase/kernelbase.spec
@@ -1520,7 +1520,7 @@
 @ stdcall SetThreadGroupAffinity(long ptr ptr)
 @ stdcall SetThreadIdealProcessor(long long)
 @ stdcall SetThreadIdealProcessorEx(long ptr ptr)
-# @ stub SetThreadInformation
+@ stdcall SetThreadInformation(long long ptr long)
 @ stdcall SetThreadLocale(long)
 @ stdcall SetThreadPreferredUILanguages(long ptr ptr)
 @ stdcall SetThreadPriority(long long)
diff --git a/dlls/kernelbase/thread.c b/dlls/kernelbase/thread.c
index 6ba58cf0a67..f11d17748fe 100644
--- a/dlls/kernelbase/thread.c
+++ b/dlls/kernelbase/thread.c
@@ -606,6 +606,25 @@ LANGID WINAPI DECLSPEC_HOTPATCH SetThreadUILanguage( LANGID langid )
 }
 
 
+/**********************************************************************
+ *            SetThreadInformation   (kernelbase.@)
+ */
+BOOL WINAPI DECLSPEC_HOTPATCH SetThreadInformation( HANDLE thread, THREAD_INFORMATION_CLASS info_class,
+        VOID *info, DWORD size )
+{
+    switch (info_class)
+    {
+        case ThreadMemoryPriority:
+            return set_ntstatus( NtSetInformationThread( thread, ThreadPagePriority, info, size ));
+        case ThreadPowerThrottling:
+            return set_ntstatus( NtSetInformationThread( thread, ThreadPowerThrottlingState, info, size ));
+        default:
+            FIXME("Unsupported class %u.\n", info_class);
+            return FALSE;
+    }
+}
+
+
 /**********************************************************************
  *           SuspendThread   (kernelbase.@)
  */
diff --git a/include/processthreadsapi.h b/include/processthreadsapi.h
index 8cdaff4796a..d266b7a727b 100644
--- a/include/processthreadsapi.h
+++ b/include/processthreadsapi.h
@@ -23,8 +23,23 @@
 extern "C" {
 #endif
 
+typedef enum _THREAD_INFORMATION_CLASS
+{
+    ThreadMemoryPriority,
+    ThreadAbsoluteCpuPriority,
+    ThreadDynamicCodePolicy,
+    ThreadPowerThrottling,
+    ThreadInformationClassMax
+} THREAD_INFORMATION_CLASS;
+
+typedef struct _MEMORY_PRIORITY_INFORMATION
+{
+    ULONG MemoryPriority;
+} MEMORY_PRIORITY_INFORMATION, *PMEMORY_PRIORITY_INFORMATION;
+
 WINBASEAPI HRESULT WINAPI GetThreadDescription(HANDLE,PWSTR *);
 WINBASEAPI HRESULT WINAPI SetThreadDescription(HANDLE,PCWSTR);
+WINBASEAPI BOOL WINAPI SetThreadInformation(HANDLE,THREAD_INFORMATION_CLASS,LPVOID,DWORD);
 
 #ifdef __cplusplus
 }




More information about the wine-cvs mailing list