mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-21 12:35:33 +03:00
1d6d85cff4
Squashed commit of the following: commit586b0eb180
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Nov 12 19:58:56 2024 +0300 next: upd more commitd729aa150f
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Tue Nov 12 16:53:15 2024 +0300 next/websvc: upd more commit0c64e6cfc6
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Mon Nov 11 21:08:51 2024 +0300 next: upd more commit05eec75222
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 8 19:20:02 2024 +0300 next: upd code
42 lines
747 B
Go
42 lines
747 B
Go
//go:build windows
|
|
|
|
package aghos
|
|
|
|
import (
|
|
"os"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func setRlimit(_ uint64) (err error) {
|
|
return Unsupported("setrlimit")
|
|
}
|
|
|
|
func haveAdminRights() (bool, error) {
|
|
var token windows.Token
|
|
h := windows.CurrentProcess()
|
|
err := windows.OpenProcessToken(h, windows.TOKEN_QUERY, &token)
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
|
|
info := make([]byte, 4)
|
|
var returnedLen uint32
|
|
err = windows.GetTokenInformation(token, windows.TokenElevation, &info[0], uint32(len(info)), &returnedLen)
|
|
token.Close()
|
|
if err != nil {
|
|
return false, err
|
|
}
|
|
if info[0] == 0 {
|
|
return false, nil
|
|
}
|
|
return true, nil
|
|
}
|
|
|
|
func isOpenWrt() (ok bool) {
|
|
return false
|
|
}
|
|
|
|
func sendShutdownSignal(c chan<- os.Signal) {
|
|
c <- os.Interrupt
|
|
}
|