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 */
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
),
613 CreateMRUListLazyA (LPCREATEMRULIST lpcml
, DWORD dwParam2
, DWORD dwParam3
, DWORD dwParam4
)
622 * DWORD dwDisposition; */
624 /* internal variables */
627 FIXME("(%p) empty stub!\n", lpcml
);
632 if (lpcml
->cbSize
< sizeof(CREATEMRULIST
))
635 FIXME("(%lu %lu %lx %lx \"%s\" %p)\n",
636 lpcml
->cbSize
, lpcml
->nMaxItems
, lpcml
->dwFlags
,
637 (DWORD
)lpcml
->hKey
, lpcml
->lpszSubKey
, lpcml
->lpfnCompare
);
639 /* dummy pointer creation */
640 ptr
= COMCTL32_Alloc (32);
642 FIXME("-- ret = %p\n", ptr
);
647 /**************************************************************************
648 * EnumMRUListA [COMCTL32.154]
650 * Enumerate item in a list
653 * hList [I] list handle
654 * nItemPos [I] item position to enumerate
655 * lpBuffer [O] buffer to receive item
656 * nBufferSize [I] size of buffer
659 * For binary lists specifies how many bytes were copied to buffer, for
660 * string lists specifies full length of string. Enumerating past the end
661 * of list returns -1.
662 * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in
665 INT WINAPI
EnumMRUListA(HANDLE hList
, INT nItemPos
, LPVOID lpBuffer
,
668 FIXME("(%08x, %d, %p, %ld): stub\n", hList
, nItemPos
, lpBuffer
,
673 /**************************************************************************
674 * Str_GetPtrA [COMCTL32.233]
685 Str_GetPtrA (LPCSTR lpSrc
, LPSTR lpDest
, INT nMaxLen
)
689 TRACE("(%p %p %d)\n", lpSrc
, lpDest
, nMaxLen
);
691 if (!lpDest
&& lpSrc
)
692 return lstrlenA (lpSrc
);
702 len
= lstrlenA (lpSrc
);
706 RtlMoveMemory (lpDest
, lpSrc
, len
);
713 /**************************************************************************
714 * Str_SetPtrA [COMCTL32.234]
724 Str_SetPtrA (LPSTR
*lppDest
, LPCSTR lpSrc
)
726 TRACE("(%p %p)\n", lppDest
, lpSrc
);
729 LPSTR ptr
= COMCTL32_ReAlloc (*lppDest
, lstrlenA (lpSrc
) + 1);
732 lstrcpyA (ptr
, lpSrc
);
737 COMCTL32_Free (*lppDest
);
746 /**************************************************************************
747 * Str_GetPtrW [COMCTL32.235]
758 Str_GetPtrW (LPCWSTR lpSrc
, LPWSTR lpDest
, INT nMaxLen
)
762 TRACE("(%p %p %d)\n", lpSrc
, lpDest
, nMaxLen
);
764 if (!lpDest
&& lpSrc
)
765 return lstrlenW (lpSrc
);
775 len
= lstrlenW (lpSrc
);
779 RtlMoveMemory (lpDest
, lpSrc
, len
*sizeof(WCHAR
));
786 /**************************************************************************
787 * Str_SetPtrW [COMCTL32.236]
797 Str_SetPtrW (LPWSTR
*lppDest
, LPCWSTR lpSrc
)
799 TRACE("(%p %p)\n", lppDest
, lpSrc
);
802 INT len
= lstrlenW (lpSrc
) + 1;
803 LPWSTR ptr
= COMCTL32_ReAlloc (*lppDest
, len
* sizeof(WCHAR
));
806 lstrcpyW (ptr
, lpSrc
);
811 COMCTL32_Free (*lppDest
);
820 /**************************************************************************
821 * The DSA-API is a set of functions to create and manipulate arrays of
822 * fix sized memory blocks. These arrays can store any kind of data
823 * (strings, icons...).
826 /**************************************************************************
827 * DSA_Create [COMCTL32.320] Creates a dynamic storage array
830 * nSize [I] size of the array elements
831 * nGrow [I] number of elements by which the array grows when it is filled
834 * Success: pointer to a array control structure. use this like a handle.
839 DSA_Create (INT nSize
, INT nGrow
)
843 TRACE("(size=%d grow=%d)\n", nSize
, nGrow
);
845 hdsa
= (HDSA
)COMCTL32_Alloc (sizeof(DSA
));
848 hdsa
->nItemCount
= 0;
851 hdsa
->nItemSize
= nSize
;
852 hdsa
->nGrow
= MAX(1, nGrow
);
859 /**************************************************************************
860 * DSA_Destroy [COMCTL32.321] Destroys a dynamic storage array
863 * hdsa [I] pointer to the array control structure
871 DSA_Destroy (const HDSA hdsa
)
873 TRACE("(%p)\n", hdsa
);
878 if (hdsa
->pData
&& (!COMCTL32_Free (hdsa
->pData
)))
881 return COMCTL32_Free (hdsa
);
885 /**************************************************************************
886 * DSA_GetItem [COMCTL32.322]
889 * hdsa [I] pointer to the array control structure
890 * nIndex [I] number of the Item to get
891 * pDest [O] destination buffer. Has to be >= dwElementSize.
899 DSA_GetItem (const HDSA hdsa
, INT nIndex
, LPVOID pDest
)
903 TRACE("(%p %d %p)\n", hdsa
, nIndex
, pDest
);
907 if ((nIndex
< 0) || (nIndex
>= hdsa
->nItemCount
))
910 pSrc
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
911 memmove (pDest
, pSrc
, hdsa
->nItemSize
);
917 /**************************************************************************
918 * DSA_GetItemPtr [COMCTL32.323]
920 * Retrieves a pointer to the specified item.
923 * hdsa [I] pointer to the array control structure
924 * nIndex [I] index of the desired item
927 * Success: pointer to an item
932 DSA_GetItemPtr (const HDSA hdsa
, INT nIndex
)
936 TRACE("(%p %d)\n", hdsa
, nIndex
);
940 if ((nIndex
< 0) || (nIndex
>= hdsa
->nItemCount
))
943 pSrc
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
945 TRACE("-- ret=%p\n", pSrc
);
951 /**************************************************************************
952 * DSA_SetItem [COMCTL32.325]
954 * Sets the contents of an item in the array.
957 * hdsa [I] pointer to the array control structure
958 * nIndex [I] index for the item
959 * pSrc [I] pointer to the new item data
967 DSA_SetItem (const HDSA hdsa
, INT nIndex
, LPVOID pSrc
)
969 INT nSize
, nNewItems
;
970 LPVOID pDest
, lpTemp
;
972 TRACE("(%p %d %p)\n", hdsa
, nIndex
, pSrc
);
974 if ((!hdsa
) || nIndex
< 0)
977 if (hdsa
->nItemCount
<= nIndex
) {
978 /* within the old array */
979 if (hdsa
->nMaxCount
> nIndex
) {
980 /* within the allocated space, set a new boundary */
981 hdsa
->nItemCount
= nIndex
+ 1;
984 /* resize the block of memory */
986 hdsa
->nGrow
* ((INT
)(((nIndex
+ 1) - 1) / hdsa
->nGrow
) + 1);
987 nSize
= hdsa
->nItemSize
* nNewItems
;
989 lpTemp
= (LPVOID
)COMCTL32_ReAlloc (hdsa
->pData
, nSize
);
993 hdsa
->nMaxCount
= nNewItems
;
994 hdsa
->nItemCount
= nIndex
+ 1;
995 hdsa
->pData
= lpTemp
;
999 /* put the new entry in */
1000 pDest
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1001 TRACE("-- move dest=%p src=%p size=%d\n",
1002 pDest
, pSrc
, hdsa
->nItemSize
);
1003 memmove (pDest
, pSrc
, hdsa
->nItemSize
);
1009 /**************************************************************************
1010 * DSA_InsertItem [COMCTL32.325]
1013 * hdsa [I] pointer to the array control structure
1014 * nIndex [I] index for the new item
1015 * pSrc [I] pointer to the element
1018 * Success: position of the new item
1023 DSA_InsertItem (const HDSA hdsa
, INT nIndex
, LPVOID pSrc
)
1025 INT nNewItems
, nSize
, i
;
1026 LPVOID lpTemp
, lpDest
;
1029 TRACE("(%p %d %p)\n", hdsa
, nIndex
, pSrc
);
1031 if ((!hdsa
) || nIndex
< 0)
1034 for (i
= 0; i
< hdsa
->nItemSize
; i
+= 4) {
1035 p
= *(DWORD
**)((char *) pSrc
+ i
);
1036 if (IsBadStringPtrA ((char*)p
, 256))
1037 TRACE("-- %d=%p\n", i
, (DWORD
*)p
);
1039 TRACE("-- %d=%p [%s]\n", i
, p
, debugstr_a((char*)p
));
1042 /* when nIndex > nItemCount then append */
1043 if (nIndex
>= hdsa
->nItemCount
)
1044 nIndex
= hdsa
->nItemCount
;
1046 /* do we need to resize ? */
1047 if (hdsa
->nItemCount
>= hdsa
->nMaxCount
) {
1048 nNewItems
= hdsa
->nMaxCount
+ hdsa
->nGrow
;
1049 nSize
= hdsa
->nItemSize
* nNewItems
;
1051 lpTemp
= (LPVOID
)COMCTL32_ReAlloc (hdsa
->pData
, nSize
);
1055 hdsa
->nMaxCount
= nNewItems
;
1056 hdsa
->pData
= lpTemp
;
1059 /* do we need to move elements ? */
1060 if (nIndex
< hdsa
->nItemCount
) {
1061 lpTemp
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1062 lpDest
= (char *) lpTemp
+ hdsa
->nItemSize
;
1063 nSize
= (hdsa
->nItemCount
- nIndex
) * hdsa
->nItemSize
;
1064 TRACE("-- move dest=%p src=%p size=%d\n",
1065 lpDest
, lpTemp
, nSize
);
1066 memmove (lpDest
, lpTemp
, nSize
);
1069 /* ok, we can put the new Item in */
1071 lpDest
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1072 TRACE("-- move dest=%p src=%p size=%d\n",
1073 lpDest
, pSrc
, hdsa
->nItemSize
);
1074 memmove (lpDest
, pSrc
, hdsa
->nItemSize
);
1076 return hdsa
->nItemCount
;
1080 /**************************************************************************
1081 * DSA_DeleteItem [COMCTL32.326]
1084 * hdsa [I] pointer to the array control structure
1085 * nIndex [I] index for the element to delete
1088 * Success: number of the deleted element
1093 DSA_DeleteItem (const HDSA hdsa
, INT nIndex
)
1095 LPVOID lpDest
,lpSrc
;
1098 TRACE("(%p %d)\n", hdsa
, nIndex
);
1102 if (nIndex
< 0 || nIndex
>= hdsa
->nItemCount
)
1105 /* do we need to move ? */
1106 if (nIndex
< hdsa
->nItemCount
- 1) {
1107 lpDest
= (char *) hdsa
->pData
+ (hdsa
->nItemSize
* nIndex
);
1108 lpSrc
= (char *) lpDest
+ hdsa
->nItemSize
;
1109 nSize
= hdsa
->nItemSize
* (hdsa
->nItemCount
- nIndex
- 1);
1110 TRACE("-- move dest=%p src=%p size=%d\n",
1111 lpDest
, lpSrc
, nSize
);
1112 memmove (lpDest
, lpSrc
, nSize
);
1118 if ((hdsa
->nMaxCount
- hdsa
->nItemCount
) >= hdsa
->nGrow
) {
1119 nSize
= hdsa
->nItemSize
* hdsa
->nItemCount
;
1121 lpDest
= (LPVOID
)COMCTL32_ReAlloc (hdsa
->pData
, nSize
);
1125 hdsa
->nMaxCount
= hdsa
->nItemCount
;
1126 hdsa
->pData
= lpDest
;
1133 /**************************************************************************
1134 * DSA_DeleteAllItems [COMCTL32.326]
1136 * Removes all items and reinitializes the array.
1139 * hdsa [I] pointer to the array control structure
1147 DSA_DeleteAllItems (const HDSA hdsa
)
1149 TRACE("(%p)\n", hdsa
);
1153 if (hdsa
->pData
&& (!COMCTL32_Free (hdsa
->pData
)))
1156 hdsa
->nItemCount
= 0;
1158 hdsa
->nMaxCount
= 0;
1164 /**************************************************************************
1165 * The DPA-API is a set of functions to create and manipulate arrays of
1169 /**************************************************************************
1170 * DPA_Create [COMCTL32.328] Creates a dynamic pointer array
1173 * nGrow [I] number of items by which the array grows when it is filled
1176 * Success: handle (pointer) to the pointer array.
1181 DPA_Create (INT nGrow
)
1185 TRACE("(%d)\n", nGrow
);
1187 hdpa
= (HDPA
)COMCTL32_Alloc (sizeof(DPA
));
1189 hdpa
->nGrow
= MAX(8, nGrow
);
1190 hdpa
->hHeap
= COMCTL32_hHeap
;
1191 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1193 (LPVOID
*)COMCTL32_Alloc (hdpa
->nMaxCount
* sizeof(LPVOID
));
1196 TRACE("-- %p\n", hdpa
);
1202 /**************************************************************************
1203 * DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array
1206 * hdpa [I] handle (pointer) to the pointer array
1214 DPA_Destroy (const HDPA hdpa
)
1216 TRACE("(%p)\n", hdpa
);
1221 if (hdpa
->ptrs
&& (!HeapFree (hdpa
->hHeap
, 0, hdpa
->ptrs
)))
1224 return HeapFree (hdpa
->hHeap
, 0, hdpa
);
1228 /**************************************************************************
1229 * DPA_Grow [COMCTL32.330]
1231 * Sets the growth amount.
1234 * hdpa [I] handle (pointer) to the existing (source) pointer array
1235 * nGrow [I] number of items, the array grows, when it's too small
1243 DPA_Grow (const HDPA hdpa
, INT nGrow
)
1245 TRACE("(%p %d)\n", hdpa
, nGrow
);
1250 hdpa
->nGrow
= MAX(8, nGrow
);
1256 /**************************************************************************
1257 * DPA_Clone [COMCTL32.331]
1259 * Copies a pointer array to an other one or creates a copy
1262 * hdpa [I] handle (pointer) to the existing (source) pointer array
1263 * hdpaNew [O] handle (pointer) to the destination pointer array
1266 * Success: pointer to the destination pointer array.
1270 * - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer
1271 * array will be created and it's handle (pointer) is returned.
1272 * - If 'hdpa' is a NULL-Pointer, the original implementation crashes,
1273 * this implementation just returns NULL.
1277 DPA_Clone (const HDPA hdpa
, const HDPA hdpaNew
)
1279 INT nNewItems
, nSize
;
1285 TRACE("(%p %p)\n", hdpa
, hdpaNew
);
1288 /* create a new DPA */
1289 hdpaTemp
= (HDPA
)HeapAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1291 hdpaTemp
->hHeap
= hdpa
->hHeap
;
1292 hdpaTemp
->nGrow
= hdpa
->nGrow
;
1297 if (hdpaTemp
->ptrs
) {
1298 /* remove old pointer array */
1299 HeapFree (hdpaTemp
->hHeap
, 0, hdpaTemp
->ptrs
);
1300 hdpaTemp
->ptrs
= NULL
;
1301 hdpaTemp
->nItemCount
= 0;
1302 hdpaTemp
->nMaxCount
= 0;
1305 /* create a new pointer array */
1306 nNewItems
= hdpaTemp
->nGrow
*
1307 ((INT
)((hdpa
->nItemCount
- 1) / hdpaTemp
->nGrow
) + 1);
1308 nSize
= nNewItems
* sizeof(LPVOID
);
1310 (LPVOID
*)HeapAlloc (hdpaTemp
->hHeap
, HEAP_ZERO_MEMORY
, nSize
);
1311 hdpaTemp
->nMaxCount
= nNewItems
;
1313 /* clone the pointer array */
1314 hdpaTemp
->nItemCount
= hdpa
->nItemCount
;
1315 memmove (hdpaTemp
->ptrs
, hdpa
->ptrs
,
1316 hdpaTemp
->nItemCount
* sizeof(LPVOID
));
1322 /**************************************************************************
1323 * DPA_GetPtr [COMCTL32.332]
1325 * Retrieves a pointer from a dynamic pointer array
1328 * hdpa [I] handle (pointer) to the pointer array
1329 * nIndex [I] array index of the desired pointer
1337 DPA_GetPtr (const HDPA hdpa
, INT i
)
1339 TRACE("(%p %d)\n", hdpa
, i
);
1345 if ((i
< 0) || (i
>= hdpa
->nItemCount
))
1348 TRACE("-- %p\n", hdpa
->ptrs
[i
]);
1350 return hdpa
->ptrs
[i
];
1354 /**************************************************************************
1355 * DPA_GetPtrIndex [COMCTL32.333]
1357 * Retrieves the index of the specified pointer
1360 * hdpa [I] handle (pointer) to the pointer array
1364 * Success: index of the specified pointer
1369 DPA_GetPtrIndex (const HDPA hdpa
, LPVOID p
)
1376 for (i
= 0; i
< hdpa
->nItemCount
; i
++) {
1377 if (hdpa
->ptrs
[i
] == p
)
1385 /**************************************************************************
1386 * DPA_InsertPtr [COMCTL32.334]
1388 * Inserts a pointer into a dynamic pointer array
1391 * hdpa [I] handle (pointer) to the array
1393 * p [I] pointer to insert
1396 * Success: index of the inserted pointer
1401 DPA_InsertPtr (const HDPA hdpa
, INT i
, LPVOID p
)
1403 INT nNewItems
, nSize
, nIndex
= 0;
1404 LPVOID
*lpTemp
, *lpDest
;
1406 TRACE("(%p %d %p)\n", hdpa
, i
, p
);
1408 if ((!hdpa
) || (i
< 0))
1413 (LPVOID
*)HeapAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1414 2 * hdpa
->nGrow
* sizeof(LPVOID
));
1417 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1421 if (hdpa
->nItemCount
>= hdpa
->nMaxCount
) {
1422 TRACE("-- resizing\n");
1423 nNewItems
= hdpa
->nMaxCount
+ hdpa
->nGrow
;
1424 nSize
= nNewItems
* sizeof(LPVOID
);
1426 lpTemp
= (LPVOID
*)HeapReAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1430 hdpa
->nMaxCount
= nNewItems
;
1431 hdpa
->ptrs
= lpTemp
;
1434 if (i
>= hdpa
->nItemCount
) {
1435 nIndex
= hdpa
->nItemCount
;
1436 TRACE("-- appending at %d\n", nIndex
);
1439 TRACE("-- inserting at %d\n", i
);
1440 lpTemp
= hdpa
->ptrs
+ i
;
1441 lpDest
= lpTemp
+ 1;
1442 nSize
= (hdpa
->nItemCount
- i
) * sizeof(LPVOID
);
1443 TRACE("-- move dest=%p src=%p size=%x\n",
1444 lpDest
, lpTemp
, nSize
);
1445 memmove (lpDest
, lpTemp
, nSize
);
1452 hdpa
->ptrs
[nIndex
] = p
;
1458 /**************************************************************************
1459 * DPA_SetPtr [COMCTL32.335]
1461 * Sets a pointer in the pointer array
1464 * hdpa [I] handle (pointer) to the pointer array
1465 * i [I] index of the pointer that will be set
1466 * p [I] pointer to be set
1474 DPA_SetPtr (const HDPA hdpa
, INT i
, LPVOID p
)
1478 TRACE("(%p %d %p)\n", hdpa
, i
, p
);
1480 if ((!hdpa
) || i
< 0)
1483 if (hdpa
->nItemCount
<= i
) {
1484 /* within the old array */
1485 if (hdpa
->nMaxCount
> i
) {
1486 /* within the allocated space, set a new boundary */
1487 hdpa
->nItemCount
= i
;
1490 /* resize the block of memory */
1492 hdpa
->nGrow
* ((INT
)(((i
+1) - 1) / hdpa
->nGrow
) + 1);
1493 INT nSize
= nNewItems
* sizeof(LPVOID
);
1495 lpTemp
= (LPVOID
*)HeapReAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1500 hdpa
->nItemCount
= nNewItems
;
1501 hdpa
->ptrs
= lpTemp
;
1505 /* put the new entry in */
1512 /**************************************************************************
1513 * DPA_DeletePtr [COMCTL32.336]
1515 * Removes a pointer from the pointer array.
1518 * hdpa [I] handle (pointer) to the pointer array
1519 * i [I] index of the pointer that will be deleted
1522 * Success: deleted pointer
1527 DPA_DeletePtr (const HDPA hdpa
, INT i
)
1529 LPVOID
*lpDest
, *lpSrc
, lpTemp
= NULL
;
1532 TRACE("(%p %d)\n", hdpa
, i
);
1534 if ((!hdpa
) || i
< 0 || i
>= hdpa
->nItemCount
)
1537 lpTemp
= hdpa
->ptrs
[i
];
1539 /* do we need to move ?*/
1540 if (i
< hdpa
->nItemCount
- 1) {
1541 lpDest
= hdpa
->ptrs
+ i
;
1543 nSize
= (hdpa
->nItemCount
- i
- 1) * sizeof(LPVOID
);
1544 TRACE("-- move dest=%p src=%p size=%x\n",
1545 lpDest
, lpSrc
, nSize
);
1546 memmove (lpDest
, lpSrc
, nSize
);
1549 hdpa
->nItemCount
--;
1552 if ((hdpa
->nMaxCount
- hdpa
->nItemCount
) >= hdpa
->nGrow
) {
1553 INT nNewItems
= MIN(hdpa
->nGrow
* 2, hdpa
->nItemCount
);
1554 nSize
= nNewItems
* sizeof(LPVOID
);
1555 lpDest
= (LPVOID
)HeapReAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1560 hdpa
->nMaxCount
= nNewItems
;
1561 hdpa
->ptrs
= (LPVOID
*)lpDest
;
1568 /**************************************************************************
1569 * DPA_DeleteAllPtrs [COMCTL32.337]
1571 * Removes all pointers and reinitializes the array.
1574 * hdpa [I] handle (pointer) to the pointer array
1582 DPA_DeleteAllPtrs (const HDPA hdpa
)
1584 TRACE("(%p)\n", hdpa
);
1589 if (hdpa
->ptrs
&& (!HeapFree (hdpa
->hHeap
, 0, hdpa
->ptrs
)))
1592 hdpa
->nItemCount
= 0;
1593 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1594 hdpa
->ptrs
= (LPVOID
*)HeapAlloc (hdpa
->hHeap
, HEAP_ZERO_MEMORY
,
1595 hdpa
->nMaxCount
* sizeof(LPVOID
));
1601 /**************************************************************************
1602 * DPA_QuickSort [Internal]
1604 * Ordinary quicksort (used by DPA_Sort).
1607 * lpPtrs [I] pointer to the pointer array
1608 * l [I] index of the "left border" of the partition
1609 * r [I] index of the "right border" of the partition
1610 * pfnCompare [I] pointer to the compare function
1611 * lParam [I] user defined value (3rd parameter in compare function)
1618 DPA_QuickSort (LPVOID
*lpPtrs
, INT l
, INT r
,
1619 PFNDPACOMPARE pfnCompare
, LPARAM lParam
)
1624 TRACE("l=%i r=%i\n", l
, r
);
1628 v
= lpPtrs
[(int)(l
+r
)/2];
1630 while ((pfnCompare
)(lpPtrs
[i
], v
, lParam
) < 0) i
++;
1631 while ((pfnCompare
)(lpPtrs
[j
], v
, lParam
) > 0) j
--;
1635 lpPtrs
[i
++] = lpPtrs
[j
];
1639 if (l
< j
) DPA_QuickSort (lpPtrs
, l
, j
, pfnCompare
, lParam
);
1640 if (i
< r
) DPA_QuickSort (lpPtrs
, i
, r
, pfnCompare
, lParam
);
1644 /**************************************************************************
1645 * DPA_Sort [COMCTL32.338]
1647 * Sorts a pointer array using a user defined compare function
1650 * hdpa [I] handle (pointer) to the pointer array
1651 * pfnCompare [I] pointer to the compare function
1652 * lParam [I] user defined value (3rd parameter of compare function)
1660 DPA_Sort (const HDPA hdpa
, PFNDPACOMPARE pfnCompare
, LPARAM lParam
)
1662 if (!hdpa
|| !pfnCompare
)
1665 TRACE("(%p %p 0x%lx)\n", hdpa
, pfnCompare
, lParam
);
1667 if ((hdpa
->nItemCount
> 1) && (hdpa
->ptrs
))
1668 DPA_QuickSort (hdpa
->ptrs
, 0, hdpa
->nItemCount
- 1,
1669 pfnCompare
, lParam
);
1675 /**************************************************************************
1676 * DPA_Search [COMCTL32.339]
1678 * Searches a pointer array for a specified pointer
1681 * hdpa [I] handle (pointer) to the pointer array
1682 * pFind [I] pointer to search for
1683 * nStart [I] start index
1684 * pfnCompare [I] pointer to the compare function
1685 * lParam [I] user defined value (3rd parameter of compare function)
1686 * uOptions [I] search options
1689 * Success: index of the pointer in the array.
1693 * Binary search taken from R.Sedgewick "Algorithms in C"!
1694 * Function is NOT tested!
1695 * If something goes wrong, blame HIM not ME! (Eric Kohl)
1699 DPA_Search (const HDPA hdpa
, LPVOID pFind
, INT nStart
,
1700 PFNDPACOMPARE pfnCompare
, LPARAM lParam
, UINT uOptions
)
1702 if (!hdpa
|| !pfnCompare
|| !pFind
)
1705 TRACE("(%p %p %d %p 0x%08lx 0x%08x)\n",
1706 hdpa
, pFind
, nStart
, pfnCompare
, lParam
, uOptions
);
1708 if (uOptions
& DPAS_SORTED
) {
1709 /* array is sorted --> use binary search */
1713 TRACE("binary search\n");
1715 l
= (nStart
== -1) ? 0 : nStart
;
1716 r
= hdpa
->nItemCount
- 1;
1720 n
= (pfnCompare
)(pFind
, lpPtr
[x
], lParam
);
1726 TRACE("-- ret=%d\n", n
);
1731 if (uOptions
& DPAS_INSERTBEFORE
) {
1732 TRACE("-- ret=%d\n", r
);
1736 if (uOptions
& DPAS_INSERTAFTER
) {
1737 TRACE("-- ret=%d\n", l
);
1742 /* array is not sorted --> use linear search */
1746 TRACE("linear search\n");
1748 nIndex
= (nStart
== -1)? 0 : nStart
;
1750 for (; nIndex
< hdpa
->nItemCount
; nIndex
++) {
1751 if ((pfnCompare
)(pFind
, lpPtr
[nIndex
], lParam
) == 0) {
1752 TRACE("-- ret=%d\n", nIndex
);
1758 TRACE("-- not found: ret=-1\n");
1763 /**************************************************************************
1764 * DPA_CreateEx [COMCTL32.340]
1766 * Creates a dynamic pointer array using the specified size and heap.
1769 * nGrow [I] number of items by which the array grows when it is filled
1770 * hHeap [I] handle to the heap where the array is stored
1773 * Success: handle (pointer) to the pointer array.
1778 DPA_CreateEx (INT nGrow
, HANDLE hHeap
)
1782 TRACE("(%d 0x%x)\n", nGrow
, hHeap
);
1785 hdpa
= (HDPA
)HeapAlloc (hHeap
, HEAP_ZERO_MEMORY
, sizeof(DPA
));
1787 hdpa
= (HDPA
)COMCTL32_Alloc (sizeof(DPA
));
1790 hdpa
->nGrow
= MIN(8, nGrow
);
1791 hdpa
->hHeap
= hHeap
? hHeap
: COMCTL32_hHeap
;
1792 hdpa
->nMaxCount
= hdpa
->nGrow
* 2;
1794 (LPVOID
*)HeapAlloc (hHeap
, HEAP_ZERO_MEMORY
,
1795 hdpa
->nMaxCount
* sizeof(LPVOID
));
1798 TRACE("-- %p\n", hdpa
);
1804 /**************************************************************************
1805 * Notification functions
1808 typedef struct tagNOTIFYDATA
1816 } NOTIFYDATA
, *LPNOTIFYDATA
;
1819 /**************************************************************************
1820 * DoNotify [Internal]
1824 DoNotify (LPNOTIFYDATA lpNotify
, UINT uCode
, LPNMHDR lpHdr
)
1827 LPNMHDR lpNmh
= NULL
;
1830 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
1831 lpNotify
->hwndFrom
, lpNotify
->hwndTo
, uCode
, lpHdr
,
1832 lpNotify
->dwParam5
);
1834 if (!lpNotify
->hwndTo
)
1837 if (lpNotify
->hwndFrom
== -1) {
1839 idFrom
= lpHdr
->idFrom
;
1842 if (lpNotify
->hwndFrom
) {
1843 HWND hwndParent
= GetParent (lpNotify
->hwndFrom
);
1845 hwndParent
= GetWindow (lpNotify
->hwndFrom
, GW_OWNER
);
1847 idFrom
= GetDlgCtrlID (lpNotify
->hwndFrom
);
1851 lpNmh
= (lpHdr
) ? lpHdr
: &nmhdr
;
1853 lpNmh
->hwndFrom
= lpNotify
->hwndFrom
;
1854 lpNmh
->idFrom
= idFrom
;
1855 lpNmh
->code
= uCode
;
1858 return SendMessageA (lpNotify
->hwndTo
, WM_NOTIFY
, idFrom
, (LPARAM
)lpNmh
);
1862 /**************************************************************************
1863 * SendNotify [COMCTL32.341]
1872 * Success: return value from notification
1877 COMCTL32_SendNotify (HWND hwndFrom
, HWND hwndTo
,
1878 UINT uCode
, LPNMHDR lpHdr
)
1882 TRACE("(0x%04x 0x%04x %d %p)\n",
1883 hwndFrom
, hwndTo
, uCode
, lpHdr
);
1885 notify
.hwndFrom
= hwndFrom
;
1886 notify
.hwndTo
= hwndTo
;
1887 notify
.dwParam5
= 0;
1888 notify
.dwParam6
= 0;
1890 return DoNotify (¬ify
, uCode
, lpHdr
);
1894 /**************************************************************************
1895 * SendNotifyEx [COMCTL32.342]
1905 * Success: return value from notification
1910 COMCTL32_SendNotifyEx (HWND hwndTo
, HWND hwndFrom
, UINT uCode
,
1911 LPNMHDR lpHdr
, DWORD dwParam5
)
1916 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
1917 hwndFrom
, hwndTo
, uCode
, lpHdr
, dwParam5
);
1919 hwndNotify
= hwndTo
;
1921 if (IsWindow (hwndFrom
)) {
1922 hwndNotify
= GetParent (hwndFrom
);
1928 notify
.hwndFrom
= hwndFrom
;
1929 notify
.hwndTo
= hwndNotify
;
1930 notify
.dwParam5
= dwParam5
;
1931 notify
.dwParam6
= 0;
1933 return DoNotify (¬ify
, uCode
, lpHdr
);
1937 /**************************************************************************
1938 * StrChrA [COMCTL32.350]
1943 COMCTL32_StrChrA (LPCSTR lpString
, CHAR cChar
)
1945 return strchr (lpString
, cChar
);
1949 /**************************************************************************
1950 * StrStrIA [COMCTL32.355]
1954 COMCTL32_StrStrIA (LPCSTR lpStr1
, LPCSTR lpStr2
)
1960 return ((LPSTR
)lpStr1
);
1962 while (lpStr1
[len1
] != 0) ++len1
;
1964 while (lpStr2
[len2
] != 0) ++len2
;
1966 return ((LPSTR
)(lpStr1
+ len1
));
1967 first
= tolower (*lpStr2
);
1968 while (len1
>= len2
) {
1969 if (tolower(*lpStr1
) == first
) {
1970 for (i
= 1; i
< len2
; ++i
)
1971 if (tolower (lpStr1
[i
]) != tolower(lpStr2
[i
]))
1974 return ((LPSTR
)lpStr1
);
1982 /**************************************************************************
1983 * StrToIntA [COMCTL32.357] Converts a string to a signed integer.
1987 COMCTL32_StrToIntA (LPSTR lpString
)
1989 return atoi(lpString
);
1993 /**************************************************************************
1994 * DPA_EnumCallback [COMCTL32.385]
1996 * Enumerates all items in a dynamic pointer array.
1999 * hdpa [I] handle to the dynamic pointer array
2008 DPA_EnumCallback (const HDPA hdpa
, DPAENUMPROC enumProc
, LPARAM lParam
)
2012 TRACE("(%p %p %08lx)\n", hdpa
, enumProc
, lParam
);
2016 if (hdpa
->nItemCount
<= 0)
2019 for (i
= 0; i
< hdpa
->nItemCount
; i
++) {
2020 if ((enumProc
)(hdpa
->ptrs
[i
], lParam
) == 0)
2028 /**************************************************************************
2029 * DPA_DestroyCallback [COMCTL32.386]
2031 * Enumerates all items in a dynamic pointer array and destroys it.
2034 * hdpa [I] handle to the dynamic pointer array
2044 DPA_DestroyCallback (const HDPA hdpa
, DPAENUMPROC enumProc
, LPARAM lParam
)
2046 TRACE("(%p %p %08lx)\n", hdpa
, enumProc
, lParam
);
2048 DPA_EnumCallback (hdpa
, enumProc
, lParam
);
2050 return DPA_Destroy (hdpa
);
2054 /**************************************************************************
2055 * DSA_EnumCallback [COMCTL32.387]
2057 * Enumerates all items in a dynamic storage array.
2060 * hdsa [I] handle to the dynamic storage array
2069 DSA_EnumCallback (const HDSA hdsa
, DSAENUMPROC enumProc
, LPARAM lParam
)
2073 TRACE("(%p %p %08lx)\n", hdsa
, enumProc
, lParam
);
2077 if (hdsa
->nItemCount
<= 0)
2080 for (i
= 0; i
< hdsa
->nItemCount
; i
++) {
2081 LPVOID lpItem
= DSA_GetItemPtr (hdsa
, i
);
2082 if ((enumProc
)(lpItem
, lParam
) == 0)
2090 /**************************************************************************
2091 * DSA_DestroyCallback [COMCTL32.388]
2093 * Enumerates all items in a dynamic storage array and destroys it.
2096 * hdsa [I] handle to the dynamic storage array
2106 DSA_DestroyCallback (const HDSA hdsa
, DSAENUMPROC enumProc
, LPARAM lParam
)
2108 TRACE("(%p %p %08lx)\n", hdsa
, enumProc
, lParam
);
2110 DSA_EnumCallback (hdsa
, enumProc
, lParam
);
2112 return DSA_Destroy (hdsa
);
2115 /**************************************************************************
2116 * StrCSpnA [COMCTL32.356]
2119 INT WINAPI
COMCTL32_StrCSpnA( LPCSTR lpStr
, LPCSTR lpSet
) {
2120 return strcspn(lpStr
, lpSet
);
2123 /**************************************************************************
2124 * StrChrW [COMCTL32.358]
2127 LPWSTR WINAPI
COMCTL32_StrChrW( LPCWSTR lpStart
, WORD wMatch
) {
2128 return CRTDLL_wcschr(lpStart
, wMatch
);
2131 /**************************************************************************
2132 * StrCmpNA [COMCTL32.352]
2135 INT WINAPI
COMCTL32_StrCmpNA( LPCSTR lpStr1
, LPCSTR lpStr2
, int nChar
) {
2136 return strncmp(lpStr1
, lpStr2
, nChar
);
2139 /**************************************************************************
2140 * StrCmpNIA [COMCTL32.353]
2143 INT WINAPI
COMCTL32_StrCmpNIA( LPCSTR lpStr1
, LPCSTR lpStr2
, int nChar
) {
2144 return strncasecmp(lpStr1
, lpStr2
, nChar
);
2147 /**************************************************************************
2148 * StrCmpNW [COMCTL32.360]
2151 INT WINAPI
COMCTL32_StrCmpNW( LPCWSTR lpStr1
, LPCWSTR lpStr2
, int nChar
) {
2152 return CRTDLL_wcsncmp(lpStr1
, lpStr2
, nChar
);
2155 /**************************************************************************
2156 * StrCmpNIW [COMCTL32.361]
2159 INT WINAPI
COMCTL32_StrCmpNIW( LPCWSTR lpStr1
, LPCWSTR lpStr2
, int nChar
) {
2160 FIXME("(%s, %s, %i): stub\n", debugstr_w(lpStr1
), debugstr_w(lpStr2
), nChar
);
2164 /**************************************************************************
2165 * StrRChrA [COMCTL32.351]
2168 LPSTR WINAPI
COMCTL32_StrRChrA( LPCSTR lpStart
, LPCSTR lpEnd
, WORD wMatch
) {
2169 return lstrrchr(lpStart
, lpEnd
, wMatch
);
2172 /**************************************************************************
2173 * StrRChrW [COMCTL32.359]
2176 LPWSTR WINAPI
COMCTL32_StrRChrW( LPCWSTR lpStart
, LPCWSTR lpEnd
, WORD wMatch
) {
2177 return lstrrchrw(lpStart
, lpEnd
, wMatch
);
2180 /**************************************************************************
2181 * StrStrA [COMCTL32.354]
2184 LPSTR WINAPI
COMCTL32_StrStrA( LPCSTR lpFirst
, LPCSTR lpSrch
) {
2185 return strstr(lpFirst
, lpSrch
);
2188 /**************************************************************************
2189 * StrStrW [COMCTL32.362]
2192 LPWSTR WINAPI
COMCTL32_StrStrW( LPCWSTR lpFirst
, LPCWSTR lpSrch
) {
2193 return CRTDLL_wcsstr(lpFirst
, lpSrch
);
2196 /**************************************************************************
2197 * StrSpnW [COMCTL32.364]
2200 INT WINAPI
COMCTL32_StrSpnW( LPWSTR lpStr
, LPWSTR lpSet
) {
2201 LPWSTR lpLoop
= lpStr
;
2204 if ((lpStr
== 0) || (lpSet
== 0)) return 0;
2206 /* while(*lpLoop) { if lpLoop++; } */
2208 for(; (*lpLoop
!= 0); lpLoop
++)
2209 if( CRTDLL_wcschr(lpSet
, *(WORD
*)lpLoop
))
2210 return (INT
)(lpLoop
-lpStr
);
2212 return (INT
)(lpLoop
-lpStr
);
2215 /**************************************************************************
2216 * comctl32_410 [COMCTL32.410]
2218 * FIXME: What's this supposed to do?
2219 * Parameter 1 is an HWND, you're on your own for the rest.
2222 BOOL WINAPI
comctl32_410( HWND hw
, DWORD b
, DWORD c
, DWORD d
) {
2224 FIXME_(commctrl
)("(%x, %lx, %lx, %lx): stub!\n", hw
, b
, c
, d
);
2229 /**************************************************************************
2230 * comctl32_411 [COMCTL32.411]
2232 * FIXME: What's this supposed to do?
2233 * Parameter 1 is an HWND, you're on your own for the rest.
2236 BOOL WINAPI
comctl32_411( HWND hw
, DWORD b
, DWORD c
) {
2238 FIXME_(commctrl
)("(%x, %lx, %lx): stub!\n", hw
, b
, c
);
2243 /**************************************************************************
2244 * comctl32_412 [COMCTL32.412]
2246 * FIXME: What's this supposed to do?
2247 * Parameter 1 is an HWND, you're on your own for the rest.
2250 BOOL WINAPI
comctl32_412( HWND hwnd
, DWORD b
, DWORD c
)
2252 FIXME_(commctrl
)("(%x, %lx, %lx): stub!\n", hwnd
, b
, c
);
2254 if (IsWindow (hwnd
) == FALSE
)
2264 /**************************************************************************
2265 * comctl32_413 [COMCTL32.413]
2267 * FIXME: What's this supposed to do?
2268 * Parameter 1 is an HWND, you're on your own for the rest.
2271 BOOL WINAPI
comctl32_413( HWND hw
, DWORD b
, DWORD c
, DWORD d
) {
2273 FIXME_(commctrl
)("(%x, %lx, %lx, %lx): stub!\n", hw
, b
, c
, d
);
2278 /*************************************************************************
2279 * InitMUILanguage [COMCTL32.70]
2281 * FIXME: What's this supposed to do? Apparently some i18n thing.
2285 BOOL WINAPI
InitMUILanguage( LANGID uiLang
) {
2287 FIXME_(commctrl
)("(%04x): stub!\n", uiLang
);