| 1 | /* $Id: comctl32undoc.cpp,v 1.2 2000-03-18 16:17:22 cbratschi Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Undocumented functions from COMCTL32.DLL | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (C) 1999 Achim Hasenmueller | 
|---|
| 6 | * | 
|---|
| 7 | * Based on the work of the WINE group (www.winehq.com) | 
|---|
| 8 | * | 
|---|
| 9 | * | 
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 11 | * | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | /* | 
|---|
| 15 | - Corel 20000317 level | 
|---|
| 16 | - (WINE 20000130 level) | 
|---|
| 17 | */ | 
|---|
| 18 |  | 
|---|
| 19 | /* CB: todo | 
|---|
| 20 | - porting/implementing string functions | 
|---|
| 21 | - DPA_LoadStream | 
|---|
| 22 | - DPA_SaveStream | 
|---|
| 23 | */ | 
|---|
| 24 |  | 
|---|
| 25 | #include "comctl32.h" | 
|---|
| 26 | #include <memory.h> | 
|---|
| 27 | #include <string.h> | 
|---|
| 28 | #include <stdlib.h> | 
|---|
| 29 | #include <ctype.h> | 
|---|
| 30 | #include <wchar.h> | 
|---|
| 31 | #include <wcstr.h> | 
|---|
| 32 | #include <wctype.h> | 
|---|
| 33 |  | 
|---|
| 34 | extern HANDLE COMCTL32_hHeap; /* handle to the private heap */ | 
|---|
| 35 |  | 
|---|
| 36 | /************************************************************************** | 
|---|
| 37 | * DPA_Merge [COMCTL32.11] | 
|---|
| 38 | * | 
|---|
| 39 | * PARAMS | 
|---|
| 40 | *     hdpa1    [I] handle to a dynamic pointer array | 
|---|
| 41 | *     hdpa2    [I] handle to a dynamic pointer array | 
|---|
| 42 | *     dwFlags  [I] flags | 
|---|
| 43 | *     pfnSort  [I] pointer to sort function | 
|---|
| 44 | *     pfnMerge [I] pointer to merge function | 
|---|
| 45 | *     lParam   [I] application specific value | 
|---|
| 46 | * | 
|---|
| 47 | * NOTES | 
|---|
| 48 | *     No more information available yet! | 
|---|
| 49 | */ | 
|---|
| 50 |  | 
|---|
| 51 | BOOL WINAPI | 
|---|
| 52 | DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags, | 
|---|
| 53 | PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam) | 
|---|
| 54 | { | 
|---|
| 55 | INT nCount; | 
|---|
| 56 |  | 
|---|
| 57 | #if 0    /* these go with the "incomplete implementation" below */ | 
|---|
| 58 | LPVOID pWork1, pWork2; | 
|---|
| 59 | INT nResult; | 
|---|
| 60 | INT nIndex; | 
|---|
| 61 | INT nNewItems; | 
|---|
| 62 | #endif | 
|---|
| 63 |  | 
|---|
| 64 |  | 
|---|
| 65 | dprintf(("COMCTL32: DPA_Merge")); | 
|---|
| 66 |  | 
|---|
| 67 | if (IsBadWritePtr (hdpa1, sizeof(DPA))) | 
|---|
| 68 | return FALSE; | 
|---|
| 69 |  | 
|---|
| 70 | if (IsBadWritePtr (hdpa2, sizeof(DPA))) | 
|---|
| 71 | return FALSE; | 
|---|
| 72 |  | 
|---|
| 73 | if (IsBadCodePtr ((FARPROC)pfnCompare)) | 
|---|
| 74 | return FALSE; | 
|---|
| 75 |  | 
|---|
| 76 | if (IsBadCodePtr ((FARPROC)pfnMerge)) | 
|---|
| 77 | return FALSE; | 
|---|
| 78 |  | 
|---|
| 79 | if (dwFlags & DPAM_SORT) { | 
|---|
| 80 | //        TRACE("sorting dpa's!\n"); | 
|---|
| 81 | if (hdpa1->nItemCount > 0) | 
|---|
| 82 | DPA_Sort (hdpa1, pfnCompare, lParam); | 
|---|
| 83 | //        TRACE ("dpa 1 sorted!\n"); | 
|---|
| 84 | if (hdpa2->nItemCount > 0) | 
|---|
| 85 | DPA_Sort (hdpa2, pfnCompare, lParam); | 
|---|
| 86 | //        TRACE ("dpa 2 sorted!\n"); | 
|---|
| 87 | } | 
|---|
| 88 |  | 
|---|
| 89 | if (hdpa2->nItemCount < 1) | 
|---|
| 90 | return TRUE; | 
|---|
| 91 |  | 
|---|
| 92 | //    TRACE("hdpa1->nItemCount=%d hdpa2->nItemCount=%d\n", | 
|---|
| 93 | //           hdpa1->nItemCount, hdpa2->nItemCount); | 
|---|
| 94 |  | 
|---|
| 95 |  | 
|---|
| 96 | /* preliminary hack - simply append the pointer list hdpa2 to hdpa1*/ | 
|---|
| 97 | for (nCount = 0; nCount < hdpa2->nItemCount; nCount++) | 
|---|
| 98 | DPA_InsertPtr (hdpa1, hdpa1->nItemCount + 1, hdpa2->ptrs[nCount]); | 
|---|
| 99 |  | 
|---|
| 100 | #if 0 | 
|---|
| 101 | /* incomplete implementation */ | 
|---|
| 102 |  | 
|---|
| 103 | pWork1 = &(hdpa1->ptrs[hdpa1->nItemCount - 1]); | 
|---|
| 104 | pWork2 = &(hdpa2->ptrs[hdpa2->nItemCount - 1]); | 
|---|
| 105 |  | 
|---|
| 106 | nIndex = hdpa1->nItemCount - 1; | 
|---|
| 107 | nCount = hdpa2->nItemCount - 1; | 
|---|
| 108 |  | 
|---|
| 109 | do | 
|---|
| 110 | { | 
|---|
| 111 | nResult = (pfnCompare)(pWork1, pWork2, lParam); | 
|---|
| 112 |  | 
|---|
| 113 | if (nResult == 0) | 
|---|
| 114 | { | 
|---|
| 115 | PVOID ptr; | 
|---|
| 116 |  | 
|---|
| 117 | ptr = (pfnMerge)(1, pWork1, pWork2, lParam); | 
|---|
| 118 | if (!ptr) | 
|---|
| 119 | return FALSE; | 
|---|
| 120 |  | 
|---|
| 121 | nCount--; | 
|---|
| 122 | pWork2--; | 
|---|
| 123 | pWork1 = ptr; | 
|---|
| 124 | } | 
|---|
| 125 | else if (nResult < 0) | 
|---|
| 126 | { | 
|---|
| 127 | if (!dwFlags & 8) | 
|---|
| 128 | { | 
|---|
| 129 | PVOID ptr; | 
|---|
| 130 |  | 
|---|
| 131 | ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1); | 
|---|
| 132 |  | 
|---|
| 133 | (pfnMerge)(2, ptr, NULL, lParam); | 
|---|
| 134 | } | 
|---|
| 135 | } | 
|---|
| 136 | else | 
|---|
| 137 | { | 
|---|
| 138 | if (!dwFlags & 4) | 
|---|
| 139 | { | 
|---|
| 140 | PVOID ptr; | 
|---|
| 141 |  | 
|---|
| 142 | ptr = (pfnMerge)(3, pWork2, NULL, lParam); | 
|---|
| 143 | if (!ptr) | 
|---|
| 144 | return FALSE; | 
|---|
| 145 | DPA_InsertPtr (hdpa1, nIndex, ptr); | 
|---|
| 146 | } | 
|---|
| 147 | nCount--; | 
|---|
| 148 | pWork2--; | 
|---|
| 149 | } | 
|---|
| 150 |  | 
|---|
| 151 | nIndex--; | 
|---|
| 152 | pWork1--; | 
|---|
| 153 |  | 
|---|
| 154 | } | 
|---|
| 155 | while (nCount >= 0); | 
|---|
| 156 | #endif | 
|---|
| 157 |  | 
|---|
| 158 | return TRUE; | 
|---|
| 159 | } | 
|---|
| 160 |  | 
|---|
| 161 |  | 
|---|
| 162 | /************************************************************************** | 
|---|
| 163 | * Alloc [COMCTL32.71] | 
|---|
| 164 | * | 
|---|
| 165 | * Allocates memory block from the dll's private heap | 
|---|
| 166 | * | 
|---|
| 167 | * PARAMS | 
|---|
| 168 | *     dwSize [I] size of the allocated memory block | 
|---|
| 169 | * | 
|---|
| 170 | * RETURNS | 
|---|
| 171 | *     Success: pointer to allocated memory block | 
|---|
| 172 | *     Failure: NULL | 
|---|
| 173 | */ | 
|---|
| 174 |  | 
|---|
| 175 |  | 
|---|
| 176 | LPVOID WINAPI COMCTL32_Alloc (DWORD dwSize) | 
|---|
| 177 | { | 
|---|
| 178 | LPVOID lpPtr; | 
|---|
| 179 |  | 
|---|
| 180 | dprintf2(("COMCTL32: COMCTL32_Alloc")); | 
|---|
| 181 |  | 
|---|
| 182 | lpPtr = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize); | 
|---|
| 183 |  | 
|---|
| 184 | return lpPtr; | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 |  | 
|---|
| 188 | /************************************************************************** | 
|---|
| 189 | * ReAlloc [COMCTL32.72] | 
|---|
| 190 | * | 
|---|
| 191 | * Changes the size of an allocated memory block or allocates a memory | 
|---|
| 192 | * block using the dll's private heap. | 
|---|
| 193 | * | 
|---|
| 194 | * PARAMS | 
|---|
| 195 | *     lpSrc  [I] pointer to memory block which will be resized | 
|---|
| 196 | *     dwSize [I] new size of the memory block. | 
|---|
| 197 | * | 
|---|
| 198 | * RETURNS | 
|---|
| 199 | *     Success: pointer to the resized memory block | 
|---|
| 200 | *     Failure: NULL | 
|---|
| 201 | * | 
|---|
| 202 | * NOTES | 
|---|
| 203 | *     If lpSrc is a NULL-pointer, then COMCTL32_ReAlloc allocates a memory | 
|---|
| 204 | *     block like COMCTL32_Alloc. | 
|---|
| 205 | */ | 
|---|
| 206 |  | 
|---|
| 207 | LPVOID WINAPI COMCTL32_ReAlloc (LPVOID lpSrc, DWORD dwSize) | 
|---|
| 208 | { | 
|---|
| 209 | LPVOID lpDest; | 
|---|
| 210 |  | 
|---|
| 211 | dprintf2(("COMCTL32: COMCTL32_ReAlloc")); | 
|---|
| 212 |  | 
|---|
| 213 | if (lpSrc) | 
|---|
| 214 | lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize); | 
|---|
| 215 | else | 
|---|
| 216 | lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize); | 
|---|
| 217 |  | 
|---|
| 218 | return lpDest; | 
|---|
| 219 | } | 
|---|
| 220 |  | 
|---|
| 221 |  | 
|---|
| 222 | /************************************************************************** | 
|---|
| 223 | * Free [COMCTL32.73] | 
|---|
| 224 | * | 
|---|
| 225 | * Frees an allocated memory block from the dll's private heap. | 
|---|
| 226 | * | 
|---|
| 227 | * PARAMS | 
|---|
| 228 | *     lpMem [I] pointer to memory block which will be freed | 
|---|
| 229 | * | 
|---|
| 230 | * RETURNS | 
|---|
| 231 | *     Success: TRUE | 
|---|
| 232 | *     Failure: FALSE | 
|---|
| 233 | */ | 
|---|
| 234 |  | 
|---|
| 235 | BOOL WINAPI COMCTL32_Free (LPVOID lpMem) | 
|---|
| 236 | { | 
|---|
| 237 | dprintf2(("COMCTL32: COMCTL32_Free")); | 
|---|
| 238 |  | 
|---|
| 239 | return HeapFree (COMCTL32_hHeap, 0, lpMem); | 
|---|
| 240 | } | 
|---|
| 241 |  | 
|---|
| 242 |  | 
|---|
| 243 | /************************************************************************** | 
|---|
| 244 | * GetSize [COMCTL32.74] | 
|---|
| 245 | * | 
|---|
| 246 | * Retrieves the size of the specified memory block from the dll's | 
|---|
| 247 | * private heap. | 
|---|
| 248 | * | 
|---|
| 249 | * PARAMS | 
|---|
| 250 | *     lpMem [I] pointer to an allocated memory block | 
|---|
| 251 | * | 
|---|
| 252 | * RETURNS | 
|---|
| 253 | *     Success: size of the specified memory block | 
|---|
| 254 | *     Failure: 0 | 
|---|
| 255 | */ | 
|---|
| 256 |  | 
|---|
| 257 | DWORD WINAPI COMCTL32_GetSize (LPVOID lpMem) | 
|---|
| 258 | { | 
|---|
| 259 | dprintf2(("COMCTL32: COMCTL32_GetSize")); | 
|---|
| 260 |  | 
|---|
| 261 | return HeapSize (COMCTL32_hHeap, 0, lpMem); | 
|---|
| 262 | } | 
|---|
| 263 |  | 
|---|
| 264 |  | 
|---|
| 265 | /************************************************************************** | 
|---|
| 266 | * The MRU-API is a set of functions to manipulate MRU(Most Recently Used) | 
|---|
| 267 | * lists. | 
|---|
| 268 | * | 
|---|
| 269 | * Stored in the reg. as a set of values under a single key.  Each item in the | 
|---|
| 270 | * list has a value name that is a single char. 'a' - 'z', '{', '|' or '}'. | 
|---|
| 271 | * The order of the list is stored with value name 'MRUList' which is a string | 
|---|
| 272 | * containing the value names (i.e. 'a', 'b', etc.) in the relevant order. | 
|---|
| 273 | */ | 
|---|
| 274 |  | 
|---|
| 275 | typedef struct tagCREATEMRULIST | 
|---|
| 276 | { | 
|---|
| 277 | DWORD  cbSize;        /* size of struct */ | 
|---|
| 278 | DWORD  nMaxItems;     /* max no. of items in list */ | 
|---|
| 279 | DWORD  dwFlags;       /* see below */ | 
|---|
| 280 | HKEY   hKey;          /* root reg. key under which list is saved */ | 
|---|
| 281 | LPCSTR lpszSubKey;    /* reg. subkey */ | 
|---|
| 282 | PROC   lpfnCompare;   /* item compare proc */ | 
|---|
| 283 | } CREATEMRULIST, *LPCREATEMRULIST; | 
|---|
| 284 |  | 
|---|
| 285 | /* dwFlags */ | 
|---|
| 286 | #define MRUF_STRING_LIST  0 /* list will contain strings */ | 
|---|
| 287 | #define MRUF_BINARY_LIST  1 /* list will contain binary data */ | 
|---|
| 288 | #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */ | 
|---|
| 289 |  | 
|---|
| 290 | /* If list is a string list lpfnCompare has the following prototype | 
|---|
| 291 | * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2) | 
|---|
| 292 | * for binary lists the prototype is | 
|---|
| 293 | * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData) | 
|---|
| 294 | * where cbData is the no. of bytes to compare. | 
|---|
| 295 | * Need to check what return value means identical - 0? | 
|---|
| 296 | */ | 
|---|
| 297 |  | 
|---|
| 298 | typedef struct tagMRU | 
|---|
| 299 | { | 
|---|
| 300 | DWORD  dwParam1;  /* some kind of flag */ | 
|---|
| 301 | DWORD  dwParam2; | 
|---|
| 302 | DWORD  dwParam3; | 
|---|
| 303 | HKEY   hkeyMRU; | 
|---|
| 304 | LPCSTR lpszSubKey; | 
|---|
| 305 | DWORD  dwParam6; | 
|---|
| 306 | } MRU, *HMRU; | 
|---|
| 307 |  | 
|---|
| 308 | HANDLE WINAPI | 
|---|
| 309 | CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2, | 
|---|
| 310 | DWORD dwParam3, DWORD dwParam4); | 
|---|
| 311 |  | 
|---|
| 312 |  | 
|---|
| 313 | /************************************************************************** | 
|---|
| 314 | *              CreateMRUListA [COMCTL32.151] | 
|---|
| 315 | * | 
|---|
| 316 | * PARAMS | 
|---|
| 317 | *     lpcml [I] ptr to CREATEMRULIST structure. | 
|---|
| 318 | * | 
|---|
| 319 | * RETURNS | 
|---|
| 320 | *     Handle to MRU list. | 
|---|
| 321 | */ | 
|---|
| 322 | HANDLE WINAPI | 
|---|
| 323 | CreateMRUListA (LPCREATEMRULIST lpcml) | 
|---|
| 324 | { | 
|---|
| 325 | dprintf(("COMCTL32: CreateMRUListA")); | 
|---|
| 326 |  | 
|---|
| 327 | return CreateMRUListLazyA (lpcml, 0, 0, 0); | 
|---|
| 328 | } | 
|---|
| 329 |  | 
|---|
| 330 | /************************************************************************** | 
|---|
| 331 | *              FreeMRUListA [COMCTL32.152] | 
|---|
| 332 | * | 
|---|
| 333 | * PARAMS | 
|---|
| 334 | *     hMRUList [I] Handle to list. | 
|---|
| 335 | * | 
|---|
| 336 | */ | 
|---|
| 337 | DWORD WINAPI | 
|---|
| 338 | FreeMRUListA (HANDLE hMRUList) | 
|---|
| 339 | { | 
|---|
| 340 | dprintf(("COMCTL32: FreeMRUListA")); | 
|---|
| 341 | //FIXME("(%08x) empty stub!\n", hMRUList); | 
|---|
| 342 |  | 
|---|
| 343 | #if 0 | 
|---|
| 344 | if (!(hmru->dwParam1 & 1001)) { | 
|---|
| 345 | RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ, | 
|---|
| 346 | hmru->lpszMRUString, | 
|---|
| 347 | lstrlenA (hmru->lpszMRUString)); | 
|---|
| 348 | } | 
|---|
| 349 |  | 
|---|
| 350 |  | 
|---|
| 351 | RegClosKey (hmru->hkeyMRU | 
|---|
| 352 | COMCTL32_Free32 (hmru->lpszMRUString); | 
|---|
| 353 | #endif | 
|---|
| 354 |  | 
|---|
| 355 | return COMCTL32_Free ((LPVOID)hMRUList); | 
|---|
| 356 | } | 
|---|
| 357 |  | 
|---|
| 358 |  | 
|---|
| 359 | /************************************************************************** | 
|---|
| 360 | *              AddMRUData [COMCTL32.167] | 
|---|
| 361 | * | 
|---|
| 362 | * Add item to MRU binary list.  If item already exists in list them it is | 
|---|
| 363 | * simply moved up to the top of the list and not added again.  If list is | 
|---|
| 364 | * full then the least recently used item is removed to make room. | 
|---|
| 365 | * | 
|---|
| 366 | * PARAMS | 
|---|
| 367 | *     hList [I] Handle to list. | 
|---|
| 368 | *     lpData [I] ptr to data to add. | 
|---|
| 369 | *     cbData [I] no. of bytes of data. | 
|---|
| 370 | * | 
|---|
| 371 | * RETURNS | 
|---|
| 372 | *     No. corresponding to registry name where value is stored 'a' -> 0 etc. | 
|---|
| 373 | *     -1 on error. | 
|---|
| 374 | */ | 
|---|
| 375 | INT WINAPI | 
|---|
| 376 | AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData) | 
|---|
| 377 | { | 
|---|
| 378 | dprintf(("COMCTL32: AddMRUData - empty stub!")); | 
|---|
| 379 |  | 
|---|
| 380 | return 0; | 
|---|
| 381 | } | 
|---|
| 382 |  | 
|---|
| 383 | /************************************************************************** | 
|---|
| 384 | *              AddMRUStringA [COMCTL32.153] | 
|---|
| 385 | * | 
|---|
| 386 | * Add item to MRU string list.  If item already exists in list them it is | 
|---|
| 387 | * simply moved up to the top of the list and not added again.  If list is | 
|---|
| 388 | * full then the least recently used item is removed to make room. | 
|---|
| 389 | * | 
|---|
| 390 | * PARAMS | 
|---|
| 391 | *     hList [I] Handle to list. | 
|---|
| 392 | *     lpszString [I] ptr to string to add. | 
|---|
| 393 | * | 
|---|
| 394 | * RETURNS | 
|---|
| 395 | *     No. corresponding to registry name where value is stored 'a' -> 0 etc. | 
|---|
| 396 | *     -1 on error. | 
|---|
| 397 | */ | 
|---|
| 398 | INT WINAPI | 
|---|
| 399 | AddMRUStringA(HANDLE hList, LPCSTR lpszString) | 
|---|
| 400 | { | 
|---|
| 401 | dprintf(("COMCTL32: AddMRUStringA - empty stub!")); | 
|---|
| 402 |  | 
|---|
| 403 | return 0; | 
|---|
| 404 | } | 
|---|
| 405 |  | 
|---|
| 406 | /************************************************************************** | 
|---|
| 407 | *              DelMRUString [COMCTL32.156] | 
|---|
| 408 | * | 
|---|
| 409 | * Removes item from either string or binary list (despite its name) | 
|---|
| 410 | * | 
|---|
| 411 | * PARAMS | 
|---|
| 412 | *    hList [I] list handle | 
|---|
| 413 | *    nItemPos [I] item position to remove 0 -> MRU | 
|---|
| 414 | * | 
|---|
| 415 | * RETURNS | 
|---|
| 416 | *    TRUE is successful, FALSE if nItemPos is out of range. | 
|---|
| 417 | */ | 
|---|
| 418 | BOOL WINAPI | 
|---|
| 419 | DelMRUString(HANDLE hList, INT nItemPos) | 
|---|
| 420 | { | 
|---|
| 421 | dprintf(("COMCTL32: DelMRUString - empty stub!")); | 
|---|
| 422 |  | 
|---|
| 423 | return TRUE; | 
|---|
| 424 | } | 
|---|
| 425 |  | 
|---|
| 426 | /************************************************************************** | 
|---|
| 427 | *                  FindMRUData [COMCTL32.169] | 
|---|
| 428 | * | 
|---|
| 429 | * Searches binary list for item that matches lpData of length cbData. | 
|---|
| 430 | * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value | 
|---|
| 431 | * corresponding to item's reg. name will be stored in it ('a' -> 0). | 
|---|
| 432 | * | 
|---|
| 433 | * PARAMS | 
|---|
| 434 | *    hList [I] list handle | 
|---|
| 435 | *    lpData [I] data to find | 
|---|
| 436 | *    cbData [I] length of data | 
|---|
| 437 | *    lpRegNum [O] position in registry (maybe NULL) | 
|---|
| 438 | * | 
|---|
| 439 | * RETURNS | 
|---|
| 440 | *    Position in list 0 -> MRU.  -1 if item not found. | 
|---|
| 441 | */ | 
|---|
| 442 | INT WINAPI | 
|---|
| 443 | FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum) | 
|---|
| 444 | { | 
|---|
| 445 | dprintf(("COMCTL32: FindMRUData - empty stub!")); | 
|---|
| 446 |  | 
|---|
| 447 | return 0; | 
|---|
| 448 | } | 
|---|
| 449 |  | 
|---|
| 450 | /************************************************************************** | 
|---|
| 451 | *                  FindMRUStringA [COMCTL32.155] | 
|---|
| 452 | * | 
|---|
| 453 | * Searches string list for item that matches lpszString. | 
|---|
| 454 | * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value | 
|---|
| 455 | * corresponding to item's reg. name will be stored in it ('a' -> 0). | 
|---|
| 456 | * | 
|---|
| 457 | * PARAMS | 
|---|
| 458 | *    hList [I] list handle | 
|---|
| 459 | *    lpszString [I] string to find | 
|---|
| 460 | *    lpRegNum [O] position in registry (maybe NULL) | 
|---|
| 461 | * | 
|---|
| 462 | * RETURNS | 
|---|
| 463 | *    Position in list 0 -> MRU.  -1 if item not found. | 
|---|
| 464 | */ | 
|---|
| 465 | INT WINAPI | 
|---|
| 466 | FindMRUStringA (HANDLE hList, LPCSTR lpszString, LPINT lpRegNum) | 
|---|
| 467 | { | 
|---|
| 468 | dprintf(("COMCTL32: FindMRUStringA - empty stub!")); | 
|---|
| 469 |  | 
|---|
| 470 | return 0; | 
|---|
| 471 | } | 
|---|
| 472 |  | 
|---|
| 473 | HANDLE WINAPI | 
|---|
| 474 | CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4) | 
|---|
| 475 | { | 
|---|
| 476 | /* DWORD  dwLocal1;   * | 
|---|
| 477 | * HKEY   hkeyResult; * | 
|---|
| 478 | * DWORD  dwLocal3;   * | 
|---|
| 479 | * LPVOID lMRU;       * | 
|---|
| 480 | * DWORD  dwLocal5;   * | 
|---|
| 481 | * DWORD  dwLocal6;   * | 
|---|
| 482 | * DWORD  dwLocal7;   * | 
|---|
| 483 | * DWORD  dwDisposition; */ | 
|---|
| 484 |  | 
|---|
| 485 | /* internal variables */ | 
|---|
| 486 | LPVOID ptr; | 
|---|
| 487 |  | 
|---|
| 488 | dprintf(("COMCTL32: CreateMRUListLazyA - empty stub!")); | 
|---|
| 489 |  | 
|---|
| 490 | if (lpcml == NULL) | 
|---|
| 491 | return 0; | 
|---|
| 492 |  | 
|---|
| 493 | if (lpcml->cbSize < sizeof(CREATEMRULIST)) | 
|---|
| 494 | return 0; | 
|---|
| 495 |  | 
|---|
| 496 | //FIXME("(%lu %lu %lx %lx \"%s\" %p)\n", | 
|---|
| 497 | //      lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags, | 
|---|
| 498 | //      (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare); | 
|---|
| 499 |  | 
|---|
| 500 | /* dummy pointer creation */ | 
|---|
| 501 | ptr = COMCTL32_Alloc (32); | 
|---|
| 502 |  | 
|---|
| 503 | //FIXME("-- ret = %p\n", ptr); | 
|---|
| 504 |  | 
|---|
| 505 | return (HANDLE)ptr; | 
|---|
| 506 | } | 
|---|
| 507 |  | 
|---|
| 508 | /************************************************************************** | 
|---|
| 509 | *                EnumMRUListA [COMCTL32.154] | 
|---|
| 510 | * | 
|---|
| 511 | * Enumerate item in a list | 
|---|
| 512 | * | 
|---|
| 513 | * PARAMS | 
|---|
| 514 | *    hList [I] list handle | 
|---|
| 515 | *    nItemPos [I] item position to enumerate | 
|---|
| 516 | *    lpBuffer [O] buffer to receive item | 
|---|
| 517 | *    nBufferSize [I] size of buffer | 
|---|
| 518 | * | 
|---|
| 519 | * RETURNS | 
|---|
| 520 | *    For binary lists specifies how many bytes were copied to buffer, for | 
|---|
| 521 | *    string lists specifies full length of string.  Enumerating past the end | 
|---|
| 522 | *    of list returns -1. | 
|---|
| 523 | *    If lpBuffer == NULL or nItemPos is -ve return value is no. of items in | 
|---|
| 524 | *    the list. | 
|---|
| 525 | */ | 
|---|
| 526 | INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, | 
|---|
| 527 | DWORD nBufferSize) | 
|---|
| 528 | { | 
|---|
| 529 | dprintf(("COMCTL32: EnumMRUListA - empty stub!")); | 
|---|
| 530 |  | 
|---|
| 531 | return 0; | 
|---|
| 532 | } | 
|---|
| 533 |  | 
|---|
| 534 |  | 
|---|
| 535 |  | 
|---|
| 536 | /************************************************************************** | 
|---|
| 537 | * Str_GetPtrA [COMCTL32.233] | 
|---|
| 538 | * | 
|---|
| 539 | * PARAMS | 
|---|
| 540 | *     lpSrc   [I] | 
|---|
| 541 | *     lpDest  [O] | 
|---|
| 542 | *     nMaxLen [I] | 
|---|
| 543 | * | 
|---|
| 544 | * RETURNS | 
|---|
| 545 | */ | 
|---|
| 546 |  | 
|---|
| 547 | INT WINAPI | 
|---|
| 548 | Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) | 
|---|
| 549 | { | 
|---|
| 550 | INT len; | 
|---|
| 551 |  | 
|---|
| 552 | dprintf(("COMCTL32: Str_GetPtrA")); | 
|---|
| 553 |  | 
|---|
| 554 | if (!lpDest && lpSrc) | 
|---|
| 555 | return lstrlenA (lpSrc); | 
|---|
| 556 |  | 
|---|
| 557 | if (nMaxLen == 0) | 
|---|
| 558 | return 0; | 
|---|
| 559 |  | 
|---|
| 560 | if (lpSrc == NULL) { | 
|---|
| 561 | lpDest[0] = '\0'; | 
|---|
| 562 | return 0; | 
|---|
| 563 | } | 
|---|
| 564 |  | 
|---|
| 565 | len = lstrlenA (lpSrc); | 
|---|
| 566 | if (len >= nMaxLen) | 
|---|
| 567 | len = nMaxLen - 1; | 
|---|
| 568 |  | 
|---|
| 569 | RtlMoveMemory (lpDest, lpSrc, len); | 
|---|
| 570 | lpDest[len] = '\0'; | 
|---|
| 571 |  | 
|---|
| 572 | return len; | 
|---|
| 573 | } | 
|---|
| 574 |  | 
|---|
| 575 |  | 
|---|
| 576 | /************************************************************************** | 
|---|
| 577 | * Str_SetPtrA [COMCTL32.234] | 
|---|
| 578 | * | 
|---|
| 579 | * PARAMS | 
|---|
| 580 | *     lppDest [O] | 
|---|
| 581 | *     lpSrc   [I] | 
|---|
| 582 | * | 
|---|
| 583 | * RETURNS | 
|---|
| 584 | */ | 
|---|
| 585 |  | 
|---|
| 586 | BOOL WINAPI | 
|---|
| 587 | Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc) | 
|---|
| 588 | { | 
|---|
| 589 | dprintf(("COMCTL32: Str_SetPtrA")); | 
|---|
| 590 |  | 
|---|
| 591 | if (lpSrc) { | 
|---|
| 592 | LPSTR ptr = (LPSTR)COMCTL32_ReAlloc (*lppDest, lstrlenA (lpSrc) + 1); | 
|---|
| 593 | if (!ptr) | 
|---|
| 594 | return FALSE; | 
|---|
| 595 | lstrcpyA (ptr, lpSrc); | 
|---|
| 596 | *lppDest = ptr; | 
|---|
| 597 | } | 
|---|
| 598 | else { | 
|---|
| 599 | if (*lppDest) { | 
|---|
| 600 | COMCTL32_Free (*lppDest); | 
|---|
| 601 | *lppDest = NULL; | 
|---|
| 602 | } | 
|---|
| 603 | } | 
|---|
| 604 |  | 
|---|
| 605 | return TRUE; | 
|---|
| 606 | } | 
|---|
| 607 |  | 
|---|
| 608 |  | 
|---|
| 609 | /************************************************************************** | 
|---|
| 610 | * Str_GetPtrW [COMCTL32.235] | 
|---|
| 611 | * | 
|---|
| 612 | * PARAMS | 
|---|
| 613 | *     lpSrc   [I] | 
|---|
| 614 | *     lpDest  [O] | 
|---|
| 615 | *     nMaxLen [I] | 
|---|
| 616 | * | 
|---|
| 617 | * RETURNS | 
|---|
| 618 | */ | 
|---|
| 619 |  | 
|---|
| 620 | INT WINAPI | 
|---|
| 621 | Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen) | 
|---|
| 622 | { | 
|---|
| 623 | INT len; | 
|---|
| 624 |  | 
|---|
| 625 | dprintf(("COMCTL32: Str_GetPtrW")); | 
|---|
| 626 |  | 
|---|
| 627 | if (!lpDest && lpSrc) | 
|---|
| 628 | return lstrlenW (lpSrc); | 
|---|
| 629 |  | 
|---|
| 630 | if (nMaxLen == 0) | 
|---|
| 631 | return 0; | 
|---|
| 632 |  | 
|---|
| 633 | if (lpSrc == NULL) { | 
|---|
| 634 | lpDest[0] = L'\0'; | 
|---|
| 635 | return 0; | 
|---|
| 636 | } | 
|---|
| 637 |  | 
|---|
| 638 | len = lstrlenW (lpSrc); | 
|---|
| 639 | if (len >= nMaxLen) | 
|---|
| 640 | len = nMaxLen - 1; | 
|---|
| 641 |  | 
|---|
| 642 | RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR)); | 
|---|
| 643 | lpDest[len] = L'\0'; | 
|---|
| 644 |  | 
|---|
| 645 | return len; | 
|---|
| 646 | } | 
|---|
| 647 |  | 
|---|
| 648 |  | 
|---|
| 649 | /************************************************************************** | 
|---|
| 650 | * Str_SetPtrW [COMCTL32.236] | 
|---|
| 651 | * | 
|---|
| 652 | * PARAMS | 
|---|
| 653 | *     lpDest [O] | 
|---|
| 654 | *     lpSrc  [I] | 
|---|
| 655 | * | 
|---|
| 656 | * RETURNS | 
|---|
| 657 | */ | 
|---|
| 658 |  | 
|---|
| 659 | BOOL WINAPI | 
|---|
| 660 | Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc) | 
|---|
| 661 | { | 
|---|
| 662 | dprintf(("COMCTL32: Str_SetPtrW")); | 
|---|
| 663 |  | 
|---|
| 664 | if (lpSrc) { | 
|---|
| 665 | INT len = lstrlenW (lpSrc) + 1; | 
|---|
| 666 | LPWSTR ptr = (LPWSTR)COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR)); | 
|---|
| 667 | if (!ptr) | 
|---|
| 668 | return FALSE; | 
|---|
| 669 | lstrcpyW (ptr, lpSrc); | 
|---|
| 670 | *lppDest = ptr; | 
|---|
| 671 | } | 
|---|
| 672 | else { | 
|---|
| 673 | if (*lppDest) { | 
|---|
| 674 | COMCTL32_Free (*lppDest); | 
|---|
| 675 | *lppDest = NULL; | 
|---|
| 676 | } | 
|---|
| 677 | } | 
|---|
| 678 |  | 
|---|
| 679 | return TRUE; | 
|---|
| 680 | } | 
|---|
| 681 |  | 
|---|
| 682 |  | 
|---|
| 683 | /************************************************************************** | 
|---|
| 684 | * The DSA-API is a set of functions to create and manipulate arrays of | 
|---|
| 685 | * fix sized memory blocks. These arrays can store any kind of data | 
|---|
| 686 | * (strings, icons...). | 
|---|
| 687 | */ | 
|---|
| 688 |  | 
|---|
| 689 | /************************************************************************** | 
|---|
| 690 | * DSA_Create [COMCTL32.320] Creates a dynamic storage array | 
|---|
| 691 | * | 
|---|
| 692 | * PARAMS | 
|---|
| 693 | *     nSize [I] size of the array elements | 
|---|
| 694 | *     nGrow [I] number of elements by which the array grows when it is filled | 
|---|
| 695 | * | 
|---|
| 696 | * RETURNS | 
|---|
| 697 | *     Success: pointer to a array control structure. use this like a handle. | 
|---|
| 698 | *     Failure: NULL | 
|---|
| 699 | */ | 
|---|
| 700 |  | 
|---|
| 701 | HDSA WINAPI | 
|---|
| 702 | DSA_Create (INT nSize, INT nGrow) | 
|---|
| 703 | { | 
|---|
| 704 | HDSA hdsa; | 
|---|
| 705 |  | 
|---|
| 706 | dprintf(("COMCTL32: DSA_Create")); | 
|---|
| 707 |  | 
|---|
| 708 | hdsa = (HDSA)COMCTL32_Alloc (sizeof(DSA)); | 
|---|
| 709 | if (hdsa) | 
|---|
| 710 | { | 
|---|
| 711 | hdsa->nItemCount = 0; | 
|---|
| 712 | hdsa->pData = NULL; | 
|---|
| 713 | hdsa->nMaxCount = 0; | 
|---|
| 714 | hdsa->nItemSize = nSize; | 
|---|
| 715 | hdsa->nGrow = MAX(1, nGrow); | 
|---|
| 716 | } | 
|---|
| 717 |  | 
|---|
| 718 | return hdsa; | 
|---|
| 719 | } | 
|---|
| 720 |  | 
|---|
| 721 |  | 
|---|
| 722 | /************************************************************************** | 
|---|
| 723 | * DSA_Destroy [COMCTL32.321] Destroys a dynamic storage array | 
|---|
| 724 | * | 
|---|
| 725 | * PARAMS | 
|---|
| 726 | *     hdsa [I] pointer to the array control structure | 
|---|
| 727 | * | 
|---|
| 728 | * RETURNS | 
|---|
| 729 | *     Success: TRUE | 
|---|
| 730 | *     Failure: FALSE | 
|---|
| 731 | */ | 
|---|
| 732 |  | 
|---|
| 733 | BOOL WINAPI | 
|---|
| 734 | DSA_Destroy (const HDSA hdsa) | 
|---|
| 735 | { | 
|---|
| 736 | dprintf(("COMCTL32: DSA_Destroy")); | 
|---|
| 737 |  | 
|---|
| 738 | if (!hdsa) | 
|---|
| 739 | return FALSE; | 
|---|
| 740 |  | 
|---|
| 741 | if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) | 
|---|
| 742 | return FALSE; | 
|---|
| 743 |  | 
|---|
| 744 | return COMCTL32_Free (hdsa); | 
|---|
| 745 | } | 
|---|
| 746 |  | 
|---|
| 747 |  | 
|---|
| 748 | /************************************************************************** | 
|---|
| 749 | * DSA_GetItem [COMCTL32.322] | 
|---|
| 750 | * | 
|---|
| 751 | * PARAMS | 
|---|
| 752 | *     hdsa   [I] pointer to the array control structure | 
|---|
| 753 | *     nIndex [I] number of the Item to get | 
|---|
| 754 | *     pDest  [O] destination buffer. Has to be >= dwElementSize. | 
|---|
| 755 | * | 
|---|
| 756 | * RETURNS | 
|---|
| 757 | *     Success: TRUE | 
|---|
| 758 | *     Failure: FALSE | 
|---|
| 759 | */ | 
|---|
| 760 |  | 
|---|
| 761 | BOOL WINAPI | 
|---|
| 762 | DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest) | 
|---|
| 763 | { | 
|---|
| 764 | LPVOID pSrc; | 
|---|
| 765 |  | 
|---|
| 766 | dprintf2(("COMCTL32: DSA_GetItem")); | 
|---|
| 767 |  | 
|---|
| 768 | if (!hdsa) | 
|---|
| 769 | return FALSE; | 
|---|
| 770 | if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) | 
|---|
| 771 | return FALSE; | 
|---|
| 772 |  | 
|---|
| 773 | pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); | 
|---|
| 774 | memmove (pDest, pSrc, hdsa->nItemSize); | 
|---|
| 775 |  | 
|---|
| 776 | return TRUE; | 
|---|
| 777 | } | 
|---|
| 778 |  | 
|---|
| 779 |  | 
|---|
| 780 | /************************************************************************** | 
|---|
| 781 | * DSA_GetItemPtr [COMCTL32.323] | 
|---|
| 782 | * | 
|---|
| 783 | * Retrieves a pointer to the specified item. | 
|---|
| 784 | * | 
|---|
| 785 | * PARAMS | 
|---|
| 786 | *     hdsa   [I] pointer to the array control structure | 
|---|
| 787 | *     nIndex [I] index of the desired item | 
|---|
| 788 | * | 
|---|
| 789 | * RETURNS | 
|---|
| 790 | *     Success: pointer to an item | 
|---|
| 791 | *     Failure: NULL | 
|---|
| 792 | */ | 
|---|
| 793 |  | 
|---|
| 794 | LPVOID WINAPI | 
|---|
| 795 | DSA_GetItemPtr (const HDSA hdsa, INT nIndex) | 
|---|
| 796 | { | 
|---|
| 797 | LPVOID pSrc; | 
|---|
| 798 |  | 
|---|
| 799 | dprintf2(("COMCTL32: DSA_GetItemPtr")); | 
|---|
| 800 |  | 
|---|
| 801 | if (!hdsa) | 
|---|
| 802 | return NULL; | 
|---|
| 803 | if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) | 
|---|
| 804 | return NULL; | 
|---|
| 805 |  | 
|---|
| 806 | pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); | 
|---|
| 807 |  | 
|---|
| 808 | //    TRACE (commctrl, "-- ret=%p\n", pSrc); | 
|---|
| 809 |  | 
|---|
| 810 | return  pSrc; | 
|---|
| 811 | } | 
|---|
| 812 |  | 
|---|
| 813 |  | 
|---|
| 814 | /************************************************************************** | 
|---|
| 815 | * DSA_SetItem [COMCTL32.325] | 
|---|
| 816 | * | 
|---|
| 817 | * Sets the contents of an item in the array. | 
|---|
| 818 | * | 
|---|
| 819 | * PARAMS | 
|---|
| 820 | *     hdsa   [I] pointer to the array control structure | 
|---|
| 821 | *     nIndex [I] index for the item | 
|---|
| 822 | *     pSrc   [I] pointer to the new item data | 
|---|
| 823 | * | 
|---|
| 824 | * RETURNS | 
|---|
| 825 | *     Success: TRUE | 
|---|
| 826 | *     Failure: FALSE | 
|---|
| 827 | */ | 
|---|
| 828 |  | 
|---|
| 829 | BOOL WINAPI | 
|---|
| 830 | DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) | 
|---|
| 831 | { | 
|---|
| 832 | INT  nSize, nNewItems; | 
|---|
| 833 | LPVOID pDest, lpTemp; | 
|---|
| 834 |  | 
|---|
| 835 | dprintf2(("COMCTL32: DSA_SetItem")); | 
|---|
| 836 |  | 
|---|
| 837 | if ((!hdsa) || nIndex < 0) | 
|---|
| 838 | return FALSE; | 
|---|
| 839 |  | 
|---|
| 840 | if (hdsa->nItemCount <= nIndex) { | 
|---|
| 841 | /* within the old array */ | 
|---|
| 842 | if (hdsa->nMaxCount > nIndex) { | 
|---|
| 843 | /* within the allocated space, set a new boundary */ | 
|---|
| 844 | hdsa->nItemCount = nIndex + 1; | 
|---|
| 845 | } | 
|---|
| 846 | else { | 
|---|
| 847 | /* resize the block of memory */ | 
|---|
| 848 | nNewItems = | 
|---|
| 849 | hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1); | 
|---|
| 850 | nSize = hdsa->nItemSize * nNewItems; | 
|---|
| 851 |  | 
|---|
| 852 | lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); | 
|---|
| 853 | if (!lpTemp) | 
|---|
| 854 | return FALSE; | 
|---|
| 855 |  | 
|---|
| 856 | hdsa->nMaxCount = nNewItems; | 
|---|
| 857 | hdsa->nItemCount = nIndex + 1; | 
|---|
| 858 | hdsa->pData = lpTemp; | 
|---|
| 859 | } | 
|---|
| 860 | } | 
|---|
| 861 |  | 
|---|
| 862 | /* put the new entry in */ | 
|---|
| 863 | pDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); | 
|---|
| 864 | //    TRACE("-- move dest=%p src=%p size=%d\n", | 
|---|
| 865 | //         pDest, pSrc, hdsa->nItemSize); | 
|---|
| 866 | memmove (pDest, pSrc, hdsa->nItemSize); | 
|---|
| 867 |  | 
|---|
| 868 | return TRUE; | 
|---|
| 869 | } | 
|---|
| 870 |  | 
|---|
| 871 |  | 
|---|
| 872 | /************************************************************************** | 
|---|
| 873 | * DSA_InsertItem [COMCTL32.325] | 
|---|
| 874 | * | 
|---|
| 875 | * PARAMS | 
|---|
| 876 | *     hdsa   [I] pointer to the array control structure | 
|---|
| 877 | *     nIndex [I] index for the new item | 
|---|
| 878 | *     pSrc   [I] pointer to the element | 
|---|
| 879 | * | 
|---|
| 880 | * RETURNS | 
|---|
| 881 | *     Success: position of the new item | 
|---|
| 882 | *     Failure: -1 | 
|---|
| 883 | */ | 
|---|
| 884 |  | 
|---|
| 885 | INT WINAPI | 
|---|
| 886 | DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) | 
|---|
| 887 | { | 
|---|
| 888 | INT   nNewItems, nSize, i; | 
|---|
| 889 | LPVOID  lpTemp, lpDest; | 
|---|
| 890 | LPDWORD p; | 
|---|
| 891 |  | 
|---|
| 892 | dprintf2(("COMCTL32: DSA_InsertItem")); | 
|---|
| 893 |  | 
|---|
| 894 | if ((!hdsa) || nIndex < 0) | 
|---|
| 895 | return -1; | 
|---|
| 896 |  | 
|---|
| 897 | for (i = 0; i < hdsa->nItemSize; i += 4) { | 
|---|
| 898 | p = *(DWORD**)((char *) pSrc + i); | 
|---|
| 899 | //      if (IsBadStringPtrA ((char*)p, 256)) | 
|---|
| 900 | //          TRACE("-- %d=%p\n", i, (DWORD*)p); | 
|---|
| 901 | //      else | 
|---|
| 902 | //          TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p)); | 
|---|
| 903 | } | 
|---|
| 904 |  | 
|---|
| 905 | /* when nIndex > nItemCount then append */ | 
|---|
| 906 | if (nIndex >= hdsa->nItemCount) | 
|---|
| 907 | nIndex = hdsa->nItemCount; | 
|---|
| 908 |  | 
|---|
| 909 | /* do we need to resize ? */ | 
|---|
| 910 | if (hdsa->nItemCount >= hdsa->nMaxCount) { | 
|---|
| 911 | nNewItems = hdsa->nMaxCount + hdsa->nGrow; | 
|---|
| 912 | nSize = hdsa->nItemSize * nNewItems; | 
|---|
| 913 |  | 
|---|
| 914 | lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); | 
|---|
| 915 | if (!lpTemp) | 
|---|
| 916 | return -1; | 
|---|
| 917 |  | 
|---|
| 918 | hdsa->nMaxCount = nNewItems; | 
|---|
| 919 | hdsa->pData = lpTemp; | 
|---|
| 920 | } | 
|---|
| 921 |  | 
|---|
| 922 | /* do we need to move elements ? */ | 
|---|
| 923 | if (nIndex < hdsa->nItemCount) { | 
|---|
| 924 | lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); | 
|---|
| 925 | lpDest = (char *) lpTemp + hdsa->nItemSize; | 
|---|
| 926 | nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize; | 
|---|
| 927 | //      TRACE("-- move dest=%p src=%p size=%d\n", | 
|---|
| 928 | //             lpDest, lpTemp, nSize); | 
|---|
| 929 | memmove (lpDest, lpTemp, nSize); | 
|---|
| 930 | } | 
|---|
| 931 |  | 
|---|
| 932 | /* ok, we can put the new Item in */ | 
|---|
| 933 | hdsa->nItemCount++; | 
|---|
| 934 | lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); | 
|---|
| 935 | //    TRACE("-- move dest=%p src=%p size=%d\n", | 
|---|
| 936 | //         lpDest, pSrc, hdsa->nItemSize); | 
|---|
| 937 | memmove (lpDest, pSrc, hdsa->nItemSize); | 
|---|
| 938 |  | 
|---|
| 939 | return hdsa->nItemCount; | 
|---|
| 940 | } | 
|---|
| 941 |  | 
|---|
| 942 |  | 
|---|
| 943 | /************************************************************************** | 
|---|
| 944 | * DSA_DeleteItem [COMCTL32.326] | 
|---|
| 945 | * | 
|---|
| 946 | * PARAMS | 
|---|
| 947 | *     hdsa   [I] pointer to the array control structure | 
|---|
| 948 | *     nIndex [I] index for the element to delete | 
|---|
| 949 | * | 
|---|
| 950 | * RETURNS | 
|---|
| 951 | *     Success: number of the deleted element | 
|---|
| 952 | *     Failure: -1 | 
|---|
| 953 | */ | 
|---|
| 954 |  | 
|---|
| 955 | INT WINAPI | 
|---|
| 956 | DSA_DeleteItem (const HDSA hdsa, INT nIndex) | 
|---|
| 957 | { | 
|---|
| 958 | LPVOID lpDest,lpSrc; | 
|---|
| 959 | INT  nSize; | 
|---|
| 960 |  | 
|---|
| 961 | dprintf2(("COMCTL32: DSA_DeleteItem")); | 
|---|
| 962 |  | 
|---|
| 963 | if (!hdsa) | 
|---|
| 964 | return -1; | 
|---|
| 965 | if (nIndex < 0 || nIndex >= hdsa->nItemCount) | 
|---|
| 966 | return -1; | 
|---|
| 967 |  | 
|---|
| 968 | /* do we need to move ? */ | 
|---|
| 969 | if (nIndex < hdsa->nItemCount - 1) { | 
|---|
| 970 | lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); | 
|---|
| 971 | lpSrc = (char *) lpDest + hdsa->nItemSize; | 
|---|
| 972 | nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1); | 
|---|
| 973 | //      TRACE (commctrl, "-- move dest=%p src=%p size=%d\n", | 
|---|
| 974 | //             lpDest, lpSrc, nSize); | 
|---|
| 975 | memmove (lpDest, lpSrc, nSize); | 
|---|
| 976 | } | 
|---|
| 977 |  | 
|---|
| 978 | hdsa->nItemCount--; | 
|---|
| 979 |  | 
|---|
| 980 | /* free memory ? */ | 
|---|
| 981 | if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) { | 
|---|
| 982 | nSize = MAX(2*hdsa->nGrow,hdsa->nItemSize)*hdsa->nItemCount; | 
|---|
| 983 |  | 
|---|
| 984 | lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); | 
|---|
| 985 | if (!lpDest) | 
|---|
| 986 | return -1; | 
|---|
| 987 |  | 
|---|
| 988 | hdsa->nMaxCount = hdsa->nItemCount; | 
|---|
| 989 | hdsa->pData = lpDest; | 
|---|
| 990 | } | 
|---|
| 991 |  | 
|---|
| 992 | return nIndex; | 
|---|
| 993 | } | 
|---|
| 994 |  | 
|---|
| 995 |  | 
|---|
| 996 | /************************************************************************** | 
|---|
| 997 | * DSA_DeleteAllItems [COMCTL32.326] | 
|---|
| 998 | * | 
|---|
| 999 | * Removes all items and reinitializes the array. | 
|---|
| 1000 | * | 
|---|
| 1001 | * PARAMS | 
|---|
| 1002 | *     hdsa [I] pointer to the array control structure | 
|---|
| 1003 | * | 
|---|
| 1004 | * RETURNS | 
|---|
| 1005 | *     Success: TRUE | 
|---|
| 1006 | *     Failure: FALSE | 
|---|
| 1007 | */ | 
|---|
| 1008 |  | 
|---|
| 1009 | BOOL WINAPI | 
|---|
| 1010 | DSA_DeleteAllItems (const HDSA hdsa) | 
|---|
| 1011 | { | 
|---|
| 1012 | dprintf(("COMCTL32: DSA_DeleteAllItems")); | 
|---|
| 1013 |  | 
|---|
| 1014 | if (!hdsa) | 
|---|
| 1015 | return FALSE; | 
|---|
| 1016 | if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) | 
|---|
| 1017 | return FALSE; | 
|---|
| 1018 |  | 
|---|
| 1019 | hdsa->nItemCount = 0; | 
|---|
| 1020 | hdsa->pData = NULL; | 
|---|
| 1021 | hdsa->nMaxCount = 0; | 
|---|
| 1022 |  | 
|---|
| 1023 | return TRUE; | 
|---|
| 1024 | } | 
|---|
| 1025 |  | 
|---|
| 1026 |  | 
|---|
| 1027 | /************************************************************************** | 
|---|
| 1028 | * The DPA-API is a set of functions to create and manipulate arrays of | 
|---|
| 1029 | * pointers. | 
|---|
| 1030 | */ | 
|---|
| 1031 |  | 
|---|
| 1032 | /************************************************************************** | 
|---|
| 1033 | * DPA_Create [COMCTL32.328] Creates a dynamic pointer array | 
|---|
| 1034 | * | 
|---|
| 1035 | * PARAMS | 
|---|
| 1036 | *     nGrow [I] number of items by which the array grows when it is filled | 
|---|
| 1037 | * | 
|---|
| 1038 | * RETURNS | 
|---|
| 1039 | *     Success: handle (pointer) to the pointer array. | 
|---|
| 1040 | *     Failure: NULL | 
|---|
| 1041 | */ | 
|---|
| 1042 |  | 
|---|
| 1043 | HDPA WINAPI | 
|---|
| 1044 | DPA_Create (INT nGrow) | 
|---|
| 1045 | { | 
|---|
| 1046 | HDPA hdpa; | 
|---|
| 1047 |  | 
|---|
| 1048 | dprintf(("COMCTL32: DPA_Create")); | 
|---|
| 1049 |  | 
|---|
| 1050 | hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); | 
|---|
| 1051 | if (hdpa) { | 
|---|
| 1052 | hdpa->nGrow = MAX(8, nGrow); | 
|---|
| 1053 | hdpa->hHeap = COMCTL32_hHeap; | 
|---|
| 1054 | hdpa->nMaxCount = hdpa->nGrow * 2; | 
|---|
| 1055 | hdpa->ptrs = | 
|---|
| 1056 | (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID)); | 
|---|
| 1057 | } | 
|---|
| 1058 |  | 
|---|
| 1059 | //    TRACE (commctrl, "-- %p\n", hdpa); | 
|---|
| 1060 |  | 
|---|
| 1061 | return hdpa; | 
|---|
| 1062 | } | 
|---|
| 1063 |  | 
|---|
| 1064 |  | 
|---|
| 1065 | /************************************************************************** | 
|---|
| 1066 | * DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array | 
|---|
| 1067 | * | 
|---|
| 1068 | * PARAMS | 
|---|
| 1069 | *     hdpa [I] handle (pointer) to the pointer array | 
|---|
| 1070 | * | 
|---|
| 1071 | * RETURNS | 
|---|
| 1072 | *     Success: TRUE | 
|---|
| 1073 | *     Failure: FALSE | 
|---|
| 1074 | */ | 
|---|
| 1075 |  | 
|---|
| 1076 | BOOL WINAPI | 
|---|
| 1077 | DPA_Destroy (const HDPA hdpa) | 
|---|
| 1078 | { | 
|---|
| 1079 | dprintf(("COMCTL32: DPA_Destroy")); | 
|---|
| 1080 |  | 
|---|
| 1081 | if (!hdpa) | 
|---|
| 1082 | return FALSE; | 
|---|
| 1083 |  | 
|---|
| 1084 | if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) | 
|---|
| 1085 | return FALSE; | 
|---|
| 1086 |  | 
|---|
| 1087 | return HeapFree (hdpa->hHeap, 0, hdpa); | 
|---|
| 1088 | } | 
|---|
| 1089 |  | 
|---|
| 1090 |  | 
|---|
| 1091 | /************************************************************************** | 
|---|
| 1092 | * DPA_Grow [COMCTL32.330] | 
|---|
| 1093 | * | 
|---|
| 1094 | * Sets the growth amount. | 
|---|
| 1095 | * | 
|---|
| 1096 | * PARAMS | 
|---|
| 1097 | *     hdpa  [I] handle (pointer) to the existing (source) pointer array | 
|---|
| 1098 | *     nGrow [I] number of items, the array grows, when it's too small | 
|---|
| 1099 | * | 
|---|
| 1100 | * RETURNS | 
|---|
| 1101 | *     Success: TRUE | 
|---|
| 1102 | *     Failure: FALSE | 
|---|
| 1103 | */ | 
|---|
| 1104 |  | 
|---|
| 1105 | BOOL WINAPI | 
|---|
| 1106 | DPA_Grow (const HDPA hdpa, INT nGrow) | 
|---|
| 1107 | { | 
|---|
| 1108 | dprintf(("COMCTL32: DPA_Grow")); | 
|---|
| 1109 |  | 
|---|
| 1110 | if (!hdpa) | 
|---|
| 1111 | return FALSE; | 
|---|
| 1112 |  | 
|---|
| 1113 | hdpa->nGrow = MAX(8, nGrow); | 
|---|
| 1114 |  | 
|---|
| 1115 | return TRUE; | 
|---|
| 1116 | } | 
|---|
| 1117 |  | 
|---|
| 1118 |  | 
|---|
| 1119 | /************************************************************************** | 
|---|
| 1120 | * DPA_Clone [COMCTL32.331] | 
|---|
| 1121 | * | 
|---|
| 1122 | * Copies a pointer array to an other one or creates a copy | 
|---|
| 1123 | * | 
|---|
| 1124 | * PARAMS | 
|---|
| 1125 | *     hdpa    [I] handle (pointer) to the existing (source) pointer array | 
|---|
| 1126 | *     hdpaNew [O] handle (pointer) to the destination pointer array | 
|---|
| 1127 | * | 
|---|
| 1128 | * RETURNS | 
|---|
| 1129 | *     Success: pointer to the destination pointer array. | 
|---|
| 1130 | *     Failure: NULL | 
|---|
| 1131 | * | 
|---|
| 1132 | * NOTES | 
|---|
| 1133 | *     - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer | 
|---|
| 1134 | *       array will be created and it's handle (pointer) is returned. | 
|---|
| 1135 | *     - If 'hdpa' is a NULL-Pointer, the original implementation crashes, | 
|---|
| 1136 | *       this implementation just returns NULL. | 
|---|
| 1137 | */ | 
|---|
| 1138 |  | 
|---|
| 1139 | HDPA WINAPI | 
|---|
| 1140 | DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) | 
|---|
| 1141 | { | 
|---|
| 1142 | INT nNewItems, nSize; | 
|---|
| 1143 | HDPA hdpaTemp; | 
|---|
| 1144 |  | 
|---|
| 1145 | dprintf(("COMCTL32: DPA_Clone")); | 
|---|
| 1146 |  | 
|---|
| 1147 | if (!hdpa) | 
|---|
| 1148 | return NULL; | 
|---|
| 1149 |  | 
|---|
| 1150 | if (!hdpaNew) { | 
|---|
| 1151 | /* create a new DPA */ | 
|---|
| 1152 | hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1153 | sizeof(DPA)); | 
|---|
| 1154 | hdpaTemp->hHeap = hdpa->hHeap; | 
|---|
| 1155 | hdpaTemp->nGrow = hdpa->nGrow; | 
|---|
| 1156 | } | 
|---|
| 1157 | else | 
|---|
| 1158 | hdpaTemp = hdpaNew; | 
|---|
| 1159 |  | 
|---|
| 1160 | if (hdpaTemp->ptrs) { | 
|---|
| 1161 | /* remove old pointer array */ | 
|---|
| 1162 | HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs); | 
|---|
| 1163 | hdpaTemp->ptrs = NULL; | 
|---|
| 1164 | hdpaTemp->nItemCount = 0; | 
|---|
| 1165 | hdpaTemp->nMaxCount = 0; | 
|---|
| 1166 | } | 
|---|
| 1167 |  | 
|---|
| 1168 | /* create a new pointer array */ | 
|---|
| 1169 | nNewItems = hdpaTemp->nGrow * | 
|---|
| 1170 | ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1); | 
|---|
| 1171 | nSize = nNewItems * sizeof(LPVOID); | 
|---|
| 1172 | hdpaTemp->ptrs = | 
|---|
| 1173 | (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); | 
|---|
| 1174 | hdpaTemp->nMaxCount = nNewItems; | 
|---|
| 1175 |  | 
|---|
| 1176 | /* clone the pointer array */ | 
|---|
| 1177 | hdpaTemp->nItemCount = hdpa->nItemCount; | 
|---|
| 1178 | memmove (hdpaTemp->ptrs, hdpa->ptrs, | 
|---|
| 1179 | hdpaTemp->nItemCount * sizeof(LPVOID)); | 
|---|
| 1180 |  | 
|---|
| 1181 | return hdpaTemp; | 
|---|
| 1182 | } | 
|---|
| 1183 |  | 
|---|
| 1184 |  | 
|---|
| 1185 | /************************************************************************** | 
|---|
| 1186 | * DPA_GetPtr [COMCTL32.332] | 
|---|
| 1187 | * | 
|---|
| 1188 | * Retrieves a pointer from a dynamic pointer array | 
|---|
| 1189 | * | 
|---|
| 1190 | * PARAMS | 
|---|
| 1191 | *     hdpa   [I] handle (pointer) to the pointer array | 
|---|
| 1192 | *     nIndex [I] array index of the desired pointer | 
|---|
| 1193 | * | 
|---|
| 1194 | * RETURNS | 
|---|
| 1195 | *     Success: pointer | 
|---|
| 1196 | *     Failure: NULL | 
|---|
| 1197 | */ | 
|---|
| 1198 |  | 
|---|
| 1199 | LPVOID WINAPI | 
|---|
| 1200 | DPA_GetPtr (const HDPA hdpa, INT i) | 
|---|
| 1201 | { | 
|---|
| 1202 | dprintf2(("COMCTL32: DPA_GetPtr")); | 
|---|
| 1203 |  | 
|---|
| 1204 | if (!hdpa) | 
|---|
| 1205 | return NULL; | 
|---|
| 1206 | if (!hdpa->ptrs) | 
|---|
| 1207 | return NULL; | 
|---|
| 1208 | if ((i < 0) || (i >= hdpa->nItemCount)) | 
|---|
| 1209 | return NULL; | 
|---|
| 1210 |  | 
|---|
| 1211 | //    TRACE (commctrl, "-- %p\n", hdpa->ptrs[i]); | 
|---|
| 1212 |  | 
|---|
| 1213 | return hdpa->ptrs[i]; | 
|---|
| 1214 | } | 
|---|
| 1215 |  | 
|---|
| 1216 |  | 
|---|
| 1217 | /************************************************************************** | 
|---|
| 1218 | * DPA_GetPtrIndex [COMCTL32.333] | 
|---|
| 1219 | * | 
|---|
| 1220 | * Retrieves the index of the specified pointer | 
|---|
| 1221 | * | 
|---|
| 1222 | * PARAMS | 
|---|
| 1223 | *     hdpa   [I] handle (pointer) to the pointer array | 
|---|
| 1224 | *     p      [I] pointer | 
|---|
| 1225 | * | 
|---|
| 1226 | * RETURNS | 
|---|
| 1227 | *     Success: index of the specified pointer | 
|---|
| 1228 | *     Failure: -1 | 
|---|
| 1229 | */ | 
|---|
| 1230 |  | 
|---|
| 1231 | INT WINAPI | 
|---|
| 1232 | DPA_GetPtrIndex (const HDPA hdpa, LPVOID p) | 
|---|
| 1233 | { | 
|---|
| 1234 | INT i; | 
|---|
| 1235 |  | 
|---|
| 1236 | dprintf2(("COMCTL32: DPA_GetPtrIndex")); | 
|---|
| 1237 |  | 
|---|
| 1238 | if (!hdpa->ptrs) | 
|---|
| 1239 | return -1; | 
|---|
| 1240 |  | 
|---|
| 1241 | for (i = 0; i < hdpa->nItemCount; i++) { | 
|---|
| 1242 | if (hdpa->ptrs[i] == p) | 
|---|
| 1243 | return i; | 
|---|
| 1244 | } | 
|---|
| 1245 |  | 
|---|
| 1246 | return -1; | 
|---|
| 1247 | } | 
|---|
| 1248 |  | 
|---|
| 1249 |  | 
|---|
| 1250 | /************************************************************************** | 
|---|
| 1251 | * DPA_InsertPtr [COMCTL32.334] | 
|---|
| 1252 | * | 
|---|
| 1253 | * Inserts a pointer into a dynamic pointer array | 
|---|
| 1254 | * | 
|---|
| 1255 | * PARAMS | 
|---|
| 1256 | *     hdpa [I] handle (pointer) to the array | 
|---|
| 1257 | *     i    [I] array index | 
|---|
| 1258 | *     p    [I] pointer to insert | 
|---|
| 1259 | * | 
|---|
| 1260 | * RETURNS | 
|---|
| 1261 | *     Success: index of the inserted pointer | 
|---|
| 1262 | *     Failure: -1 | 
|---|
| 1263 | */ | 
|---|
| 1264 |  | 
|---|
| 1265 | INT WINAPI | 
|---|
| 1266 | DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p) | 
|---|
| 1267 | { | 
|---|
| 1268 | INT   nNewItems, nSize, nIndex = 0; | 
|---|
| 1269 | LPVOID  *lpTemp, *lpDest; | 
|---|
| 1270 |  | 
|---|
| 1271 | dprintf2(("COMCTL32: DPA_InsertPtr")); | 
|---|
| 1272 |  | 
|---|
| 1273 | if ((!hdpa) || (i < 0)) | 
|---|
| 1274 | return -1; | 
|---|
| 1275 |  | 
|---|
| 1276 | if (!hdpa->ptrs) { | 
|---|
| 1277 | hdpa->ptrs = | 
|---|
| 1278 | (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1279 | 2 * hdpa->nGrow * sizeof(LPVOID)); | 
|---|
| 1280 | if (!hdpa->ptrs) | 
|---|
| 1281 | return -1; | 
|---|
| 1282 | hdpa->nMaxCount = hdpa->nGrow * 2; | 
|---|
| 1283 | nIndex = 0; | 
|---|
| 1284 | } | 
|---|
| 1285 | else { | 
|---|
| 1286 | if (hdpa->nItemCount >= hdpa->nMaxCount) { | 
|---|
| 1287 | //          TRACE (commctrl, "-- resizing\n"); | 
|---|
| 1288 | nNewItems = hdpa->nMaxCount + hdpa->nGrow; | 
|---|
| 1289 | nSize = nNewItems * sizeof(LPVOID); | 
|---|
| 1290 |  | 
|---|
| 1291 | lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1292 | hdpa->ptrs, nSize); | 
|---|
| 1293 | if (!lpTemp) | 
|---|
| 1294 | return -1; | 
|---|
| 1295 | hdpa->nMaxCount = nNewItems; | 
|---|
| 1296 | hdpa->ptrs = lpTemp; | 
|---|
| 1297 | } | 
|---|
| 1298 |  | 
|---|
| 1299 | if (i >= hdpa->nItemCount) { | 
|---|
| 1300 | nIndex = hdpa->nItemCount; | 
|---|
| 1301 | //          TRACE (commctrl, "-- appending at %d\n", nIndex); | 
|---|
| 1302 | } | 
|---|
| 1303 | else { | 
|---|
| 1304 | //          TRACE (commctrl, "-- inserting at %d\n", i); | 
|---|
| 1305 | lpTemp = hdpa->ptrs + i; | 
|---|
| 1306 | lpDest = lpTemp + 1; | 
|---|
| 1307 | nSize  = (hdpa->nItemCount - i) * sizeof(LPVOID); | 
|---|
| 1308 | //          TRACE (commctrl, "-- move dest=%p src=%p size=%x\n", | 
|---|
| 1309 | //                 lpDest, lpTemp, nSize); | 
|---|
| 1310 | memmove (lpDest, lpTemp, nSize); | 
|---|
| 1311 | nIndex = i; | 
|---|
| 1312 | } | 
|---|
| 1313 | } | 
|---|
| 1314 |  | 
|---|
| 1315 | /* insert item */ | 
|---|
| 1316 | hdpa->nItemCount++; | 
|---|
| 1317 | hdpa->ptrs[nIndex] = p; | 
|---|
| 1318 |  | 
|---|
| 1319 | return nIndex; | 
|---|
| 1320 | } | 
|---|
| 1321 |  | 
|---|
| 1322 |  | 
|---|
| 1323 | /************************************************************************** | 
|---|
| 1324 | * DPA_SetPtr [COMCTL32.335] | 
|---|
| 1325 | * | 
|---|
| 1326 | * Sets a pointer in the pointer array | 
|---|
| 1327 | * | 
|---|
| 1328 | * PARAMS | 
|---|
| 1329 | *     hdpa [I] handle (pointer) to the pointer array | 
|---|
| 1330 | *     i    [I] index of the pointer that will be set | 
|---|
| 1331 | *     p    [I] pointer to be set | 
|---|
| 1332 | * | 
|---|
| 1333 | * RETURNS | 
|---|
| 1334 | *     Success: TRUE | 
|---|
| 1335 | *     Failure: FALSE | 
|---|
| 1336 | */ | 
|---|
| 1337 |  | 
|---|
| 1338 | BOOL WINAPI | 
|---|
| 1339 | DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) | 
|---|
| 1340 | { | 
|---|
| 1341 | LPVOID *lpTemp; | 
|---|
| 1342 |  | 
|---|
| 1343 | dprintf2(("COMCTL32: DPA_SetPtr")); | 
|---|
| 1344 |  | 
|---|
| 1345 | if ((!hdpa) || i < 0) | 
|---|
| 1346 | return FALSE; | 
|---|
| 1347 |  | 
|---|
| 1348 | if (hdpa->nItemCount <= i) { | 
|---|
| 1349 | /* within the old array */ | 
|---|
| 1350 | if (hdpa->nMaxCount > i) { | 
|---|
| 1351 | /* within the allocated space, set a new boundary */ | 
|---|
| 1352 | hdpa->nItemCount = i; | 
|---|
| 1353 | } | 
|---|
| 1354 | else { | 
|---|
| 1355 | /* resize the block of memory */ | 
|---|
| 1356 | INT nNewItems = | 
|---|
| 1357 | hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1); | 
|---|
| 1358 | INT nSize = nNewItems * sizeof(LPVOID); | 
|---|
| 1359 |  | 
|---|
| 1360 | lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1361 | hdpa->ptrs, nSize); | 
|---|
| 1362 | if (!lpTemp) | 
|---|
| 1363 | return FALSE; | 
|---|
| 1364 |  | 
|---|
| 1365 | hdpa->nItemCount = nNewItems; | 
|---|
| 1366 | hdpa->ptrs = lpTemp; | 
|---|
| 1367 | } | 
|---|
| 1368 | } | 
|---|
| 1369 |  | 
|---|
| 1370 | /* put the new entry in */ | 
|---|
| 1371 | hdpa->ptrs[i] = p; | 
|---|
| 1372 |  | 
|---|
| 1373 | return TRUE; | 
|---|
| 1374 | } | 
|---|
| 1375 |  | 
|---|
| 1376 |  | 
|---|
| 1377 | /************************************************************************** | 
|---|
| 1378 | * DPA_DeletePtr [COMCTL32.336] | 
|---|
| 1379 | * | 
|---|
| 1380 | * Removes a pointer from the pointer array. | 
|---|
| 1381 | * | 
|---|
| 1382 | * PARAMS | 
|---|
| 1383 | *     hdpa [I] handle (pointer) to the pointer array | 
|---|
| 1384 | *     i    [I] index of the pointer that will be deleted | 
|---|
| 1385 | * | 
|---|
| 1386 | * RETURNS | 
|---|
| 1387 | *     Success: deleted pointer | 
|---|
| 1388 | *     Failure: NULL | 
|---|
| 1389 | */ | 
|---|
| 1390 |  | 
|---|
| 1391 | LPVOID WINAPI | 
|---|
| 1392 | DPA_DeletePtr (const HDPA hdpa, INT i) | 
|---|
| 1393 | { | 
|---|
| 1394 | LPVOID *lpDest, *lpSrc, lpTemp = NULL; | 
|---|
| 1395 | INT  nSize; | 
|---|
| 1396 |  | 
|---|
| 1397 | dprintf2(("COMCTL32: DPA_DeletePtr")); | 
|---|
| 1398 |  | 
|---|
| 1399 | if ((!hdpa) || i < 0 || i >= hdpa->nItemCount) | 
|---|
| 1400 | return NULL; | 
|---|
| 1401 |  | 
|---|
| 1402 | lpTemp = hdpa->ptrs[i]; | 
|---|
| 1403 |  | 
|---|
| 1404 | /* do we need to move ?*/ | 
|---|
| 1405 | if (i < hdpa->nItemCount - 1) { | 
|---|
| 1406 | lpDest = hdpa->ptrs + i; | 
|---|
| 1407 | lpSrc = lpDest + 1; | 
|---|
| 1408 | nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID); | 
|---|
| 1409 | //      TRACE (commctrl,"-- move dest=%p src=%p size=%x\n", | 
|---|
| 1410 | //             lpDest, lpSrc, nSize); | 
|---|
| 1411 | memmove (lpDest, lpSrc, nSize); | 
|---|
| 1412 | } | 
|---|
| 1413 |  | 
|---|
| 1414 | hdpa->nItemCount --; | 
|---|
| 1415 |  | 
|---|
| 1416 | /* free memory ?*/ | 
|---|
| 1417 | if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { | 
|---|
| 1418 | INT nNewItems = MAX(hdpa->nGrow*2,hdpa->nItemCount); | 
|---|
| 1419 |  | 
|---|
| 1420 | nSize = nNewItems * sizeof(LPVOID); | 
|---|
| 1421 | lpDest = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1422 | hdpa->ptrs, nSize); | 
|---|
| 1423 | if (!lpDest) | 
|---|
| 1424 | return NULL; | 
|---|
| 1425 |  | 
|---|
| 1426 | hdpa->nMaxCount = nNewItems; | 
|---|
| 1427 | hdpa->ptrs = (LPVOID*)lpDest; | 
|---|
| 1428 | } | 
|---|
| 1429 |  | 
|---|
| 1430 | return lpTemp; | 
|---|
| 1431 | } | 
|---|
| 1432 |  | 
|---|
| 1433 |  | 
|---|
| 1434 | /************************************************************************** | 
|---|
| 1435 | * DPA_DeleteAllPtrs [COMCTL32.337] | 
|---|
| 1436 | * | 
|---|
| 1437 | * Removes all pointers and reinitializes the array. | 
|---|
| 1438 | * | 
|---|
| 1439 | * PARAMS | 
|---|
| 1440 | *     hdpa [I] handle (pointer) to the pointer array | 
|---|
| 1441 | * | 
|---|
| 1442 | * RETURNS | 
|---|
| 1443 | *     Success: TRUE | 
|---|
| 1444 | *     Failure: FALSE | 
|---|
| 1445 | */ | 
|---|
| 1446 |  | 
|---|
| 1447 | BOOL WINAPI | 
|---|
| 1448 | DPA_DeleteAllPtrs (const HDPA hdpa) | 
|---|
| 1449 | { | 
|---|
| 1450 | dprintf(("COMCTL32: DPA_DeleteAllPtrs")); | 
|---|
| 1451 |  | 
|---|
| 1452 | if (!hdpa) | 
|---|
| 1453 | return FALSE; | 
|---|
| 1454 |  | 
|---|
| 1455 | if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) | 
|---|
| 1456 | return FALSE; | 
|---|
| 1457 |  | 
|---|
| 1458 | hdpa->nItemCount = 0; | 
|---|
| 1459 | hdpa->nMaxCount = hdpa->nGrow * 2; | 
|---|
| 1460 | hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1461 | hdpa->nMaxCount * sizeof(LPVOID)); | 
|---|
| 1462 |  | 
|---|
| 1463 | return TRUE; | 
|---|
| 1464 | } | 
|---|
| 1465 |  | 
|---|
| 1466 |  | 
|---|
| 1467 | /************************************************************************** | 
|---|
| 1468 | * DPA_QuickSort [Internal] | 
|---|
| 1469 | * | 
|---|
| 1470 | * Ordinary quicksort (used by DPA_Sort). | 
|---|
| 1471 | * | 
|---|
| 1472 | * PARAMS | 
|---|
| 1473 | *     lpPtrs     [I] pointer to the pointer array | 
|---|
| 1474 | *     l          [I] index of the "left border" of the partition | 
|---|
| 1475 | *     r          [I] index of the "right border" of the partition | 
|---|
| 1476 | *     pfnCompare [I] pointer to the compare function | 
|---|
| 1477 | *     lParam     [I] user defined value (3rd parameter in compare function) | 
|---|
| 1478 | * | 
|---|
| 1479 | * RETURNS | 
|---|
| 1480 | *     NONE | 
|---|
| 1481 | * | 
|---|
| 1482 | * NOTES: | 
|---|
| 1483 | *          Reverted back to the orginal quick sort, because the existing sort did not sort. | 
|---|
| 1484 | *          Kudos to the orginal author of the quick sort. | 
|---|
| 1485 | */ | 
|---|
| 1486 |  | 
|---|
| 1487 | static VOID | 
|---|
| 1488 | DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r, | 
|---|
| 1489 | PFNDPACOMPARE pfnCompare, LPARAM lParam) | 
|---|
| 1490 | { | 
|---|
| 1491 | LPVOID t, v; | 
|---|
| 1492 | INT  i, j; | 
|---|
| 1493 |  | 
|---|
| 1494 | //TRACE("l=%i r=%i\n", l, r); | 
|---|
| 1495 |  | 
|---|
| 1496 | i = l; | 
|---|
| 1497 | j = r; | 
|---|
| 1498 | v = lpPtrs[(int)(l+r)/2]; | 
|---|
| 1499 | do { | 
|---|
| 1500 | while ((pfnCompare)(lpPtrs[i], v, lParam) < 0) i++; | 
|---|
| 1501 | while ((pfnCompare)(lpPtrs[j], v, lParam) > 0) j--; | 
|---|
| 1502 | if (i <= j) | 
|---|
| 1503 | { | 
|---|
| 1504 | t = lpPtrs[i]; | 
|---|
| 1505 | lpPtrs[i++] = lpPtrs[j]; | 
|---|
| 1506 | lpPtrs[j--] = t; | 
|---|
| 1507 | } | 
|---|
| 1508 | } while (i <= j); | 
|---|
| 1509 | if (l < j) DPA_QuickSort (lpPtrs, l, j, pfnCompare, lParam); | 
|---|
| 1510 | if (i < r) DPA_QuickSort (lpPtrs, i, r, pfnCompare, lParam); | 
|---|
| 1511 | } | 
|---|
| 1512 |  | 
|---|
| 1513 |  | 
|---|
| 1514 | /************************************************************************** | 
|---|
| 1515 | * DPA_Sort [COMCTL32.338] | 
|---|
| 1516 | * | 
|---|
| 1517 | * Sorts a pointer array using a user defined compare function | 
|---|
| 1518 | * | 
|---|
| 1519 | * PARAMS | 
|---|
| 1520 | *     hdpa       [I] handle (pointer) to the pointer array | 
|---|
| 1521 | *     pfnCompare [I] pointer to the compare function | 
|---|
| 1522 | *     lParam     [I] user defined value (3rd parameter of compare function) | 
|---|
| 1523 | * | 
|---|
| 1524 | * RETURNS | 
|---|
| 1525 | *     Success: TRUE | 
|---|
| 1526 | *     Failure: FALSE | 
|---|
| 1527 | */ | 
|---|
| 1528 |  | 
|---|
| 1529 | BOOL WINAPI | 
|---|
| 1530 | DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) | 
|---|
| 1531 | { | 
|---|
| 1532 | dprintf(("COMCTL32: DPA_Sort")); | 
|---|
| 1533 |  | 
|---|
| 1534 | if (!hdpa || !pfnCompare) | 
|---|
| 1535 | return FALSE; | 
|---|
| 1536 |  | 
|---|
| 1537 | if ((hdpa->nItemCount > 1) && (hdpa->ptrs)) | 
|---|
| 1538 | DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1, | 
|---|
| 1539 | pfnCompare, lParam); | 
|---|
| 1540 |  | 
|---|
| 1541 | return TRUE; | 
|---|
| 1542 | } | 
|---|
| 1543 |  | 
|---|
| 1544 |  | 
|---|
| 1545 | /************************************************************************** | 
|---|
| 1546 | * DPA_Search [COMCTL32.339] | 
|---|
| 1547 | * | 
|---|
| 1548 | * Searches a pointer array for a specified pointer | 
|---|
| 1549 | * | 
|---|
| 1550 | * PARAMS | 
|---|
| 1551 | *     hdpa       [I] handle (pointer) to the pointer array | 
|---|
| 1552 | *     pFind      [I] pointer to search for | 
|---|
| 1553 | *     nStart     [I] start index | 
|---|
| 1554 | *     pfnCompare [I] pointer to the compare function | 
|---|
| 1555 | *     lParam     [I] user defined value (3rd parameter of compare function) | 
|---|
| 1556 | *     uOptions   [I] search options | 
|---|
| 1557 | * | 
|---|
| 1558 | * RETURNS | 
|---|
| 1559 | *     Success: index of the pointer in the array. | 
|---|
| 1560 | *     Failure: -1 | 
|---|
| 1561 | * | 
|---|
| 1562 | * NOTES | 
|---|
| 1563 | *     Binary search taken from R.Sedgewick "Algorithms in C"! | 
|---|
| 1564 | *     Function is NOT tested! | 
|---|
| 1565 | *     If something goes wrong, blame HIM not ME! (Eric Kohl) | 
|---|
| 1566 | */ | 
|---|
| 1567 |  | 
|---|
| 1568 | INT WINAPI | 
|---|
| 1569 | DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart, | 
|---|
| 1570 | PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions) | 
|---|
| 1571 | { | 
|---|
| 1572 | dprintf(("COMCTL32: DPA_Search")); | 
|---|
| 1573 |  | 
|---|
| 1574 | if (!hdpa || !pfnCompare || !pFind) | 
|---|
| 1575 | return -1; | 
|---|
| 1576 |  | 
|---|
| 1577 | if (uOptions & DPAS_SORTED) { | 
|---|
| 1578 | /* array is sorted --> use binary search */ | 
|---|
| 1579 | INT l, r, x, n; | 
|---|
| 1580 | LPVOID *lpPtr; | 
|---|
| 1581 |  | 
|---|
| 1582 | //      TRACE (commctrl, "binary search\n"); | 
|---|
| 1583 |  | 
|---|
| 1584 | l = (nStart == -1) ? 0 : nStart; | 
|---|
| 1585 | r = hdpa->nItemCount - 1; | 
|---|
| 1586 | lpPtr = hdpa->ptrs; | 
|---|
| 1587 | while (r >= l) { | 
|---|
| 1588 | x = (l + r) / 2; | 
|---|
| 1589 | n = (pfnCompare)(pFind, lpPtr[x], lParam); | 
|---|
| 1590 | if (n < 0) | 
|---|
| 1591 | r = x - 1; | 
|---|
| 1592 | else | 
|---|
| 1593 | l = x + 1; | 
|---|
| 1594 | if (n == 0) { | 
|---|
| 1595 | //              TRACE (commctrl, "-- ret=%d\n", n); | 
|---|
| 1596 | return n; | 
|---|
| 1597 | } | 
|---|
| 1598 | } | 
|---|
| 1599 |  | 
|---|
| 1600 | if (uOptions & DPAS_INSERTBEFORE) { | 
|---|
| 1601 | //          TRACE (commctrl, "-- ret=%d\n", r); | 
|---|
| 1602 | return r; | 
|---|
| 1603 | } | 
|---|
| 1604 |  | 
|---|
| 1605 | if (uOptions & DPAS_INSERTAFTER) { | 
|---|
| 1606 | //          TRACE (commctrl, "-- ret=%d\n", l); | 
|---|
| 1607 | return l; | 
|---|
| 1608 | } | 
|---|
| 1609 | } | 
|---|
| 1610 | else { | 
|---|
| 1611 | /* array is not sorted --> use linear search */ | 
|---|
| 1612 | LPVOID *lpPtr; | 
|---|
| 1613 | INT  nIndex; | 
|---|
| 1614 |  | 
|---|
| 1615 | //      TRACE (commctrl, "linear search\n"); | 
|---|
| 1616 |  | 
|---|
| 1617 | nIndex = (nStart == -1)? 0 : nStart; | 
|---|
| 1618 | lpPtr = hdpa->ptrs; | 
|---|
| 1619 | for (; nIndex < hdpa->nItemCount; nIndex++) { | 
|---|
| 1620 | if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) { | 
|---|
| 1621 | //              TRACE (commctrl, "-- ret=%d\n", nIndex); | 
|---|
| 1622 | return nIndex; | 
|---|
| 1623 | } | 
|---|
| 1624 | } | 
|---|
| 1625 | } | 
|---|
| 1626 |  | 
|---|
| 1627 | //    TRACE (commctrl, "-- not found: ret=-1\n"); | 
|---|
| 1628 | return -1; | 
|---|
| 1629 | } | 
|---|
| 1630 |  | 
|---|
| 1631 |  | 
|---|
| 1632 | /************************************************************************** | 
|---|
| 1633 | * DPA_CreateEx [COMCTL32.340] | 
|---|
| 1634 | * | 
|---|
| 1635 | * Creates a dynamic pointer array using the specified size and heap. | 
|---|
| 1636 | * | 
|---|
| 1637 | * PARAMS | 
|---|
| 1638 | *     nGrow [I] number of items by which the array grows when it is filled | 
|---|
| 1639 | *     hHeap [I] handle to the heap where the array is stored | 
|---|
| 1640 | * | 
|---|
| 1641 | * RETURNS | 
|---|
| 1642 | *     Success: handle (pointer) to the pointer array. | 
|---|
| 1643 | *     Failure: NULL | 
|---|
| 1644 | */ | 
|---|
| 1645 |  | 
|---|
| 1646 | HDPA WINAPI | 
|---|
| 1647 | DPA_CreateEx (INT nGrow, HANDLE hHeap) | 
|---|
| 1648 | { | 
|---|
| 1649 | HDPA hdpa; | 
|---|
| 1650 |  | 
|---|
| 1651 | dprintf(("COMCTL32: DPA_CreateEx")); | 
|---|
| 1652 |  | 
|---|
| 1653 | if (hHeap) | 
|---|
| 1654 | hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA)); | 
|---|
| 1655 | else | 
|---|
| 1656 | hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); | 
|---|
| 1657 |  | 
|---|
| 1658 | if (hdpa) { | 
|---|
| 1659 | hdpa->nGrow = MIN(8, nGrow); | 
|---|
| 1660 | hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap; | 
|---|
| 1661 | hdpa->nMaxCount = hdpa->nGrow * 2; | 
|---|
| 1662 | hdpa->ptrs = | 
|---|
| 1663 | (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, | 
|---|
| 1664 | hdpa->nMaxCount * sizeof(LPVOID)); | 
|---|
| 1665 | } | 
|---|
| 1666 |  | 
|---|
| 1667 | //    TRACE (commctrl, "-- %p\n", hdpa); | 
|---|
| 1668 |  | 
|---|
| 1669 | return hdpa; | 
|---|
| 1670 | } | 
|---|
| 1671 |  | 
|---|
| 1672 | /************************************************************************** | 
|---|
| 1673 | * Notification functions | 
|---|
| 1674 | */ | 
|---|
| 1675 |  | 
|---|
| 1676 | typedef struct tagNOTIFYDATA | 
|---|
| 1677 | { | 
|---|
| 1678 | HWND hwndFrom; | 
|---|
| 1679 | HWND hwndTo; | 
|---|
| 1680 | DWORD  dwParam3; | 
|---|
| 1681 | DWORD  dwParam4; | 
|---|
| 1682 | DWORD  dwParam5; | 
|---|
| 1683 | DWORD  dwParam6; | 
|---|
| 1684 | } NOTIFYDATA, *LPNOTIFYDATA; | 
|---|
| 1685 |  | 
|---|
| 1686 |  | 
|---|
| 1687 | /************************************************************************** | 
|---|
| 1688 | * DoNotify [Internal] | 
|---|
| 1689 | */ | 
|---|
| 1690 |  | 
|---|
| 1691 | static LRESULT | 
|---|
| 1692 | DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr) | 
|---|
| 1693 | { | 
|---|
| 1694 | NMHDR nmhdr; | 
|---|
| 1695 | LPNMHDR lpNmh = NULL; | 
|---|
| 1696 | UINT idFrom = 0; | 
|---|
| 1697 |  | 
|---|
| 1698 | //    TRACE (commctrl, "(0x%04x 0x%04x %d %p 0x%08lx)\n", | 
|---|
| 1699 | //         lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr, | 
|---|
| 1700 | //         lpNotify->dwParam5); | 
|---|
| 1701 |  | 
|---|
| 1702 | if (!lpNotify->hwndTo) | 
|---|
| 1703 | return 0; | 
|---|
| 1704 |  | 
|---|
| 1705 | if (lpNotify->hwndFrom == -1) { | 
|---|
| 1706 | lpNmh = lpHdr; | 
|---|
| 1707 | idFrom = lpHdr->idFrom; | 
|---|
| 1708 | } | 
|---|
| 1709 | else { | 
|---|
| 1710 | if (lpNotify->hwndFrom) { | 
|---|
| 1711 | HWND hwndParent = GetParent (lpNotify->hwndFrom); | 
|---|
| 1712 | if (hwndParent) { | 
|---|
| 1713 | hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER); | 
|---|
| 1714 | if (hwndParent) | 
|---|
| 1715 | idFrom = GetDlgCtrlID (lpNotify->hwndFrom); | 
|---|
| 1716 | } | 
|---|
| 1717 | } | 
|---|
| 1718 |  | 
|---|
| 1719 | lpNmh = (lpHdr) ? lpHdr : &nmhdr; | 
|---|
| 1720 |  | 
|---|
| 1721 | lpNmh->hwndFrom = lpNotify->hwndFrom; | 
|---|
| 1722 | lpNmh->idFrom = idFrom; | 
|---|
| 1723 | lpNmh->code = uCode; | 
|---|
| 1724 | } | 
|---|
| 1725 |  | 
|---|
| 1726 | return SendMessageA (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh); | 
|---|
| 1727 | } | 
|---|
| 1728 |  | 
|---|
| 1729 |  | 
|---|
| 1730 | /************************************************************************** | 
|---|
| 1731 | * SendNotify [COMCTL32.341] | 
|---|
| 1732 | * | 
|---|
| 1733 | * PARAMS | 
|---|
| 1734 | *     hwndFrom [I] | 
|---|
| 1735 | *     hwndTo   [I] | 
|---|
| 1736 | *     uCode    [I] | 
|---|
| 1737 | *     lpHdr    [I] | 
|---|
| 1738 | * | 
|---|
| 1739 | * RETURNS | 
|---|
| 1740 | *     Success: return value from notification | 
|---|
| 1741 | *     Failure: 0 | 
|---|
| 1742 | */ | 
|---|
| 1743 |  | 
|---|
| 1744 | LRESULT WINAPI | 
|---|
| 1745 | COMCTL32_SendNotify (HWND hwndFrom, HWND hwndTo, | 
|---|
| 1746 | UINT uCode, LPNMHDR lpHdr) | 
|---|
| 1747 | { | 
|---|
| 1748 | NOTIFYDATA notify; | 
|---|
| 1749 |  | 
|---|
| 1750 | dprintf(("COMCTL32: SendNotify")); | 
|---|
| 1751 |  | 
|---|
| 1752 | notify.hwndFrom = hwndFrom; | 
|---|
| 1753 | notify.hwndTo   = hwndTo; | 
|---|
| 1754 | notify.dwParam5 = 0; | 
|---|
| 1755 | notify.dwParam6 = 0; | 
|---|
| 1756 |  | 
|---|
| 1757 | return DoNotify (¬ify, uCode, lpHdr); | 
|---|
| 1758 | } | 
|---|
| 1759 |  | 
|---|
| 1760 |  | 
|---|
| 1761 | /************************************************************************** | 
|---|
| 1762 | * SendNotifyEx [COMCTL32.342] | 
|---|
| 1763 | * | 
|---|
| 1764 | * PARAMS | 
|---|
| 1765 | *     hwndFrom [I] | 
|---|
| 1766 | *     hwndTo   [I] | 
|---|
| 1767 | *     uCode    [I] | 
|---|
| 1768 | *     lpHdr    [I] | 
|---|
| 1769 | *     dwParam5 [I] | 
|---|
| 1770 | * | 
|---|
| 1771 | * RETURNS | 
|---|
| 1772 | *     Success: return value from notification | 
|---|
| 1773 | *     Failure: 0 | 
|---|
| 1774 | */ | 
|---|
| 1775 |  | 
|---|
| 1776 | LRESULT WINAPI | 
|---|
| 1777 | COMCTL32_SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode, | 
|---|
| 1778 | LPNMHDR lpHdr, DWORD dwParam5) | 
|---|
| 1779 | { | 
|---|
| 1780 | NOTIFYDATA notify; | 
|---|
| 1781 | HWND hwndNotify; | 
|---|
| 1782 |  | 
|---|
| 1783 | dprintf(("COMCTL32: SendNotifyEx")); | 
|---|
| 1784 |  | 
|---|
| 1785 | hwndNotify = hwndTo; | 
|---|
| 1786 | if (!hwndTo) { | 
|---|
| 1787 | if (IsWindow (hwndFrom)) { | 
|---|
| 1788 | hwndNotify = GetParent (hwndFrom); | 
|---|
| 1789 | if (!hwndNotify) | 
|---|
| 1790 | return 0; | 
|---|
| 1791 | } | 
|---|
| 1792 | } | 
|---|
| 1793 |  | 
|---|
| 1794 | notify.hwndFrom = hwndFrom; | 
|---|
| 1795 | notify.hwndTo   = hwndNotify; | 
|---|
| 1796 | notify.dwParam5 = dwParam5; | 
|---|
| 1797 | notify.dwParam6 = 0; | 
|---|
| 1798 |  | 
|---|
| 1799 | return DoNotify (¬ify, uCode, lpHdr); | 
|---|
| 1800 | } | 
|---|
| 1801 |  | 
|---|
| 1802 |  | 
|---|
| 1803 | /************************************************************************** | 
|---|
| 1804 | * StrChrA [COMCTL32.350] | 
|---|
| 1805 | * | 
|---|
| 1806 | */ | 
|---|
| 1807 |  | 
|---|
| 1808 | LPSTR WINAPI | 
|---|
| 1809 | COMCTL32_StrChrA (LPCSTR lpString, CHAR cChar) | 
|---|
| 1810 | { | 
|---|
| 1811 | dprintf(("COMCTL32: StrChrA")); | 
|---|
| 1812 |  | 
|---|
| 1813 | return strchr (lpString, cChar); | 
|---|
| 1814 | } | 
|---|
| 1815 |  | 
|---|
| 1816 |  | 
|---|
| 1817 | /************************************************************************** | 
|---|
| 1818 | * StrStrIA [COMCTL32.355] | 
|---|
| 1819 | */ | 
|---|
| 1820 |  | 
|---|
| 1821 | LPSTR WINAPI | 
|---|
| 1822 | COMCTL32_StrStrIA (LPCSTR lpStr1, LPCSTR lpStr2) | 
|---|
| 1823 | { | 
|---|
| 1824 | INT len1, len2, i; | 
|---|
| 1825 | CHAR  first; | 
|---|
| 1826 |  | 
|---|
| 1827 | dprintf(("COMCTL32: StrStrIA")); | 
|---|
| 1828 |  | 
|---|
| 1829 | if (*lpStr2 == 0) | 
|---|
| 1830 | return ((LPSTR)lpStr1); | 
|---|
| 1831 | len1 = 0; | 
|---|
| 1832 | while (lpStr1[len1] != 0) ++len1; | 
|---|
| 1833 | len2 = 0; | 
|---|
| 1834 | while (lpStr2[len2] != 0) ++len2; | 
|---|
| 1835 | if (len2 == 0) | 
|---|
| 1836 | return ((LPSTR)(lpStr1 + len1)); | 
|---|
| 1837 | first = tolower (*lpStr2); | 
|---|
| 1838 | while (len1 >= len2) { | 
|---|
| 1839 | if (tolower(*lpStr1) == first) { | 
|---|
| 1840 | for (i = 1; i < len2; ++i) | 
|---|
| 1841 | if (tolower (lpStr1[i]) != tolower(lpStr2[i])) | 
|---|
| 1842 | break; | 
|---|
| 1843 | if (i >= len2) | 
|---|
| 1844 | return ((LPSTR)lpStr1); | 
|---|
| 1845 | } | 
|---|
| 1846 | ++lpStr1; --len1; | 
|---|
| 1847 | } | 
|---|
| 1848 | return (NULL); | 
|---|
| 1849 | } | 
|---|
| 1850 |  | 
|---|
| 1851 |  | 
|---|
| 1852 | /************************************************************************** | 
|---|
| 1853 | * StrToIntA [COMCTL32.357] Converts a string to a signed integer. | 
|---|
| 1854 | */ | 
|---|
| 1855 |  | 
|---|
| 1856 | INT WINAPI | 
|---|
| 1857 | COMCTL32_StrToIntA (LPSTR lpString) | 
|---|
| 1858 | { | 
|---|
| 1859 | dprintf(("COMCTL32: StrToIntA")); | 
|---|
| 1860 |  | 
|---|
| 1861 | return atoi(lpString); | 
|---|
| 1862 | } | 
|---|
| 1863 |  | 
|---|
| 1864 | /************************************************************************** | 
|---|
| 1865 | * DPA_EnumCallback [COMCTL32.385] | 
|---|
| 1866 | * | 
|---|
| 1867 | * Enumerates all items in a dynamic pointer array. | 
|---|
| 1868 | * | 
|---|
| 1869 | * PARAMS | 
|---|
| 1870 | *     hdpa     [I] handle to the dynamic pointer array | 
|---|
| 1871 | *     enumProc [I] | 
|---|
| 1872 | *     lParam   [I] | 
|---|
| 1873 | * | 
|---|
| 1874 | * RETURNS | 
|---|
| 1875 | *     none | 
|---|
| 1876 | */ | 
|---|
| 1877 |  | 
|---|
| 1878 |  | 
|---|
| 1879 | VOID WINAPI | 
|---|
| 1880 | DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) | 
|---|
| 1881 | { | 
|---|
| 1882 | INT i; | 
|---|
| 1883 |  | 
|---|
| 1884 | dprintf(("COMCTL32: DPA_EnumCallback")); | 
|---|
| 1885 |  | 
|---|
| 1886 | if (!hdpa) | 
|---|
| 1887 | return; | 
|---|
| 1888 | if (hdpa->nItemCount <= 0) | 
|---|
| 1889 | return; | 
|---|
| 1890 |  | 
|---|
| 1891 | for (i = 0; i < hdpa->nItemCount; i++) { | 
|---|
| 1892 | if ((enumProc)(hdpa->ptrs[i], lParam) == 0) | 
|---|
| 1893 | return; | 
|---|
| 1894 | } | 
|---|
| 1895 |  | 
|---|
| 1896 | return; | 
|---|
| 1897 | } | 
|---|
| 1898 |  | 
|---|
| 1899 |  | 
|---|
| 1900 | /************************************************************************** | 
|---|
| 1901 | * DPA_DestroyCallback [COMCTL32.386] | 
|---|
| 1902 | * | 
|---|
| 1903 | * Enumerates all items in a dynamic pointer array and destroys it. | 
|---|
| 1904 | * | 
|---|
| 1905 | * PARAMS | 
|---|
| 1906 | *     hdpa     [I] handle to the dynamic pointer array | 
|---|
| 1907 | *     enumProc [I] | 
|---|
| 1908 | *     lParam   [I] | 
|---|
| 1909 | * | 
|---|
| 1910 | * RETURNS | 
|---|
| 1911 | *     Success: TRUE | 
|---|
| 1912 | *     Failure: FALSE | 
|---|
| 1913 | */ | 
|---|
| 1914 |  | 
|---|
| 1915 | BOOL WINAPI | 
|---|
| 1916 | DPA_DestroyCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) | 
|---|
| 1917 | { | 
|---|
| 1918 | dprintf(("COMCTL32: DPA_DestroyCallback")); | 
|---|
| 1919 |  | 
|---|
| 1920 | DPA_EnumCallback (hdpa, enumProc, lParam); | 
|---|
| 1921 |  | 
|---|
| 1922 | return DPA_Destroy (hdpa); | 
|---|
| 1923 | } | 
|---|
| 1924 |  | 
|---|
| 1925 |  | 
|---|
| 1926 | /************************************************************************** | 
|---|
| 1927 | * DSA_EnumCallback [COMCTL32.387] | 
|---|
| 1928 | * | 
|---|
| 1929 | * Enumerates all items in a dynamic storage array. | 
|---|
| 1930 | * | 
|---|
| 1931 | * PARAMS | 
|---|
| 1932 | *     hdsa     [I] handle to the dynamic storage array | 
|---|
| 1933 | *     enumProc [I] | 
|---|
| 1934 | *     lParam   [I] | 
|---|
| 1935 | * | 
|---|
| 1936 | * RETURNS | 
|---|
| 1937 | *     none | 
|---|
| 1938 | */ | 
|---|
| 1939 |  | 
|---|
| 1940 | VOID WINAPI | 
|---|
| 1941 | DSA_EnumCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam) | 
|---|
| 1942 | { | 
|---|
| 1943 | INT i; | 
|---|
| 1944 |  | 
|---|
| 1945 | dprintf(("COMCTL32: DSA_EnumCallback")); | 
|---|
| 1946 |  | 
|---|
| 1947 | if (!hdsa) | 
|---|
| 1948 | return; | 
|---|
| 1949 | if (hdsa->nItemCount <= 0) | 
|---|
| 1950 | return; | 
|---|
| 1951 |  | 
|---|
| 1952 | for (i = 0; i < hdsa->nItemCount; i++) { | 
|---|
| 1953 | LPVOID lpItem = DSA_GetItemPtr (hdsa, i); | 
|---|
| 1954 | if ((enumProc)(lpItem, lParam) == 0) | 
|---|
| 1955 | return; | 
|---|
| 1956 | } | 
|---|
| 1957 |  | 
|---|
| 1958 | return; | 
|---|
| 1959 | } | 
|---|
| 1960 |  | 
|---|
| 1961 |  | 
|---|
| 1962 | /************************************************************************** | 
|---|
| 1963 | * DSA_DestroyCallback [COMCTL32.388] | 
|---|
| 1964 | * | 
|---|
| 1965 | * Enumerates all items in a dynamic storage array and destroys it. | 
|---|
| 1966 | * | 
|---|
| 1967 | * PARAMS | 
|---|
| 1968 | *     hdsa     [I] handle to the dynamic storage array | 
|---|
| 1969 | *     enumProc [I] | 
|---|
| 1970 | *     lParam   [I] | 
|---|
| 1971 | * | 
|---|
| 1972 | * RETURNS | 
|---|
| 1973 | *     Success: TRUE | 
|---|
| 1974 | *     Failure: FALSE | 
|---|
| 1975 | */ | 
|---|
| 1976 |  | 
|---|
| 1977 | BOOL WINAPI | 
|---|
| 1978 | DSA_DestroyCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam) | 
|---|
| 1979 | { | 
|---|
| 1980 | dprintf(("COMCTL32: DSA_DestroyCallback")); | 
|---|
| 1981 |  | 
|---|
| 1982 | DSA_EnumCallback (hdsa, enumProc, lParam); | 
|---|
| 1983 |  | 
|---|
| 1984 | return DSA_Destroy (hdsa); | 
|---|
| 1985 | } | 
|---|
| 1986 |  | 
|---|
| 1987 | /************************************************************************** | 
|---|
| 1988 | * StrCSpnA [COMCTL32.356] | 
|---|
| 1989 | * | 
|---|
| 1990 | */ | 
|---|
| 1991 | INT WINAPI COMCTL32_StrCSpnA( LPCSTR lpStr, LPCSTR lpSet) | 
|---|
| 1992 | { | 
|---|
| 1993 | dprintf(("COMCTL32: StrCSpnA")); | 
|---|
| 1994 |  | 
|---|
| 1995 | return strcspn(lpStr, lpSet); | 
|---|
| 1996 | } | 
|---|
| 1997 |  | 
|---|
| 1998 | /************************************************************************** | 
|---|
| 1999 | * StrChrW [COMCTL32.358] | 
|---|
| 2000 | * | 
|---|
| 2001 | */ | 
|---|
| 2002 | LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) | 
|---|
| 2003 | { | 
|---|
| 2004 | dprintf(("COMCTL32: StrChrW")); | 
|---|
| 2005 |  | 
|---|
| 2006 | return (unsigned short*)wcschr((wchar_t*)lpStart, wMatch); | 
|---|
| 2007 | } | 
|---|
| 2008 |  | 
|---|
| 2009 | /************************************************************************** | 
|---|
| 2010 | * StrCmpNA [COMCTL32.352] | 
|---|
| 2011 | * | 
|---|
| 2012 | */ | 
|---|
| 2013 | INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) | 
|---|
| 2014 | { | 
|---|
| 2015 | dprintf(("COMCTL32: StrCmpNA")); | 
|---|
| 2016 |  | 
|---|
| 2017 | return strncmp(lpStr1, lpStr2, nChar); | 
|---|
| 2018 | } | 
|---|
| 2019 |  | 
|---|
| 2020 | /************************************************************************** | 
|---|
| 2021 | * StrCmpNIA [COMCTL32.353] | 
|---|
| 2022 | * | 
|---|
| 2023 | */ | 
|---|
| 2024 | INT WINAPI COMCTL32_StrCmpNIA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) | 
|---|
| 2025 | { | 
|---|
| 2026 | //AH: Inline helper function from WINE | 
|---|
| 2027 | int res; | 
|---|
| 2028 |  | 
|---|
| 2029 | dprintf(("COMCTL32: StrCmpNIA")); | 
|---|
| 2030 |  | 
|---|
| 2031 | if (!nChar) return 0; | 
|---|
| 2032 | while ((--nChar > 0) && *lpStr1) | 
|---|
| 2033 | { | 
|---|
| 2034 | res = toupper(*lpStr1++) - toupper(*lpStr2++); | 
|---|
| 2035 | if (res) return res; | 
|---|
| 2036 | } | 
|---|
| 2037 | return toupper(*lpStr1) - toupper(*lpStr2); | 
|---|
| 2038 | } | 
|---|
| 2039 |  | 
|---|
| 2040 | /************************************************************************** | 
|---|
| 2041 | * StrCmpNW [COMCTL32.360] | 
|---|
| 2042 | * | 
|---|
| 2043 | */ | 
|---|
| 2044 | INT WINAPI COMCTL32_StrCmpNW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) | 
|---|
| 2045 | { | 
|---|
| 2046 | dprintf(("COMCTL32: StrCmpNW")); | 
|---|
| 2047 |  | 
|---|
| 2048 | return wcsncmp((wchar_t*)lpStr1,(wchar_t*)lpStr2,nChar); | 
|---|
| 2049 | } | 
|---|
| 2050 |  | 
|---|
| 2051 | /************************************************************************** | 
|---|
| 2052 | * StrCmpNIW [COMCTL32.361] | 
|---|
| 2053 | * | 
|---|
| 2054 | */ | 
|---|
| 2055 | INT WINAPI COMCTL32_StrCmpNIW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) | 
|---|
| 2056 | { | 
|---|
| 2057 | dprintf(("COMCTL32: StrCmpNIW - unimplemented stub\n")); | 
|---|
| 2058 |  | 
|---|
| 2059 | return 0; | 
|---|
| 2060 | } | 
|---|
| 2061 |  | 
|---|
| 2062 | /*********************************************************************** | 
|---|
| 2063 | *           ChrCmpA | 
|---|
| 2064 | * This fuction returns FALSE if both words match, TRUE otherwise... | 
|---|
| 2065 | */ | 
|---|
| 2066 | static BOOL ChrCmpA( WORD word1, WORD word2) { | 
|---|
| 2067 | if (LOBYTE(word1) == LOBYTE(word2)) { | 
|---|
| 2068 | if (IsDBCSLeadByte(LOBYTE(word1))) { | 
|---|
| 2069 | return (word1 != word2); | 
|---|
| 2070 | } | 
|---|
| 2071 | return FALSE; | 
|---|
| 2072 | } | 
|---|
| 2073 | return TRUE; | 
|---|
| 2074 | } | 
|---|
| 2075 |  | 
|---|
| 2076 | /************************************************************************** | 
|---|
| 2077 | * StrRChrA [COMCTL32.351] | 
|---|
| 2078 | * | 
|---|
| 2079 | */ | 
|---|
| 2080 | LPSTR WINAPI COMCTL32_StrRChrA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch) | 
|---|
| 2081 | { | 
|---|
| 2082 | LPCSTR lpGotIt = NULL; | 
|---|
| 2083 |  | 
|---|
| 2084 | dprintf(("COMCTL32: StrRChrA")); | 
|---|
| 2085 |  | 
|---|
| 2086 | if (!lpEnd) lpEnd = lpStart + strlen(lpStart); | 
|---|
| 2087 |  | 
|---|
| 2088 | for(; lpStart < lpEnd; lpStart = CharNextA(lpStart)) | 
|---|
| 2089 | if (!ChrCmpA( GET_WORD(lpStart), wMatch)) | 
|---|
| 2090 | lpGotIt = lpStart; | 
|---|
| 2091 |  | 
|---|
| 2092 | return ((LPSTR)lpGotIt); | 
|---|
| 2093 |  | 
|---|
| 2094 | return 0; | 
|---|
| 2095 | } | 
|---|
| 2096 |  | 
|---|
| 2097 | /*********************************************************************** | 
|---|
| 2098 | *           ChrCmpW | 
|---|
| 2099 | * This fuction returns FALSE if both words match, TRUE otherwise... | 
|---|
| 2100 | */ | 
|---|
| 2101 | static BOOL ChrCmpW( WORD word1, WORD word2) { | 
|---|
| 2102 | return (word1 != word2); | 
|---|
| 2103 | } | 
|---|
| 2104 |  | 
|---|
| 2105 | /************************************************************************** | 
|---|
| 2106 | * StrRChrW [COMCTL32.359] | 
|---|
| 2107 | * | 
|---|
| 2108 | */ | 
|---|
| 2109 | LPWSTR WINAPI COMCTL32_StrRChrW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch) | 
|---|
| 2110 | { | 
|---|
| 2111 | //AH: Inline Wine helper function | 
|---|
| 2112 | LPCWSTR lpGotIt = NULL; | 
|---|
| 2113 |  | 
|---|
| 2114 | dprintf(("COMCTL32: StrRChrW")); | 
|---|
| 2115 |  | 
|---|
| 2116 | if (!lpEnd) lpEnd = lpStart + lstrlenW(lpStart); | 
|---|
| 2117 |  | 
|---|
| 2118 | for(; lpStart < lpEnd; lpStart = CharNextW(lpStart)) | 
|---|
| 2119 | if (!ChrCmpW( GET_WORD(lpStart), wMatch)) | 
|---|
| 2120 | lpGotIt = lpStart; | 
|---|
| 2121 |  | 
|---|
| 2122 | return (LPWSTR)lpGotIt; | 
|---|
| 2123 | } | 
|---|
| 2124 |  | 
|---|
| 2125 |  | 
|---|
| 2126 | /************************************************************************** | 
|---|
| 2127 | * StrStrA [COMCTL32.354] | 
|---|
| 2128 | * | 
|---|
| 2129 | */ | 
|---|
| 2130 | LPSTR WINAPI COMCTL32_StrStrA( LPCSTR lpFirst, LPCSTR lpSrch) | 
|---|
| 2131 | { | 
|---|
| 2132 | dprintf(("COMCTL32: StrStrA")); | 
|---|
| 2133 |  | 
|---|
| 2134 | return strstr(lpFirst, lpSrch); | 
|---|
| 2135 | } | 
|---|
| 2136 |  | 
|---|
| 2137 | /************************************************************************** | 
|---|
| 2138 | * StrStrW [COMCTL32.362] | 
|---|
| 2139 | * | 
|---|
| 2140 | */ | 
|---|
| 2141 | LPWSTR WINAPI COMCTL32_StrStrW( LPCWSTR lpFirst, LPCWSTR lpSrch) | 
|---|
| 2142 | { | 
|---|
| 2143 | dprintf(("COMCTL32: StrStrW")); | 
|---|
| 2144 |  | 
|---|
| 2145 | return (unsigned short*)wcsstr((wchar_t*)lpFirst,(wchar_t*)lpSrch); | 
|---|
| 2146 | } | 
|---|
| 2147 |  | 
|---|
| 2148 | /************************************************************************** | 
|---|
| 2149 | * StrSpnW [COMCTL32.364] | 
|---|
| 2150 | * | 
|---|
| 2151 | */ | 
|---|
| 2152 | INT WINAPI COMCTL32_StrSpnW( LPWSTR lpStr, LPWSTR lpSet) | 
|---|
| 2153 | { | 
|---|
| 2154 | LPWSTR lpLoop = lpStr; | 
|---|
| 2155 |  | 
|---|
| 2156 | dprintf(("COMCTL32: StrSpnW")); | 
|---|
| 2157 |  | 
|---|
| 2158 | /* validate ptr */ | 
|---|
| 2159 | if ((lpStr == 0) || (lpSet == 0)) return 0; | 
|---|
| 2160 |  | 
|---|
| 2161 | /* while(*lpLoop) { if lpLoop++; } */ | 
|---|
| 2162 |  | 
|---|
| 2163 | for(; (*lpLoop != 0); lpLoop++) | 
|---|
| 2164 | if (wcschr((wchar_t*)lpSet, *(WORD*)lpLoop)) | 
|---|
| 2165 | return (INT)(lpLoop-lpStr); | 
|---|
| 2166 |  | 
|---|
| 2167 | return (INT)(lpLoop-lpStr); | 
|---|
| 2168 | } | 
|---|
| 2169 |  | 
|---|
| 2170 | /************************************************************************** | 
|---|
| 2171 | * comctl32_410 [COMCTL32.410] | 
|---|
| 2172 | * | 
|---|
| 2173 | * FIXME: What's this supposed to do? | 
|---|
| 2174 | *        Parameter 1 is an HWND, you're on your own for the rest. | 
|---|
| 2175 | */ | 
|---|
| 2176 |  | 
|---|
| 2177 | BOOL WINAPI comctl32_410( HWND hw, DWORD b, DWORD c, DWORD d) | 
|---|
| 2178 | { | 
|---|
| 2179 | dprintf(("COMCTL32: comctl32_410 - empty stub!")); | 
|---|
| 2180 |  | 
|---|
| 2181 | return TRUE; | 
|---|
| 2182 | } | 
|---|
| 2183 |  | 
|---|
| 2184 | /************************************************************************** | 
|---|
| 2185 | * comctl32_411 [COMCTL32.411] | 
|---|
| 2186 | * | 
|---|
| 2187 | * FIXME: What's this supposed to do? | 
|---|
| 2188 | *        Parameter 1 is an HWND, you're on your own for the rest. | 
|---|
| 2189 | */ | 
|---|
| 2190 |  | 
|---|
| 2191 | BOOL WINAPI comctl32_411( HWND hw, DWORD b, DWORD c) | 
|---|
| 2192 | { | 
|---|
| 2193 | dprintf(("COMCTL32: comctl32_411 - empty stub!")); | 
|---|
| 2194 |  | 
|---|
| 2195 | return TRUE; | 
|---|
| 2196 | } | 
|---|
| 2197 |  | 
|---|
| 2198 | /************************************************************************** | 
|---|
| 2199 | * comctl32_412 [COMCTL32.412] | 
|---|
| 2200 | * | 
|---|
| 2201 | * FIXME: What's this supposed to do? | 
|---|
| 2202 | *        Parameter 1 is an HWND, you're on your own for the rest. | 
|---|
| 2203 | */ | 
|---|
| 2204 |  | 
|---|
| 2205 | BOOL WINAPI comctl32_412( HWND hwnd, DWORD b, DWORD c) | 
|---|
| 2206 | { | 
|---|
| 2207 | dprintf(("COMCTL32: comctl32_412 - empty stub!")); | 
|---|
| 2208 |  | 
|---|
| 2209 | if (IsWindow (hwnd) == FALSE) | 
|---|
| 2210 | return FALSE; | 
|---|
| 2211 |  | 
|---|
| 2212 | if (b == 0) | 
|---|
| 2213 | return FALSE; | 
|---|
| 2214 |  | 
|---|
| 2215 |  | 
|---|
| 2216 | return TRUE; | 
|---|
| 2217 | } | 
|---|
| 2218 |  | 
|---|
| 2219 | /************************************************************************** | 
|---|
| 2220 | * comctl32_413 [COMCTL32.413] | 
|---|
| 2221 | * | 
|---|
| 2222 | * FIXME: What's this supposed to do? | 
|---|
| 2223 | *        Parameter 1 is an HWND, you're on your own for the rest. | 
|---|
| 2224 | */ | 
|---|
| 2225 |  | 
|---|
| 2226 | BOOL WINAPI comctl32_413( HWND hw, DWORD b, DWORD c, DWORD d) | 
|---|
| 2227 | { | 
|---|
| 2228 | dprintf(("COMCTL32: comctl32_413 - empty stub!")); | 
|---|
| 2229 |  | 
|---|
| 2230 | return TRUE; | 
|---|
| 2231 | } | 
|---|
| 2232 |  | 
|---|
| 2233 | /************************************************************************* | 
|---|
| 2234 | * InitMUILanguage [COMCTL32.70] | 
|---|
| 2235 | * | 
|---|
| 2236 | * FIXME: What's this supposed to do?  Apparently some i18n thing. | 
|---|
| 2237 | * | 
|---|
| 2238 | */ | 
|---|
| 2239 |  | 
|---|
| 2240 | BOOL WINAPI InitMUILanguage( LANGID uiLang) | 
|---|
| 2241 | { | 
|---|
| 2242 | dprintf(("COMCTL32: InitMUILanguage - empty stub!")); | 
|---|
| 2243 |  | 
|---|
| 2244 | return TRUE; | 
|---|
| 2245 | } | 
|---|