| 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. |
| 6 |
use ctypes::{c_int, c_void}; |
| 7 |
use shared::basetsd::INT_PTR; |
| 8 |
use shared::minwindef::{BOOL, DWORD, LPARAM, UINT}; |
| 9 |
use um::winnt::{HANDLE, HRESULT, LPCWSTR, LPWSTR, PVOID, ULONGLONG}; |
| 10 |
pub const DA_LAST: c_int = 0x7FFFFFFF; |
| 11 |
pub const DA_ERR: c_int = -1; |
| 12 |
FN!{stdcall PFNDAENUMCALLBACK( |
| 13 |
p: *mut c_void, |
| 14 |
pData: *mut c_void, |
| 15 |
) -> c_int} |
| 16 |
FN!{stdcall PFNDAENUMCALLBACKCONST( |
| 17 |
p: *const c_void, |
| 18 |
pData: *mut c_void, |
| 19 |
) -> c_int} |
| 20 |
FN!{stdcall PFNDACOMPARE( |
| 21 |
p1: *mut c_void, |
| 22 |
p2: *mut c_void, |
| 23 |
lParam: LPARAM, |
| 24 |
) -> c_int} |
| 25 |
FN!{stdcall PFNDACOMPARECONST( |
| 26 |
p1: *const c_void, |
| 27 |
p2: *const c_void, |
| 28 |
lParam: LPARAM, |
| 29 |
) -> c_int} |
| 30 |
pub enum DSA {} |
| 31 |
pub type HDSA = *mut DSA; |
| 32 |
extern "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] |
| 78 |
pub unsafe fn DSA_GetItemCount(hdsa: HDSA) -> c_int { |
| 79 |
*(hdsa as *mut c_int) |
| 80 |
} |
| 81 |
#[inline] |
| 82 |
pub unsafe fn DSA_AppendItem(hdsa: HDSA, pitem: *const c_void) -> c_int { |
| 83 |
DSA_InsertItem(hdsa, DA_LAST, pitem) |
| 84 |
} |
| 85 |
extern "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 |
} |
| 98 |
pub const DSA_APPEND: c_int = DA_LAST; |
| 99 |
pub const DSA_ERR: c_int = DA_ERR; |
| 100 |
pub type PFNDSAENUMCALLBACK = PFNDAENUMCALLBACK; |
| 101 |
pub type PFNDSAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; |
| 102 |
pub type PFNDSACOMPARE = PFNDACOMPARE; |
| 103 |
pub type PFNDSACOMPARECONST = PFNDACOMPARECONST; |
| 104 |
pub enum DPA {} |
| 105 |
pub type HDPA = *mut DPA; |
| 106 |
extern "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] |
| 162 |
pub unsafe fn DPA_GetPtrCount(hdpa: HDPA) -> c_int { |
| 163 |
*(hdpa as *mut c_int) |
| 164 |
} |
| 165 |
#[inline] |
| 166 |
pub unsafe fn DPA_SetPtrCount(hdpa: HDPA, cItems: c_int) { |
| 167 |
*(hdpa as *mut c_int) = cItems; |
| 168 |
} |
| 169 |
#[inline] |
| 170 |
pub unsafe fn DPA_FastDeleteLastPtr(hdpa: HDPA) -> c_int { |
| 171 |
*(hdpa as *mut c_int) -= 1; |
| 172 |
*(hdpa as *mut c_int) |
| 173 |
} |
| 174 |
#[inline] |
| 175 |
pub unsafe fn DPA_AppendPtr(hdpa: HDPA, pitem: *mut c_void) -> c_int { |
| 176 |
DPA_InsertPtr(hdpa, DA_LAST, pitem) |
| 177 |
} |
| 178 |
extern "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 |
} |
| 188 |
STRUCT!{struct DPASTREAMINFO { |
| 189 |
iPos: c_int, |
| 190 |
pvItem: *mut c_void, |
| 191 |
}} |
| 192 |
pub enum IStream {} |
| 193 |
FN!{stdcall PFNDPASTREAM( |
| 194 |
pinfo: *mut DPASTREAMINFO, |
| 195 |
pstream: *mut IStream, |
| 196 |
pvInstData: *mut c_void, |
| 197 |
) -> HRESULT} |
| 198 |
extern "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 |
} |
| 212 |
pub const DPAM_SORTED: DWORD = 0x00000001; |
| 213 |
pub const DPAM_NORMAL: DWORD = 0x00000002; |
| 214 |
pub const DPAM_UNION: DWORD = 0x00000004; |
| 215 |
pub const DPAM_INTERSECT: DWORD = 0x00000008; |
| 216 |
FN!{stdcall PFNDPAMERGE( |
| 217 |
uMsg: UINT, |
| 218 |
pvDest: *mut c_void, |
| 219 |
pvSrc: *mut c_void, |
| 220 |
lParam: LPARAM, |
| 221 |
) -> *mut c_void} |
| 222 |
FN!{stdcall PFNDPAMERGECONST( |
| 223 |
uMsg: UINT, |
| 224 |
pvDest: *const c_void, |
| 225 |
pvSrc: *const c_void, |
| 226 |
lParam: LPARAM, |
| 227 |
) -> *const c_void} |
| 228 |
pub const DPAMM_MERGE: UINT = 1; |
| 229 |
pub const DPAMM_DELETE: UINT = 2; |
| 230 |
pub const DPAMM_INSERT: UINT = 3; |
| 231 |
extern "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 |
} |
| 241 |
pub const DPAS_SORTED: UINT = 0x0001; |
| 242 |
pub const DPAS_INSERTBEFORE: UINT = 0x0002; |
| 243 |
pub const DPAS_INSERTAFTER: UINT = 0x0004; |
| 244 |
extern "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] |
| 255 |
pub 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 |
} |
| 272 |
pub const DPA_APPEND: c_int = DA_LAST; |
| 273 |
pub const DPA_ERR: c_int = DA_ERR; |
| 274 |
pub type PFNDPAENUMCALLBACK = PFNDAENUMCALLBACK; |
| 275 |
pub type PFNDPAENUMCALLBACKCONST = PFNDAENUMCALLBACKCONST; |
| 276 |
pub type PFNDPACOMPARE = PFNDACOMPARE; |
| 277 |
pub type PFNDPACOMPARECONST = PFNDACOMPARECONST; |
| 278 |
extern "system" { |
| 279 |
pub fn Str_SetPtrW( |
| 280 |
ppsz: *mut LPWSTR, |
| 281 |
psz: LPCWSTR, |
| 282 |
) -> BOOL; |
| 283 |
} |