Module: wine Branch: master Commit: ea4ba2f7de2d761f4f2e30f4ef146731d0b8d08c URL: https://gitlab.winehq.org/wine/wine/-/commit/ea4ba2f7de2d761f4f2e30f4ef14673...
Author: Vijay Kiran Kamuju infyquest@gmail.com Date: Sat Mar 9 20:51:08 2024 +0100
ntdll: Add NtQueryInformationProcess(ProcessQuotaLimits) stub.
Based on a patch by Qian Hong.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=44812 Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com
---
dlls/ntdll/unix/process.c | 30 +++++++++++++++++++++++++++++- dlls/wow64/process.c | 22 +++++++++++++++++++++- dlls/wow64/struct32.h | 10 ++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 2c6dc1b43cc..cc2d820e723 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -1124,7 +1124,6 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
switch (class) { - UNIMPLEMENTED_INFO_CLASS(ProcessQuotaLimits); UNIMPLEMENTED_INFO_CLASS(ProcessBasePriority); UNIMPLEMENTED_INFO_CLASS(ProcessRaisePriority); UNIMPLEMENTED_INFO_CLASS(ProcessExceptionPort); @@ -1580,6 +1579,35 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class else ret = STATUS_INVALID_PARAMETER; break;
+ case ProcessQuotaLimits: + { + QUOTA_LIMITS qlimits; + + FIXME( "ProcessQuotaLimits (%p,%p,0x%08x,%p) stub\n", handle, info, (int)size, ret_len ); + + len = sizeof(QUOTA_LIMITS); + if (size == len) + { + if (!handle) ret = STATUS_INVALID_HANDLE; + else + { + /* FIXME: SetProcessWorkingSetSize can also set the quota values. + Quota Limits should be stored inside the process. */ + qlimits.PagedPoolLimit = (SIZE_T)-1; + qlimits.NonPagedPoolLimit = (SIZE_T)-1; + /* Default minimum working set size is 204800 bytes (50 Pages) */ + qlimits.MinimumWorkingSetSize = 204800; + /* Default maximum working set size is 1413120 bytes (345 Pages) */ + qlimits.MaximumWorkingSetSize = 1413120; + qlimits.PagefileLimit = (SIZE_T)-1; + qlimits.TimeLimit.QuadPart = -1; + memcpy(info, &qlimits, len); + } + } + else ret = STATUS_INFO_LENGTH_MISMATCH; + break; + } + default: FIXME("(%p,info_class=%d,%p,0x%08x,%p) Unknown information class\n", handle, class, info, (int)size, ret_len ); diff --git a/dlls/wow64/process.c b/dlls/wow64/process.c index 8b543d2a859..3150ad4b2f6 100644 --- a/dlls/wow64/process.c +++ b/dlls/wow64/process.c @@ -252,7 +252,6 @@ static void put_ps_attributes( PS_ATTRIBUTE_LIST32 *attr32, const PS_ATTRIBUTE_L } }
- void put_vm_counters( VM_COUNTERS_EX32 *info32, const VM_COUNTERS_EX *info, ULONG size ) { info32->PeakVirtualSize = info->PeakVirtualSize; @@ -566,6 +565,27 @@ NTSTATUS WINAPI wow64_NtQueryInformationProcess( UINT *args ) /* FIXME: check buffer alignment */ return NtQueryInformationProcess( handle, class, ptr, len, retlen );
+ case ProcessQuotaLimits: /* QUOTA_LIMITS */ + if (len == sizeof(QUOTA_LIMITS32)) + { + QUOTA_LIMITS info; + QUOTA_LIMITS32 *info32 = ptr; + + if (!(status = NtQueryInformationProcess( handle, class, &info, sizeof(info), NULL ))) + { + info32->PagedPoolLimit = info.PagedPoolLimit; + info32->NonPagedPoolLimit = info.NonPagedPoolLimit; + info32->MinimumWorkingSetSize = info.MinimumWorkingSetSize; + info32->MaximumWorkingSetSize = info.MaximumWorkingSetSize; + info32->PagefileLimit = info.PagefileLimit; + info32->TimeLimit = info.TimeLimit; + if (retlen) *retlen = len; + } + return status; + } + if (retlen) *retlen = sizeof(QUOTA_LIMITS32); + return STATUS_INFO_LENGTH_MISMATCH; + case ProcessVmCounters: /* VM_COUNTERS_EX */ if (len == sizeof(VM_COUNTERS32) || len == sizeof(VM_COUNTERS_EX32)) { diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index 2c4cf4f9e3c..9535fba3a84 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -728,4 +728,14 @@ typedef struct ULONG Thread; } PROCESS_ACCESS_TOKEN32;
+typedef struct +{ + ULONG PagedPoolLimit; + ULONG NonPagedPoolLimit; + ULONG MinimumWorkingSetSize; + ULONG MaximumWorkingSetSize; + ULONG PagefileLimit; + LARGE_INTEGER TimeLimit; +} QUOTA_LIMITS32; + #endif /* __WOW64_STRUCT32_H */