aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/service_manager.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-05-13 11:32:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-05-13 14:21:38 +0200
commit8adbb0d5125a13121257d545bc5def0b3b17b488 (patch)
treeb5e24df4ae181df9912fa7a0f77c176fff4b4a3f /service/service_manager.go
parentui: show taskbar progress (diff)
downloadwireguard-windows-8adbb0d5125a13121257d545bc5def0b3b17b488.tar.xz
wireguard-windows-8adbb0d5125a13121257d545bc5def0b3b17b488.zip
service: use more standard naming scheme for syscalls
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'service/service_manager.go')
-rw-r--r--service/service_manager.go40
1 files changed, 20 insertions, 20 deletions
diff --git a/service/service_manager.go b/service/service_manager.go
index 92508215..a3642712 100644
--- a/service/service_manager.go
+++ b/service/service_manager.go
@@ -219,27 +219,27 @@ func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest
go checkForUpdates()
- var sessionsPointer *wtsSessionInfo
+ var sessionsPointer *WTS_SESSION_INFO
var count uint32
err = wtsEnumerateSessions(0, 0, 1, &sessionsPointer, &count)
if err != nil {
serviceError = ErrorEnumerateSessions
return
}
- sessions := *(*[]wtsSessionInfo)(unsafe.Pointer(&struct {
- addr *wtsSessionInfo
+ sessions := *(*[]WTS_SESSION_INFO)(unsafe.Pointer(&struct {
+ addr *WTS_SESSION_INFO
len int
cap int
}{sessionsPointer, int(count), int(count)}))
for _, session := range sessions {
- if session.state != wtsActive {
+ if session.State != WTSActive {
continue
}
procsLock.Lock()
- if alive := aliveSessions[session.sessionID]; !alive {
- aliveSessions[session.sessionID] = true
- if _, ok := procs[session.sessionID]; !ok {
- go startProcess(session.sessionID)
+ if alive := aliveSessions[session.SessionID]; !alive {
+ aliveSessions[session.SessionID] = true
+ if _, ok := procs[session.SessionID]; !ok {
+ go startProcess(session.SessionID)
}
}
procsLock.Unlock()
@@ -262,27 +262,27 @@ loop:
case svc.Interrogate:
changes <- c.CurrentStatus
case svc.SessionChange:
- if c.EventType != wtsSessionLogon && c.EventType != wtsSessionLogoff {
+ if c.EventType != WTS_SESSION_LOGON && c.EventType != WTS_SESSION_LOGOFF {
continue
}
- sessionNotification := (*wtsSessionNotification)(unsafe.Pointer(c.EventData))
- if uintptr(sessionNotification.size) != unsafe.Sizeof(*sessionNotification) {
- log.Printf("Unexpected size of WTSSESSION_NOTIFICATION: %d", sessionNotification.size)
+ sessionNotification := (*WTS_SESSION_NOTIFICATION)(unsafe.Pointer(c.EventData))
+ if uintptr(sessionNotification.Size) != unsafe.Sizeof(*sessionNotification) {
+ log.Printf("Unexpected size of WTS_SESSION_NOTIFICATION: %d", sessionNotification.Size)
continue
}
- if c.EventType == wtsSessionLogoff {
+ if c.EventType == WTS_SESSION_LOGOFF {
procsLock.Lock()
- delete(aliveSessions, sessionNotification.sessionID)
- if proc, ok := procs[sessionNotification.sessionID]; ok {
+ delete(aliveSessions, sessionNotification.SessionID)
+ if proc, ok := procs[sessionNotification.SessionID]; ok {
proc.Kill()
}
procsLock.Unlock()
- } else if c.EventType == wtsSessionLogon {
+ } else if c.EventType == WTS_SESSION_LOGON {
procsLock.Lock()
- if alive := aliveSessions[sessionNotification.sessionID]; !alive {
- aliveSessions[sessionNotification.sessionID] = true
- if _, ok := procs[sessionNotification.sessionID]; !ok {
- go startProcess(sessionNotification.sessionID)
+ if alive := aliveSessions[sessionNotification.SessionID]; !alive {
+ aliveSessions[sessionNotification.SessionID] = true
+ if _, ok := procs[sessionNotification.SessionID]; !ok {
+ go startProcess(sessionNotification.SessionID)
}
}
procsLock.Unlock()