Use windows.ByteSliceFromString for null-terminated drive path

This commit is contained in:
copilot-swe-agent[bot]
2026-07-07 09:43:30 +00:00
committed by GitHub
parent e27ed44f76
commit 1870a01df5

View File

@@ -45,7 +45,10 @@ func ResolveDrive(driveRoot string) string {
if !available {
return ""
}
driveBytes := append([]byte(driveRoot), 0)
driveBytes, err := windows.ByteSliceFromString(driveRoot)
if err != nil {
return ""
}
ret, _, _ := procResolve.Call(uintptr(unsafe.Pointer(&driveBytes[0])))
if ret == 0 {
return ""