Skip to content

Instantly share code, notes, and snippets.

@ananace
Last active May 4, 2022 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ananace/1139461949d532fea812ac53a6b016bb to your computer and use it in GitHub Desktop.
Save ananace/1139461949d532fea812ac53a6b016bb to your computer and use it in GitHub Desktop.
Quick and ugly Kernel32.SetThreadInformation stub
Add a stub for missing Kernel32.SetThreadInformation, needed for Star Citizen 3.17.1
https://bugs.winehq.org/show_bug.cgi?id=52956
https://bugs.winehq.org/attachment.cgi?id=72326
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index 818e7d87a2f..706c518dbe1 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 SetThreadInformation(long long ptr long)
@ stdcall -import SetThreadLocale(long)
@ stdcall -import SetThreadPreferredUILanguages(long ptr ptr)
@ stdcall -import SetThreadPriority(long long)
diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c
index a090c54aa28..bccaa410333 100644
--- a/dlls/kernel32/thread.c
+++ b/dlls/kernel32/thread.c
@@ -142,6 +142,23 @@ BOOL WINAPI GetThreadSelectorEntry( HANDLE thread, DWORD sel, LDT_ENTRY *ldtent
}
+/***********************************************************************
+ * SetThreadInformation (KERNEL32.@)
+ */
+BOOL SetThreadInformation(HANDLE hThread,
+ THREAD_INFORMATION_CLASS threadInformationClass,
+ LPVOID threadInformation,
+ DWORD threadInformationSize)
+{
+ FIXME("(%p, %u, %p, %u): stub\n",
+ hThread,
+ threadInformationClass,
+ threadInformation,
+ threadInformationSize);
+ return TRUE;
+}
+
+
/***********************************************************************
* GetCurrentThread [KERNEL32.@] Gets pseudohandle for current thread
*
diff --git a/include/processthreadsapi.h b/include/processthreadsapi.h
index 8cdaff4796a..58755240727 100644
--- a/include/processthreadsapi.h
+++ b/include/processthreadsapi.h
@@ -23,6 +23,14 @@
extern "C" {
#endif
+typedef enum _THREAD_INFORMATION_CLASS {
+ ThreadMemoryPriority,
+ ThreadAbsoluteCpuPriority,
+ ThreadDynamicCodePolicy,
+ ThreadPowerThrottling,
+ ThreadInformationClassMax
+} THREAD_INFORMATION_CLASS;
+
WINBASEAPI HRESULT WINAPI GetThreadDescription(HANDLE,PWSTR *);
WINBASEAPI HRESULT WINAPI SetThreadDescription(HANDLE,PCWSTR);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment