private void GetWorkingSetLimits(out IntPtr minWorkingSet, out IntPtr maxWorkingSet)
{
SafeProcessHandle handle = null;
try
{
handle = GetProcessHandle(Interop.Advapi32.ProcessOptions.PROCESS_QUERY_INFORMATION);
// GetProcessWorkingSetSize is not exposed in coresys. We use
// GetProcessWorkingSetSizeEx instead which also returns FLAGS which give some flexibility
// in terms of Min and Max values which we neglect.
int ignoredFlags;
if (!Interop.Kernel32.GetProcessWorkingSetSizeEx(handle, out minWorkingSet, out maxWorkingSet, out ignoredFlags))
{
throw new Win32Exception();
}
}
finally
{
ReleaseProcessHandle(handle);
}
}