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
3d0c9efc
Commit
3d0c9efc
authored
May 17, 2023
by
Connor McAdams
Committed by
Alexandre Julliard
Jun 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
uiautomationcore: Put general purpose helper functions into separate source file.
Signed-off-by:
Connor McAdams
<
cmcadams@codeweavers.com
>
parent
ad7b9726
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
90 deletions
+117
-90
Makefile.in
dlls/uiautomationcore/Makefile.in
+2
-1
uia_client.c
dlls/uiautomationcore/uia_client.c
+0
-87
uia_private.h
dlls/uiautomationcore/uia_private.h
+5
-2
uia_utils.c
dlls/uiautomationcore/uia_utils.c
+110
-0
No files found.
dlls/uiautomationcore/Makefile.in
View file @
3d0c9efc
...
@@ -10,7 +10,8 @@ C_SRCS = \
...
@@ -10,7 +10,8 @@ C_SRCS = \
uia_event.c
\
uia_event.c
\
uia_ids.c
\
uia_ids.c
\
uia_main.c
\
uia_main.c
\
uia_provider.c
uia_provider.c
\
uia_utils.c
IDL_SRCS
=
\
IDL_SRCS
=
\
uia_classes.idl
\
uia_classes.idl
\
...
...
dlls/uiautomationcore/uia_client.c
View file @
3d0c9efc
...
@@ -58,93 +58,6 @@ static HRESULT add_node_to_node_array(struct uia_node_array *out_nodes, HUIANODE
...
@@ -58,93 +58,6 @@ static HRESULT add_node_to_node_array(struct uia_node_array *out_nodes, HUIANODE
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
get_safearray_dim_bounds
(
SAFEARRAY
*
sa
,
UINT
dim
,
LONG
*
lbound
,
LONG
*
elems
)
{
LONG
ubound
;
HRESULT
hr
;
*
lbound
=
*
elems
=
0
;
hr
=
SafeArrayGetLBound
(
sa
,
dim
,
lbound
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
SafeArrayGetUBound
(
sa
,
dim
,
&
ubound
);
if
(
FAILED
(
hr
))
return
hr
;
*
elems
=
(
ubound
-
(
*
lbound
))
+
1
;
return
S_OK
;
}
HRESULT
get_safearray_bounds
(
SAFEARRAY
*
sa
,
LONG
*
lbound
,
LONG
*
elems
)
{
UINT
dims
;
*
lbound
=
*
elems
=
0
;
dims
=
SafeArrayGetDim
(
sa
);
if
(
dims
!=
1
)
{
WARN
(
"Invalid dimensions %d for safearray.
\n
"
,
dims
);
return
E_FAIL
;
}
return
get_safearray_dim_bounds
(
sa
,
1
,
lbound
,
elems
);
}
int
uia_compare_safearrays
(
SAFEARRAY
*
sa1
,
SAFEARRAY
*
sa2
,
int
prop_type
)
{
LONG
i
,
idx
,
lbound
[
2
],
elems
[
2
];
int
val
[
2
];
HRESULT
hr
;
hr
=
get_safearray_bounds
(
sa1
,
&
lbound
[
0
],
&
elems
[
0
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get safearray bounds from sa1 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
hr
=
get_safearray_bounds
(
sa2
,
&
lbound
[
1
],
&
elems
[
1
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get safearray bounds from sa2 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
if
(
elems
[
0
]
!=
elems
[
1
])
return
(
elems
[
0
]
>
elems
[
1
])
-
(
elems
[
0
]
<
elems
[
1
]);
if
(
prop_type
!=
UIAutomationType_IntArray
)
{
FIXME
(
"Array type %#x value comparison currently unimplemented.
\n
"
,
prop_type
);
return
-
1
;
}
for
(
i
=
0
;
i
<
elems
[
0
];
i
++
)
{
idx
=
lbound
[
0
]
+
i
;
hr
=
SafeArrayGetElement
(
sa1
,
&
idx
,
&
val
[
0
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get element from sa1 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
idx
=
lbound
[
1
]
+
i
;
hr
=
SafeArrayGetElement
(
sa2
,
&
idx
,
&
val
[
1
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get element from sa2 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
if
(
val
[
0
]
!=
val
[
1
])
return
(
val
[
0
]
>
val
[
1
])
-
(
val
[
0
]
<
val
[
1
]);
}
return
0
;
}
static
void
clear_uia_node_ptr_safearray
(
SAFEARRAY
*
sa
,
LONG
elems
)
static
void
clear_uia_node_ptr_safearray
(
SAFEARRAY
*
sa
,
LONG
elems
)
{
{
HUIANODE
node
;
HUIANODE
node
;
...
...
dlls/uiautomationcore/uia_private.h
View file @
3d0c9efc
...
@@ -152,8 +152,6 @@ static inline BOOL uia_array_reserve(void **elements, SIZE_T *capacity, SIZE_T c
...
@@ -152,8 +152,6 @@ static inline BOOL uia_array_reserve(void **elements, SIZE_T *capacity, SIZE_T c
}
}
/* uia_client.c */
/* uia_client.c */
HRESULT
get_safearray_bounds
(
SAFEARRAY
*
sa
,
LONG
*
lbound
,
LONG
*
elems
)
DECLSPEC_HIDDEN
;
int
uia_compare_safearrays
(
SAFEARRAY
*
sa1
,
SAFEARRAY
*
sa2
,
int
prop_type
)
DECLSPEC_HIDDEN
;
int
get_node_provider_type_at_idx
(
struct
uia_node
*
node
,
int
idx
)
DECLSPEC_HIDDEN
;
int
get_node_provider_type_at_idx
(
struct
uia_node
*
node
,
int
idx
)
DECLSPEC_HIDDEN
;
HRESULT
attach_event_to_uia_node
(
HUIANODE
node
,
struct
uia_event
*
event
)
DECLSPEC_HIDDEN
;
HRESULT
attach_event_to_uia_node
(
HUIANODE
node
,
struct
uia_event
*
event
)
DECLSPEC_HIDDEN
;
HRESULT
create_uia_node_from_elprov
(
IRawElementProviderSimple
*
elprov
,
HUIANODE
*
out_node
,
HRESULT
create_uia_node_from_elprov
(
IRawElementProviderSimple
*
elprov
,
HUIANODE
*
out_node
,
...
@@ -179,3 +177,8 @@ void uia_provider_thread_remove_node(HUIANODE node) DECLSPEC_HIDDEN;
...
@@ -179,3 +177,8 @@ void uia_provider_thread_remove_node(HUIANODE node) DECLSPEC_HIDDEN;
LRESULT
uia_lresult_from_node
(
HUIANODE
huianode
)
DECLSPEC_HIDDEN
;
LRESULT
uia_lresult_from_node
(
HUIANODE
huianode
)
DECLSPEC_HIDDEN
;
HRESULT
create_msaa_provider
(
IAccessible
*
acc
,
long
child_id
,
HWND
hwnd
,
BOOL
known_root_acc
,
HRESULT
create_msaa_provider
(
IAccessible
*
acc
,
long
child_id
,
HWND
hwnd
,
BOOL
known_root_acc
,
IRawElementProviderSimple
**
elprov
)
DECLSPEC_HIDDEN
;
IRawElementProviderSimple
**
elprov
)
DECLSPEC_HIDDEN
;
/* uia_utils.c */
HRESULT
get_safearray_dim_bounds
(
SAFEARRAY
*
sa
,
UINT
dim
,
LONG
*
lbound
,
LONG
*
elems
)
DECLSPEC_HIDDEN
;
HRESULT
get_safearray_bounds
(
SAFEARRAY
*
sa
,
LONG
*
lbound
,
LONG
*
elems
)
DECLSPEC_HIDDEN
;
int
uia_compare_safearrays
(
SAFEARRAY
*
sa1
,
SAFEARRAY
*
sa2
,
int
prop_type
)
DECLSPEC_HIDDEN
;
dlls/uiautomationcore/uia_utils.c
0 → 100644
View file @
3d0c9efc
/*
* Copyright 2023 Connor McAdams for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "uia_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
uiautomation
);
HRESULT
get_safearray_dim_bounds
(
SAFEARRAY
*
sa
,
UINT
dim
,
LONG
*
lbound
,
LONG
*
elems
)
{
LONG
ubound
;
HRESULT
hr
;
*
lbound
=
*
elems
=
0
;
hr
=
SafeArrayGetLBound
(
sa
,
dim
,
lbound
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
SafeArrayGetUBound
(
sa
,
dim
,
&
ubound
);
if
(
FAILED
(
hr
))
return
hr
;
*
elems
=
(
ubound
-
(
*
lbound
))
+
1
;
return
S_OK
;
}
HRESULT
get_safearray_bounds
(
SAFEARRAY
*
sa
,
LONG
*
lbound
,
LONG
*
elems
)
{
UINT
dims
;
*
lbound
=
*
elems
=
0
;
dims
=
SafeArrayGetDim
(
sa
);
if
(
dims
!=
1
)
{
WARN
(
"Invalid dimensions %d for safearray.
\n
"
,
dims
);
return
E_FAIL
;
}
return
get_safearray_dim_bounds
(
sa
,
1
,
lbound
,
elems
);
}
int
uia_compare_safearrays
(
SAFEARRAY
*
sa1
,
SAFEARRAY
*
sa2
,
int
prop_type
)
{
LONG
i
,
idx
,
lbound
[
2
],
elems
[
2
];
int
val
[
2
];
HRESULT
hr
;
hr
=
get_safearray_bounds
(
sa1
,
&
lbound
[
0
],
&
elems
[
0
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get safearray bounds from sa1 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
hr
=
get_safearray_bounds
(
sa2
,
&
lbound
[
1
],
&
elems
[
1
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get safearray bounds from sa2 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
if
(
elems
[
0
]
!=
elems
[
1
])
return
(
elems
[
0
]
>
elems
[
1
])
-
(
elems
[
0
]
<
elems
[
1
]);
if
(
prop_type
!=
UIAutomationType_IntArray
)
{
FIXME
(
"Array type %#x value comparison currently unimplemented.
\n
"
,
prop_type
);
return
-
1
;
}
for
(
i
=
0
;
i
<
elems
[
0
];
i
++
)
{
idx
=
lbound
[
0
]
+
i
;
hr
=
SafeArrayGetElement
(
sa1
,
&
idx
,
&
val
[
0
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get element from sa1 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
idx
=
lbound
[
1
]
+
i
;
hr
=
SafeArrayGetElement
(
sa2
,
&
idx
,
&
val
[
1
]);
if
(
FAILED
(
hr
))
{
ERR
(
"Failed to get element from sa2 with hr %#lx
\n
"
,
hr
);
return
-
1
;
}
if
(
val
[
0
]
!=
val
[
1
])
return
(
val
[
0
]
>
val
[
1
])
-
(
val
[
0
]
<
val
[
1
]);
}
return
0
;
}
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