|
18 | 18 | package org.openqa.selenium.os; |
19 | 19 |
|
20 | 20 | import com.sun.jna.Native; |
21 | | -import com.sun.jna.Pointer; |
22 | | -import com.sun.jna.Structure; |
23 | | -import com.sun.jna.platform.win32.WinBase; |
24 | | -import com.sun.jna.platform.win32.WinNT; |
25 | 21 | import com.sun.jna.win32.W32APIOptions; |
26 | 22 |
|
27 | | -import java.util.Arrays; |
28 | | -import java.util.List; |
29 | | - |
30 | | -import org.openqa.selenium.Beta; |
31 | | - |
32 | | -@Beta |
33 | 23 | public interface Kernel32 extends com.sun.jna.platform.win32.Kernel32 { |
34 | 24 | Kernel32 INSTANCE = (Kernel32) Native.loadLibrary( |
35 | 25 | "kernel32", Kernel32.class, W32APIOptions.UNICODE_OPTIONS); |
36 | 26 |
|
37 | | - WinNT.HANDLE CreateJobObject(WinBase.SECURITY_ATTRIBUTES attrs, String name); |
38 | | - boolean SetInformationJobObject(HANDLE hJob, int JobObjectInfoClass, Pointer lpJobObjectInfo, int cbJobObjectInfoLength); |
39 | | - boolean AssignProcessToJobObject(HANDLE hJob, HANDLE hProcess); |
40 | | - boolean TerminateJobObject(HANDLE hJob, long uExitCode); |
41 | | - int ResumeThread(HANDLE hThread); |
42 | 27 | int GetProcessId(HANDLE Process); |
43 | 28 |
|
44 | | - // 0x00000800 |
45 | | - int JOB_OBJECT_LIMIT_BREAKAWAY_OK = 2048; |
46 | | - |
47 | | - // 0x00002000 |
48 | | - int JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 8192; |
49 | | - |
50 | | - // see SetInformationJobObject at msdn |
51 | | - int JobObjectExtendedLimitInformation = 9; |
52 | | - |
53 | | - // see SetInformationJobObject at msdn |
54 | | - int JobObjectBasicUIRestrictions = 4; |
55 | | - |
56 | | - // 0x00000020 |
57 | | - int JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x00000020; |
58 | | - |
59 | | - // 0x00000004 |
60 | | - int CREATE_SUSPENDED = 4; |
61 | | - |
62 | | - // 0x01000000 |
63 | | - int CREATE_BREAKAWAY_FROM_JOB = 16777216; |
64 | | - |
65 | | - static class JOBJECT_BASIC_LIMIT_INFORMATION extends Structure { |
66 | | - public LARGE_INTEGER PerProcessUserTimeLimit; |
67 | | - public LARGE_INTEGER PerJobUserTimeLimit; |
68 | | - public int LimitFlags; |
69 | | - public SIZE_T MinimumWorkingSetSize; |
70 | | - public SIZE_T MaximumWorkingSetSize; |
71 | | - public int ActiveProcessLimit; |
72 | | - public ULONG_PTR Affinity; |
73 | | - public int PriorityClass; |
74 | | - public int SchedulingClass; |
75 | | - |
76 | | - protected List<String> getFieldOrder() { |
77 | | - return Arrays.asList("PerProcessUserTimeLimit", "PerJobUserTimeLimit", "LimitFlags", |
78 | | - "MinimumWorkingSetSize", "MaximumWorkingSetSize", "ActiveProcessLimit", "Affinity", |
79 | | - "PriorityClass", "SchedulingClass"); |
80 | | - } |
81 | | - } |
82 | | - |
83 | | - static class IO_COUNTERS extends Structure { |
84 | | - public ULONGLONG ReadOperationCount; |
85 | | - public ULONGLONG WriteOperationCount; |
86 | | - public ULONGLONG OtherOperationCount; |
87 | | - public ULONGLONG ReadTransferCount; |
88 | | - public ULONGLONG WriteTransferCount; |
89 | | - public ULONGLONG OtherTransferCount; |
90 | | - |
91 | | - protected List<String> getFieldOrder() { |
92 | | - return Arrays.asList("ReadOperationCount", "WriteOperationCount", "OtherOperationCount", |
93 | | - "ReadTransferCount", "WriteTransferCount", "OtherTransferCount"); |
94 | | - } |
95 | | - } |
96 | | - |
97 | | - static class JOBJECT_EXTENDED_LIMIT_INFORMATION extends Structure { |
98 | | - public JOBJECT_EXTENDED_LIMIT_INFORMATION() {} |
99 | | - |
100 | | - public JOBJECT_EXTENDED_LIMIT_INFORMATION(Pointer memory) { |
101 | | - super(memory); |
102 | | - } |
103 | | - |
104 | | - public JOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; |
105 | | - public IO_COUNTERS IoInfo; |
106 | | - public SIZE_T ProcessMemoryLimit; |
107 | | - public SIZE_T JobMemoryLimit; |
108 | | - public SIZE_T PeakProcessMemoryUsed; |
109 | | - public SIZE_T PeakJobMemoryUsed; |
110 | | - |
111 | | - protected List<String> getFieldOrder() { |
112 | | - return Arrays.asList("BasicLimitInformation", "IoInfo", "ProcessMemoryLimit", |
113 | | - "JobMemoryLimit", "PeakProcessMemoryUsed", "PeakJobMemoryUsed"); |
114 | | - } |
115 | | - |
116 | | - public static class ByReference extends JOBJECT_EXTENDED_LIMIT_INFORMATION implements Structure.ByReference { |
117 | | - public ByReference() {} |
118 | | - |
119 | | - public ByReference(Pointer memory) { |
120 | | - super(memory); |
121 | | - } |
122 | | - } |
123 | | - } |
124 | | - |
125 | | - static class JOBOBJECT_BASIC_UI_RESTRICTIONS extends Structure { |
126 | | - public JOBOBJECT_BASIC_UI_RESTRICTIONS() {} |
127 | | - |
128 | | - public JOBOBJECT_BASIC_UI_RESTRICTIONS(Pointer memory) { |
129 | | - super(memory); |
130 | | - } |
131 | | - |
132 | | - public int UIRestrictionsClass; |
133 | | - |
134 | | - protected List<String> getFieldOrder() { |
135 | | - return Arrays.asList("UIRestrictionsClass"); |
136 | | - } |
137 | | - |
138 | | - public static class ByReference extends JOBOBJECT_BASIC_UI_RESTRICTIONS implements Structure.ByReference { |
139 | | - public ByReference() {} |
140 | | - |
141 | | - public ByReference(Pointer memory) { |
142 | | - super(memory); |
143 | | - } |
144 | | - } |
145 | | - } |
146 | | - |
147 | 29 | } |
0 commit comments