winapi_ui_automation/um/
jobapi2.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6use shared::basetsd::LONG64;
7use shared::minwindef::{BOOL, DWORD, LPDWORD, LPVOID, UINT, ULONG};
8use shared::ntdef::{HANDLE, LPCWSTR, PCWSTR, VOID};
9use um::minwinbase::LPSECURITY_ATTRIBUTES;
10use um::winnt::JOBOBJECTINFOCLASS;
11STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION {
12    MaxIops: LONG64,
13    MaxBandwidth: LONG64,
14    ReservationIops: LONG64,
15    VolumeName: PCWSTR,
16    BaseIoSize: ULONG,
17    ControlFlags: ULONG,
18}}
19extern "system" {
20    pub fn CreateJobObjectW(
21        lpJobAttributes: LPSECURITY_ATTRIBUTES,
22        lpName: LPCWSTR,
23    ) -> HANDLE;
24    pub fn FreeMemoryJobObject(
25        Buffer: *mut VOID,
26    ) -> ();
27    pub fn OpenJobObjectW(
28        dwDesiredAccess: DWORD,
29        bInheritHandle: BOOL,
30        lpName: LPCWSTR,
31    ) -> HANDLE;
32    pub fn AssignProcessToJobObject(
33        hJob: HANDLE,
34        hProcess: HANDLE,
35    ) -> BOOL;
36    pub fn TerminateJobObject(
37        hJob: HANDLE,
38        uExitCode: UINT,
39    ) -> BOOL;
40    pub fn SetInformationJobObject(
41        hJob: HANDLE,
42        JobObjectInformationClass: JOBOBJECTINFOCLASS,
43        lpJobObjectInformation: LPVOID,
44        cbJovObjectInformationLength: DWORD,
45    ) -> BOOL;
46    pub fn SetIoRateControlInformationJobObject(
47        hJob: HANDLE,
48        IoRateControlInfo: *mut JOBOBJECT_IO_RATE_CONTROL_INFORMATION,
49    ) -> DWORD;
50    pub fn QueryInformationJobObject(
51        hJob: HANDLE,
52        JobObjectInformationClass: JOBOBJECTINFOCLASS,
53        lpJobObjectInformation: LPVOID,
54        cbJovObjectInformationLength: DWORD,
55        lpReturnLength: LPDWORD,
56    ) -> BOOL;
57    pub fn QueryIoRateControlInformationJobObject(
58        hJob: HANDLE,
59        VolumeName: PCWSTR,
60        InfoBlocks: *mut *mut JOBOBJECT_IO_RATE_CONTROL_INFORMATION,
61        InfoBlockCount: *mut ULONG,
62    ) -> DWORD;
63}