-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
security_generated.go
97 lines (86 loc) · 2.7 KB
/
security_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
// This file was autogenerated using go run mkcode.go -- security.go
// DO NOT EDIT.
package ntdll
import "unsafe"
import "reflect"
var (
procNtQuerySecurityObject = modntdll.NewProc("NtQuerySecurityObject")
procNtSetSecurityObject = modntdll.NewProc("NtSetSecurityObject")
)
// Acl has been derived from the ACL struct definition.
type Acl struct {
AclRevision byte
Sbz1 byte
AclSize uint16
AceCount uint16
Sbz2 uint16
}
// Sid has been derived from the SID struct definition.
type Sid struct {
Revision byte
SubAuthorityCount byte
IdentifierAuthority SidIdentifierAuthority
SubAuthority [1]uint32
}
// SubAuthoritySlice returns a slice over the elements of Sid.SubAuthority.
//
// Beware: The data is not copied out of Sid. The size can usually be taken from an other member of the struct (Sid).
func (t *Sid) SubAuthoritySlice(size int) []uint32 {
s := []uint32{}
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s))
hdr.Data = uintptr(unsafe.Pointer(&t.SubAuthority[0]))
hdr.Len = size
hdr.Cap = size
return s
}
// SetSubAuthoritySlice copies s into the memory at Sid.SubAuthority.
//
// Beware: No bounds check is performed. Another member of the struct (Sid) usually has to be set to the array size.
func (t *Sid) SetSubAuthoritySlice(s []uint32) {
s1 := []uint32{}
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s1))
hdr.Data = uintptr(unsafe.Pointer(&t.SubAuthority[0]))
hdr.Len = len(s)
hdr.Cap = len(s)
copy(s1, s)
}
// SidIdentifierAuthority has been derived from the SID_IDENTIFIER_AUTHORITY struct definition.
type SidIdentifierAuthority struct {
Value [6]byte
}
// SecurityDescriptor has been derived from the SECURITY_DESCRIPTOR struct definition.
type SecurityDescriptor struct {
Revision byte
Sbz1 byte
Control SecurityDescriptorControl
Owner *Sid
Group *Sid
Sacl *Acl
Dacl *Acl
}
// unknown-parameter: Handle, SecurityInformation, SecurityDescriptor, Length, LengthNeeded.
func NtQuerySecurityObject(
Handle Handle,
SecurityInformation SecurityInformationT,
SecurityDescriptor *SecurityDescriptor,
Length uint32,
LengthNeeded *uint32,
) NtStatus {
r0, _, _ := procNtQuerySecurityObject.Call(uintptr(Handle),
uintptr(SecurityInformation),
uintptr(unsafe.Pointer(SecurityDescriptor)),
uintptr(Length),
uintptr(unsafe.Pointer(LengthNeeded)))
return NtStatus(r0)
}
// unknown-parameter: Handle, SecurityInformation, SecurityDescriptor.
func NtSetSecurityObject(
Handle Handle,
SecurityInformation SecurityInformationT,
SecurityDescriptor *SecurityDescriptor,
) NtStatus {
r0, _, _ := procNtSetSecurityObject.Call(uintptr(Handle),
uintptr(SecurityInformation),
uintptr(unsafe.Pointer(SecurityDescriptor)))
return NtStatus(r0)
}