// mksyscall_mingw.sh -l32 syscall_mingw.go syscall_mingw_386.go // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT package syscall import "unsafe" var ( modKERNEL32 = loadDll("kernel32.dll") procGetLastError = getSysProcAddr(modKERNEL32, "GetLastError") procLoadLibraryW = getSysProcAddr(modKERNEL32, "LoadLibraryW") procFreeLibrary = getSysProcAddr(modKERNEL32, "FreeLibrary") procGetProcAddress = getSysProcAddr(modKERNEL32, "GetProcAddress") procGetVersion = getSysProcAddr(modKERNEL32, "GetVersion") procFormatMessageW = getSysProcAddr(modKERNEL32, "FormatMessageW") ) func GetLastError() (lasterrno int) { r0, _, _ := Syscall(procGetLastError, 0, 0, 0) lasterrno = int(r0) return } func LoadLibrary(libname string) (handle uint32, errno int) { r0, _, e1 := Syscall(procLoadLibraryW, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0) handle = uint32(r0) if uint32(r0) == 0 { errno = int(e1) } else { errno = 0 } return } func FreeLibrary(handle uint32) (ok bool, errno int) { r0, _, e1 := Syscall(procFreeLibrary, uintptr(handle), 0, 0) ok = bool(r0 != 0) if uint32(r0) == 0 { errno = int(e1) } else { errno = 0 } return } func GetProcAddress(module uint32, procname string) (proc uint32, errno int) { r0, _, e1 := Syscall(procGetProcAddress, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0) proc = uint32(r0) if uint32(r0) == 0 { errno = int(e1) } else { errno = 0 } return } func GetVersion() (ver uint32, errno int) { r0, _, e1 := Syscall(procGetVersion, 0, 0, 0) ver = uint32(r0) if uint32(r0) == 0 { errno = int(e1) } else { errno = 0 } return } func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, errno int) { var _p0 *uint16 if len(buf) > 0 { _p0 = &buf[0] } r0, _, e1 := Syscall9(procFormatMessageW, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) n = uint32(r0) if uint32(r0) == 0 { errno = int(e1) } else { errno = 0 } return }