Syscall in Golang to dll lib

135 Views Asked by At

I can't bring the string to MZFanDll.dll in Goland and call func inside dll.

func main() {
    user32 := syscall.MustLoadDLL("MZFanDll.dll")
    messageBox := user32.MustFindProc("GET_OP_CALCULATION")
    text, _ := syscall.UTF16PtrFromString("ECF(K)6E192-PLHDAJ1;0;1.2;0;20;200;500")
    MB_OK := 0
    ret, _, _ := messageBox.Call(
        uintptr(0),
        uintptr(unsafe.Pointer(text)),
        uintptr(MB_OK))
    fmt.Printf("Returned: %d\n", ret)
}

When I run this code I'am getting panic

panic: Failed to load MZFanDll.dll: %1 is not a valid Win32 application.

Whats wrong? How to avoid the panic?

0

There are 0 best solutions below