2 * Undocumented functions from COMCTL32.DLL
4 * Copyright 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
5 * 1998 Juergen Schmied <j.schmied@metronet.de>
7 * All of these functions are UNDOCUMENTED!! And I mean UNDOCUMENTED!!!!
8 * Do NOT rely on names or contents of undocumented structures and types!!!
9 * These functions are used by EXPLORER.EXE, IEXPLORE.EXE and
10 * COMCTL32.DLL (internally).
13 * - Add more functions.
14 * - Write some documentation.
18 #include <stdlib.h> /* atoi */
23 #include "wine/unicode.h"
26 #include "debugtools.h"
28 DEFAULT_DEBUG_CHANNEL(commctrl
);
31 extern HANDLE COMCTL32_hHeap
; /* handle to the private heap */
34 * We put some function prototypes here that don't seem to belong in
35 * any header file. When they find their place, we can remove them.
37 extern LPSTR WINAPI
lstrrchr(LPCSTR
, LPCSTR
, WORD
);
38 extern LPWSTR WINAPI
lstrrchrw(LPCWSTR
, LPCWSTR
, WORD
);
41 typedef struct _STREAMDATA
46 } STREAMDATA
, *PSTREAMDATA
;
48 typedef struct _LOADDATA
52 } LOADDATA
, *LPLOADDATA
;
54 typedef HRESULT(CALLBACK
*DPALOADPROC
)(LPLOADDATA
,IStream
*,LPARAM
);
57 /**************************************************************************
58 * DPA_LoadStream [COMCTL32.9]
60 * Loads a dynamic pointer array from a stream
63 * phDpa [O] pointer to a handle to a dynamic pointer array
64 * loadProc [I] pointer to a callback function
65 * pStream [I] pointer to a stream
66 * lParam [I] application specific value
69 * No more information available yet!
73 DPA_LoadStream (HDPA
*phDpa
, DPALOADPROC loadProc
, IStream
*pStream
, LPARAM lParam
)
76 LARGE_INTEGER position
;
77 ULARGE_INTEGER newPosition
;
78 STREAMDATA streamData
;
84 FIXME ("phDpa=%p loadProc=%p pStream=%p lParam=%lx\n",
85 phDpa
, loadProc
, pStream
, lParam
);
87 if (!phDpa
|| !loadProc
|| !pStream
)
92 position
.s
.LowPart
= 0;
93 position
.s
.HighPart
= 0;
95 errCode
= IStream_Seek (pStream
, position
, STREAM_SEEK_CUR
, &newPosition
);
99 errCode
= IStream_Read (pStream
, &streamData
, sizeof(STREAMDATA
), &ulRead
);
103 FIXME ("dwSize=%lu dwData2=%lu dwItems=%lu\n",
104 streamData
.dwSize
, streamData
.dwData2
, streamData
.dwItems
);
106 if (lParam
< sizeof(STREAMDATA
) ||
107 streamData
.dwSize
< sizeof(STREAMDATA
) ||
108 streamData
.dwData2
< 1) {
113 hDpa
= DPA_Create (streamData
.dwItems
);
115 return E_OUTOFMEMORY
;
117 if (!DPA_Grow (hDpa
, streamData
.dwItems
))
118 return E_OUTOFMEMORY
;
120 /* load data from the stream into the dpa */
122 for (loadData
.nCount
= 0; loadData
.nCount
< streamData
.dwItems
; loadData
.nCount
++) {
123 errCode
= (loadProc
)(&loadData
, pStream
, lParam
);
124 if (errCode
!= S_OK
) {
133 /* set the number of items */
134 hDpa
->nItemCount
= loadData
.nCount
;
136 /* store the handle to the dpa */
138 FIXME ("new hDpa=%p\n", hDpa
);
144 /**************************************************************************
145 * DPA_SaveStream [COMCTL32.10]
147 * Saves a dynamic pointer array to a stream
150 * hDpa [I] handle to a dynamic pointer array
151 * loadProc [I] pointer to a callback function
152 * pStream [I] pointer to a stream
153 * lParam [I] application specific value
156 * No more information available yet!
160 DPA_SaveStream (const HDPA hDpa
, DPALOADPROC loadProc
, IStream
*pStream
, LPARAM lParam
)
163 FIXME ("hDpa=%p loadProc=%p pStream=%p lParam=%lx\n",
164 hDpa
, loadProc
, pStream
, lParam
);
170 /**************************************************************************
171 * DPA_Merge [COMCTL32.11]
174 * hdpa1 [I] handle to a dynamic pointer array
175 * hdpa2 [I] handle to a dynamic pointer array
177 * pfnSort [I] pointer to sort function
178 * pfnMerge [I] pointer to merge function
179 * lParam [I] application specific value
182 * No more information available yet!
186 DPA_Merge (const HDPA hdpa1
, const HDPA hdpa2
, DWORD dwFlags
,
187 PFNDPACOMPARE pfnCompare
, PFNDPAMERGE pfnMerge
, LPARAM lParam
)
191 #if 0 /* these go with the "incomplete implementation" below */
192 LPVOID pWork1
, pWork2
;
198 TRACE("(%p %p %08lx %p %p %08lx): semi stub!\n",
199 hdpa1
, hdpa2
, dwFlags
, pfnCompare
, pfnMerge
, lParam
);
201 if (IsBadWritePtr (hdpa1
, sizeof(DPA
)))
204 if (IsBadWritePtr (hdpa2
, sizeof(DPA
)))
207 if (IsBadCodePtr ((FARPROC
)pfnCompare
))
210 if (IsBadCodePtr ((FARPROC
)pfnMerge
))
213 if (dwFlags
& DPAM_SORT
) {
214 TRACE("sorting dpa's!\n");
215 if (hdpa1
->nItemCount
> 0)
216 DPA_Sort (hdpa1
, pfnCompare
, lParam
);
217 TRACE ("dpa 1 sorted!\n");
218 if (hdpa2
->nItemCount
> 0)
219 DPA_Sort (hdpa2
, pfnCompare
, lParam
);
220 TRACE ("dpa 2 sorted!\n");
223 if (hdpa2
->nItemCount
< 1)
226 TRACE("hdpa1->nItemCount=%d hdpa2->nItemCount=%d\n",
227 hdpa1
->nItemCount
, hdpa2
->nItemCount
);
230 /* preliminary hack - simply append the pointer list hdpa2 to hdpa1 */
231 for (nCount
= 0; nCount
< hdpa2
->nItemCount
; nCount
++)
232 DPA_InsertPtr (hdpa1
, hdpa1
->nItemCount
+ 1, hdpa2
->ptrs
[nCount
]);
235 /* incomplete implementation */
237 pWork1
= &(hdpa1
->ptrs
[hdpa1
->nItemCount
- 1]);
238 pWork2
= &(hdpa2
->ptrs
[hdpa2
->nItemCount
- 1]);
240 nIndex
= hdpa1
->nItemCount
- 1;
241 nCount
= hdpa2
->nItemCount
- 1;
245 nResult
= (pfnCompare
)(pWork1
, pWork2
, lParam
);
251 ptr
= (pfnMerge
)(1, pWork1
, pWork2
, lParam
);
259 else if (nResult
< 0)
265 ptr
= DPA_DeletePtr (hdpa1
, hdpa1
->nItemCount
- 1);
267 (pfnMerge
)(2, ptr
, NULL
, lParam
);
276 ptr
= (pfnMerge
)(3, pWork2
, NULL
, lParam
);
279 DPA_InsertPtr (hdpa1
, nIndex
, ptr
);
296 /**************************************************************************
297 * Alloc [COMCTL32.71]
299 * Allocates memory block from the dll's private heap
302 * dwSize [I] size of the allocated memory block
305 * Success: pointer to allocated memory block
310 COMCTL32_Alloc (DWORD dwSize
)
314 TRACE("(0x%lx)\n", dwSize
);
316 lpPtr
= HeapAlloc (COMCTL32_hHeap
, HEAP_ZERO_MEMORY
, dwSize
);
318 TRACE("-- ret=%p\n", lpPtr
);
324 /**************************************************************************
325 * ReAlloc [COMCTL32.72]
327 * Changes the size of an allocated memory block or allocates a memory
328 * block using the dll's private heap.
331 * lpSrc [I] pointer to memory block which will be resized
332 * dwSize [I] new size of the memory block.
335 * Success: pointer to the resized memory block
339 * If lpSrc is a NULL-pointer, then COMCTL32_ReAlloc allocates a memory
340 * block like COMCTL32_Alloc.
344 COMCTL32_ReAlloc (LPVOID lpSrc
, DWORD dwSize
)
348 TRACE("(%p 0x%08lx)\n", lpSrc
, dwSize
);
351 lpDest
= HeapReAlloc (COMCTL32_hHeap
, HEAP_ZERO_MEMORY
, lpSrc
, dwSize
);
353 lpDest
= HeapAlloc (COMCTL32_hHeap
, HEAP_ZERO_MEMORY
, dwSize
);
355 TRACE("-- ret=%p\n", lpDest
);
361 /**************************************************************************
364 * Frees an allocated memory block from the dll's private heap.
367 * lpMem [I] pointer to memory block which will be freed
375 COMCTL32_Free (LPVOID lpMem
)
377 TRACE("(%p)\n", lpMem
);
379 return HeapFree (COMCTL32_hHeap
, 0, lpMem
);
383 /**************************************************************************
384 * GetSize [COMCTL32.74]
386 * Retrieves the size of the specified memory block from the dll's
390 * lpMem [I] pointer to an allocated memory block
393 * Success: size of the specified memory block
398 COMCTL32_GetSize (LPVOID lpMem
)
400 TRACE("(%p)\n", lpMem
);
402 return HeapSize (COMCTL32_hHeap
, 0, lpMem
);
406 /**************************************************************************
407 * The MRU-API is a set of functions to manipulate MRU(Most Recently Used)
410 * Stored in the reg. as a set of values under a single key. Each item in the
411 * list has a value name that is a single char. 'a' - 'z', '{', '|' or '}'.
412 * The order of the list is stored with value name 'MRUList' which is a string
413 * containing the value names (i.e. 'a', 'b', etc.) in the relevant order.
416 typedef struct tagCREATEMRULIST
418 DWORD cbSize
; /* size of struct */
419 DWORD nMaxItems
; /* max no. of items in list */
420 DWORD dwFlags
; /* see below */
421 HKEY hKey
; /* root reg. key under which list is saved */
422 LPCSTR lpszSubKey
; /* reg. subkey */
423 PROC lpfnCompare
; /* item compare proc */
424 } CREATEMRULIST
, *LPCREATEMRULIST
;
427 #define MRUF_STRING_LIST 0 /* list will contain strings */
428 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
429 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
431 /* If list is a string list lpfnCompare has the following prototype
432 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
433 * for binary lists the prototype is
434 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
435 * where cbData is the no. of bytes to compare.
436 * Need to check what return value means identical - 0?
439 typedef struct tagMRU
441 DWORD dwParam1
; /* some kind of flag */
450 CreateMRUListLazyA (LPCREATEMRULIST lpcml
, DWORD dwParam2
,
451 DWORD dwParam3
, DWORD dwParam4
);
454 /**************************************************************************
455 * CreateMRUListA [COMCTL32.151]
458 * lpcml [I] ptr to CREATEMRULIST structure.
461 * Handle to MRU list.
464 CreateMRUListA (LPCREATEMRULIST lpcml
)
466 return CreateMRUListLazyA (lpcml
, 0, 0, 0);
469 /**************************************************************************
470 * FreeMRUListA [COMCTL32.152]
473 * hMRUList [I] Handle to list.
477 FreeMRUListA (HANDLE hMRUList
)
479 FIXME("(%08x) empty stub!\n", hMRUList
);
482 if (!(hmru
->dwParam1
& 1001)) {
483 RegSetValueExA (hmru
->hKeyMRU
, "MRUList", 0, REG_SZ
,
485 lstrlenA (hmru
->lpszMRUString
));
489 RegClosKey (hmru
->hkeyMRU
490 COMCTL32_Free32 (hmru
->lpszMRUString
);
493 return COMCTL32_Free ((LPVOID
)hMRUList
);
497 /**************************************************************************
498 * AddMRUData [COMCTL32.167]
500 * Add item to MRU binary list. If item already exists in list them it is
501 * simply moved up to the top of the list and not added again. If list is
502 * full then the least recently used item is removed to make room.
505 * hList [I] Handle to list.
506 * lpData [I] ptr to data to add.
507 * cbData [I] no. of bytes of data.
510 * No. corresponding to registry name where value is stored 'a' -> 0 etc.
514 AddMRUData (HANDLE hList
, LPCVOID lpData
, DWORD cbData
)
516 FIXME("(%08x, %p, %ld) empty stub!\n", hList
, lpData
, cbData
);
521 /**************************************************************************
522 * AddMRUStringA [COMCTL32.153]
524 * Add item to MRU string list. If item already exists in list them it is
525 * simply moved up to the top of the list and not added again. If list is
526 * full then the least recently used item is removed to make room.
529 * hList [I] Handle to list.
530 * lpszString [I] ptr to string to add.
533 * No. corresponding to registry name where value is stored 'a' -> 0 etc.
537 AddMRUStringA(HANDLE hList
, LPCSTR lpszString
)
539 FIXME("(%08x, %s) empty stub!\n", hList
, debugstr_a(lpszString
));
544 /**************************************************************************
545 * DelMRUString [COMCTL32.156]
547 * Removes item from either string or binary list (despite its name)
550 * hList [I] list handle
551 * nItemPos [I] item position to remove 0 -> MRU
554 * TRUE is successful, FALSE if nItemPos is out of range.
557 DelMRUString(HANDLE hList
, INT nItemPos
)
559 FIXME("(%08x, %d): stub\n", hList
, nItemPos
);
563 /**************************************************************************
564 * FindMRUData [COMCTL32.169]
566 * Searches binary list for item that matches lpData of length cbData.
567 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
568 * corresponding to item's reg. name will be stored in it ('a' -> 0).
571 * hList [I] list handle
572 * lpData [I] data to find
573 * cbData [I] length of data
574 * lpRegNum [O] position in registry (maybe NULL)
577 * Position in list 0 -> MRU. -1 if item not found.
580 FindMRUData (HANDLE hList
, LPCVOID lpData
, DWORD cbData
, LPINT lpRegNum
)
582 FIXME("(%08x, %p, %ld, %p) empty stub!\n",
583 hList
, lpData
, cbData
, lpRegNum
);
588 /**************************************************************************
589 * FindMRUStringA [COMCTL32.155]
591 * Searches string list for item that matches lpszString.
592 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
593 * corresponding to item's reg. name will be stored in it ('a' -> 0).
596 * hList [I] list handle
597 * lpszString [I] string to find
598 * lpRegNum [O] position in registry (maybe NULL)
601 * Position in list 0 -> MRU. -1 if item not found.
604 FindMRUStringA (HANDLE hList
, LPCSTR lpszString
, LPINT lpRegNum
)
606 FIXME("(%08x, %s, %p) empty stub!\n", hList
, debugstr_a(lpszString
),
612 /**************************************************************************
613 * CreateMRUListLazyA [COMCTL32.157]
616 CreateMRUListLazyA (LPCREATEMRULIST lpcml
, DWORD dwParam2
, DWORD dwParam3
, DWORD dwParam4
)
625 * DWORD dwDisposition; */
627 /* internal variables */
630 FIXME("(%p) empty stub!\n", lpcml
);
635 if (lpcml
->cbSize
< sizeof(CREATEMRULIST
))
638 FIXME("(%lu %lu %lx %lx \"%s\" %p)\n",
639 lpcml
->cbSize
, lpcml
->nMaxItems
, lpcml
->dwFlags
,
640 (DWORD
)lpcml
->hKey
, lpcml
->lpszSubKey
, lpcml
->lpfnCompare
);
642 /* dummy pointer creation */
643 ptr
= COMCTL32_Alloc (32);
645 FIXME("-- ret = %p\n", ptr
);
650 /**************************************************************************
651 * EnumMRUListA [COMCTL32.154]
653 * Enumerate item in a list
656 * hList [I] list handle
657 * nItemPos [I] item position to enumerate
658 * lpBuffer [O] buffer to receive item
659 * nBufferSize [I] size of buffer
662 * For binary lists specifies how many bytes were copied to buffer, for
663 * string lists specifies full length of string. Enumerating past the end
664 * of list returns -1.
665 * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in
668 INT WINAPI
EnumMRUListA(HANDLE hList
, INT nItemPos
, LPVOID lpBuffer
,
671 FIXME("(%08x, %d, %p, %ld): stub\n", hList
, nItemPos
, lpBuffer
,
676 /**************************************************************************
677 * Str_GetPtrA [COMCTL32.233]
688 Str_GetPtrA (LPCSTR lpSrc
, LPSTR lpDest
, INT nMaxLen
)
692 TRACE("(%p %p %d)\n", lpSrc
, lpDest
, nMaxLen
);
694 if (!lpDest
&& lpSrc
)
695 return lstrlenA (lpSrc
);
705 len
= lstrlenA (lpSrc
);
709 RtlMoveMemory (lpDest
, lpSrc
, len
);
716 /**************************************************************************
717 * Str_SetPtrA [COMCTL32.234]
727 Str_SetPtrA (LPSTR
*lppDest
, LPCSTR lpSrc
)
729 TRACE("(%p %p)\n", lppDest
, lpSrc
);
732 LPSTR ptr
= COMCTL32_ReAlloc (*lppDest
, lstrlenA (lpSrc
) + 1);
735 lstrcpyA (ptr
, lpSrc
);
740 COMCTL32_Free (*lppDest
);
749 /**************************************************************************
750 * Str_GetPtrW [COMCTL32.235]
761 Str_GetPtrW (LPCWSTR lpSrc
, LPWSTR lpDest
, INT nMaxLen
)
765 TRACE("(%p %p %d)\n", lpSrc
, lpDest
, nMaxLen
);
767 if (!lpDest
&& lpSrc
)
768 return lstrlenW (lpSrc
);
778 len
= lstrlenW (lpSrc
);
782 RtlMoveMemory (lpDest
, lpSrc
, len
*sizeof(WCHAR
));
789 /**************************************************************************
790 * Str_SetPtrW [COMCTL32.236]
800 Str_SetPtrW (LPWSTR
*lppDest
, LPCWSTR lpSrc
)
802 TRACE("(%p %p)\n", lppDest
, lpSrc
);
805 INT len
= lstrlenW (lpSrc
) + 1;
806 LPWSTR ptr
= COMCTL32_ReAlloc (*lppDest
, len
* sizeof(WCHAR
));
809 lstrcpyW (ptr
, lpSrc
);
814 COMCTL32_Free (*lppDest
);
823 /**************************************************************************
824 * The DSA-API is a set of functions to create and manipulate arrays of
825 * fixed-size memory blocks. These arrays can store any kind of data
826 * (strings, icons...).
829 /**************************************************************************
830 * DSA_Create [COMCTL32.320] Creates a dynamic storage array
833 * nSize [I] size of the array elements
834 * nGrow [I] number of elements by which the array grows when it is filled
837 * Success: pointer to an array control structure. Use this like a handle.
842 DSA_Create (INT nSize
, INT nGrow
)
846 TRACE("(size=%d grow=%d)\n", nSize
, nGrow
);
848 hdsa
= (HDSA
)COMCTL32_Alloc (sizeof(DSA
));
851 hdsa
->nItemCount
= 0;
854 hdsa
->nItemSize
= nSize
;
855 hdsa
->nGrow
= max(1, nGrow
);
862 /**************************************************************************
863 * DSA_Destroy [COMCTL32.321] Destroys a dynamic storage array
866 * hdsa [I] pointer to the array control structure
874 DSA_Destroy (const HDSA hdsa
)
876 TRACE("(%p)\n", hdsa
);
881 if (hdsa
->pData
&& (!COMCTL32_Free (hdsa
->pData
)))
884 return COMCTL32_Free (hdsa
);
888 /**************************************************************************
889 * DSA_GetItem [COMCTL32.322]
892 * hdsa [I] pointer to the array control structure
893 * nIndex [I] number of the Item to get
894 * pDest [O] destination buffer. Has to be >= dwElementSize.
902 DSA_GetItem (const HDSA hdsa
, INT nIndex
, LPVOID pDest
)
906 TRACE("(%p %d %p)\n", hdsa
, nIndex
, pDest
);
910 if ((nIndex
< 0) || (nIndex
>= hdsa
->nItemCount
))
913 pSrc
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
914 memmove (pDest
, pSrc
, hdsa
->nItemSize
);
920 /**************************************************************************
921 * DSA_GetItemPtr [COMCTL32.323]
923 * Retrieves a pointer to the specified item.
926 * hdsa [I] pointer to the array control structure
927 * nIndex [I] index of the desired item
930 * Success: pointer to an item
935 DSA_GetItemPtr (const HDSA hdsa
, INT nIndex
)
939 TRACE("(%p %d)\n", hdsa
, nIndex
);
943 if ((nIndex
< 0) || (nIndex
>= hdsa
->nItemCount
))
946 pSrc
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
948 TRACE("-- ret=%p\n", pSrc
);
954 /**************************************************************************
955 * DSA_SetItem [COMCTL32.325]
957 * Sets the contents of an item in the array.
960 * hdsa [I] pointer to the array control structure
961 * nIndex [I] index for the item
962 * pSrc [I] pointer to the new item data
970 DSA_SetItem (const HDSA hdsa
, INT nIndex
, LPVOID pSrc
)
972 INT nSize
, nNewItems
;
973 LPVOID pDest
, lpTemp
;
975 TRACE("(%p %d %p)\n", hdsa
, nIndex
, pSrc
);
977 if ((!hdsa
) || nIndex
< 0)
980 if (hdsa
->nItemCount
<= nIndex
) {
981 /* within the old array */
982 if (hdsa
->nMaxCount
> nIndex
) {
983 /* within the allocated space, set a new boundary */
984 hdsa
->nItemCount
= nIndex
+ 1;
987 /* resize the block of memory */
989 hdsa
->nGrow
* ((INT
)(((nIndex
+ 1) - 1) / hdsa
->nGrow
) + 1);
990 nSize
= hdsa
->nItemSize
* nNewItems
;
992 lpTemp
= (LPVOID
)COMCTL32_ReAlloc (hdsa
->pData
, nSize
);
996 hdsa
->nMaxCount
= nNewItems
;
997 hdsa
->nItemCount
= nIndex
+ 1;
998 hdsa
->pData
= lpTemp
;
1002 /* put the new entry in */
1003 pDest
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1004 TRACE("-- move dest=%p src=%p size=%d\n",
1005 pDest
, pSrc
, hdsa
->nItemSize
);
1006 memmove (pDest
, pSrc
, hdsa
->nItemSize
);
1012 /**************************************************************************
1013 * DSA_InsertItem [COMCTL32.325]
1016 * hdsa [I] pointer to the array control structure
1017 * nIndex [I] index for the new item
1018 * pSrc [I] pointer to the element
1021 * Success: position of the new item
1026 DSA_InsertItem (const HDSA hdsa
, INT nIndex
, LPVOID pSrc
)
1028 INT nNewItems
, nSize
, i
;
1029 LPVOID lpTemp
, lpDest
;
1032 TRACE("(%p %d %p)\n", hdsa
, nIndex
, pSrc
);
1034 if ((!hdsa
) || nIndex
< 0)
1037 for (i
= 0; i
< hdsa
->nItemSize
; i
+= 4) {
1038 p
= *(DWORD
**)((char *) pSrc
+ i
);
1039 if (IsBadStringPtrA ((char*)p
, 256))
1040 TRACE("-- %d=%p\n", i
, (DWORD
*)p
);
1042 TRACE("-- %d=%p [%s]\n", i
, p
, debugstr_a((char*)p
));
1045 /* when nIndex >= nItemCount then append */
1046 if (nIndex
>= hdsa
->nItemCount
)
1047 nIndex
= hdsa
->nItemCount
;
1049 /* do we need to resize ? */
1050 if (hdsa
->nItemCount
>= hdsa
->nMaxCount
) {
1051 nNewItems
= hdsa
->nMaxCount
+ hdsa
->nGrow
;
1052 nSize
= hdsa
->nItemSize
* nNewItems
;
1054 lpTemp
= (LPVOID
)COMCTL32_ReAlloc (hdsa
->pData
, nSize
);
1058 hdsa
->nMaxCount
= nNewItems
;
1059 hdsa
->pData
= lpTemp
;
1062 /* do we need to move elements ? */
1063 if (nIndex
< hdsa
->nItemCount
) {
1064 lpTemp
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1065 lpDest
= (char *) lpTemp
+ hdsa
->nItemSize
;
1066 nSize
= (hdsa
->nItemCount
- nIndex
) * hdsa
->nItemSize
;
1067 TRACE("-- move dest=%p src=%p size=%d\n",
1068 lpDest
, lpTemp
, nSize
);
1069 memmove (lpDest
, lpTemp
, nSize
);
1072 /* ok, we can put the new Item in */
1074 lpDest
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1075 TRACE("-- move dest=%p src=%p size=%d\n",
1076 lpDest
, pSrc
, hdsa
->nItemSize
);
1077 memmove (lpDest
, pSrc
, hdsa
->nItemSize
);
1083 /**************************************************************************
1084 * DSA_DeleteItem [COMCTL32.326]
1087 * hdsa [I] pointer to the array control structure
1088 * nIndex [I] index for the element to delete
1091 * Success: number of the deleted element
1096 DSA_DeleteItem (const HDSA hdsa
, INT nIndex
)
1098 LPVOID lpDest
,lpSrc
;
1101 TRACE("(%p %d)\n", hdsa
, nIndex
);
1105 if (nIndex
< 0 || nIndex
>= hdsa
->nItemCount
)
1108 /* do we need to move ? */
1109 if (nIndex
< hdsa
->nItemCount
- 1) {
1110 lpDest
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1111 lpSrc
= (char *) lpDest
+ hdsa
->nItemSize
;
1112 nSize
= hdsa
->nItemSize
* (hdsa
->nItemCount
- nIndex
- 1);
1113 TRACE("-- move dest=%p src=%p size=%d\n",
1114 lpDest
, lpSrc
, nSize
);
1115 memmove (lpDest
, lpSrc
, nSize
);
1121 if ((hdsa
->nMaxCount
- hdsa
->nItemCount
) >= hdsa
->nGrow
) {
1122 nSize
= hdsa
->nItemSize
* hdsa
->nItemCount
;
1124 lpDest
= (LPVOID
)COMCTL32_ReAlloc (hdsa
->pData
, nSize
);
1128 hdsa
->nMaxCount
= hdsa
->nItemCount
;
1129 hdsa
->pData
= lpDest
;
1136 /**************************************************************************
1137 * DSA_DeleteAllItems [COMCTL32.326]
1139 * Removes all items and reinitializes the array.
1142 * hdsa [I] pointer to the array control structure
1150 DSA_DeleteAllItems (const HDSA hdsa
)
1152 TRACE("(%p)\n", hdsa
);
1156 if (hdsa
->pData
&& (!COMCTL32_Free (hdsa
->pData
)))
1159 hdsa
->nItemCount
= 0;
1161 hdsa
->nMaxCount
= 0;
1167 /**************************************************************************
1168 * The DPA-API is a set of functions to create and manipulate arrays of
1172 /**************************************************************************
1173 * DPA_Create [COMCTL32.328] Creates a dynamic pointer array
1176 * nGrow [I] number of items by which the array grows when it is filled
1179 * Success: handle (pointer) to the pointer array.
1184 DPA_Create (INT nGrow
)
1188 TRACE("(%d)\n", nGrow
);
1190 hdpa
= (HDPA
)COMCTL32_Alloc (sizeof(DPA
));
1192 hdpa
->nGrow
= max(8, nGrow
);
1193 hdpa
->hHeap
= COMCTL32_hHeap
;
1194 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1196 (LPVOID
*)COMCTL32_Alloc (hdpa
->nMaxCount
* sizeof(LPVOID
));
1199 TRACE("-- %p\n", hdpa
);
1205 /**************************************************************************
1206 * DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array
1209 * hdpa [I] handle (pointer) to the pointer array
1217 DPA_Destroy (const HDPA hdpa
)
1219 TRACE("(%p)\n", hdpa
);
1224 if (hdpa
->ptrs
&& (!HeapFree (hdpa
->hHeap
, 0, hdpa
->ptrs
)))
1227 return HeapFree (hdpa
->hHeap
, 0, hdpa
);
1231 /**************************************************************************
1232 * DPA_Grow [COMCTL32.330]
1234 * Sets the growth amount.
1237 * hdpa [I] handle (pointer) to the existing (source) pointer array
1238 * nGrow [I] number of items, the array grows, when it's too small
1246 DPA_Grow (const HDPA hdpa
, INT nGrow
)
1248 TRACE("(%p %d)\n", hdpa
, nGrow
);
1253 hdpa
->nGrow
= max(8, nGrow
);
1259 /**************************************************************************
1260 * DPA_Clone [COMCTL32.331]
1262 * Copies a pointer array to an other one or creates a copy
1265 * hdpa [I] handle (pointer) to the existing (source) pointer array
1266 * hdpaNew [O] handle (pointer) to the destination pointer array
1269 * Success: pointer to the destination pointer array.
1273 * - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer
1274 * array will be created and it's handle (pointer) is returned.
1275 * - If 'hdpa' is a NULL-Pointer, the original implementation crashes,
1276 * this implementation just returns NULL.
1280 DPA_Clone (const HDPA hdpa
, const HDPA hdpaNew
)
1282 INT nNewItems
, nSize
;
1288 TRACE("(%p %p)\n", hdpa
, hdpaNew
);
1291 /* create a new DPA */
1292 hdpaTemp
= (HDPA
)HeapAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1294 hdpaTemp
->hHeap
= hdpa
->hHeap
;
1295 hdpaTemp
->nGrow
= hdpa
->nGrow
;
1300 if (hdpaTemp
->ptrs
) {
1301 /* remove old pointer array */
1302 HeapFree (hdpaTemp
->hHeap
, 0, hdpaTemp
->ptrs
);
1303 hdpaTemp
->ptrs
= NULL
;
1304 hdpaTemp
->nItemCount
= 0;
1305 hdpaTemp
->nMaxCount
= 0;
1308 /* create a new pointer array */
1309 nNewItems
= hdpaTemp
->nGrow
*
1310 ((INT
)((hdpa
->nItemCount
- 1) / hdpaTemp
->nGrow
) + 1);
1311 nSize
= nNewItems
* sizeof(LPVOID
);
1313 (LPVOID
*)HeapAlloc (hdpaTemp
->hHeap
, HEAP_ZERO_MEMORY
, nSize
);
1314 hdpaTemp
->nMaxCount
= nNewItems
;
1316 /* clone the pointer array */
1317 hdpaTemp
->nItemCount
= hdpa
->nItemCount
;
1318 memmove (hdpaTemp
->ptrs
, hdpa
->ptrs
,
1319 hdpaTemp
->nItemCount
* sizeof(LPVOID
));
1325 /**************************************************************************
1326 * DPA_GetPtr [COMCTL32.332]
1328 * Retrieves a pointer from a dynamic pointer array
1331 * hdpa [I] handle (pointer) to the pointer array
1332 * nIndex [I] array index of the desired pointer
1340 DPA_GetPtr (const HDPA hdpa
, INT i
)
1342 TRACE("(%p %d)\n", hdpa
, i
);
1348 if ((i
< 0) || (i
>= hdpa
->nItemCount
))
1351 TRACE("-- %p\n", hdpa
->ptrs
[i
]);
1353 return hdpa
->ptrs
[i
];
1357 /**************************************************************************
1358 * DPA_GetPtrIndex [COMCTL32.333]
1360 * Retrieves the index of the specified pointer
1363 * hdpa [I] handle (pointer) to the pointer array
1367 * Success: index of the specified pointer
1372 DPA_GetPtrIndex (const HDPA hdpa
, LPVOID p
)
1379 for (i
= 0; i
< hdpa
->nItemCount
; i
++) {
1380 if (hdpa
->ptrs
[i
] == p
)
1388 /**************************************************************************
1389 * DPA_InsertPtr [COMCTL32.334]
1391 * Inserts a pointer into a dynamic pointer array
1394 * hdpa [I] handle (pointer) to the array
1396 * p [I] pointer to insert
1399 * Success: index of the inserted pointer
1404 DPA_InsertPtr (const HDPA hdpa
, INT i
, LPVOID p
)
1406 INT nNewItems
, nSize
, nIndex
= 0;
1407 LPVOID
*lpTemp
, *lpDest
;
1409 TRACE("(%p %d %p)\n", hdpa
, i
, p
);
1411 if ((!hdpa
) || (i
< 0))
1416 (LPVOID
*)HeapAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1417 2 * hdpa
->nGrow
* sizeof(LPVOID
));
1420 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1424 if (hdpa
->nItemCount
>= hdpa
->nMaxCount
) {
1425 TRACE("-- resizing\n");
1426 nNewItems
= hdpa
->nMaxCount
+ hdpa
->nGrow
;
1427 nSize
= nNewItems
* sizeof(LPVOID
);
1429 lpTemp
= (LPVOID
*)HeapReAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1433 hdpa
->nMaxCount
= nNewItems
;
1434 hdpa
->ptrs
= lpTemp
;
1437 if (i
>= hdpa
->nItemCount
) {
1438 nIndex
= hdpa
->nItemCount
;
1439 TRACE("-- appending at %d\n", nIndex
);
1442 TRACE("-- inserting at %d\n", i
);
1443 lpTemp
= hdpa
->ptrs
+ i
;
1444 lpDest
= lpTemp
+ 1;
1445 nSize
= (hdpa
->nItemCount
- i
) * sizeof(LPVOID
);
1446 TRACE("-- move dest=%p src=%p size=%x\n",
1447 lpDest
, lpTemp
, nSize
);
1448 memmove (lpDest
, lpTemp
, nSize
);
1455 hdpa
->ptrs
[nIndex
] = p
;
1461 /**************************************************************************
1462 * DPA_SetPtr [COMCTL32.335]
1464 * Sets a pointer in the pointer array
1467 * hdpa [I] handle (pointer) to the pointer array
1468 * i [I] index of the pointer that will be set
1469 * p [I] pointer to be set
1477 DPA_SetPtr (const HDPA hdpa
, INT i
, LPVOID p
)
1481 TRACE("(%p %d %p)\n", hdpa
, i
, p
);
1483 if ((!hdpa
) || i
< 0)
1486 if (hdpa
->nItemCount
<= i
) {
1487 /* within the old array */
1488 if (hdpa
->nMaxCount
> i
) {
1489 /* within the allocated space, set a new boundary */
1490 hdpa
->nItemCount
= i
;
1493 /* resize the block of memory */
1495 hdpa
->nGrow
* ((INT
)(((i
+1) - 1) / hdpa
->nGrow
) + 1);
1496 INT nSize
= nNewItems
* sizeof(LPVOID
);
1498 lpTemp
= (LPVOID
*)HeapReAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1503 hdpa
->nItemCount
= nNewItems
;
1504 hdpa
->ptrs
= lpTemp
;
1508 /* put the new entry in */
1515 /**************************************************************************
1516 * DPA_DeletePtr [COMCTL32.336]
1518 * Removes a pointer from the pointer array.
1521 * hdpa [I] handle (pointer) to the pointer array
1522 * i [I] index of the pointer that will be deleted
1525 * Success: deleted pointer
1530 DPA_DeletePtr (const HDPA hdpa
, INT i
)
1532 LPVOID
*lpDest
, *lpSrc
, lpTemp
= NULL
;
1535 TRACE("(%p %d)\n", hdpa
, i
);
1537 if ((!hdpa
) || i
< 0 || i
>= hdpa
->nItemCount
)
1540 lpTemp
= hdpa
->ptrs
[i
];
1542 /* do we need to move ?*/
1543 if (i
< hdpa
->nItemCount
- 1) {
1544 lpDest
= hdpa
->ptrs
+ i
;
1546 nSize
= (hdpa
->nItemCount
- i
- 1) * sizeof(LPVOID
);
1547 TRACE("-- move dest=%p src=%p size=%x\n",
1548 lpDest
, lpSrc
, nSize
);
1549 memmove (lpDest
, lpSrc
, nSize
);
1552 hdpa
->nItemCount
--;
1555 if ((hdpa
->nMaxCount
- hdpa
->nItemCount
) >= hdpa
->nGrow
) {
1556 INT nNewItems
= max(hdpa
->nGrow
* 2, hdpa
->nItemCount
);
1557 nSize
= nNewItems
* sizeof(LPVOID
);
1558 lpDest
= (LPVOID
)HeapReAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1563 hdpa
->nMaxCount
= nNewItems
;
1564 hdpa
->ptrs
= (LPVOID
*)lpDest
;
1571 /**************************************************************************
1572 * DPA_DeleteAllPtrs [COMCTL32.337]
1574 * Removes all pointers and reinitializes the array.
1577 * hdpa [I] handle (pointer) to the pointer array
1585 DPA_DeleteAllPtrs (const HDPA hdpa
)
1587 TRACE("(%p)\n", hdpa
);
1592 if (hdpa
->ptrs
&& (!HeapFree (hdpa
->hHeap
, 0, hdpa
->ptrs
)))
1595 hdpa
->nItemCount
= 0;
1596 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1597 hdpa
->ptrs
= (LPVOID
*)HeapAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1598 hdpa
->nMaxCount
* sizeof(LPVOID
));
1604 /**************************************************************************
1605 * DPA_QuickSort [Internal]
1607 * Ordinary quicksort (used by DPA_Sort).
1610 * lpPtrs [I] pointer to the pointer array
1611 * l [I] index of the "left border" of the partition
1612 * r [I] index of the "right border" of the partition
1613 * pfnCompare [I] pointer to the compare function
1614 * lParam [I] user defined value (3rd parameter in compare function)
1621 DPA_QuickSort (LPVOID
*lpPtrs
, INT l
, INT r
,
1622 PFNDPACOMPARE pfnCompare
, LPARAM lParam
)
1627 TRACE("l=%i r=%i\n", l
, r
);
1631 v
= lpPtrs
[(int)(l
+r
)/2];
1633 while ((pfnCompare
)(lpPtrs
[i
], v
, lParam
) < 0) i
++;
1634 while ((pfnCompare
)(lpPtrs
[j
], v
, lParam
) > 0) j
--;
1638 lpPtrs
[i
++] = lpPtrs
[j
];
1642 if (l
< j
) DPA_QuickSort (lpPtrs
, l
, j
, pfnCompare
, lParam
);
1643 if (i
< r
) DPA_QuickSort (lpPtrs
, i
, r
, pfnCompare
, lParam
);
1647 /**************************************************************************
1648 * DPA_Sort [COMCTL32.338]
1650 * Sorts a pointer array using a user defined compare function
1653 * hdpa [I] handle (pointer) to the pointer array
1654 * pfnCompare [I] pointer to the compare function
1655 * lParam [I] user defined value (3rd parameter of compare function)
1663 DPA_Sort (const HDPA hdpa
, PFNDPACOMPARE pfnCompare
, LPARAM lParam
)
1665 if (!hdpa
|| !pfnCompare
)
1668 TRACE("(%p %p 0x%lx)\n", hdpa
, pfnCompare
, lParam
);
1670 if ((hdpa
->nItemCount
> 1) && (hdpa
->ptrs
))
1671 DPA_QuickSort (hdpa
->ptrs
, 0, hdpa
->nItemCount
- 1,
1672 pfnCompare
, lParam
);
1678 /**************************************************************************
1679 * DPA_Search [COMCTL32.339]
1681 * Searches a pointer array for a specified pointer
1684 * hdpa [I] handle (pointer) to the pointer array
1685 * pFind [I] pointer to search for
1686 * nStart [I] start index
1687 * pfnCompare [I] pointer to the compare function
1688 * lParam [I] user defined value (3rd parameter of compare function)
1689 * uOptions [I] search options
1692 * Success: index of the pointer in the array.
1696 * Binary search taken from R.Sedgewick "Algorithms in C"!
1697 * Function is NOT tested!
1698 * If something goes wrong, blame HIM not ME! (Eric Kohl)
1702 DPA_Search (const HDPA hdpa
, LPVOID pFind
, INT nStart
,
1703 PFNDPACOMPARE pfnCompare
, LPARAM lParam
, UINT uOptions
)
1705 if (!hdpa
|| !pfnCompare
|| !pFind
)
1708 TRACE("(%p %p %d %p 0x%08lx 0x%08x)\n",
1709 hdpa
, pFind
, nStart
, pfnCompare
, lParam
, uOptions
);
1711 if (uOptions
& DPAS_SORTED
) {
1712 /* array is sorted --> use binary search */
1716 TRACE("binary search\n");
1718 l
= (nStart
== -1) ? 0 : nStart
;
1719 r
= hdpa
->nItemCount
- 1;
1723 n
= (pfnCompare
)(pFind
, lpPtr
[x
], lParam
);
1729 TRACE("-- ret=%d\n", n
);
1734 if (uOptions
& DPAS_INSERTBEFORE
) {
1735 TRACE("-- ret=%d\n", r
);
1739 if (uOptions
& DPAS_INSERTAFTER
) {
1740 TRACE("-- ret=%d\n", l
);
1745 /* array is not sorted --> use linear search */
1749 TRACE("linear search\n");
1751 nIndex
= (nStart
== -1)? 0 : nStart
;
1753 for (; nIndex
< hdpa
->nItemCount
; nIndex
++) {
1754 if ((pfnCompare
)(pFind
, lpPtr
[nIndex
], lParam
) == 0) {
1755 TRACE("-- ret=%d\n", nIndex
);
1761 TRACE("-- not found: ret=-1\n");
1766 /**************************************************************************
1767 * DPA_CreateEx [COMCTL32.340]
1769 * Creates a dynamic pointer array using the specified size and heap.
1772 * nGrow [I] number of items by which the array grows when it is filled
1773 * hHeap [I] handle to the heap where the array is stored
1776 * Success: handle (pointer) to the pointer array.
1781 DPA_CreateEx (INT nGrow
, HANDLE hHeap
)
1785 TRACE("(%d 0x%x)\n", nGrow
, hHeap
);
1788 hdpa
= (HDPA
)HeapAlloc (hHeap
, HEAP_ZERO_MEMORY
, sizeof(DPA
));
1790 hdpa
= (HDPA
)COMCTL32_Alloc (sizeof(DPA
));
1793 hdpa
->nGrow
= min(8, nGrow
);
1794 hdpa
->hHeap
= hHeap
? hHeap
: COMCTL32_hHeap
;
1795 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1797 (LPVOID
*)HeapAlloc (hHeap
, HEAP_ZERO_MEMORY
,
1798 hdpa
->nMaxCount
* sizeof(LPVOID
));
1801 TRACE("-- %p\n", hdpa
);
1807 /**************************************************************************
1808 * Notification functions
1811 typedef struct tagNOTIFYDATA
1819 } NOTIFYDATA
, *LPNOTIFYDATA
;
1822 /**************************************************************************
1823 * DoNotify [Internal]
1827 DoNotify (LPNOTIFYDATA lpNotify
, UINT uCode
, LPNMHDR lpHdr
)
1830 LPNMHDR lpNmh
= NULL
;
1833 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
1834 lpNotify
->hwndFrom
, lpNotify
->hwndTo
, uCode
, lpHdr
,
1835 lpNotify
->dwParam5
);
1837 if (!lpNotify
->hwndTo
)
1840 if (lpNotify
->hwndFrom
== -1) {
1842 idFrom
= lpHdr
->idFrom
;
1845 if (lpNotify
->hwndFrom
) {
1846 HWND hwndParent
= GetParent (lpNotify
->hwndFrom
);
1848 hwndParent
= GetWindow (lpNotify
->hwndFrom
, GW_OWNER
);
1850 idFrom
= GetDlgCtrlID (lpNotify
->hwndFrom
);
1854 lpNmh
= (lpHdr
) ? lpHdr
: &nmhdr
;
1856 lpNmh
->hwndFrom
= lpNotify
->hwndFrom
;
1857 lpNmh
->idFrom
= idFrom
;
1858 lpNmh
->code
= uCode
;
1861 return SendMessageA (lpNotify
->hwndTo
, WM_NOTIFY
, idFrom
, (LPARAM
)lpNmh
);
1865 /**************************************************************************
1866 * SendNotify [COMCTL32.341]
1875 * Success: return value from notification
1880 COMCTL32_SendNotify (HWND hwndFrom
, HWND hwndTo
,
1881 UINT uCode
, LPNMHDR lpHdr
)
1885 TRACE("(0x%04x 0x%04x %d %p)\n",
1886 hwndFrom
, hwndTo
, uCode
, lpHdr
);
1888 notify
.hwndFrom
= hwndFrom
;
1889 notify
.hwndTo
= hwndTo
;
1890 notify
.dwParam5
= 0;
1891 notify
.dwParam6
= 0;
1893 return DoNotify (¬ify
, uCode
, lpHdr
);
1897 /**************************************************************************
1898 * SendNotifyEx [COMCTL32.342]
1908 * Success: return value from notification
1913 COMCTL32_SendNotifyEx (HWND hwndTo
, HWND hwndFrom
, UINT uCode
,
1914 LPNMHDR lpHdr
, DWORD dwParam5
)
1919 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
1920 hwndFrom
, hwndTo
, uCode
, lpHdr
, dwParam5
);
1922 hwndNotify
= hwndTo
;
1924 if (IsWindow (hwndFrom
)) {
1925 hwndNotify
= GetParent (hwndFrom
);
1931 notify
.hwndFrom
= hwndFrom
;
1932 notify
.hwndTo
= hwndNotify
;
1933 notify
.dwParam5
= dwParam5
;
1934 notify
.dwParam6
= 0;
1936 return DoNotify (¬ify
, uCode
, lpHdr
);
1940 /**************************************************************************
1941 * StrChrA [COMCTL32.350]
1946 COMCTL32_StrChrA (LPCSTR lpString
, CHAR cChar
)
1948 return strchr (lpString
, cChar
);
1952 /**************************************************************************
1953 * StrStrIA [COMCTL32.355]
1957 COMCTL32_StrStrIA (LPCSTR lpStr1
, LPCSTR lpStr2
)
1963 return ((LPSTR
)lpStr1
);
1965 while (lpStr1
[len1
] != 0) ++len1
;
1967 while (lpStr2
[len2
] != 0) ++len2
;
1969 return ((LPSTR
)(lpStr1
+ len1
));
1970 first
= tolower (*lpStr2
);
1971 while (len1
>= len2
) {
1972 if (tolower(*lpStr1
) == first
) {
1973 for (i
= 1; i
< len2
; ++i
)
1974 if (tolower (lpStr1
[i
]) != tolower(lpStr2
[i
]))
1977 return ((LPSTR
)lpStr1
);
1985 /**************************************************************************
1986 * StrToIntA [COMCTL32.357] Converts a string to a signed integer.
1990 COMCTL32_StrToIntA (LPSTR lpString
)
1992 return atoi(lpString
);
1996 /**************************************************************************
1997 * DPA_EnumCallback [COMCTL32.385]
1999 * Enumerates all items in a dynamic pointer array.
2002 * hdpa [I] handle to the dynamic pointer array
2011 DPA_EnumCallback (const HDPA hdpa
, DPAENUMPROC enumProc
, LPARAM lParam
)
2015 TRACE("(%p %p %08lx)\n", hdpa
, enumProc
, lParam
);
2019 if (hdpa
->nItemCount
<= 0)
2022 for (i
= 0; i
< hdpa
->nItemCount
; i
++) {
2023 if ((enumProc
)(hdpa
->ptrs
[i
], lParam
) == 0)
2031 /**************************************************************************
2032 * DPA_DestroyCallback [COMCTL32.386]
2034 * Enumerates all items in a dynamic pointer array and destroys it.
2037 * hdpa [I] handle to the dynamic pointer array
2047 DPA_DestroyCallback (const HDPA hdpa
, DPAENUMPROC enumProc
, LPARAM lParam
)
2049 TRACE("(%p %p %08lx)\n", hdpa
, enumProc
, lParam
);
2051 DPA_EnumCallback (hdpa
, enumProc
, lParam
);
2053 return DPA_Destroy (hdpa
);
2057 /**************************************************************************
2058 * DSA_EnumCallback [COMCTL32.387]
2060 * Enumerates all items in a dynamic storage array.
2063 * hdsa [I] handle to the dynamic storage array
2072 DSA_EnumCallback (const HDSA hdsa
, DSAENUMPROC enumProc
, LPARAM lParam
)
2076 TRACE("(%p %p %08lx)\n", hdsa
, enumProc
, lParam
);
2080 if (hdsa
->nItemCount
<= 0)
2083 for (i
= 0; i
< hdsa
->nItemCount
; i
++) {
2084 LPVOID lpItem
= DSA_GetItemPtr (hdsa
, i
);
2085 if ((enumProc
)(lpItem
, lParam
) == 0)
2093 /**************************************************************************
2094 * DSA_DestroyCallback [COMCTL32.388]
2096 * Enumerates all items in a dynamic storage array and destroys it.
2099 * hdsa [I] handle to the dynamic storage array
2109 DSA_DestroyCallback (const HDSA hdsa
, DSAENUMPROC enumProc
, LPARAM lParam
)
2111 TRACE("(%p %p %08lx)\n", hdsa
, enumProc
, lParam
);
2113 DSA_EnumCallback (hdsa
, enumProc
, lParam
);
2115 return DSA_Destroy (hdsa
);
2118 /**************************************************************************
2119 * StrCSpnA [COMCTL32.356]
2122 INT WINAPI
COMCTL32_StrCSpnA( LPCSTR lpStr
, LPCSTR lpSet
) {
2123 return strcspn(lpStr
, lpSet
);
2126 /**************************************************************************
2127 * StrChrW [COMCTL32.358]
2130 LPWSTR WINAPI
COMCTL32_StrChrW( LPCWSTR lpStart
, WORD wMatch
) {
2131 return strchrW(lpStart
, wMatch
);
2134 /**************************************************************************
2135 * StrCmpNA [COMCTL32.352]
2138 INT WINAPI
COMCTL32_StrCmpNA( LPCSTR lpStr1
, LPCSTR lpStr2
, int nChar
) {
2139 return strncmp(lpStr1
, lpStr2
, nChar
);
2142 /**************************************************************************
2143 * StrCmpNIA [COMCTL32.353]
2146 INT WINAPI
COMCTL32_StrCmpNIA( LPCSTR lpStr1
, LPCSTR lpStr2
, int nChar
) {
2147 return strncasecmp(lpStr1
, lpStr2
, nChar
);
2150 /**************************************************************************
2151 * StrCmpNW [COMCTL32.360]
2154 INT WINAPI
COMCTL32_StrCmpNW( LPCWSTR lpStr1
, LPCWSTR lpStr2
, int nChar
) {
2155 return strncmpW(lpStr1
, lpStr2
, nChar
);
2158 /**************************************************************************
2159 * StrCmpNIW [COMCTL32.361]
2162 INT WINAPI
COMCTL32_StrCmpNIW( LPCWSTR lpStr1
, LPCWSTR lpStr2
, int nChar
) {
2163 FIXME("(%s, %s, %i): stub\n", debugstr_w(lpStr1
), debugstr_w(lpStr2
), nChar
);
2167 /**************************************************************************
2168 * StrRChrA [COMCTL32.351]
2171 LPSTR WINAPI
COMCTL32_StrRChrA( LPCSTR lpStart
, LPCSTR lpEnd
, WORD wMatch
) {
2172 return lstrrchr(lpStart
, lpEnd
, wMatch
);
2175 /**************************************************************************
2176 * StrRChrW [COMCTL32.359]
2179 LPWSTR WINAPI
COMCTL32_StrRChrW( LPCWSTR lpStart
, LPCWSTR lpEnd
, WORD wMatch
) {
2180 return lstrrchrw(lpStart
, lpEnd
, wMatch
);
2183 /**************************************************************************
2184 * StrStrA [COMCTL32.354]
2187 LPSTR WINAPI
COMCTL32_StrStrA( LPCSTR lpFirst
, LPCSTR lpSrch
) {
2188 return strstr(lpFirst
, lpSrch
);
2191 /**************************************************************************
2192 * StrStrW [COMCTL32.362]
2195 LPWSTR WINAPI
COMCTL32_StrStrW( LPCWSTR lpFirst
, LPCWSTR lpSrch
) {
2196 return strstrW(lpFirst
, lpSrch
);
2199 /**************************************************************************
2200 * StrSpnW [COMCTL32.364]
2203 INT WINAPI
COMCTL32_StrSpnW( LPWSTR lpStr
, LPWSTR lpSet
) {
2204 LPWSTR lpLoop
= lpStr
;
2207 if ((lpStr
== 0) || (lpSet
== 0)) return 0;
2209 /* while(*lpLoop) { if lpLoop++; } */
2211 for(; (*lpLoop
!= 0); lpLoop
++)
2212 if( strchrW(lpSet
, *(WORD
*)lpLoop
))
2213 return (INT
)(lpLoop
-lpStr
);
2215 return (INT
)(lpLoop
-lpStr
);
2218 /**************************************************************************
2219 * COMCTL32_410 [COMCTL32.410]
2221 * FIXME: What's this supposed to do?
2222 * Parameter 1 is an HWND, you're on your own for the rest.
2225 BOOL WINAPI
COMCTL32_410( HWND hw
, DWORD b
, DWORD c
, DWORD d
) {
2227 FIXME("(%x, %lx, %lx, %lx): stub!\n", hw
, b
, c
, d
);
2232 /**************************************************************************
2233 * COMCTL32_411 [COMCTL32.411]
2235 * FIXME: What's this supposed to do?
2236 * Parameter 1 is an HWND, you're on your own for the rest.
2239 BOOL WINAPI
COMCTL32_411( HWND hw
, DWORD b
, DWORD c
) {
2241 FIXME("(%x, %lx, %lx): stub!\n", hw
, b
, c
);
2246 /**************************************************************************
2247 * COMCTL32_412 [COMCTL32.412]
2249 * FIXME: What's this supposed to do?
2250 * Parameter 1 is an HWND, you're on your own for the rest.
2253 BOOL WINAPI
COMCTL32_412( HWND hwnd
, DWORD b
, DWORD c
)
2255 FIXME("(%x, %lx, %lx): stub!\n", hwnd
, b
, c
);
2257 if (IsWindow (hwnd
) == FALSE
)
2267 /**************************************************************************
2268 * COMCTL32_413 [COMCTL32.413]
2270 * FIXME: What's this supposed to do?
2271 * Parameter 1 is an HWND, you're on your own for the rest.
2274 BOOL WINAPI
COMCTL32_413( HWND hw
, DWORD b
, DWORD c
, DWORD d
) {
2276 FIXME("(%x, %lx, %lx, %lx): stub!\n", hw
, b
, c
, d
);
2282 /**************************************************************************
2283 * COMCTL32_415 [COMCTL32.415]
2285 * FIXME: What's this supposed to do?
2286 * Parameter 1 is an HWND, you're on your own for the rest.
2289 BOOL WINAPI
COMCTL32_415( HWND hwnd
, DWORD b
, DWORD c
, DWORD d
, DWORD e
)
2292 FIXME("(%x, %lx, %lx, %lx, %lx): stub!\n", hwnd
, b
, c
, d
, e
);