break; + case ProcessQuotaLimits: + { + QUOTA_LIMITS qlimits; + + if (ProcessInformationLength >= sizeof(QUOTA_LIMITS)) + { + if (!ProcessInformation) + ret = STATUS_ACCESS_VIOLATION; + else if (!ProcessHandle) + ret = STATUS_INVALID_HANDLE; + else + { +
Please remove this empty line.
+ 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; Please test against these hard-coded values. And add a FIXME here because they should be queried from process and SetProcessWorkingSetSize() can change them. + memcpy(ProcessInformation, &qlimits, sizeof(QUOTA_LIMITS)); Please use sizeof(qlimits) instead. + + len = sizeof(QUOTA_LIMITS); + } + + if (ProcessInformationLength > sizeof(QUOTA_LIMITS)) + ret = STATUS_INFO_LENGTH_MISMATCH; You should check ProcessInformationLength == sizeof(QUOTA_LIMITS) and remove this. You didn't correctly test the required size. You should test size of sizeof(QUOTA_LIMITS)-/+1 + } + else + { + len = sizeof(QUOTA_LIMITS); + ret = STATUS_INFO_LENGTH_MISMATCH; + } + } + break; case ProcessIoCounters: { IO_COUNTERS pii;