mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 16:47:27 -04:00
windows: add SetInformationJobObject functions
This CL also adds some struct for the function. https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_jobobject_extended_limit_information https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_jobobject_basic_limit_information https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-_jobobject_basic_ui_restrictions https://docs.microsoft.com/en-us/windows/desktop/api/winnt/ns-winnt-io_counters Change-Id: Ie3b7570fc344a25ad2a39129b74434b8baa1eed9 Reviewed-on: https://go-review.googlesource.com/c/sys/+/179039 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> Run-TryBot: Alex Brainman <alex.brainman@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
committed by
Alex Brainman
parent
854af27f14
commit
cc920278c2
@@ -198,6 +198,7 @@ var (
|
||||
procResumeThread = modkernel32.NewProc("ResumeThread")
|
||||
procSetPriorityClass = modkernel32.NewProc("SetPriorityClass")
|
||||
procGetPriorityClass = modkernel32.NewProc("GetPriorityClass")
|
||||
procSetInformationJobObject = modkernel32.NewProc("SetInformationJobObject")
|
||||
procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW")
|
||||
procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW")
|
||||
procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW")
|
||||
@@ -2132,6 +2133,19 @@ func GetPriorityClass(process Handle) (ret uint32, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func SetInformationJobObject(job Handle, JobObjectInformationClass uint32, JobObjectInformation uintptr, JobObjectInformationLength uint32) (ret int, err error) {
|
||||
r0, _, e1 := syscall.Syscall6(procSetInformationJobObject.Addr(), 4, uintptr(job), uintptr(JobObjectInformationClass), uintptr(JobObjectInformation), uintptr(JobObjectInformationLength), 0, 0)
|
||||
ret = int(r0)
|
||||
if ret == 0 {
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
} else {
|
||||
err = syscall.EINVAL
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)))
|
||||
if r1 == 0 {
|
||||
|
||||
Reference in New Issue
Block a user