From 7e39544bfa6cf3e68a8567c202624f7f2d3fc7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Sun, 16 Sep 2018 16:59:21 +0200 Subject: [PATCH] kernel32: Add stub for SetProcessWorkingSetSizeEx. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45523 Signed-off-by: André Hentschel Signed-off-by: Alexandre Julliard --- .../api-ms-win-core-memory-l1-1-1.spec | 2 +- .../api-ms-win-core-memory-l1-1-2.spec | 2 +- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/process.c | 36 ++++++++++++++----- dlls/kernelbase/kernelbase.spec | 2 +- include/winbase.h | 1 + 6 files changed, 32 insertions(+), 13 deletions(-) diff --git a/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec b/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec index 42630c10489..3200be9a781 100644 --- a/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec +++ b/dlls/api-ms-win-core-memory-l1-1-1/api-ms-win-core-memory-l1-1-1.spec @@ -15,7 +15,7 @@ @ stdcall QueryMemoryResourceNotification(ptr ptr) kernel32.QueryMemoryResourceNotification @ stdcall ReadProcessMemory(long ptr ptr long ptr) kernel32.ReadProcessMemory @ stdcall ResetWriteWatch(ptr long) kernel32.ResetWriteWatch -@ stub SetProcessWorkingSetSizeEx +@ stdcall SetProcessWorkingSetSizeEx(long long long long) kernel32.SetProcessWorkingSetSizeEx @ stdcall SetSystemFileCacheSize(long long long) kernel32.SetSystemFileCacheSize @ stdcall UnmapViewOfFile(ptr) kernel32.UnmapViewOfFile @ stub UnmapViewOfFileEx diff --git a/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec b/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec index 6100213eb7b..57a5b105621 100644 --- a/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec +++ b/dlls/api-ms-win-core-memory-l1-1-2/api-ms-win-core-memory-l1-1-2.spec @@ -21,7 +21,7 @@ @ stdcall ReadProcessMemory(long ptr ptr long ptr) kernel32.ReadProcessMemory @ stub RegisterBadMemoryNotification @ stdcall ResetWriteWatch(ptr long) kernel32.ResetWriteWatch -@ stub SetProcessWorkingSetSizeEx +@ stdcall SetProcessWorkingSetSizeEx(long long long long) kernel32.SetProcessWorkingSetSizeEx @ stdcall SetSystemFileCacheSize(long long long) kernel32.SetSystemFileCacheSize @ stdcall UnmapViewOfFile(ptr) kernel32.UnmapViewOfFile @ stub UnmapViewOfFileEx diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index f1d75b8e1c6..9db7d98f41b 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1434,7 +1434,7 @@ @ stdcall SetProcessShutdownParameters(long long) # @ stub SetProcessUserModeExceptionPolicy @ stdcall SetProcessWorkingSetSize(long long long) -# @ stub SetProcessWorkingSetSizeEx +@ stdcall SetProcessWorkingSetSizeEx(long long long long) @ stdcall SetSearchPathMode(long) @ stdcall SetStdHandle(long long) # @ stub SetStdHandleEx diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index 85e0042024c..87c9ed70152 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -3389,12 +3389,36 @@ err: } +/*********************************************************************** + * SetProcessWorkingSetSizeEx [KERNEL32.@] + * Sets the min/max working set sizes for a specified process. + * + * PARAMS + * process [I] Handle to the process of interest + * minset [I] Specifies minimum working set size + * maxset [I] Specifies maximum working set size + * flags [I] Flags to enforce working set sizes + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ +BOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE process, SIZE_T minset, SIZE_T maxset, DWORD flags) +{ + WARN("(%p,%ld,%ld,%x): stub - harmless\n", process, minset, maxset, flags); + if(( minset == (SIZE_T)-1) && (maxset == (SIZE_T)-1)) { + /* Trim the working set to zero */ + /* Swap the process out of physical RAM */ + } + return TRUE; +} + /*********************************************************************** * SetProcessWorkingSetSize [KERNEL32.@] * Sets the min/max working set sizes for a specified process. * * PARAMS - * hProcess [I] Handle to the process of interest + * process [I] Handle to the process of interest * minset [I] Specifies minimum working set size * maxset [I] Specifies maximum working set size * @@ -3402,15 +3426,9 @@ err: * Success: TRUE * Failure: FALSE */ -BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess, SIZE_T minset, - SIZE_T maxset) +BOOL WINAPI SetProcessWorkingSetSize(HANDLE process, SIZE_T minset, SIZE_T maxset) { - WARN("(%p,%ld,%ld): stub - harmless\n",hProcess,minset,maxset); - if(( minset == (SIZE_T)-1) && (maxset == (SIZE_T)-1)) { - /* Trim the working set to zero */ - /* Swap the process out of physical RAM */ - } - return TRUE; + return SetProcessWorkingSetSizeEx(process, minset, maxset, 0); } /*********************************************************************** diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 89fad2c835b..29805760da2 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1461,7 +1461,7 @@ @ stdcall SetProcessPriorityBoost(long long) kernel32.SetProcessPriorityBoost @ stdcall SetProcessShutdownParameters(long long) kernel32.SetProcessShutdownParameters # @ stub SetProcessValidCallTargets -# @ stub SetProcessWorkingSetSizeEx +@ stdcall SetProcessWorkingSetSizeEx(long long long long) kernel32.SetProcessWorkingSetSizeEx # @ stub SetProtectedPolicy # @ stub SetRoamingLastObservedChangeTime @ stub SetSecurityAccessMask diff --git a/include/winbase.h b/include/winbase.h index 8b26308b956..4d959d0da65 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -2597,6 +2597,7 @@ WINBASEAPI BOOL WINAPI SetProcessAffinityMask(HANDLE,DWORD_PTR); WINBASEAPI BOOL WINAPI SetProcessPriorityBoost(HANDLE,BOOL); WINBASEAPI BOOL WINAPI SetProcessShutdownParameters(DWORD,DWORD); WINBASEAPI BOOL WINAPI SetProcessWorkingSetSize(HANDLE,SIZE_T,SIZE_T); +WINBASEAPI BOOL WINAPI SetProcessWorkingSetSizeEx(HANDLE,SIZE_T,SIZE_T,DWORD); WINBASEAPI BOOL WINAPI SetSearchPathMode(DWORD); WINADVAPI BOOL WINAPI SetSecurityDescriptorControl(PSECURITY_DESCRIPTOR,SECURITY_DESCRIPTOR_CONTROL,SECURITY_DESCRIPTOR_CONTROL); WINADVAPI BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR,BOOL,PACL,BOOL);