|
|
@@ -224,6 +224,7 @@ var (
|
|
|
procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW")
|
|
|
procFindVolumeClose = modkernel32.NewProc("FindVolumeClose")
|
|
|
procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose")
|
|
|
+ procGetDiskFreeSpaceExW = modkernel32.NewProc("GetDiskFreeSpaceExW")
|
|
|
procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW")
|
|
|
procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives")
|
|
|
procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW")
|
|
|
@@ -2503,6 +2504,18 @@ func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetDiskFreeSpaceEx(directoryName *uint16, freeBytesAvailableToCaller *uint64, totalNumberOfBytes *uint64, totalNumberOfFreeBytes *uint64) (err error) {
|
|
|
+ r1, _, e1 := syscall.Syscall6(procGetDiskFreeSpaceExW.Addr(), 4, uintptr(unsafe.Pointer(directoryName)), uintptr(unsafe.Pointer(freeBytesAvailableToCaller)), uintptr(unsafe.Pointer(totalNumberOfBytes)), uintptr(unsafe.Pointer(totalNumberOfFreeBytes)), 0, 0)
|
|
|
+ if r1 == 0 {
|
|
|
+ if e1 != 0 {
|
|
|
+ err = errnoErr(e1)
|
|
|
+ } else {
|
|
|
+ err = syscall.EINVAL
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetDriveType(rootPathName *uint16) (driveType uint32) {
|
|
|
r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0)
|
|
|
driveType = uint32(r0)
|