From ca7f33d4116e3a1f9425755d6a44e7ed9b4c97df Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 6 May 2019 11:56:55 +0200 Subject: [PATCH] windows: CreateFile's templatefile parameter has always been a HANDLE This fixes a bug in the declaration. The documentation involving this parameter is at: https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-createfilew Change-Id: I650c54b3110d29921627b08d47be4fa41d60bbf4 Reviewed-on: https://go-review.googlesource.com/c/sys/+/175159 Run-TryBot: Jason Donenfeld TryBot-Result: Gobot Gobot Reviewed-by: Benny Siegert --- windows/syscall_windows.go | 2 +- windows/zsyscall_windows.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/windows/syscall_windows.go b/windows/syscall_windows.go index f4d19644..1eb69a14 100644 --- a/windows/syscall_windows.go +++ b/windows/syscall_windows.go @@ -134,7 +134,7 @@ func NewCallbackCDecl(fn interface{}) uintptr { //sys GetVersion() (ver uint32, err error) //sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW //sys ExitProcess(exitcode uint32) -//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW +//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW //sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) //sys GetOverlappedResult(handle Handle, overlapped *Overlapped, done *uint32, wait bool) (err error) diff --git a/windows/zsyscall_windows.go b/windows/zsyscall_windows.go index 7060f434..8bbd0cce 100644 --- a/windows/zsyscall_windows.go +++ b/windows/zsyscall_windows.go @@ -611,7 +611,7 @@ func ExitProcess(exitcode uint32) { return } -func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) { +func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile Handle) (handle Handle, err error) { r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) handle = Handle(r0) if handle == InvalidHandle {