<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<blockquote type="cite">
<pre style="font-family: monospace, Consolas, "Microsoft Yahei"; color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;"> 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
+ {
+</pre>
</blockquote>
Please remove this empty line.<br>
<blockquote type="cite">
<pre style="font-family: monospace, Consolas, "Microsoft Yahei"; color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;">
+ 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;</pre>
</blockquote>
Please test against these hard-coded values. And add a FIXME here
because they should be queried from process and
SetProcessWorkingSetSize() can change them.<br>
<blockquote type="cite">
<pre style="font-family: monospace, Consolas, "Microsoft Yahei"; color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;">
+ memcpy(ProcessInformation, &qlimits, sizeof(QUOTA_LIMITS));</pre>
</blockquote>
Please use sizeof(qlimits) instead.<br>
<blockquote type="cite">
<pre style="font-family: monospace, Consolas, "Microsoft Yahei"; color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;">
+
+ len = sizeof(QUOTA_LIMITS);
+ }
+
+ if (ProcessInformationLength > sizeof(QUOTA_LIMITS))
+ ret = STATUS_INFO_LENGTH_MISMATCH;</pre>
</blockquote>
You should check ProcessInformationLength == sizeof(QUOTA_LIMITS)
and remove this. You didn't <br>
correctly test the required size. You should test size of
sizeof(QUOTA_LIMITS)-/+1<br>
<blockquote type="cite">
<pre style="font-family: monospace, Consolas, "Microsoft Yahei"; color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial; overflow-wrap: break-word; white-space: pre-wrap;">
+ }
+ else
+ {
+ len = sizeof(QUOTA_LIMITS);
+ ret = STATUS_INFO_LENGTH_MISMATCH;
+ }
+ }
+ break;
case ProcessIoCounters:
{
IO_COUNTERS pii;</pre>
</blockquote>
<br>
</body>
</html>