2014-04-19 00:09:25 +09:00
|
|
|
// +build windows
|
|
|
|
|
2014-04-22 09:44:22 +09:00
|
|
|
package gopsutil
|
2014-04-19 00:09:25 +09:00
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2014-05-16 11:33:35 +09:00
|
|
|
"unsafe"
|
2014-04-19 00:09:25 +09:00
|
|
|
)
|
|
|
|
|
2014-04-20 01:53:00 +09:00
|
|
|
var (
|
2014-11-27 22:28:05 +09:00
|
|
|
Modkernel32 = syscall.NewLazyDLL("kernel32.dll")
|
|
|
|
ModNt = syscall.NewLazyDLL("ntdll.dll")
|
2014-04-28 01:15:29 +09:00
|
|
|
|
2014-11-27 22:28:05 +09:00
|
|
|
ProcGetSystemTimes = Modkernel32.NewProc("GetSystemTimes")
|
|
|
|
ProcNtQuerySystemInformation = ModNt.NewProc("NtQuerySystemInformation")
|
2014-04-20 01:53:00 +09:00
|
|
|
)
|
2014-04-22 22:10:13 +09:00
|
|
|
|
|
|
|
type FILETIME struct {
|
|
|
|
DwLowDateTime uint32
|
|
|
|
DwHighDateTime uint32
|
|
|
|
}
|
2014-05-16 11:33:35 +09:00
|
|
|
|
|
|
|
// borrowed from net/interface_windows.go
|
2014-11-27 10:18:15 +09:00
|
|
|
func BytePtrToString(p *uint8) string {
|
2014-05-16 11:33:35 +09:00
|
|
|
a := (*[10000]uint8)(unsafe.Pointer(p))
|
|
|
|
i := 0
|
|
|
|
for a[i] != 0 {
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
return string(a[:i])
|
|
|
|
}
|