Skip to content

Commit 42671b4

Browse files
authored
Update JOB_OBJECT_ALL_ACCESS and OpenJobObject (#2095)
Update `JOB_OBJECT_ALL_ACCESS` value to the most recent one. Update `winapi.OpenJobObject` to accept `inheritHandle` as `bool`. The underlying syscall stays the same, but this allows cleaner calls from go's perspective as it avoids `bool` to `uint32` casting. Signed-off-by: Maksim An <[email protected]>
1 parent 71270a3 commit 42671b4

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

internal/jobobject/jobobject.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func Open(ctx context.Context, options *Options) (_ *JobObject, err error) {
188188
return nil, winapi.RtlNtStatusToDosError(status)
189189
}
190190
} else {
191-
jobHandle, err = winapi.OpenJobObject(winapi.JOB_OBJECT_ALL_ACCESS, 0, unicodeJobName.Buffer)
191+
jobHandle, err = winapi.OpenJobObject(winapi.JOB_OBJECT_ALL_ACCESS, false, unicodeJobName.Buffer)
192192
if err != nil {
193193
return nil, err
194194
}

internal/winapi/jobobject.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const (
2828
// https://docs.microsoft.com/en-us/windows/win32/procthread/job-object-security-and-access-rights
2929
const (
3030
JOB_OBJECT_QUERY = 0x0004
31-
JOB_OBJECT_ALL_ACCESS = 0x1F001F
31+
JOB_OBJECT_ALL_ACCESS = 0x1F003F
3232
)
3333

3434
// IO limit flags
@@ -199,7 +199,7 @@ type SILOOBJECT_BASIC_INFORMATION struct {
199199
// LPCWSTR lpName
200200
// );
201201
//
202-
//sys OpenJobObject(desiredAccess uint32, inheritHandle int32, lpName *uint16) (handle windows.Handle, err error) = kernel32.OpenJobObjectW
202+
//sys OpenJobObject(desiredAccess uint32, inheritHandle bool, lpName *uint16) (handle windows.Handle, err error) = kernel32.OpenJobObjectW
203203

204204
// DWORD SetIoRateControlInformationJobObject(
205205
// HANDLE hJob,

internal/winapi/zsyscall_windows.go

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)