Skip to content

Commit 83d4471

Browse files
committed
Port to arm64
Updates: golang/go#36439 Updates: golang/go#44020 Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 2a20daf commit 83d4471

File tree

4 files changed

+100
-2
lines changed

4 files changed

+100
-2
lines changed
File renamed without changes.

oleacc_arm64.go

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Copyright 2010 The win Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build windows,arm64
6+
7+
package win
8+
9+
import (
10+
"syscall"
11+
"unsafe"
12+
)
13+
14+
func (idProp *MSAAPROPID) split() (uintptr, uintptr) {
15+
if idProp == nil {
16+
return 0, 0
17+
}
18+
x := (*struct { a, b uintptr })(unsafe.Pointer(idProp))
19+
return x.a, x.b
20+
}
21+
22+
// SetPropValue identifies the accessible element to be annotated, specify the property to be annotated, and provide a new value for that property.
23+
// 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
24+
func (obj *IAccPropServices) SetPropValue(idString []byte, idProp *MSAAPROPID, v *VARIANT) HRESULT {
25+
var idStringPtr unsafe.Pointer
26+
idStringLen := len(idString)
27+
if idStringLen != 0 {
28+
idStringPtr = unsafe.Pointer(&idString[0])
29+
}
30+
propA, propB := idProp.split()
31+
ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetPropValue, 6,
32+
uintptr(unsafe.Pointer(obj)),
33+
uintptr(idStringPtr),
34+
uintptr(idStringLen),
35+
propA, propB,
36+
uintptr(unsafe.Pointer(v)))
37+
return HRESULT(ret)
38+
}
39+
40+
// 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.
41+
func (obj *IAccPropServices) SetHwndProp(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT {
42+
propA, propB := idProp.split()
43+
ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetHwndProp, 7,
44+
uintptr(unsafe.Pointer(obj)),
45+
uintptr(hwnd),
46+
uintptr(idObject),
47+
uintptr(idChild),
48+
propA, propB,
49+
uintptr(unsafe.Pointer(v)),
50+
0, 0)
51+
return HRESULT(ret)
52+
}
53+
54+
// SetHwndPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HWND-based accessible elements.
55+
func (obj *IAccPropServices) SetHwndPropStr(hwnd HWND, idObject int32, idChild uint32, idProp *MSAAPROPID, str string) HRESULT {
56+
str16, err := syscall.UTF16PtrFromString(str)
57+
if err != nil {
58+
return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1)
59+
}
60+
propA, propB := idProp.split()
61+
ret, _, _ := syscall.Syscall9(obj.LpVtbl.SetHwndPropStr, 7,
62+
uintptr(unsafe.Pointer(obj)),
63+
uintptr(hwnd),
64+
uintptr(idObject),
65+
uintptr(idChild),
66+
propA, propB,
67+
uintptr(unsafe.Pointer(str16)),
68+
0, 0)
69+
return HRESULT(ret)
70+
}
71+
72+
// 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.
73+
func (obj *IAccPropServices) SetHmenuProp(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, v *VARIANT) HRESULT {
74+
propA, propB := idProp.split()
75+
ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuProp, 6,
76+
uintptr(unsafe.Pointer(obj)),
77+
uintptr(hmenu),
78+
uintptr(idChild),
79+
propA, propB,
80+
uintptr(unsafe.Pointer(v)))
81+
return HRESULT(ret)
82+
}
83+
84+
// SetHmenuPropStr wraps SetPropValue, providing a more convenient entry point for callers who are annotating HMENU-based accessible elements.
85+
func (obj *IAccPropServices) SetHmenuPropStr(hmenu HMENU, idChild uint32, idProp *MSAAPROPID, str string) HRESULT {
86+
str16, err := syscall.UTF16PtrFromString(str)
87+
if err != nil {
88+
return -((E_INVALIDARG ^ 0xFFFFFFFF) + 1)
89+
}
90+
propA, propB := idProp.split()
91+
ret, _, _ := syscall.Syscall6(obj.LpVtbl.SetHmenuPropStr, 6,
92+
uintptr(unsafe.Pointer(obj)),
93+
uintptr(hmenu),
94+
uintptr(idChild),
95+
propA, propB,
96+
uintptr(unsafe.Pointer(str16)))
97+
return HRESULT(ret)
98+
}

oleaut32_64.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build windows,amd64
5+
// +build windows,amd64 windows,arm64
66

77
package win
88

shobj_64.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build windows,amd64
5+
// +build windows,amd64 windows,arm64
66

77
package win
88

0 commit comments

Comments
 (0)