Crate win32job

source ·
Expand description

§wun32job-rs

A safe API for Windows’ job objects, which can be used to set various limits to processes associated with them. See also Microsoft Docs.

§Using the higher level API

After getting an ExtendedLimitInfo object, either by querying the info of a job or by creating an empty one using new(), use helper methods to configure the required limits, and finally set the info to the job.

use win32job::*;

let mut info = ExtendedLimitInfo::new();

info.limit_working_memory(1 * 1024 * 1024,  4 * 1024 * 1024)
    .limit_priority_class(PriorityClass::BelowNormal);

let job = Job::create_with_limit_info(&mut info)?;
job.assign_current_process()?;

Which is equivalnent to:

use win32job::*;

let job = Job::create()?;
let mut info = job.query_extended_limit_info()?;

info.limit_working_memory(1 * 1024 * 1024,  4 * 1024 * 1024)
    .limit_priority_class(PriorityClass::BelowNormal);

job.set_extended_limit_info(&mut info)?;
job.assign_current_process()?;

Modules§

Structs§

Enums§