Add function for setting privileges globally

Also optimize privilege setting with the same privilege name multiple
times.
This commit is contained in:
John Starks
2016-05-12 21:33:03 -07:00
parent 3b8b3c98b2
commit f1a78c8aaf
2 changed files with 68 additions and 23 deletions
+8 -4
View File
@@ -2,8 +2,12 @@
package winio
import "unsafe"
import "syscall"
import (
"syscall"
"unsafe"
"golang.org/x/sys/windows"
)
var _ unsafe.Pointer
@@ -300,7 +304,7 @@ func setFileInformationByHandle(h syscall.Handle, class uint32, buffer *byte, si
return
}
func adjustTokenPrivileges(token syscall.Handle, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) {
func adjustTokenPrivileges(token windows.Token, releaseAll bool, input *byte, outputSize uint32, output *byte, requiredSize *uint32) (success bool, err error) {
var _p0 uint32
if releaseAll {
_p0 = 1
@@ -343,7 +347,7 @@ func revertToSelf() (err error) {
return
}
func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *syscall.Handle) (err error) {
func openThreadToken(thread syscall.Handle, accessMask uint32, openAsSelf bool, token *windows.Token) (err error) {
var _p0 uint32
if openAsSelf {
_p0 = 1