This is needed by x64 chromium sandbox for >= win8. Not doing anything but returning true is enough to make it work, though security won't be perfect.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- ...api-ms-win-core-processthreads-l1-1-1.spec | 2 +- ...api-ms-win-core-processthreads-l1-1-2.spec | 2 +- dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/process.c | 10 ++++++++++ dlls/kernelbase/kernelbase.spec | 2 +- include/winnt.h | 19 +++++++++++++++++++ 6 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/dlls/api-ms-win-core-processthreads-l1-1-1/api-ms-win-core-processthreads-l1-1-1.spec b/dlls/api-ms-win-core-processthreads-l1-1-1/api-ms-win-core-processthreads-l1-1-1.spec index ebbe55fe68..616fa63909 100644 --- a/dlls/api-ms-win-core-processthreads-l1-1-1/api-ms-win-core-processthreads-l1-1-1.spec +++ b/dlls/api-ms-win-core-processthreads-l1-1-1/api-ms-win-core-processthreads-l1-1-1.spec @@ -44,7 +44,7 @@ @ stdcall ResumeThread(long) kernel32.ResumeThread @ stdcall SetPriorityClass(long long) kernel32.SetPriorityClass @ stdcall SetProcessAffinityUpdateMode(long long) kernel32.SetProcessAffinityUpdateMode -@ stub SetProcessMitigationPolicy +@ stdcall SetProcessMitigationPolicy(long ptr long) kernel32.SetProcessMitigationPolicy @ stdcall SetProcessShutdownParameters(long long) kernel32.SetProcessShutdownParameters @ stdcall SetThreadContext(long ptr) kernel32.SetThreadContext @ stdcall SetThreadIdealProcessorEx(long ptr ptr) kernel32.SetThreadIdealProcessorEx diff --git a/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec b/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec index db94c2e5e7..8de6c5b66c 100644 --- a/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec +++ b/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec @@ -49,7 +49,7 @@ @ stdcall ResumeThread(long) kernel32.ResumeThread @ stdcall SetPriorityClass(long long) kernel32.SetPriorityClass @ stdcall SetProcessAffinityUpdateMode(long long) kernel32.SetProcessAffinityUpdateMode -@ stub SetProcessMitigationPolicy +@ stdcall SetProcessMitigationPolicy(long ptr long) kernel32.SetProcessMitigationPolicy @ stdcall SetProcessPriorityBoost(long long) kernel32.SetProcessPriorityBoost @ stdcall SetProcessShutdownParameters(long long) kernel32.SetProcessShutdownParameters @ stdcall SetThreadContext(long ptr) kernel32.SetThreadContext diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index de6f007999..812ffc6ad4 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1427,6 +1427,7 @@ @ stdcall SetProcessAffinityMask(long long) @ stdcall SetProcessAffinityUpdateMode(long long) @ stdcall SetProcessDEPPolicy(long) +@ stdcall SetProcessMitigationPolicy(long ptr long) # @ stub SetProcessPreferredUILanguages @ stdcall SetProcessPriorityBoost(long long) @ stdcall SetProcessShutdownParameters(long long) diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 4e6ba1118e..a2801df874 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -4389,3 +4389,13 @@ BOOL WINAPI BaseFlushAppcompatCache(void) SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } + +/********************************************************************** + * SetProcessMitigationPolicy (KERNEL32.@) + */ +BOOL WINAPI SetProcessMitigationPolicy(PROCESS_MITIGATION_POLICY migitation_policy, void *buffer, SIZE_T length) +{ + FIXME("(%d, %p, %lu): stub\n", migitation_policy, buffer, length); + + return TRUE; +} diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index fb7fafe47b..f07ab7bf9a 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1456,7 +1456,7 @@ # @ stub SetProcessDefaultCpuSets # @ stub SetProcessGroupAffinity # @ stub SetProcessInformation -# @ stub SetProcessMitigationPolicy +@ stdcall SetProcessMitigationPolicy(long ptr long) kernel32.SetProcessMitigationPolicy # @ stub SetProcessPreferredUILanguages @ stdcall SetProcessPriorityBoost(long long) kernel32.SetProcessPriorityBoost @ stdcall SetProcessShutdownParameters(long long) kernel32.SetProcessShutdownParameters diff --git a/include/winnt.h b/include/winnt.h index 7f822c4aec..e9e5989f24 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -6273,6 +6273,25 @@ typedef enum _RTL_UMS_SCHEDULER_REASON
typedef void (CALLBACK *PRTL_UMS_SCHEDULER_ENTRY_POINT)(RTL_UMS_SCHEDULER_REASON,ULONG_PTR,PVOID);
+typedef enum _PROCESS_MITIGATION_POLICY { + ProcessDEPPolicy, + ProcessASLRPolicy, + ProcessDynamicCodePolicy, + ProcessStrictHandleCheckPolicy, + ProcessSystemCallDisablePolicy, + ProcessMitigationOptionsMask, + ProcessExtensionPointDisablePolicy, + ProcessControlFlowGuardPolicy, + ProcessSignaturePolicy, + ProcessFontDisablePolicy, + ProcessImageLoadPolicy, + ProcessSystemCallFilterPolicy, + ProcessPayloadRestrictionPolicy, + ProcessChildProcessPolicy, + ProcessSideChannelIsolationPolicy, + MaxProcessMitigationPolicy +} PROCESS_MITIGATION_POLICY, *PPROCESS_MITIGATION_POLICY; + #ifdef __cplusplus } #endif
This is needed by x64 chromium sandbox for >= win10.
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- dlls/kernel32/process.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index a2801df874..5dd1933e12 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -4216,8 +4216,17 @@ BOOL WINAPI UpdateProcThreadAttribute(struct _PROC_THREAD_ATTRIBUTE_LIST *list, } break;
+ case PROC_THREAD_ATTRIBUTE_CHILD_PROCESS_POLICY: + if (size != sizeof(DWORD) && size != sizeof(DWORD64)) + { + SetLastError(ERROR_BAD_LENGTH); + return FALSE; + } + break; + default: SetLastError(ERROR_NOT_SUPPORTED); + FIXME("Unhandled attribute number %lu\n", attr & PROC_THREAD_ATTRIBUTE_NUMBER); return FALSE; }
This is needed by chromium tests
Signed-off-by: Fabian Maurer dark.shadow4@web.de --- ...api-ms-win-core-processthreads-l1-1-2.spec | 2 +- dlls/kernel32/kernel32.spec | 1 + dlls/kernel32/thread.c | 11 +++++++ dlls/kernelbase/kernelbase.spec | 2 +- include/processthreadsapi.h | 31 +++++++++++++++++++ 5 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 include/processthreadsapi.h
diff --git a/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec b/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec index 8de6c5b66c..bcb915cdda 100644 --- a/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec +++ b/dlls/api-ms-win-core-processthreads-l1-1-2/api-ms-win-core-processthreads-l1-1-2.spec @@ -54,7 +54,7 @@ @ stdcall SetProcessShutdownParameters(long long) kernel32.SetProcessShutdownParameters @ stdcall SetThreadContext(long ptr) kernel32.SetThreadContext @ stdcall SetThreadIdealProcessorEx(long ptr ptr) kernel32.SetThreadIdealProcessorEx -@ stub SetThreadInformation +@ stdcall SetThreadInformation(long long ptr long) kernel32.SetThreadInformation @ stdcall SetThreadPriority(long long) kernel32.SetThreadPriority @ stdcall SetThreadPriorityBoost(long long) kernel32.SetThreadPriorityBoost @ stdcall SetThreadStackGuarantee(ptr) kernel32.SetThreadStackGuarantee diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 812ffc6ad4..ee8c083044 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1451,6 +1451,7 @@ @ stdcall SetThreadGroupAffinity(long ptr ptr) @ stdcall SetThreadIdealProcessor(long long) @ stdcall SetThreadIdealProcessorEx(long ptr ptr) +@ stdcall SetThreadInformation(long long ptr long) @ stdcall SetThreadLocale(long) @ stdcall SetThreadPreferredUILanguages(long ptr ptr) @ stdcall SetThreadPriority(long long) diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index a86ad3443a..5fc47bf298 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -35,6 +35,7 @@ #include "winbase.h" #include "winerror.h" #include "winternl.h" +#include "processthreadsapi.h" #include "wine/exception.h" #include "wine/library.h" #include "wine/server.h" @@ -1180,3 +1181,13 @@ BOOL WINAPI TrySubmitThreadpoolCallback( PTP_SIMPLE_CALLBACK callback, PVOID use
return TRUE; } + +/********************************************************************** + * SetThreadInformation [KERNEL32.@] + */ +BOOL WINAPI SetThreadInformation(HANDLE hthread, THREAD_INFORMATION_CLASS thread_information_class, void *thread_information, DWORD thread_information_size) +{ + FIXME("(%p, %d, %p, %d): stub\n", hthread, thread_information_class, thread_information, thread_information_size); + + return TRUE; +} diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index f07ab7bf9a..0559dc6f31 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1483,7 +1483,7 @@ @ stdcall SetThreadGroupAffinity(long ptr ptr) kernel32.SetThreadGroupAffinity @ stdcall SetThreadIdealProcessor(long long) kernel32.SetThreadIdealProcessor @ stdcall SetThreadIdealProcessorEx(long ptr ptr) kernel32.SetThreadIdealProcessorEx -# @ stub SetThreadInformation +@ stdcall SetThreadInformation(long long ptr long) kernel32.SetThreadInformation @ stdcall SetThreadLocale(long) kernel32.SetThreadLocale @ stdcall SetThreadPreferredUILanguages(long ptr ptr) kernel32.SetThreadPreferredUILanguages @ stdcall SetThreadPriority(long long) kernel32.SetThreadPriority diff --git a/include/processthreadsapi.h b/include/processthreadsapi.h new file mode 100644 index 0000000000..f14cefe5d2 --- /dev/null +++ b/include/processthreadsapi.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 Fabian Maurer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#ifndef __WINE_PROCESSTHREADSAPI_H +#define __WINE_PROCESSTHREADSAPI_H + +typedef enum _THREAD_INFORMATION_CLASS { + ThreadMemoryPriority, + ThreadAbsoluteCpuPriority, + ThreadDynamicCodePolicy, + ThreadPowerThrottling, + ThreadInformationClassMax +} THREAD_INFORMATION_CLASS; + +#endif /* __WINE_PROCESSTHREADSAPI_H */ +