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 typedef struct _STREAMDATA
39 } STREAMDATA, *PSTREAMDATA;
41 typedef struct _LOADDATA
45 } LOADDATA, *LPLOADDATA;
47 typedef HRESULT(CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM);
50 /**************************************************************************
51 * DPA_LoadStream [COMCTL32.9]
53 * Loads a dynamic pointer array from a stream
56 * phDpa [O] pointer to a handle to a dynamic pointer array
57 * loadProc [I] pointer to a callback function
58 * pStream [I] pointer to a stream
59 * lParam [I] application specific value
62 * No more information available yet!
66 DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam)
69 LARGE_INTEGER position;
70 ULARGE_INTEGER newPosition;
71 STREAMDATA streamData;
77 FIXME ("phDpa=%p loadProc=%p pStream=%p lParam=%lx\n",
78 phDpa, loadProc, pStream, lParam);
80 if (!phDpa || !loadProc || !pStream)
85 position.s.LowPart = 0;
86 position.s.HighPart = 0;
88 errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition);
92 errCode = IStream_Read (pStream, &streamData, sizeof(STREAMDATA), &ulRead);
96 FIXME ("dwSize=%lu dwData2=%lu dwItems=%lu\n",
97 streamData.dwSize, streamData.dwData2, streamData.dwItems);
99 if (lParam < sizeof(STREAMDATA) ||
100 streamData.dwSize < sizeof(STREAMDATA) ||
101 streamData.dwData2 < 1) {
106 hDpa = DPA_Create (streamData.dwItems);
108 return E_OUTOFMEMORY;
110 if (!DPA_Grow (hDpa, streamData.dwItems))
111 return E_OUTOFMEMORY;
113 /* load data from the stream into the dpa */
115 for (loadData.nCount = 0; loadData.nCount < streamData.dwItems; loadData.nCount++) {
116 errCode = (loadProc)(&loadData, pStream, lParam);
117 if (errCode != S_OK) {
126 /* set the number of items */
127 hDpa->nItemCount = loadData.nCount;
129 /* store the handle to the dpa */
131 FIXME ("new hDpa=%p\n", hDpa);
137 /**************************************************************************
138 * DPA_SaveStream [COMCTL32.10]
140 * Saves a dynamic pointer array to a stream
143 * hDpa [I] handle to a dynamic pointer array
144 * loadProc [I] pointer to a callback function
145 * pStream [I] pointer to a stream
146 * lParam [I] application specific value
149 * No more information available yet!
153 DPA_SaveStream (const HDPA hDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam)
156 FIXME ("hDpa=%p loadProc=%p pStream=%p lParam=%lx\n",
157 hDpa, loadProc, pStream, lParam);
163 /**************************************************************************
164 * DPA_Merge [COMCTL32.11]
167 * hdpa1 [I] handle to a dynamic pointer array
168 * hdpa2 [I] handle to a dynamic pointer array
170 * pfnSort [I] pointer to sort function
171 * pfnMerge [I] pointer to merge function
172 * lParam [I] application specific value
175 * No more information available yet!
179 DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags,
180 PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam)
184 #if 0 /* these go with the "incomplete implementation" below */
185 LPVOID pWork1, pWork2;
191 TRACE("(%p %p %08lx %p %p %08lx): semi stub!\n",
192 hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam);
194 if (IsBadWritePtr (hdpa1, sizeof(DPA)))
197 if (IsBadWritePtr (hdpa2, sizeof(DPA)))
200 if (IsBadCodePtr ((FARPROC)pfnCompare))
203 if (IsBadCodePtr ((FARPROC)pfnMerge))
206 if (dwFlags & DPAM_SORT) {
207 TRACE("sorting dpa's!\n");
208 if (hdpa1->nItemCount > 0)
209 DPA_Sort (hdpa1, pfnCompare, lParam);
210 TRACE ("dpa 1 sorted!\n");
211 if (hdpa2->nItemCount > 0)
212 DPA_Sort (hdpa2, pfnCompare, lParam);
213 TRACE ("dpa 2 sorted!\n");
216 if (hdpa2->nItemCount < 1)
219 TRACE("hdpa1->nItemCount=%d hdpa2->nItemCount=%d\n",
220 hdpa1->nItemCount, hdpa2->nItemCount);
223 /* preliminary hack - simply append the pointer list hdpa2 to hdpa1 */
224 for (nCount = 0; nCount < hdpa2->nItemCount; nCount++)
225 DPA_InsertPtr (hdpa1, hdpa1->nItemCount + 1, hdpa2->ptrs[nCount]);
228 /* incomplete implementation */
230 pWork1 = &(hdpa1->ptrs[hdpa1->nItemCount - 1]);
231 pWork2 = &(hdpa2->ptrs[hdpa2->nItemCount - 1]);
233 nIndex = hdpa1->nItemCount - 1;
234 nCount = hdpa2->nItemCount - 1;
238 nResult = (pfnCompare)(pWork1, pWork2, lParam);
244 ptr = (pfnMerge)(1, pWork1, pWork2, lParam);
252 else if (nResult < 0)
258 ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1);
260 (pfnMerge)(2, ptr, NULL, lParam);
269 ptr = (pfnMerge)(3, pWork2, NULL, lParam);
272 DPA_InsertPtr (hdpa1, nIndex, ptr);
289 /**************************************************************************
290 * Alloc [COMCTL32.71]
292 * Allocates memory block from the dll's private heap
295 * dwSize [I] size of the allocated memory block
298 * Success: pointer to allocated memory block
303 COMCTL32_Alloc (DWORD dwSize)
307 TRACE("(0x%lx)\n", dwSize);
309 lpPtr = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);
311 TRACE("-- ret=%p\n", lpPtr);
317 /**************************************************************************
318 * ReAlloc [COMCTL32.72]
320 * Changes the size of an allocated memory block or allocates a memory
321 * block using the dll's private heap.
324 * lpSrc [I] pointer to memory block which will be resized
325 * dwSize [I] new size of the memory block.
328 * Success: pointer to the resized memory block
332 * If lpSrc is a NULL-pointer, then COMCTL32_ReAlloc allocates a memory
333 * block like COMCTL32_Alloc.
337 COMCTL32_ReAlloc (LPVOID lpSrc, DWORD dwSize)
341 TRACE("(%p 0x%08lx)\n", lpSrc, dwSize);
344 lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize);
346 lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);
348 TRACE("-- ret=%p\n", lpDest);
354 /**************************************************************************
357 * Frees an allocated memory block from the dll's private heap.
360 * lpMem [I] pointer to memory block which will be freed
368 COMCTL32_Free (LPVOID lpMem)
370 TRACE("(%p)\n", lpMem);
372 return HeapFree (COMCTL32_hHeap, 0, lpMem);
376 /**************************************************************************
377 * GetSize [COMCTL32.74]
379 * Retrieves the size of the specified memory block from the dll's
383 * lpMem [I] pointer to an allocated memory block
386 * Success: size of the specified memory block
391 COMCTL32_GetSize (LPVOID lpMem)
393 TRACE("(%p)\n", lpMem);
395 return HeapSize (COMCTL32_hHeap, 0, lpMem);
399 /**************************************************************************
400 * The MRU-API is a set of functions to manipulate MRU(Most Recently Used)
403 * Stored in the reg. as a set of values under a single key. Each item in the
404 * list has a value name that is a single char. 'a' - 'z', '{', '|' or '}'.
405 * The order of the list is stored with value name 'MRUList' which is a string
406 * containing the value names (i.e. 'a', 'b', etc.) in the relevant order.
409 typedef struct tagCREATEMRULIST
411 DWORD cbSize; /* size of struct */
412 DWORD nMaxItems; /* max no. of items in list */
413 DWORD dwFlags; /* see below */
414 HKEY hKey; /* root reg. key under which list is saved */
415 LPCSTR lpszSubKey; /* reg. subkey */
416 PROC lpfnCompare; /* item compare proc */
417 } CREATEMRULIST, *LPCREATEMRULIST;
420 #define MRUF_STRING_LIST 0 /* list will contain strings */
421 #define MRUF_BINARY_LIST 1 /* list will contain binary data */
422 #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */
424 /* If list is a string list lpfnCompare has the following prototype
425 * int CALLBACK MRUCompareString(LPCSTR s1, LPCSTR s2)
426 * for binary lists the prototype is
427 * int CALLBACK MRUCompareBinary(LPCVOID data1, LPCVOID data2, DWORD cbData)
428 * where cbData is the no. of bytes to compare.
429 * Need to check what return value means identical - 0?
432 typedef struct tagMRU
434 DWORD dwParam1; /* some kind of flag */
443 CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2,
444 DWORD dwParam3, DWORD dwParam4);
447 /**************************************************************************
448 * CreateMRUListA [COMCTL32.151]
451 * lpcml [I] ptr to CREATEMRULIST structure.
454 * Handle to MRU list.
457 CreateMRUListA (LPCREATEMRULIST lpcml)
459 return CreateMRUListLazyA (lpcml, 0, 0, 0);
462 /**************************************************************************
463 * FreeMRUListA [COMCTL32.152]
466 * hMRUList [I] Handle to list.
470 FreeMRUListA (HANDLE hMRUList)
472 FIXME("(%08x) empty stub!\n", hMRUList);
475 if (!(hmru->dwParam1 & 1001)) {
476 RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ,
478 strlen (hmru->lpszMRUString));
482 RegClosKey (hmru->hkeyMRU
483 COMCTL32_Free32 (hmru->lpszMRUString);
486 return COMCTL32_Free ((LPVOID)hMRUList);
490 /**************************************************************************
491 * AddMRUData [COMCTL32.167]
493 * Add item to MRU binary list. If item already exists in list them it is
494 * simply moved up to the top of the list and not added again. If list is
495 * full then the least recently used item is removed to make room.
498 * hList [I] Handle to list.
499 * lpData [I] ptr to data to add.
500 * cbData [I] no. of bytes of data.
503 * No. corresponding to registry name where value is stored 'a' -> 0 etc.
507 AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData)
509 FIXME("(%08x, %p, %ld) empty stub!\n", hList, lpData, cbData);
514 /**************************************************************************
515 * AddMRUStringA [COMCTL32.153]
517 * Add item to MRU string list. If item already exists in list them it is
518 * simply moved up to the top of the list and not added again. If list is
519 * full then the least recently used item is removed to make room.
522 * hList [I] Handle to list.
523 * lpszString [I] ptr to string to add.
526 * No. corresponding to registry name where value is stored 'a' -> 0 etc.
530 AddMRUStringA(HANDLE hList, LPCSTR lpszString)
532 FIXME("(%08x, %s) empty stub!\n", hList, debugstr_a(lpszString));
537 /**************************************************************************
538 * DelMRUString [COMCTL32.156]
540 * Removes item from either string or binary list (despite its name)
543 * hList [I] list handle
544 * nItemPos [I] item position to remove 0 -> MRU
547 * TRUE is successful, FALSE if nItemPos is out of range.
550 DelMRUString(HANDLE hList, INT nItemPos)
552 FIXME("(%08x, %d): stub\n", hList, nItemPos);
556 /**************************************************************************
557 * FindMRUData [COMCTL32.169]
559 * Searches binary list for item that matches lpData of length cbData.
560 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
561 * corresponding to item's reg. name will be stored in it ('a' -> 0).
564 * hList [I] list handle
565 * lpData [I] data to find
566 * cbData [I] length of data
567 * lpRegNum [O] position in registry (maybe NULL)
570 * Position in list 0 -> MRU. -1 if item not found.
573 FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
575 FIXME("(%08x, %p, %ld, %p) empty stub!\n",
576 hList, lpData, cbData, lpRegNum);
581 /**************************************************************************
582 * FindMRUStringA [COMCTL32.155]
584 * Searches string list for item that matches lpszString.
585 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
586 * corresponding to item's reg. name will be stored in it ('a' -> 0).
589 * hList [I] list handle
590 * lpszString [I] string to find
591 * lpRegNum [O] position in registry (maybe NULL)
594 * Position in list 0 -> MRU. -1 if item not found.
597 FindMRUStringA (HANDLE hList, LPCSTR lpszString, LPINT lpRegNum)
599 FIXME("(%08x, %s, %p) empty stub!\n", hList, debugstr_a(lpszString),
605 /**************************************************************************
606 * CreateMRUListLazyA [COMCTL32.157]
609 CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)
618 * DWORD dwDisposition; */
620 /* internal variables */
623 FIXME("(%p) empty stub!\n", lpcml);
628 if (lpcml->cbSize < sizeof(CREATEMRULIST))
631 FIXME("(%lu %lu %lx %lx \"%s\" %p)\n",
632 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags,
633 (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare);
635 /* dummy pointer creation */
636 ptr = COMCTL32_Alloc (32);
638 FIXME("-- ret = %p\n", ptr);
643 /**************************************************************************
644 * EnumMRUListA [COMCTL32.154]
646 * Enumerate item in a list
649 * hList [I] list handle
650 * nItemPos [I] item position to enumerate
651 * lpBuffer [O] buffer to receive item
652 * nBufferSize [I] size of buffer
655 * For binary lists specifies how many bytes were copied to buffer, for
656 * string lists specifies full length of string. Enumerating past the end
657 * of list returns -1.
658 * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in
661 INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer,
664 FIXME("(%08x, %d, %p, %ld): stub\n", hList, nItemPos, lpBuffer,
669 /**************************************************************************
670 * Str_GetPtrA [COMCTL32.233]
681 Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen)
685 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
687 if (!lpDest && lpSrc)
688 return strlen (lpSrc);
698 len = strlen (lpSrc);
702 RtlMoveMemory (lpDest, lpSrc, len);
709 /**************************************************************************
710 * Str_SetPtrA [COMCTL32.234]
720 Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc)
722 TRACE("(%p %p)\n", lppDest, lpSrc);
725 LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1);
733 COMCTL32_Free (*lppDest);
742 /**************************************************************************
743 * Str_GetPtrW [COMCTL32.235]
754 Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen)
758 TRACE("(%p %p %d)\n", lpSrc, lpDest, nMaxLen);
760 if (!lpDest && lpSrc)
761 return strlenW (lpSrc);
771 len = strlenW (lpSrc);
775 RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR));
782 /**************************************************************************
783 * Str_SetPtrW [COMCTL32.236]
793 Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc)
795 TRACE("(%p %p)\n", lppDest, lpSrc);
798 INT len = strlenW (lpSrc) + 1;
799 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR));
802 strcpyW (ptr, lpSrc);
807 COMCTL32_Free (*lppDest);
816 /**************************************************************************
817 * The DSA-API is a set of functions to create and manipulate arrays of
818 * fixed-size memory blocks. These arrays can store any kind of data
819 * (strings, icons...).
822 /**************************************************************************
823 * DSA_Create [COMCTL32.320] Creates a dynamic storage array
826 * nSize [I] size of the array elements
827 * nGrow [I] number of elements by which the array grows when it is filled
830 * Success: pointer to an array control structure. Use this like a handle.
835 DSA_Create (INT nSize, INT nGrow)
839 TRACE("(size=%d grow=%d)\n", nSize, nGrow);
841 hdsa = (HDSA)COMCTL32_Alloc (sizeof(DSA));
844 hdsa->nItemCount = 0;
847 hdsa->nItemSize = nSize;
848 hdsa->nGrow = max(1, nGrow);
855 /**************************************************************************
856 * DSA_Destroy [COMCTL32.321] Destroys a dynamic storage array
859 * hdsa [I] pointer to the array control structure
867 DSA_Destroy (const HDSA hdsa)
869 TRACE("(%p)\n", hdsa);
874 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData)))
877 return COMCTL32_Free (hdsa);
881 /**************************************************************************
882 * DSA_GetItem [COMCTL32.322]
885 * hdsa [I] pointer to the array control structure
886 * nIndex [I] number of the Item to get
887 * pDest [O] destination buffer. Has to be >= dwElementSize.
895 DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest)
899 TRACE("(%p %d %p)\n", hdsa, nIndex, pDest);
903 if ((nIndex < 0) || (nIndex >= hdsa->nItemCount))
906 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
907 memmove (pDest, pSrc, hdsa->nItemSize);
913 /**************************************************************************
914 * DSA_GetItemPtr [COMCTL32.323]
916 * Retrieves a pointer to the specified item.
919 * hdsa [I] pointer to the array control structure
920 * nIndex [I] index of the desired item
923 * Success: pointer to an item
928 DSA_GetItemPtr (const HDSA hdsa, INT nIndex)
932 TRACE("(%p %d)\n", hdsa, nIndex);
936 if ((nIndex < 0) || (nIndex >= hdsa->nItemCount))
939 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
941 TRACE("-- ret=%p\n", pSrc);
947 /**************************************************************************
948 * DSA_SetItem [COMCTL32.325]
950 * Sets the contents of an item in the array.
953 * hdsa [I] pointer to the array control structure
954 * nIndex [I] index for the item
955 * pSrc [I] pointer to the new item data
963 DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
965 INT nSize, nNewItems;
966 LPVOID pDest, lpTemp;
968 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
970 if ((!hdsa) || nIndex < 0)
973 if (hdsa->nItemCount <= nIndex) {
974 /* within the old array */
975 if (hdsa->nMaxCount > nIndex) {
976 /* within the allocated space, set a new boundary */
977 hdsa->nItemCount = nIndex + 1;
980 /* resize the block of memory */
982 hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1);
983 nSize = hdsa->nItemSize * nNewItems;
985 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
989 hdsa->nMaxCount = nNewItems;
990 hdsa->nItemCount = nIndex + 1;
991 hdsa->pData = lpTemp;
995 /* put the new entry in */
996 pDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
997 TRACE("-- move dest=%p src=%p size=%d\n",
998 pDest, pSrc, hdsa->nItemSize);
999 memmove (pDest, pSrc, hdsa->nItemSize);
1005 /**************************************************************************
1006 * DSA_InsertItem [COMCTL32.325]
1009 * hdsa [I] pointer to the array control structure
1010 * nIndex [I] index for the new item
1011 * pSrc [I] pointer to the element
1014 * Success: position of the new item
1019 DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
1021 INT nNewItems, nSize, i;
1022 LPVOID lpTemp, lpDest;
1025 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
1027 if ((!hdsa) || nIndex < 0)
1030 for (i = 0; i < hdsa->nItemSize; i += 4) {
1031 p = *(DWORD**)((char *) pSrc + i);
1032 if (IsBadStringPtrA ((char*)p, 256))
1033 TRACE("-- %d=%p\n", i, (DWORD*)p);
1035 TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p));
1038 /* when nIndex >= nItemCount then append */
1039 if (nIndex >= hdsa->nItemCount)
1040 nIndex = hdsa->nItemCount;
1042 /* do we need to resize ? */
1043 if (hdsa->nItemCount >= hdsa->nMaxCount) {
1044 nNewItems = hdsa->nMaxCount + hdsa->nGrow;
1045 nSize = hdsa->nItemSize * nNewItems;
1047 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
1051 hdsa->nMaxCount = nNewItems;
1052 hdsa->pData = lpTemp;
1055 /* do we need to move elements ? */
1056 if (nIndex < hdsa->nItemCount) {
1057 lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
1058 lpDest = (char *) lpTemp + hdsa->nItemSize;
1059 nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize;
1060 TRACE("-- move dest=%p src=%p size=%d\n",
1061 lpDest, lpTemp, nSize);
1062 memmove (lpDest, lpTemp, nSize);
1065 /* ok, we can put the new Item in */
1067 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
1068 TRACE("-- move dest=%p src=%p size=%d\n",
1069 lpDest, pSrc, hdsa->nItemSize);
1070 memmove (lpDest, pSrc, hdsa->nItemSize);
1076 /**************************************************************************
1077 * DSA_DeleteItem [COMCTL32.326]
1080 * hdsa [I] pointer to the array control structure
1081 * nIndex [I] index for the element to delete
1084 * Success: number of the deleted element
1089 DSA_DeleteItem (const HDSA hdsa, INT nIndex)
1091 LPVOID lpDest,lpSrc;
1094 TRACE("(%p %d)\n", hdsa, nIndex);
1098 if (nIndex < 0 || nIndex >= hdsa->nItemCount)
1101 /* do we need to move ? */
1102 if (nIndex < hdsa->nItemCount - 1) {
1103 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
1104 lpSrc = (char *) lpDest + hdsa->nItemSize;
1105 nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1);
1106 TRACE("-- move dest=%p src=%p size=%d\n",
1107 lpDest, lpSrc, nSize);
1108 memmove (lpDest, lpSrc, nSize);
1114 if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) {
1115 nSize = hdsa->nItemSize * hdsa->nItemCount;
1117 lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);
1121 hdsa->nMaxCount = hdsa->nItemCount;
1122 hdsa->pData = lpDest;
1129 /**************************************************************************
1130 * DSA_DeleteAllItems [COMCTL32.326]
1132 * Removes all items and reinitializes the array.
1135 * hdsa [I] pointer to the array control structure
1143 DSA_DeleteAllItems (const HDSA hdsa)
1145 TRACE("(%p)\n", hdsa);
1149 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData)))
1152 hdsa->nItemCount = 0;
1154 hdsa->nMaxCount = 0;
1160 /**************************************************************************
1161 * The DPA-API is a set of functions to create and manipulate arrays of
1165 /**************************************************************************
1166 * DPA_Create [COMCTL32.328] Creates a dynamic pointer array
1169 * nGrow [I] number of items by which the array grows when it is filled
1172 * Success: handle (pointer) to the pointer array.
1177 DPA_Create (INT nGrow)
1181 TRACE("(%d)\n", nGrow);
1183 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));
1185 hdpa->nGrow = max(8, nGrow);
1186 hdpa->hHeap = COMCTL32_hHeap;
1187 hdpa->nMaxCount = hdpa->nGrow * 2;
1189 (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID));
1192 TRACE("-- %p\n", hdpa);
1198 /**************************************************************************
1199 * DPA_Destroy [COMCTL32.329] Destroys a dynamic pointer array
1202 * hdpa [I] handle (pointer) to the pointer array
1210 DPA_Destroy (const HDPA hdpa)
1212 TRACE("(%p)\n", hdpa);
1217 if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs)))
1220 return HeapFree (hdpa->hHeap, 0, hdpa);
1224 /**************************************************************************
1225 * DPA_Grow [COMCTL32.330]
1227 * Sets the growth amount.
1230 * hdpa [I] handle (pointer) to the existing (source) pointer array
1231 * nGrow [I] number of items, the array grows, when it's too small
1239 DPA_Grow (const HDPA hdpa, INT nGrow)
1241 TRACE("(%p %d)\n", hdpa, nGrow);
1246 hdpa->nGrow = max(8, nGrow);
1252 /**************************************************************************
1253 * DPA_Clone [COMCTL32.331]
1255 * Copies a pointer array to an other one or creates a copy
1258 * hdpa [I] handle (pointer) to the existing (source) pointer array
1259 * hdpaNew [O] handle (pointer) to the destination pointer array
1262 * Success: pointer to the destination pointer array.
1266 * - If the 'hdpaNew' is a NULL-Pointer, a copy of the source pointer
1267 * array will be created and it's handle (pointer) is returned.
1268 * - If 'hdpa' is a NULL-Pointer, the original implementation crashes,
1269 * this implementation just returns NULL.
1273 DPA_Clone (const HDPA hdpa, const HDPA hdpaNew)
1275 INT nNewItems, nSize;
1281 TRACE("(%p %p)\n", hdpa, hdpaNew);
1284 /* create a new DPA */
1285 hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
1287 hdpaTemp->hHeap = hdpa->hHeap;
1288 hdpaTemp->nGrow = hdpa->nGrow;
1293 if (hdpaTemp->ptrs) {
1294 /* remove old pointer array */
1295 HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs);
1296 hdpaTemp->ptrs = NULL;
1297 hdpaTemp->nItemCount = 0;
1298 hdpaTemp->nMaxCount = 0;
1301 /* create a new pointer array */
1302 nNewItems = hdpaTemp->nGrow *
1303 ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);
1304 nSize = nNewItems * sizeof(LPVOID);
1306 (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);
1307 hdpaTemp->nMaxCount = nNewItems;
1309 /* clone the pointer array */
1310 hdpaTemp->nItemCount = hdpa->nItemCount;
1311 memmove (hdpaTemp->ptrs, hdpa->ptrs,
1312 hdpaTemp->nItemCount * sizeof(LPVOID));
1318 /**************************************************************************
1319 * DPA_GetPtr [COMCTL32.332]
1321 * Retrieves a pointer from a dynamic pointer array
1324 * hdpa [I] handle (pointer) to the pointer array
1325 * nIndex [I] array index of the desired pointer
1333 DPA_GetPtr (const HDPA hdpa, INT i)
1335 TRACE("(%p %d)\n", hdpa, i);
1341 if ((i < 0) || (i >= hdpa->nItemCount))
1344 TRACE("-- %p\n", hdpa->ptrs[i]);
1346 return hdpa->ptrs[i];
1350 /**************************************************************************
1351 * DPA_GetPtrIndex [COMCTL32.333]
1353 * Retrieves the index of the specified pointer
1356 * hdpa [I] handle (pointer) to the pointer array
1360 * Success: index of the specified pointer
1365 DPA_GetPtrIndex (const HDPA hdpa, LPVOID p)
1372 for (i = 0; i < hdpa->nItemCount; i++) {
1373 if (hdpa->ptrs[i] == p)
1381 /**************************************************************************
1382 * DPA_InsertPtr [COMCTL32.334]
1384 * Inserts a pointer into a dynamic pointer array
1387 * hdpa [I] handle (pointer) to the array
1389 * p [I] pointer to insert
1392 * Success: index of the inserted pointer
1397 DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p)
1399 INT nNewItems, nSize, nIndex = 0;
1400 LPVOID *lpTemp, *lpDest;
1402 TRACE("(%p %d %p)\n", hdpa, i, p);
1404 if ((!hdpa) || (i < 0))
1409 (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
1410 2 * hdpa->nGrow * sizeof(LPVOID));
1413 hdpa->nMaxCount = hdpa->nGrow * 2;
1417 if (hdpa->nItemCount >= hdpa->nMaxCount) {
1418 TRACE("-- resizing\n");
1419 nNewItems = hdpa->nMaxCount + hdpa->nGrow;
1420 nSize = nNewItems * sizeof(LPVOID);
1422 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
1426 hdpa->nMaxCount = nNewItems;
1427 hdpa->ptrs = lpTemp;
1430 if (i >= hdpa->nItemCount) {
1431 nIndex = hdpa->nItemCount;
1432 TRACE("-- appending at %d\n", nIndex);
1435 TRACE("-- inserting at %d\n", i);
1436 lpTemp = hdpa->ptrs + i;
1437 lpDest = lpTemp + 1;
1438 nSize = (hdpa->nItemCount - i) * sizeof(LPVOID);
1439 TRACE("-- move dest=%p src=%p size=%x\n",
1440 lpDest, lpTemp, nSize);
1441 memmove (lpDest, lpTemp, nSize);
1448 hdpa->ptrs[nIndex] = p;
1454 /**************************************************************************
1455 * DPA_SetPtr [COMCTL32.335]
1457 * Sets a pointer in the pointer array
1460 * hdpa [I] handle (pointer) to the pointer array
1461 * i [I] index of the pointer that will be set
1462 * p [I] pointer to be set
1470 DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
1474 TRACE("(%p %d %p)\n", hdpa, i, p);
1476 if ((!hdpa) || i < 0)
1479 if (hdpa->nItemCount <= i) {
1480 /* within the old array */
1481 if (hdpa->nMaxCount > i) {
1482 /* within the allocated space, set a new boundary */
1483 hdpa->nItemCount = i;
1486 /* resize the block of memory */
1488 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1);
1489 INT nSize = nNewItems * sizeof(LPVOID);
1491 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
1496 hdpa->nItemCount = nNewItems;
1497 hdpa->ptrs = lpTemp;
1501 /* put the new entry in */
1508 /**************************************************************************
1509 * DPA_DeletePtr [COMCTL32.336]
1511 * Removes a pointer from the pointer array.
1514 * hdpa [I] handle (pointer) to the pointer array
1515 * i [I] index of the pointer that will be deleted
1518 * Success: deleted pointer
1523 DPA_DeletePtr (const HDPA hdpa, INT i)
1525 LPVOID *lpDest, *lpSrc, lpTemp = NULL;
1528 TRACE("(%p %d)\n", hdpa, i);
1530 if ((!hdpa) || i < 0 || i >= hdpa->nItemCount)
1533 lpTemp = hdpa->ptrs[i];
1535 /* do we need to move ?*/
1536 if (i < hdpa->nItemCount - 1) {
1537 lpDest = hdpa->ptrs + i;
1539 nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID);
1540 TRACE("-- move dest=%p src=%p size=%x\n",
1541 lpDest, lpSrc, nSize);
1542 memmove (lpDest, lpSrc, nSize);
1545 hdpa->nItemCount --;
1548 if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
1549 INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);
1550 nSize = nNewItems * sizeof(LPVOID);
1551 lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
1556 hdpa->nMaxCount = nNewItems;
1557 hdpa->ptrs = (LPVOID*)lpDest;
1564 /**************************************************************************
1565 * DPA_DeleteAllPtrs [COMCTL32.337]
1567 * Removes all pointers and reinitializes the array.
1570 * hdpa [I] handle (pointer) to the pointer array
1578 DPA_DeleteAllPtrs (const HDPA hdpa)
1580 TRACE("(%p)\n", hdpa);
1585 if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs)))
1588 hdpa->nItemCount = 0;
1589 hdpa->nMaxCount = hdpa->nGrow * 2;
1590 hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
1591 hdpa->nMaxCount * sizeof(LPVOID));
1597 /**************************************************************************
1598 * DPA_QuickSort [Internal]
1600 * Ordinary quicksort (used by DPA_Sort).
1603 * lpPtrs [I] pointer to the pointer array
1604 * l [I] index of the "left border" of the partition
1605 * r [I] index of the "right border" of the partition
1606 * pfnCompare [I] pointer to the compare function
1607 * lParam [I] user defined value (3rd parameter in compare function)
1614 DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r,
1615 PFNDPACOMPARE pfnCompare, LPARAM lParam)
1620 TRACE("l=%i r=%i\n", l, r);
1622 if (l==r) /* one element is always sorted */
1624 if (r<l) /* oops, got it in the wrong order */
1626 DPA_QuickSort(lpPtrs, r, l, pfnCompare, lParam);
1629 m = (l+r)/2; /* divide by two */
1630 DPA_QuickSort(lpPtrs, l, m, pfnCompare, lParam);
1631 DPA_QuickSort(lpPtrs, m+1, r, pfnCompare, lParam);
1633 /* join the two sides */
1634 while( (l<=m) && (m<r) )
1636 if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0)
1639 memmove(&lpPtrs[l+1],&lpPtrs[l],(m-l+1)*sizeof lpPtrs[l]);
1649 /**************************************************************************
1650 * DPA_Sort [COMCTL32.338]
1652 * Sorts a pointer array using a user defined compare function
1655 * hdpa [I] handle (pointer) to the pointer array
1656 * pfnCompare [I] pointer to the compare function
1657 * lParam [I] user defined value (3rd parameter of compare function)
1665 DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam)
1667 if (!hdpa || !pfnCompare)
1670 TRACE("(%p %p 0x%lx)\n", hdpa, pfnCompare, lParam);
1672 if ((hdpa->nItemCount > 1) && (hdpa->ptrs))
1673 DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1,
1674 pfnCompare, lParam);
1680 /**************************************************************************
1681 * DPA_Search [COMCTL32.339]
1683 * Searches a pointer array for a specified pointer
1686 * hdpa [I] handle (pointer) to the pointer array
1687 * pFind [I] pointer to search for
1688 * nStart [I] start index
1689 * pfnCompare [I] pointer to the compare function
1690 * lParam [I] user defined value (3rd parameter of compare function)
1691 * uOptions [I] search options
1694 * Success: index of the pointer in the array.
1698 * Binary search taken from R.Sedgewick "Algorithms in C"!
1699 * Function is NOT tested!
1700 * If something goes wrong, blame HIM not ME! (Eric Kohl)
1704 DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart,
1705 PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions)
1707 if (!hdpa || !pfnCompare || !pFind)
1710 TRACE("(%p %p %d %p 0x%08lx 0x%08x)\n",
1711 hdpa, pFind, nStart, pfnCompare, lParam, uOptions);
1713 if (uOptions & DPAS_SORTED) {
1714 /* array is sorted --> use binary search */
1718 TRACE("binary search\n");
1720 l = (nStart == -1) ? 0 : nStart;
1721 r = hdpa->nItemCount - 1;
1725 n = (pfnCompare)(pFind, lpPtr[x], lParam);
1731 TRACE("-- ret=%d\n", n);
1736 if (uOptions & DPAS_INSERTBEFORE) {
1737 TRACE("-- ret=%d\n", r);
1741 if (uOptions & DPAS_INSERTAFTER) {
1742 TRACE("-- ret=%d\n", l);
1747 /* array is not sorted --> use linear search */
1751 TRACE("linear search\n");
1753 nIndex = (nStart == -1)? 0 : nStart;
1755 for (; nIndex < hdpa->nItemCount; nIndex++) {
1756 if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) {
1757 TRACE("-- ret=%d\n", nIndex);
1763 TRACE("-- not found: ret=-1\n");
1768 /**************************************************************************
1769 * DPA_CreateEx [COMCTL32.340]
1771 * Creates a dynamic pointer array using the specified size and heap.
1774 * nGrow [I] number of items by which the array grows when it is filled
1775 * hHeap [I] handle to the heap where the array is stored
1778 * Success: handle (pointer) to the pointer array.
1783 DPA_CreateEx (INT nGrow, HANDLE hHeap)
1787 TRACE("(%d 0x%x)\n", nGrow, hHeap);
1790 hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA));
1792 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));
1795 hdpa->nGrow = min(8, nGrow);
1796 hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap;
1797 hdpa->nMaxCount = hdpa->nGrow * 2;
1799 (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY,
1800 hdpa->nMaxCount * sizeof(LPVOID));
1803 TRACE("-- %p\n", hdpa);
1809 /**************************************************************************
1810 * Notification functions
1813 typedef struct tagNOTIFYDATA
1821 } NOTIFYDATA, *LPNOTIFYDATA;
1824 /**************************************************************************
1825 * DoNotify [Internal]
1829 DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr)
1832 LPNMHDR lpNmh = NULL;
1835 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
1836 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr,
1837 lpNotify->dwParam5);
1839 if (!lpNotify->hwndTo)
1842 if (lpNotify->hwndFrom == -1) {
1844 idFrom = lpHdr->idFrom;
1847 if (lpNotify->hwndFrom) {
1848 HWND hwndParent = GetParent (lpNotify->hwndFrom);
1850 hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER);
1852 idFrom = GetDlgCtrlID (lpNotify->hwndFrom);
1856 lpNmh = (lpHdr) ? lpHdr : &nmhdr;
1858 lpNmh->hwndFrom = lpNotify->hwndFrom;
1859 lpNmh->idFrom = idFrom;
1860 lpNmh->code = uCode;
1863 return SendMessageA (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh);
1867 /**************************************************************************
1868 * SendNotify [COMCTL32.341]
1877 * Success: return value from notification
1882 COMCTL32_SendNotify (HWND hwndFrom, HWND hwndTo,
1883 UINT uCode, LPNMHDR lpHdr)
1887 TRACE("(0x%04x 0x%04x %d %p)\n",
1888 hwndFrom, hwndTo, uCode, lpHdr);
1890 notify.hwndFrom = hwndFrom;
1891 notify.hwndTo = hwndTo;
1892 notify.dwParam5 = 0;
1893 notify.dwParam6 = 0;
1895 return DoNotify (¬ify, uCode, lpHdr);
1899 /**************************************************************************
1900 * SendNotifyEx [COMCTL32.342]
1910 * Success: return value from notification
1915 COMCTL32_SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode,
1916 LPNMHDR lpHdr, DWORD dwParam5)
1921 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
1922 hwndFrom, hwndTo, uCode, lpHdr, dwParam5);
1924 hwndNotify = hwndTo;
1926 if (IsWindow (hwndFrom)) {
1927 hwndNotify = GetParent (hwndFrom);
1933 notify.hwndFrom = hwndFrom;
1934 notify.hwndTo = hwndNotify;
1935 notify.dwParam5 = dwParam5;
1936 notify.dwParam6 = 0;
1938 return DoNotify (¬ify, uCode, lpHdr);
1942 /**************************************************************************
1943 * StrChrA [COMCTL32.350]
1948 COMCTL32_StrChrA (LPCSTR lpString, CHAR cChar)
1950 return strchr (lpString, cChar);
1954 /**************************************************************************
1955 * StrStrIA [COMCTL32.355]
1959 COMCTL32_StrStrIA (LPCSTR lpStr1, LPCSTR lpStr2)
1965 return ((LPSTR)lpStr1);
1967 while (lpStr1[len1] != 0) ++len1;
1969 while (lpStr2[len2] != 0) ++len2;
1971 return ((LPSTR)(lpStr1 + len1));
1972 first = tolower (*lpStr2);
1973 while (len1 >= len2) {
1974 if (tolower(*lpStr1) == first) {
1975 for (i = 1; i < len2; ++i)
1976 if (tolower (lpStr1[i]) != tolower(lpStr2[i]))
1979 return ((LPSTR)lpStr1);
1987 /**************************************************************************
1988 * StrToIntA [COMCTL32.357] Converts a string to a signed integer.
1992 COMCTL32_StrToIntA (LPSTR lpString)
1994 return atoi(lpString);
1998 /**************************************************************************
1999 * DPA_EnumCallback [COMCTL32.385]
2001 * Enumerates all items in a dynamic pointer array.
2004 * hdpa [I] handle to the dynamic pointer array
2013 DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam)
2017 TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam);
2021 if (hdpa->nItemCount <= 0)
2024 for (i = 0; i < hdpa->nItemCount; i++) {
2025 if ((enumProc)(hdpa->ptrs[i], lParam) == 0)
2033 /**************************************************************************
2034 * DPA_DestroyCallback [COMCTL32.386]
2036 * Enumerates all items in a dynamic pointer array and destroys it.
2039 * hdpa [I] handle to the dynamic pointer array
2049 DPA_DestroyCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam)
2051 TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam);
2053 DPA_EnumCallback (hdpa, enumProc, lParam);
2055 return DPA_Destroy (hdpa);
2059 /**************************************************************************
2060 * DSA_EnumCallback [COMCTL32.387]
2062 * Enumerates all items in a dynamic storage array.
2065 * hdsa [I] handle to the dynamic storage array
2074 DSA_EnumCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam)
2078 TRACE("(%p %p %08lx)\n", hdsa, enumProc, lParam);
2082 if (hdsa->nItemCount <= 0)
2085 for (i = 0; i < hdsa->nItemCount; i++) {
2086 LPVOID lpItem = DSA_GetItemPtr (hdsa, i);
2087 if ((enumProc)(lpItem, lParam) == 0)
2095 /**************************************************************************
2096 * DSA_DestroyCallback [COMCTL32.388]
2098 * Enumerates all items in a dynamic storage array and destroys it.
2101 * hdsa [I] handle to the dynamic storage array
2111 DSA_DestroyCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam)
2113 TRACE("(%p %p %08lx)\n", hdsa, enumProc, lParam);
2115 DSA_EnumCallback (hdsa, enumProc, lParam);
2117 return DSA_Destroy (hdsa);
2120 /**************************************************************************
2121 * StrCSpnA [COMCTL32.356]
2124 INT WINAPI COMCTL32_StrCSpnA( LPCSTR lpStr, LPCSTR lpSet) {
2125 return strcspn(lpStr, lpSet);
2128 /**************************************************************************
2129 * StrChrW [COMCTL32.358]
2132 LPWSTR WINAPI COMCTL32_StrChrW( LPCWSTR lpStart, WORD wMatch) {
2133 return strchrW(lpStart, wMatch);
2136 /**************************************************************************
2137 * StrCmpNA [COMCTL32.352]
2140 INT WINAPI COMCTL32_StrCmpNA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) {
2141 return strncmp(lpStr1, lpStr2, nChar);
2144 /**************************************************************************
2145 * StrCmpNIA [COMCTL32.353]
2148 INT WINAPI COMCTL32_StrCmpNIA( LPCSTR lpStr1, LPCSTR lpStr2, int nChar) {
2149 return strncasecmp(lpStr1, lpStr2, nChar);
2152 /**************************************************************************
2153 * StrCmpNW [COMCTL32.360]
2156 INT WINAPI COMCTL32_StrCmpNW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) {
2157 return strncmpW(lpStr1, lpStr2, nChar);
2160 /**************************************************************************
2161 * StrCmpNIW [COMCTL32.361]
2164 INT WINAPI COMCTL32_StrCmpNIW( LPCWSTR lpStr1, LPCWSTR lpStr2, int nChar) {
2165 FIXME("(%s, %s, %i): stub\n", debugstr_w(lpStr1), debugstr_w(lpStr2), nChar);
2169 /**************************************************************************
2170 * StrRChrA [COMCTL32.351]
2173 LPSTR WINAPI COMCTL32_StrRChrA( LPCSTR lpStart, LPCSTR lpEnd, WORD wMatch )
2175 LPCSTR lpGotIt = NULL;
2176 BOOL dbcs = IsDBCSLeadByte( LOBYTE(wMatch) );
2178 TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
2180 if (!lpEnd) lpEnd = lpStart + strlen(lpStart);
2182 for(; lpStart < lpEnd; lpStart = CharNextA(lpStart))
2184 if (*lpStart != LOBYTE(wMatch)) continue;
2185 if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue;
2188 return (LPSTR)lpGotIt;
2192 /**************************************************************************
2193 * StrRChrW [COMCTL32.359]
2196 LPWSTR WINAPI COMCTL32_StrRChrW( LPCWSTR lpStart, LPCWSTR lpEnd, WORD wMatch)
2198 LPCWSTR lpGotIt = NULL;
2200 TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
2201 if (!lpEnd) lpEnd = lpStart + strlenW(lpStart);
2203 for(; lpStart < lpEnd; lpStart = CharNextW(lpStart))
2204 if (*lpStart == wMatch) lpGotIt = lpStart;
2206 return (LPWSTR)lpGotIt;
2210 /**************************************************************************
2211 * StrStrA [COMCTL32.354]
2214 LPSTR WINAPI COMCTL32_StrStrA( LPCSTR lpFirst, LPCSTR lpSrch) {
2215 return strstr(lpFirst, lpSrch);
2218 /**************************************************************************
2219 * StrStrW [COMCTL32.362]
2222 LPWSTR WINAPI COMCTL32_StrStrW( LPCWSTR lpFirst, LPCWSTR lpSrch) {
2223 return strstrW(lpFirst, lpSrch);
2226 /**************************************************************************
2227 * StrSpnW [COMCTL32.364]
2230 INT WINAPI COMCTL32_StrSpnW( LPWSTR lpStr, LPWSTR lpSet) {
2231 LPWSTR lpLoop = lpStr;
2234 if ((lpStr == 0) || (lpSet == 0)) return 0;
2236 /* while(*lpLoop) { if lpLoop++; } */
2238 for(; (*lpLoop != 0); lpLoop++)
2239 if( strchrW(lpSet, *(WORD*)lpLoop))
2240 return (INT)(lpLoop-lpStr);
2242 return (INT)(lpLoop-lpStr);
2245 /**************************************************************************
2246 * COMCTL32_410 [COMCTL32.410]
2248 * FIXME: What's this supposed to do?
2249 * Parameter 1 is an HWND, you're on your own for the rest.
2252 BOOL WINAPI COMCTL32_410( HWND hw, DWORD b, DWORD c, DWORD d) {
2254 FIXME("(%x, %lx, %lx, %lx): stub!\n", hw, b, c, d);
2259 /**************************************************************************
2260 * COMCTL32_411 [COMCTL32.411]
2262 * FIXME: What's this supposed to do?
2263 * Parameter 1 is an HWND, you're on your own for the rest.
2266 BOOL WINAPI COMCTL32_411( HWND hw, DWORD b, DWORD c) {
2268 FIXME("(%x, %lx, %lx): stub!\n", hw, b, c);
2273 /**************************************************************************
2274 * COMCTL32_412 [COMCTL32.412]
2276 * FIXME: What's this supposed to do?
2277 * Parameter 1 is an HWND, you're on your own for the rest.
2280 BOOL WINAPI COMCTL32_412( HWND hwnd, DWORD b, DWORD c)
2282 FIXME("(%x, %lx, %lx): stub!\n", hwnd, b, c);
2284 if (IsWindow (hwnd) == FALSE)
2294 /**************************************************************************
2295 * COMCTL32_413 [COMCTL32.413]
2297 * FIXME: What's this supposed to do?
2298 * Parameter 1 is an HWND, you're on your own for the rest.
2301 BOOL WINAPI COMCTL32_413( HWND hw, DWORD b, DWORD c, DWORD d) {
2303 FIXME("(%x, %lx, %lx, %lx): stub!\n", hw, b, c, d);
2309 /**************************************************************************
2310 * COMCTL32_415 [COMCTL32.415]
2312 * FIXME: What's this supposed to do?
2313 * Parameter 1 is an HWND, you're on your own for the rest.
2316 BOOL WINAPI COMCTL32_415( HWND hwnd, DWORD b, DWORD c, DWORD d, DWORD e)
2319 FIXME("(%x, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e);