From 0131e684e801af603bb75e5d7f959b32442f327a Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 13 Dec 2017 20:31:17 +0000 Subject: [PATCH] windows: make GetDriveType use GetDriveTypeW Fixes golang/go#23121 Change-Id: I71495b82a573e9f492a52dde325522a6203c06eb Reviewed-on: https://go-review.googlesource.com/83855 Reviewed-by: Alex Brainman Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- windows/syscall_windows.go | 2 +- windows/zsyscall_windows.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go index e0da2aa0..1e9f4bb4 100644 --- a/windows/syscall_windows.go +++ b/windows/syscall_windows.go @@ -248,7 +248,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) = FindNextVolumeMountPointW //sys FindVolumeClose(findVolume Handle) (err error) //sys FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) -//sys GetDriveType(rootPathName *uint16) (driveType uint32) +//sys GetDriveType(rootPathName *uint16) (driveType uint32) = GetDriveTypeW //sys GetLogicalDrives() (drivesBitMask uint32, err error) [failretval==0] //sys GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) [failretval==0] = GetLogicalDriveStringsW //sys GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationW diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index 6ad2c85b..c7b3b15e 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -186,7 +186,7 @@ var ( procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW") procFindVolumeClose = modkernel32.NewProc("FindVolumeClose") procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose") - procGetDriveType = modkernel32.NewProc("GetDriveType") + procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW") procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives") procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW") procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW") @@ -1962,7 +1962,7 @@ func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { } func GetDriveType(rootPathName *uint16) (driveType uint32) { - r0, _, _ := syscall.Syscall(procGetDriveType.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) + r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) driveType = uint32(r0) return }