Skip to content

Commit

Permalink
patches: fix star citizen patch -- use stub, upstream implementation …
Browse files Browse the repository at this point in the history
…does not work
  • Loading branch information
GloriousEggroll committed May 21, 2022
1 parent f6773b3 commit 2111516
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 73 deletions.
Original file line number Diff line number Diff line change
@@ -1,98 +1,53 @@
From 15aa8c6fb81921811cb2c7f99ae43f31930b4c10 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov@codeweavers.com>
Date: Fri, 20 May 2022 15:20:27 +0300
Subject: [PATCH] kernelbase: Add SetThreadInformation().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52956
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@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 ca339181e327..cbba3abdba0c 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
+++ a/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 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 791c36039189..fd9701dd20be 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 6ba58cf0a67e..f11d17748fe8 100644
--- a/dlls/kernelbase/thread.c
+++ b/dlls/kernelbase/thread.c
@@ -606,6 +606,25 @@ LANGID WINAPI DECLSPEC_HOTPATCH SetThreadUILanguage( LANGID langid )
--- a/dlls/kernel32/thread.c
+++ a/dlls/kernel32/thread.c
@@ -142,6 +142,23 @@ BOOL WINAPI GetThreadSelectorEntry( HANDLE thread, DWORD sel, LDT_ENTRY *ldtent
}
+/**********************************************************************
+ * SetThreadInformation (kernelbase.@)


+/***********************************************************************
+ * SetThreadInformation (KERNEL32.@)
+ */
+BOOL WINAPI DECLSPEC_HOTPATCH SetThreadInformation( HANDLE thread, THREAD_INFORMATION_CLASS info_class,
+ VOID *info, DWORD size )
+BOOL SetThreadInformation(HANDLE hThread,
+ THREAD_INFORMATION_CLASS threadInformationClass,
+ LPVOID threadInformation,
+ DWORD threadInformationSize)
+{
+ 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;
+ }
+ FIXME("(%p, %u, %p, %u): stub\n",
+ hThread,
+ threadInformationClass,
+ threadInformation,
+ threadInformationSize);
+ return TRUE;
+}
+
+
/**********************************************************************
* SuspendThread (kernelbase.@)
*/
diff --git a/include/processthreadsapi.h b/include/processthreadsapi.h
index 8cdaff4796a7..d266b7a727be 100644
/***********************************************************************
* GetCurrentThread [KERNEL32.@] Gets pseudohandle for current thread
*
--- a/include/processthreadsapi.h
+++ b/include/processthreadsapi.h
@@ -23,8 +23,23 @@
+++ a/include/processthreadsapi.h
@@ -23,6 +23,14 @@
extern "C" {
#endif

+typedef enum _THREAD_INFORMATION_CLASS
+{

+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
}

0 comments on commit 2111516

Please sign in to comment.