zenity
zenity copied to clipboard
When I call the SelectFile method, it occasionally reports: Incorrect function
func OpenDir() (string, error) {
path, err := zenity.SelectFile(zenity.Directory())
if zenity.ErrCanceled == err {
log.Info("the cancel button is pressed")
return "", fmt.Errorf("the cancel button is pressed")
} else if err != nil {
log.Error("Exception:", err)
return "", err //it occasionally reports: Incorrect function
}
return path, err
}
The code runs on the Windows platform.
I don't have a windows machine handy.
If you can pinpoint which Windows API is returning ERROR_INVALID_FUNCTION it would be extremely helpful.
If this is something easily reproducible, that would mean adding logs to every return err in this file and seeing which one is being tripped.
I found out which method caused the error. The issue occurred in the CoInitializeEx method within the ole32.go file.
func CoInitializeEx(reserved uintptr, coInit uint32) error {
return windows.CoInitializeEx(reserved, coInit)
}
The bug has been fixed in the new version.