Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: LoadDLL() bad error formatting on Windows #12293

Closed
ip opened this issue Aug 24, 2015 · 2 comments
Closed

syscall: LoadDLL() bad error formatting on Windows #12293

ip opened this issue Aug 24, 2015 · 2 comments

Comments

@ip
Copy link

@ip ip commented Aug 24, 2015

This is a tiny issue. I use Windows 7 x64. How to reproduce:
echo > corrupted.dll
Create main.go:

package main

import (
    "syscall"
    "fmt"
)

func main() {
    _, err := syscall.LoadDLL("./corrupted.dll")
    if err != nil {
        fmt.Println(err)
    }
}

It writes: Failed to load ./corrupted.dll: %1 is not a valid Win32 application.

Probably there are more similar errors in other places.

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Aug 24, 2015
@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented Aug 25, 2015

Windows returns you ERROR_BAD_EXE_FORMAT. The error message for it (https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx) is "%1 is not a valid Win32 application.". So that is what Go prints.

It is unfortunate, but I don't see how we can improve this situation.

Alex

@ip
Copy link
Author

@ip ip commented Aug 25, 2015

Yes, sorry, I just wrote same program in C++ and got same output.

@golang golang locked and limited conversation to collaborators Aug 24, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.