winapi_ui_automation/um/
dpa_dsa.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6use ctypes::{c_int, c_void};
7use shared::basetsd::INT_PTR;
8use shared::minwindef::{BOOL, DWORD, LPARAM, UINT};
9use um::winnt::{HANDLE, HRESULT, LPCWSTR, LPWSTR, PVOID, ULONGLONG};
10pub const DA_LAST: c_int = 0x7FFFFFFF;
11pub const DA_ERR: c_int = -1;
12FN!{stdcall PFNDAENUMCALLBACK(
13    p: *mut c_void,
14    pData: *mut c_void,
15) -> c_int}
16FN!{stdcall PFNDAENUMCALLBACKCONST(
17    p: *const c_void,
18    pData: *mut c_void,
19) -> c_int}
20FN!{stdcall PFNDACOMPARE(
21    p1: *mut c_void,
22    p2: *mut c_void,
23    lParam: LPARAM,
24) -> c_int}
25FN!{stdcall PFNDACOMPARECONST(
26    p1: *const c_void,
27    p2: *const c_void,
28    lParam: LPARAM,
29) -> c_int}
30pub enum DSA {}
31pub type HDSA = *mut DSA;
32extern "system" {
33    pub fn DSA_Create(
34        cbItem: c_int,
35        cItemGrow: c_int,
36    ) -> HDSA;
37    pub fn DSA_Destroy(
38        hdsa: HDSA,
39    ) -> BOOL;
40    pub fn DSA_DestroyCallback(
41        hdsa: HDSA,
42        pfnCB: PFNDAENUMCALLBACK,
43        pData: *mut c_void,
44    );
45    pub fn DSA_DeleteItem(
46        hdsa: HDSA,
47        i: c_int,
48    ) -> BOOL;
49    pub fn DSA_DeleteAllItems(
50        hdsa: HDSA,
51    ) -> BOOL;
52    pub fn DSA_EnumCallback(
53        hdsa: HDSA,
54        pfnCB: PFNDAENUMCALLBACK,
55        pData: *mut c_void,
56    );
57    pub fn DSA_InsertItem(
58        hdsa: HDSA,
59        i: c_int,
60        pitem: *const c_void,
61    ) -> c_int;
62    pub fn DSA_GetItemPtr(
63        hdsa: HDSA,
64        i: c_int,
65    ) -> PVOID;
66    pub fn DSA_GetItem(
67        hdsa: HDSA,
68        i: c_int,
69        pitem: *mut c_void,
70    ) -> BOOL;
71    pub fn DSA_SetItem(
72        hdsa: HDSA,
73        i: c_int,
74        pitem: *const c_void,
75    ) -> BOOL;
76}
77#[inline]
78pub unsafe fn DSA_GetItemCount(hdsa: HDSA) -> c_int {
79    *(hdsa as *mut c_int)
80}
81#[inline]
82pub unsafe fn DSA_AppendItem(hdsa: HDSA, pitem: *const c_void) -> c_int {
83    DSA_InsertItem(hdsa, DA_LAST, pitem)
84}
85extern "system" {
86    pub fn DSA_Clone(
87        hdsa: HDSA,
88    ) -> HDSA;
89    pub fn DSA_GetSize(
90        hdsa: HDSA,
91    ) -> ULONGLONG;
92    pub fn DSA_Sort(
93        pdsa: HDSA,
94        pfnCompare: PFNDACOMPARE,
95        lParam: LPARAM,
96    ) -> BOOL;
97}
98pub const DSA_APPEND: c_int = DA_LAST;
99pub const DSA_ERR: c_int = DA_ERR;
100pub type PFNDSAENUMCALLBACK = PFNDAENUMCALLBACK;
101pub type PFNDSAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST;
102pub type PFNDSACOMPARE = PFNDACOMPARE;
103pub type PFNDSACOMPARECONST = PFNDACOMPARECONST;
104pub enum DPA {}
105pub type HDPA = *mut DPA;
106extern "system" {
107    pub fn DPA_Create(
108        cItemGrow: c_int,
109    ) -> HDPA;
110    pub fn DPA_CreateEx(
111        cpGrow: c_int,
112        hheap: HANDLE,
113    ) -> HDPA;
114    pub fn DPA_Clone(
115        hdpa: HDPA,
116        hdpaNew: HDPA,
117    ) -> HDPA;
118    pub fn DPA_Destroy(
119        hdpa: HDPA,
120    ) -> BOOL;
121    pub fn DPA_DestroyCallback(
122        hdpa: HDPA,
123        pfnCB: PFNDAENUMCALLBACK,
124        pData: *mut c_void,
125    );
126    pub fn DPA_DeletePtr(
127        hdpa: HDPA,
128        i: c_int,
129    ) -> PVOID;
130    pub fn DPA_DeleteAllPtrs(
131        hdpa: HDPA,
132    ) -> BOOL;
133    pub fn DPA_EnumCallback(
134        hdpa: HDPA,
135        pfnCB: PFNDAENUMCALLBACK,
136        pData: *mut c_void,
137    );
138    pub fn DPA_Grow(
139        hdpa: HDPA,
140        cp: c_int,
141    ) -> BOOL;
142    pub fn DPA_InsertPtr(
143        hdpa: HDPA,
144        i: c_int,
145        p: *mut c_void,
146    ) -> c_int;
147    pub fn DPA_SetPtr(
148        hdpa: HDPA,
149        i: c_int,
150        p: *mut c_void,
151    ) -> BOOL;
152    pub fn DPA_GetPtr(
153        hdpa: HDPA,
154        i: INT_PTR,
155    ) -> PVOID;
156    pub fn DPA_GetPtrIndex(
157        hdpa: HDPA,
158        p: *const c_void,
159    ) -> c_int;
160}
161#[inline]
162pub unsafe fn DPA_GetPtrCount(hdpa: HDPA) -> c_int {
163    *(hdpa as *mut c_int)
164}
165#[inline]
166pub unsafe fn DPA_SetPtrCount(hdpa: HDPA, cItems: c_int) {
167    *(hdpa as *mut c_int) = cItems;
168}
169#[inline]
170pub unsafe fn DPA_FastDeleteLastPtr(hdpa: HDPA) -> c_int {
171    *(hdpa as *mut c_int) -= 1;
172    *(hdpa as *mut c_int)
173}
174#[inline]
175pub unsafe fn DPA_AppendPtr(hdpa: HDPA, pitem: *mut c_void) -> c_int {
176    DPA_InsertPtr(hdpa, DA_LAST, pitem)
177}
178extern "system" {
179    pub fn DPA_GetSize(
180        hdpa: HDPA,
181    ) -> ULONGLONG;
182    pub fn DPA_Sort(
183        hdpa: HDPA,
184        pfnCompare: PFNDACOMPARE,
185        lParam: LPARAM,
186    ) -> BOOL;
187}
188STRUCT!{struct DPASTREAMINFO {
189    iPos: c_int,
190    pvItem: *mut c_void,
191}}
192pub enum IStream {}
193FN!{stdcall PFNDPASTREAM(
194    pinfo: *mut DPASTREAMINFO,
195    pstream: *mut IStream,
196    pvInstData: *mut c_void,
197) -> HRESULT}
198extern "system" {
199    pub fn DPA_LoadStream(
200        phdpa: *mut HDPA,
201        pfn: PFNDPASTREAM,
202        pstream: *mut IStream,
203        pvInstData: *mut c_void,
204    ) -> HRESULT;
205    pub fn DPA_SaveStream(
206        hdpa: HDPA,
207        pfn: PFNDPASTREAM,
208        pstream: *mut IStream,
209        pvInstData: *mut c_void,
210    ) -> HRESULT;
211}
212pub const DPAM_SORTED: DWORD = 0x00000001;
213pub const DPAM_NORMAL: DWORD = 0x00000002;
214pub const DPAM_UNION: DWORD = 0x00000004;
215pub const DPAM_INTERSECT: DWORD = 0x00000008;
216FN!{stdcall PFNDPAMERGE(
217    uMsg: UINT,
218    pvDest: *mut c_void,
219    pvSrc: *mut c_void,
220    lParam: LPARAM,
221) -> *mut c_void}
222FN!{stdcall PFNDPAMERGECONST(
223    uMsg: UINT,
224    pvDest: *const c_void,
225    pvSrc: *const c_void,
226    lParam: LPARAM,
227) -> *const c_void}
228pub const DPAMM_MERGE: UINT = 1;
229pub const DPAMM_DELETE: UINT = 2;
230pub const DPAMM_INSERT: UINT = 3;
231extern "system" {
232    pub fn DPA_Merge(
233        hdpaDest: HDPA,
234        hdpaSrc: HDPA,
235        dwFlags: DWORD,
236        pfnCompare: PFNDACOMPARE,
237        pfnMerge: PFNDPAMERGE,
238        lParam: LPARAM,
239    ) -> BOOL;
240}
241pub const DPAS_SORTED: UINT = 0x0001;
242pub const DPAS_INSERTBEFORE: UINT = 0x0002;
243pub const DPAS_INSERTAFTER: UINT = 0x0004;
244extern "system" {
245    pub fn DPA_Search(
246        hdpa: HDPA,
247        pFind: *mut c_void,
248        iStart: c_int,
249        pfnCompare: PFNDACOMPARE,
250        lParam: LPARAM,
251        options: UINT,
252    ) -> c_int;
253}
254#[inline]
255pub unsafe fn DPA_SortedInsertPtr(
256    hdpa: HDPA,
257    pFind: *mut c_void,
258    iStart: c_int,
259    pfnCompare: PFNDACOMPARE,
260    lParam: LPARAM,
261    options: UINT,
262    pitem: *mut c_void,
263) -> c_int {
264    DPA_InsertPtr(
265        hdpa,
266        DPA_Search(
267            hdpa, pFind, iStart, pfnCompare, lParam, DPAS_SORTED | options,
268        ),
269        pitem,
270    )
271}
272pub const DPA_APPEND: c_int = DA_LAST;
273pub const DPA_ERR: c_int = DA_ERR;
274pub type PFNDPAENUMCALLBACK = PFNDAENUMCALLBACK;
275pub type PFNDPAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST;
276pub type PFNDPACOMPARE = PFNDACOMPARE;
277pub type PFNDPACOMPARECONST = PFNDACOMPARECONST;
278extern "system" {
279    pub fn Str_SetPtrW(
280        ppsz: *mut LPWSTR,
281        psz: LPCWSTR,
282    ) -> BOOL;
283}