-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathprocess_generated.go
362 lines (343 loc) · 16.8 KB
/
process_generated.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
// This file was autogenerated using go run mkcode.go -- process.go
// DO NOT EDIT.
package ntdll
import "unsafe"
// The ProcessInformationClass constants have been derived from the PROCESS_INFORMATION_CLASS enum definition.
type ProcessInformationClass uint32
const (
ProcessBasicInformation ProcessInformationClass = 0
ProcessQuotaLimits = 1
ProcessIoCounters = 2
ProcessVmCounters = 3
ProcessTimes = 4
ProcessBasePriority = 5
ProcessRaisePriority = 6
ProcessDebugPort = 7
ProcessExceptionPort = 8
ProcessAccessToken = 9
ProcessLdtInformation = 10
ProcessLdtSize = 11
ProcessDefaultHardErrorMode = 12
ProcessIoPortHandlers = 13
ProcessPooledUsageAndLimits = 14
ProcessWorkingSetWatch = 15
ProcessUserModeIOPL = 16
ProcessEnableAlignmentFaultFixup = 17
ProcessPriorityClass = 18
ProcessWx86Information = 19
ProcessHandleCount = 20
ProcessAffinityMask = 21
ProcessPriorityBoost = 22
ProcessDeviceMap = 23
ProcessSessionInformation = 24
ProcessForegroundInformation = 25
ProcessWow64Information = 26
ProcessImageFileName = 27
ProcessLUIDDeviceMapsEnabled = 28
ProcessBreakOnTermination = 29
ProcessDebugObjectHandle = 30
ProcessDebugFlags = 31
ProcessHandleTracing = 32
ProcessIoPriority = 33
ProcessExecuteFlags = 34
ProcessTlsInformation = 35
ProcessCookie = 36
ProcessImageInformation = 37
ProcessCycleTime = 38
ProcessPagePriority = 39
ProcessInstrumentationCallback = 40
ProcessThreadStackAllocation = 41
ProcessWorkingSetWatchEx = 42
ProcessImageFileNameWin32 = 43
ProcessImageFileMapping = 44
ProcessAffinityUpdateMode = 45
ProcessMemoryAllocationMode = 46
ProcessGroupInformation = 47
ProcessTokenVirtualizationEnabled = 48
ProcessConsoleHostProcess = 49
ProcessWindowInformation = 50
ProcessHandleInformation = 51
ProcessMitigationPolicy = 52
ProcessDynamicFunctionTableInformation = 53
ProcessHandleCheckingMode = 54
ProcessKeepAliveCount = 55
ProcessRevokeFileHandles = 56
ProcessWorkingSetControl = 57
ProcessHandleTable = 58
ProcessCheckStackExtentsMode = 59
ProcessCommandLineInformation = 60
ProcessProtectionInformation = 61
ProcessMemoryExhaustion = 62
ProcessFaultInformation = 63
ProcessTelemetryIdInformation = 64
ProcessCommitReleaseInformation = 65
ProcessDefaultCpuSetsInformation = 66
ProcessAllowedCpuSetsInformation = 67
ProcessSubsystemProcess = 68
ProcessJobMemoryInformation = 69
ProcessInPrivate = 70
ProcessRaiseUMExceptionOnInvalidHandleClose = 71
ProcessIumChallengeResponse = 72
ProcessChildProcessInformation = 73
ProcessHighGraphicsPriorityInformation = 74
ProcessSubsystemInformation = 75
ProcessEnergyValues = 76
ProcessPowerThrottlingState = 77
ProcessReserved3Information = 78
ProcessWin32kSyscallFilterInformation = 79
ProcessDisableSystemAllowedCpuSets = 80
ProcessWakeInformation = 81
ProcessEnergyTrackingState = 82
ProcessManageWritesToExecutableMemory = 83
ProcessCaptureTrustletLiveDump = 84
ProcessTelemetryCoverage = 85
ProcessEnclaveInformation = 86
ProcessEnableReadWriteVmLogging = 87
ProcessUptimeInformation = 88
ProcessImageSection = 89
ProcessDebugAuthInformation = 90
ProcessSystemResourceManagement = 91
ProcessSequenceNumber = 92
ProcessLoaderDetour = 93
ProcessSecurityDomainInformation = 94
ProcessCombineSecurityDomainsInformation = 95
ProcessEnableLogging = 96
ProcessLeapSecondInformation = 97
ProcessFiberShadowStackAllocation = 98
ProcessFreeFiberShadowStackAllocation = 99
ProcessAltSystemCallInformation = 100
ProcessDynamicEHContinuationTargets = 101
ProcessDynamicEnforcedCetCompatibleRanges = 102
ProcessCreateStateChange = 103
ProcessApplyStateChange = 104
ProcessEnableOptionalXStateFeatures = 105
ProcessAltPrefetchParam = 106
ProcessAssignCpuPartitions = 107
ProcessPriorityClassEx = 108
ProcessMembershipInformation = 109
ProcessEffectiveIoPriority = 110
ProcessEffectivePagePriority = 111
)
// The ThreadInformationClass constants have been derived from the THREAD_INFORMATION_CLASS enum definition.
type ThreadInformationClass uint32
const (
ThreadBasicInformation ThreadInformationClass = 0
ThreadTimes = 1
ThreadPriority = 2
ThreadBasePriority = 3
ThreadAffinityMask = 4
ThreadImpersonationToken = 5
ThreadDescriptorTableEntry = 6
ThreadEnableAlignmentFaultFixup = 7
ThreadEventPair_Reusable = 8
ThreadQuerySetWin32StartAddress = 9
ThreadZeroTlsCell = 10
ThreadPerformanceCount = 11
ThreadAmILastThread = 12
ThreadIdealProcessor = 13
ThreadPriorityBoost = 14
ThreadSetTlsArrayAddress = 15
ThreadIsIoPending = 16
ThreadHideFromDebugger = 17
ThreadBreakOnTermination = 18
ThreadSwitchLegacyState = 19
ThreadIsTerminated = 20
ThreadLastSystemCall = 21
ThreadIoPriority = 22
ThreadCycleTime = 23
ThreadPagePriority = 24
ThreadActualBasePriority = 25
ThreadTebInformation = 26
ThreadCSwitchMon = 27
ThreadCSwitchPmu = 28
ThreadWow64Context = 29
ThreadGroupInformation = 30
ThreadUmsInformation = 31
ThreadCounterProfiling = 32
ThreadIdealProcessorEx = 33
MaxThreadInfoClass = 34
)
var (
procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess")
procNtOpenProcess = modntdll.NewProc("NtOpenProcess")
procNtOpenThread = modntdll.NewProc("NtOpenThread")
procNtQueryInformationThread = modntdll.NewProc("NtQueryInformationThread")
procNtSetInformationThread = modntdll.NewProc("NtSetInformationThread")
procNtSetInformationProcess = modntdll.NewProc("NtSetInformationProcess")
procNtCreateProcess = modntdll.NewProc("NtCreateProcess")
procNtCreateProcessEx = modntdll.NewProc("NtCreateProcessEx")
)
// Peb has been derived from the PEB struct definition.
type Peb struct {
Reserved1 [2]byte
BeingDebugged byte
Reserved2 [1]byte
Reserved3 [2]*byte
Ldr *PebLdrData
ProcessParameters *RtlUserProcessParameters
Reserved4 [3]*byte
AtlThunkSListPtr *byte
Reserved5 *byte
Reserved6 uint32
Reserved7 *byte
Reserved8 uint32
AtlThunkSListPtr32 uint32
Reserved9 [45]*byte
Reserved10 [96]byte
PostProcessInitRoutine *PsPostProcessInitRoutine
Reserved11 [128]byte
Reserved12 [1]*byte
SessionId uint32
}
// PebLdrData has been derived from the PEB_LDR_DATA struct definition.
type PebLdrData struct {
Reserved1 [8]byte
Reserved2 [3]*byte
InMemoryOrderModuleList ListEntry
}
// RtlUserProcessParameters has been derived from the RTL_USER_PROCESS_PARAMETERS struct definition.
type RtlUserProcessParameters struct {
Reserved1 [16]byte
Reserved2 [10]*byte
ImagePathName UnicodeString
CommandLine UnicodeString
}
// ProcessBasicInformationT has been derived from the PROCESS_BASIC_INFORMATION struct definition.
type ProcessBasicInformationT struct {
ExitStatus NtStatus
PebBaseAddress *Peb
AffinityMask *uint32
BasePriority Kpriority
UniqueProcessId Handle
InheritedFromUniqueProcessId Handle
}
// unknown-parameter: ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength, ReturnLength.
func NtQueryInformationProcess(
ProcessHandle Handle,
ProcessInformationClass ProcessInformationClass,
ProcessInformation *byte,
ProcessInformationLength uint32,
ReturnLength *uint32,
) NtStatus {
r0, _, _ := procNtQueryInformationProcess.Call(uintptr(ProcessHandle),
uintptr(ProcessInformationClass),
uintptr(unsafe.Pointer(ProcessInformation)),
uintptr(ProcessInformationLength),
uintptr(unsafe.Pointer(ReturnLength)))
return NtStatus(r0)
}
// OUT-parameter: ProcessHandle.
// *OPT-parameter: ClientId.
func NtOpenProcess(
ProcessHandle *Handle,
DesiredAccess AccessMask,
ObjectAttributes *ObjectAttributes,
ClientId *ClientId,
) NtStatus {
r0, _, _ := procNtOpenProcess.Call(uintptr(unsafe.Pointer(ProcessHandle)),
uintptr(DesiredAccess),
uintptr(unsafe.Pointer(ObjectAttributes)),
uintptr(unsafe.Pointer(ClientId)))
return NtStatus(r0)
}
// OUT-parameter: ThreadHandle.
// *OPT-parameter: ClientId.
func NtOpenThread(
ThreadHandle *Handle,
DesiredAccess AccessMask,
ObjectAttributes *ObjectAttributes,
ClientId *ClientId,
) NtStatus {
r0, _, _ := procNtOpenThread.Call(uintptr(unsafe.Pointer(ThreadHandle)),
uintptr(DesiredAccess),
uintptr(unsafe.Pointer(ObjectAttributes)),
uintptr(unsafe.Pointer(ClientId)))
return NtStatus(r0)
}
// unknown-parameter: ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength, ReturnLength.
func NtQueryInformationThread(
ThreadHandle Handle,
ThreadInformationClass ThreadInformationClass,
ThreadInformation *byte,
ThreadInformationLength uint32,
ReturnLength *uint32,
) NtStatus {
r0, _, _ := procNtQueryInformationThread.Call(uintptr(ThreadHandle),
uintptr(ThreadInformationClass),
uintptr(unsafe.Pointer(ThreadInformation)),
uintptr(ThreadInformationLength),
uintptr(unsafe.Pointer(ReturnLength)))
return NtStatus(r0)
}
// unknown-parameter: ThreadHandle, ThreadInformationClass, ThreadInformation, ThreadInformationLength.
func NtSetInformationThread(
ThreadHandle Handle,
ThreadInformationClass ThreadInformationClass,
ThreadInformation *byte,
ThreadInformationLength uint32,
) NtStatus {
r0, _, _ := procNtSetInformationThread.Call(uintptr(ThreadHandle),
uintptr(ThreadInformationClass),
uintptr(unsafe.Pointer(ThreadInformation)),
uintptr(ThreadInformationLength))
return NtStatus(r0)
}
// unknown-parameter: ProcessHandle, ProcessInformationClass, ProcessInformation, ProcessInformationLength.
func NtSetInformationProcess(
ProcessHandle Handle,
ProcessInformationClass ProcessInformationClass,
ProcessInformation *byte,
ProcessInformationLength uint32,
) NtStatus {
r0, _, _ := procNtSetInformationProcess.Call(uintptr(ProcessHandle),
uintptr(ProcessInformationClass),
uintptr(unsafe.Pointer(ProcessInformation)),
uintptr(ProcessInformationLength))
return NtStatus(r0)
}
// OUT-parameter: ProcessHandle.
// *OPT-parameter: ObjectAttributes, SectionHandle, DebugPort, TokenHandle.
func NtCreateProcess(
ProcessHandle *Handle,
DesiredAccess AccessMask,
ObjectAttributes *ObjectAttributes,
ParentProcess Handle,
InheritObjectTable bool,
SectionHandle Handle,
DebugPort Handle,
TokenHandle Handle,
) NtStatus {
r0, _, _ := procNtCreateProcess.Call(uintptr(unsafe.Pointer(ProcessHandle)),
uintptr(DesiredAccess),
uintptr(unsafe.Pointer(ObjectAttributes)),
uintptr(ParentProcess),
fromBool(InheritObjectTable),
uintptr(SectionHandle),
uintptr(DebugPort),
uintptr(TokenHandle))
return NtStatus(r0)
}
// OUT-parameter: ProcessHandle.
// *OPT-parameter: ObjectAttributes, SectionHandle, DebugPort, ExceptionPort.
func NtCreateProcessEx(
ProcessHandle *Handle,
DesiredAccess AccessMask,
ObjectAttributes *ObjectAttributes,
ParentProcess Handle,
Flags uint32,
SectionHandle Handle,
DebugPort Handle,
ExceptionPort Handle,
InJob bool,
) NtStatus {
r0, _, _ := procNtCreateProcessEx.Call(uintptr(unsafe.Pointer(ProcessHandle)),
uintptr(DesiredAccess),
uintptr(unsafe.Pointer(ObjectAttributes)),
uintptr(ParentProcess),
uintptr(Flags),
uintptr(SectionHandle),
uintptr(DebugPort),
uintptr(ExceptionPort),
fromBool(InJob))
return NtStatus(r0)
}