From: Vijay Kiran Kamuju infyquest@gmail.com
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 | 24 ++++++++++++++++++++++++ dlls/wow64/struct32.h | 10 ++++++++++ 3 files changed, 63 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 2c6dc1b43cc..09e38572cf2 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 (!info || !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..359f0d398eb 100644 --- a/dlls/wow64/process.c +++ b/dlls/wow64/process.c @@ -252,6 +252,15 @@ static void put_ps_attributes( PS_ATTRIBUTE_LIST32 *attr32, const PS_ATTRIBUTE_L } }
+void put_quota_limits( QUOTA_LIMITS32 *info32, const QUOTA_LIMITS *info ) +{ + info32->PagedPoolLimit = info->PagedPoolLimit; + info32->NonPagedPoolLimit = info->NonPagedPoolLimit; + info32->MinimumWorkingSetSize = info->MinimumWorkingSetSize; + info32->MaximumWorkingSetSize = info->MaximumWorkingSetSize; + info32->PagefileLimit = info->PagefileLimit; + info32->TimeLimit = info->TimeLimit; +}
void put_vm_counters( VM_COUNTERS_EX32 *info32, const VM_COUNTERS_EX *info, ULONG size ) { @@ -566,6 +575,21 @@ 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 ))) + { + put_quota_limits( info32, &info ); + 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 */