Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3bc59a4e
Commit
3bc59a4e
authored
Feb 03, 2023
by
Connor McAdams
Committed by
Alexandre Julliard
Feb 27, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uiautomationcore: Implement IUIAutomation::IntNativeArrayToSafeArray.
Signed-off-by:
Connor McAdams
<
cmcadams@codeweavers.com
>
parent
dc79cdc5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
2 deletions
+67
-2
uiautomation.c
dlls/uiautomationcore/tests/uiautomation.c
+40
-0
uia_com_client.c
dlls/uiautomationcore/uia_com_client.c
+27
-2
No files found.
dlls/uiautomationcore/tests/uiautomation.c
View file @
3bc59a4e
...
...
@@ -10017,11 +10017,17 @@ exit:
static
void
test_CUIAutomation_value_conversion
(
IUIAutomation
*
uia_iface
)
{
static
const
VARTYPE
invalid_int_vts
[]
=
{
VT_I8
,
VT_INT
};
int
in_arr
[
3
]
=
{
0xdeadbeef
,
0xfeedbeef
,
0x1337b33f
};
int
*
out_arr
,
out_arr_count
,
i
;
LONG
lbound
,
ubound
;
SAFEARRAY
*
sa
;
VARTYPE
vt
;
HRESULT
hr
;
UINT
dims
;
/*
* Conversion from VT_I4 SAFEARRAY to native int array.
*/
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
invalid_int_vts
);
i
++
)
{
vt
=
invalid_int_vts
[
i
];
...
...
@@ -10047,6 +10053,40 @@ static void test_CUIAutomation_value_conversion(IUIAutomation *uia_iface)
SafeArrayDestroy
(
sa
);
CoTaskMemFree
(
out_arr
);
/*
* Conversion from native int array to VT_I4 SAFEARRAY.
*/
sa
=
NULL
;
hr
=
IUIAutomation_IntNativeArrayToSafeArray
(
uia_iface
,
in_arr
,
ARRAY_SIZE
(
in_arr
),
&
sa
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
SafeArrayGetVartype
(
sa
,
&
vt
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
vt
==
VT_I4
,
"Unexpected vt %d.
\n
"
,
vt
);
dims
=
SafeArrayGetDim
(
sa
);
ok
(
dims
==
1
,
"Unexpected array dims %d
\n
"
,
dims
);
hr
=
SafeArrayGetLBound
(
sa
,
1
,
&
lbound
);
ok
(
hr
==
S_OK
,
"Failed to get LBound with hr %#lx
\n
"
,
hr
);
ok
(
lbound
==
0
,
"Unexpected LBound %#lx
\n
"
,
lbound
);
hr
=
SafeArrayGetUBound
(
sa
,
1
,
&
ubound
);
ok
(
hr
==
S_OK
,
"Failed to get UBound with hr %#lx
\n
"
,
hr
);
ok
(((
ubound
-
lbound
)
+
1
)
==
ARRAY_SIZE
(
in_arr
),
"Unexpected array size %#lx
\n
"
,
((
ubound
-
lbound
)
+
1
));
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
in_arr
);
i
++
)
{
LONG
idx
=
lbound
+
i
;
int
tmp_val
;
hr
=
SafeArrayGetElement
(
sa
,
&
idx
,
&
tmp_val
);
ok
(
hr
==
S_OK
,
"Failed to get element at idx %ld, hr %#lx
\n
"
,
idx
,
hr
);
ok
(
tmp_val
==
in_arr
[
i
],
"Expected %d at idx %d, got %d
\n
"
,
in_arr
[
i
],
i
,
tmp_val
);
}
SafeArrayDestroy
(
sa
);
}
struct
uia_com_classes
{
...
...
dlls/uiautomationcore/uia_com_client.c
View file @
3bc59a4e
...
...
@@ -1366,8 +1366,33 @@ static HRESULT WINAPI uia_iface_RemoveAllEventHandlers(IUIAutomation6 *iface)
static
HRESULT
WINAPI
uia_iface_IntNativeArrayToSafeArray
(
IUIAutomation6
*
iface
,
int
*
arr
,
int
arr_count
,
SAFEARRAY
**
out_sa
)
{
FIXME
(
"%p, %p, %d, %p: stub
\n
"
,
iface
,
arr
,
arr_count
,
out_sa
);
return
E_NOTIMPL
;
HRESULT
hr
=
S_OK
;
SAFEARRAY
*
sa
;
int
*
sa_arr
;
TRACE
(
"%p, %p, %d, %p
\n
"
,
iface
,
arr
,
arr_count
,
out_sa
);
if
(
!
out_sa
||
!
arr
||
!
arr_count
)
return
E_INVALIDARG
;
*
out_sa
=
NULL
;
if
(
!
(
sa
=
SafeArrayCreateVector
(
VT_I4
,
0
,
arr_count
)))
return
E_OUTOFMEMORY
;
hr
=
SafeArrayAccessData
(
sa
,
(
void
**
)
&
sa_arr
);
if
(
FAILED
(
hr
))
goto
exit
;
memcpy
(
sa_arr
,
arr
,
sizeof
(
*
arr
)
*
arr_count
);
hr
=
SafeArrayUnaccessData
(
sa
);
if
(
SUCCEEDED
(
hr
))
*
out_sa
=
sa
;
exit:
if
(
FAILED
(
hr
))
SafeArrayDestroy
(
sa
);
return
hr
;
}
static
HRESULT
WINAPI
uia_iface_IntSafeArrayToNativeArray
(
IUIAutomation6
*
iface
,
SAFEARRAY
*
sa
,
int
**
out_arr
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment