Added uptime functionality

This commit is contained in:
lin committed 2026-10-05 22:12:10 +02:00
1 parent 403b621478
commit 6430e5ddca
5 files changed
+125 -2

No files matched your search

+6
View File
@@ -21,16 +21,22 @@ type WindowsSystemCheckTools struct {
* Windows processor information
*/
SystemTimes *windows.LazyProc
/*
* Windows uptime metrics
*/
Uptime *windows.LazyProc
}
func GetWindowsTools() WindowsSystemCheckTools {
kernel32 := sync.OnceValue(func() *windows.LazyDLL { return windows.NewLazySystemDLL("kernel32.dll") })
procGlobalMemoryStatusEx := sync.OnceValue(func() *windows.LazyProc { return kernel32().NewProc("GlobalMemoryStatusEx") })
systemTimes := sync.OnceValue(func() *windows.LazyProc { return kernel32().NewProc("GetSystemTimes") })
uptime := sync.OnceValue(func() *windows.LazyProc { return kernel32().NewProc("GetTickCount64") })
return WindowsSystemCheckTools{
Kernel32: kernel32(),
ProcGlobalMemoryStatusEx: procGlobalMemoryStatusEx(),
SystemTimes: systemTimes(),
Uptime: uptime(),
}
}