SyscallN.
This commit is contained in:
parent
5cde0b4fdb
commit
e256a51c4a
2 changed files with 11 additions and 15 deletions
|
@ -50,16 +50,12 @@ func (u *IUnknown) Release() {
|
||||||
|
|
||||||
//go:uintptrescapes
|
//go:uintptrescapes
|
||||||
func (u *IUnknown) call(trap uintptr, a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
func (u *IUnknown) call(trap uintptr, a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||||
switch nargs := uintptr(len(a)); nargs {
|
return unkcall(uintptr(unsafe.Pointer(u)), trap, a...)
|
||||||
case 0:
|
}
|
||||||
return syscall.Syscall(trap, nargs+1, uintptr(unsafe.Pointer(u)), 0, 0)
|
|
||||||
case 1:
|
//go:uintptrescapes
|
||||||
return syscall.Syscall(trap, nargs+1, uintptr(unsafe.Pointer(u)), a[0], 0)
|
func unkcall(self, trap uintptr, a ...uintptr) (r1, r2 uintptr, lastErr error) {
|
||||||
case 2:
|
return syscall.SyscallN(trap, append([]uintptr{self}, a...)...)
|
||||||
return syscall.Syscall(trap, nargs+1, uintptr(unsafe.Pointer(u)), a[0], a[1])
|
|
||||||
default:
|
|
||||||
panic("COM call with too many arguments.")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/wine-mirror/wine/blob/master/include/objidl.idl
|
// https://github.com/wine-mirror/wine/blob/master/include/objidl.idl
|
||||||
|
|
|
@ -271,7 +271,7 @@ func GetWindowText(wnd HWND) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func SendMessagePointer(wnd HWND, msg uint32, wparam uintptr, lparam unsafe.Pointer) (ret uintptr) {
|
func SendMessagePointer(wnd HWND, msg uint32, wparam uintptr, lparam unsafe.Pointer) (ret uintptr) {
|
||||||
r0, _, _ := syscall.Syscall6(procSendMessageW.Addr(), 4, uintptr(wnd), uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0)
|
r0, _, _ := syscall.SyscallN(procSendMessageW.Addr(), uintptr(wnd), uintptr(msg), uintptr(wparam), uintptr(lparam))
|
||||||
ret = uintptr(r0)
|
ret = uintptr(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -290,7 +290,7 @@ func MessageLoop(wnd HWND) error {
|
||||||
isDialogMessage := procIsDialogMessageW.Addr()
|
isDialogMessage := procIsDialogMessageW.Addr()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
s, _, err := syscall.Syscall6(getMessage, 4, uintptr(msg), 0, 0, 0, 0, 0)
|
s, _, err := syscall.SyscallN(getMessage, uintptr(msg), 0, 0, 0)
|
||||||
if int32(s) == -1 {
|
if int32(s) == -1 {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -298,10 +298,10 @@ func MessageLoop(wnd HWND) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
s, _, _ = syscall.Syscall(isDialogMessage, 2, uintptr(wnd), uintptr(msg), 0)
|
s, _, _ = syscall.SyscallN(isDialogMessage, uintptr(wnd), uintptr(msg))
|
||||||
if s == 0 {
|
if s == 0 {
|
||||||
syscall.Syscall(translateMessage, 1, uintptr(msg), 0, 0)
|
syscall.SyscallN(translateMessage, uintptr(msg))
|
||||||
syscall.Syscall(dispatchMessage, 1, uintptr(msg), 0, 0)
|
syscall.SyscallN(dispatchMessage, uintptr(msg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue