From 83d447139eb246f787f33215aa9edd54aa61b847 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 3 Feb 2021 23:57:23 +0100 Subject: Port to arm64 Updates: https://github.com/golang/go/issues/36439 Updates: https://github.com/golang/go/issues/44020 Signed-off-by: Jason A. Donenfeld --- oleacc_64.go | 86 -------------------------------------------------- oleacc_amd64.go | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ oleacc_arm64.go | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ oleaut32_64.go | 2 +- shobj_64.go | 2 +- 5 files changed, 186 insertions(+), 88 deletions(-) delete mode 100644 oleacc_64.go create mode 100644 oleacc_amd64.go create mode 100644 oleacc_arm64.go diff --git a/oleacc_64.go b/oleacc_64.go deleted file mode 100644 index 1a210b01..00000000 --- a/oleacc_64.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2010 The win Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows,amd64 - -package win - -import ( - "syscall" - "unsafe" -) - -// SetPropValue identifies the accessible element to be annotated, specify the property to be annotated, and provide a new value for that property. -// If server developers know the HWND of the accessible element they want to annotate, they can use one of the following methods: SetHwndPropStr, SetHwndProp, or SetHwndPropServer -func (obj *IAccPropServices) SetPropValue(idString []byte, idProp *MSAAPROPID, v *VARIANT) HRESULT { - var idStringPtr unsafe.Pointer - idStringLen := len(idString) - if idStringLen != 0 { - idStringPtr = unsafe.Pointer(&idString[0]) - } - ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetPropValue, 5, - uintptr(unsafe.Pointer(obj)), - uintptr(idStringPtr), - uintptr(idStringLen), - uintptr(unsafe.Pointer(idProp)), - uintptr(unsafe.Pointer(v)), - 0) - return HRESULT(ret) -} - -// SetHwndProp wraps SetPropValue, providing a convenient entry point for callers who are annotating HWND-based accessible elements. If the new value is a string, you can use SetHwndPropStr instead. -func (obj *IAccPropServices) SetHwndProp(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT { - ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHwndProp, 6, - uintptr(unsafe.Pointer(obj)), - uintptr(hwnd), - uintptr(idObject), - uintptr(idChild), - uintptr(unsafe.Pointer(idProp)), - uintptr(unsafe.Pointer(v))) - return HRESULT(ret) -} - -// SetHwndPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HWND-based accessible elements. -func (obj *IAccPropServices) SetHwndPropStr(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, str string) HRESULT { - str16, err := syscall.UTF16PtrFromString(str) - if err != nil { - return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1) - } - ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHwndPropStr, 6, - uintptr(unsafe.Pointer(obj)), - uintptr(hwnd), - uintptr(idObject), - uintptr(idChild), - uintptr(unsafe.Pointer(idProp)), - uintptr(unsafe.Pointer(str16))) - return HRESULT(ret) -} - -// SetHmenuProp wraps SetPropValue, providing a convenient entry point for callers who are annotating HMENU-based accessible elements. If the new value is a string, you can use IAccPropServices::SetHmenuPropStr instead. -func (obj *IAccPropServices) SetHmenuProp(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT { - ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuProp, 5, - uintptr(unsafe.Pointer(obj)), - uintptr(hmenu), - uintptr(idChild), - uintptr(unsafe.Pointer(idProp)), - uintptr(unsafe.Pointer(v)), - 0) - return HRESULT(ret) -} - -// SetHmenuPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HMENU-based accessible elements. -func (obj *IAccPropServices) SetHmenuPropStr(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, str string) HRESULT { - str16, err := syscall.UTF16PtrFromString(str) - if err != nil { - return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1) - } - ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuPropStr, 5, - uintptr(unsafe.Pointer(obj)), - uintptr(hmenu), - uintptr(idChild), - uintptr(unsafe.Pointer(idProp)), - uintptr(unsafe.Pointer(str16)), - 0) - return HRESULT(ret) -} diff --git a/oleacc_amd64.go b/oleacc_amd64.go new file mode 100644 index 00000000..1a210b01 --- /dev/null +++ b/oleacc_amd64.go @@ -0,0 +1,86 @@ +// Copyright 2010 The win Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build windows,amd64 + +package win + +import ( + "syscall" + "unsafe" +) + +// SetPropValue identifies the accessible element to be annotated, specify the property to be annotated, and provide a new value for that property. +// If server developers know the HWND of the accessible element they want to annotate, they can use one of the following methods: SetHwndPropStr, SetHwndProp, or SetHwndPropServer +func (obj *IAccPropServices) SetPropValue(idString []byte, idProp *MSAAPROPID, v *VARIANT) HRESULT { + var idStringPtr unsafe.Pointer + idStringLen := len(idString) + if idStringLen != 0 { + idStringPtr = unsafe.Pointer(&idString[0]) + } + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetPropValue, 5, + uintptr(unsafe.Pointer(obj)), + uintptr(idStringPtr), + uintptr(idStringLen), + uintptr(unsafe.Pointer(idProp)), + uintptr(unsafe.Pointer(v)), + 0) + return HRESULT(ret) +} + +// SetHwndProp wraps SetPropValue, providing a convenient entry point for callers who are annotating HWND-based accessible elements. If the new value is a string, you can use SetHwndPropStr instead. +func (obj *IAccPropServices) SetHwndProp(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT { + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHwndProp, 6, + uintptr(unsafe.Pointer(obj)), + uintptr(hwnd), + uintptr(idObject), + uintptr(idChild), + uintptr(unsafe.Pointer(idProp)), + uintptr(unsafe.Pointer(v))) + return HRESULT(ret) +} + +// SetHwndPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HWND-based accessible elements. +func (obj *IAccPropServices) SetHwndPropStr(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, str string) HRESULT { + str16, err := syscall.UTF16PtrFromString(str) + if err != nil { + return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1) + } + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHwndPropStr, 6, + uintptr(unsafe.Pointer(obj)), + uintptr(hwnd), + uintptr(idObject), + uintptr(idChild), + uintptr(unsafe.Pointer(idProp)), + uintptr(unsafe.Pointer(str16))) + return HRESULT(ret) +} + +// SetHmenuProp wraps SetPropValue, providing a convenient entry point for callers who are annotating HMENU-based accessible elements. If the new value is a string, you can use IAccPropServices::SetHmenuPropStr instead. +func (obj *IAccPropServices) SetHmenuProp(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT { + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuProp, 5, + uintptr(unsafe.Pointer(obj)), + uintptr(hmenu), + uintptr(idChild), + uintptr(unsafe.Pointer(idProp)), + uintptr(unsafe.Pointer(v)), + 0) + return HRESULT(ret) +} + +// SetHmenuPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HMENU-based accessible elements. +func (obj *IAccPropServices) SetHmenuPropStr(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, str string) HRESULT { + str16, err := syscall.UTF16PtrFromString(str) + if err != nil { + return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1) + } + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuPropStr, 5, + uintptr(unsafe.Pointer(obj)), + uintptr(hmenu), + uintptr(idChild), + uintptr(unsafe.Pointer(idProp)), + uintptr(unsafe.Pointer(str16)), + 0) + return HRESULT(ret) +} diff --git a/oleacc_arm64.go b/oleacc_arm64.go new file mode 100644 index 00000000..0b029e5a --- /dev/null +++ b/oleacc_arm64.go @@ -0,0 +1,98 @@ +// Copyright 2010 The win Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build windows,arm64 + +package win + +import ( + "syscall" + "unsafe" +) + +func (idProp *MSAAPROPID) split() (uintptr, uintptr) { + if idProp == nil { + return 0, 0 + } + x := (*struct { a, b uintptr })(unsafe.Pointer(idProp)) + return x.a, x.b +} + +// SetPropValue identifies the accessible element to be annotated, specify the property to be annotated, and provide a new value for that property. +// If server developers know the HWND of the accessible element they want to annotate, they can use one of the following methods: SetHwndPropStr, SetHwndProp, or SetHwndPropServer +func (obj *IAccPropServices) SetPropValue(idString []byte, idProp *MSAAPROPID, v *VARIANT) HRESULT { + var idStringPtr unsafe.Pointer + idStringLen := len(idString) + if idStringLen != 0 { + idStringPtr = unsafe.Pointer(&idString[0]) + } + propA, propB := idProp.split() + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetPropValue, 6, + uintptr(unsafe.Pointer(obj)), + uintptr(idStringPtr), + uintptr(idStringLen), + propA, propB, + uintptr(unsafe.Pointer(v))) + return HRESULT(ret) +} + +// SetHwndProp wraps SetPropValue, providing a convenient entry point for callers who are annotating HWND-based accessible elements. If the new value is a string, you can use SetHwndPropStr instead. +func (obj *IAccPropServices) SetHwndProp(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT { + propA, propB := idProp.split() + ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetHwndProp, 7, + uintptr(unsafe.Pointer(obj)), + uintptr(hwnd), + uintptr(idObject), + uintptr(idChild), + propA, propB, + uintptr(unsafe.Pointer(v)), + 0, 0) + return HRESULT(ret) +} + +// SetHwndPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HWND-based accessible elements. +func (obj *IAccPropServices) SetHwndPropStr(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, str string) HRESULT { + str16, err := syscall.UTF16PtrFromString(str) + if err != nil { + return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1) + } + propA, propB := idProp.split() + ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetHwndPropStr, 7, + uintptr(unsafe.Pointer(obj)), + uintptr(hwnd), + uintptr(idObject), + uintptr(idChild), + propA, propB, + uintptr(unsafe.Pointer(str16)), + 0, 0) + return HRESULT(ret) +} + +// SetHmenuProp wraps SetPropValue, providing a convenient entry point for callers who are annotating HMENU-based accessible elements. If the new value is a string, you can use IAccPropServices::SetHmenuPropStr instead. +func (obj *IAccPropServices) SetHmenuProp(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT { + propA, propB := idProp.split() + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuProp, 6, + uintptr(unsafe.Pointer(obj)), + uintptr(hmenu), + uintptr(idChild), + propA, propB, + uintptr(unsafe.Pointer(v))) + return HRESULT(ret) +} + +// SetHmenuPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HMENU-based accessible elements. +func (obj *IAccPropServices) SetHmenuPropStr(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, str string) HRESULT { + str16, err := syscall.UTF16PtrFromString(str) + if err != nil { + return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1) + } + propA, propB := idProp.split() + ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuPropStr, 6, + uintptr(unsafe.Pointer(obj)), + uintptr(hmenu), + uintptr(idChild), + propA, propB, + uintptr(unsafe.Pointer(str16))) + return HRESULT(ret) +} diff --git a/oleaut32_64.go b/oleaut32_64.go index 20bc7cb9..4046a008 100644 --- a/oleaut32_64.go +++ b/oleaut32_64.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build windows,amd64 +// +build windows,amd64 windows,arm64 package win diff --git a/shobj_64.go b/shobj_64.go index 60978d75..6e75ffd4 100644 --- a/shobj_64.go +++ b/shobj_64.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build windows,amd64 +// +build windows,amd64 windows,arm64 package win -- cgit v1.2.3-59-g8ed1b