diff --git a/client/fingerprint/storage_windows.go b/client/fingerprint/storage_windows.go index 457b09b58..716f1baf0 100644 --- a/client/fingerprint/storage_windows.go +++ b/client/fingerprint/storage_windows.go @@ -6,7 +6,7 @@ import ( "syscall" ) -//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zstorage_windows.generated.go storage_windows.go +//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zstorage_windows.go storage_windows.go //sys getDiskFreeSpaceEx(dirName *uint16, availableFreeBytes *uint64, totalBytes *uint64, totalFreeBytes *uint64) (err error) = kernel32.GetDiskFreeSpaceExW diff --git a/client/fingerprint/zstorage_windows.go b/client/fingerprint/zstorage_windows.go new file mode 100644 index 000000000..52405b3f2 --- /dev/null +++ b/client/fingerprint/zstorage_windows.go @@ -0,0 +1,26 @@ +// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT + +package fingerprint + +import "unsafe" +import "syscall" + +var _ unsafe.Pointer + +var ( + modkernel32 = syscall.NewLazyDLL("kernel32.dll") + + procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW") +) + +func getDiskFreeSpaceEx(dirName *uint16, availableFreeBytes *uint64, totalBytes *uint64, totalFreeBytes *uint64) (err error) { + r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(dirName)), uintptr(unsafe.Pointer(availableFreeBytes)), uintptr(unsafe.Pointer(totalBytes)), uintptr(unsafe.Pointer(totalFreeBytes)), 0, 0) + if r1 == 0 { + if e1 != 0 { + err = error(e1) + } else { + err = syscall.EINVAL + } + } + return +}