shirou_gopsutil/common/common_windows.go

32 lines
574 B
Go
Raw Normal View History

// +build windows
2014-04-22 08:44:22 +08:00
package gopsutil
import (
"syscall"
2014-05-16 10:33:35 +08:00
"unsafe"
)
2014-04-20 00:53:00 +08:00
var (
modkernel32 = syscall.NewLazyDLL("kernel32.dll")
modNt = syscall.NewLazyDLL("ntdll.dll")
procGetSystemTimes = modkernel32.NewProc("GetSystemTimes")
procNtQuerySystemInformation = modNt.NewProc("NtQuerySystemInformation")
2014-04-20 00:53:00 +08:00
)
type FILETIME struct {
DwLowDateTime uint32
DwHighDateTime uint32
}
2014-05-16 10:33:35 +08:00
// borrowed from net/interface_windows.go
func BytePtrToString(p *uint8) string {
2014-05-16 10:33:35 +08:00
a := (*[10000]uint8)(unsafe.Pointer(p))
i := 0
for a[i] != 0 {
i++
}
return string(a[:i])
}