Changeset 6709 for trunk/src/comctl32/comctl32undoc.c
- Timestamp:
- Sep 15, 2001, 11:26:26 AM (24 years ago)
- File:
-
- 1 edited
-
trunk/src/comctl32/comctl32undoc.c (modified) (72 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comctl32/comctl32undoc.c
r6705 r6709 98 98 99 99 FIXME ("phDpa=%p loadProc=%p pStream=%p lParam=%lx\n", 100 phDpa, loadProc, pStream, lParam);100 phDpa, loadProc, pStream, lParam); 101 101 102 102 if (!phDpa || !loadProc || !pStream) 103 return E_INVALIDARG;103 return E_INVALIDARG; 104 104 105 105 *phDpa = (HDPA)NULL; … … 110 110 errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition); 111 111 if (errCode != S_OK) 112 return errCode;112 return errCode; 113 113 114 114 errCode = IStream_Read (pStream, &streamData, sizeof(STREAMDATA), &ulRead); 115 115 if (errCode != S_OK) 116 return errCode;116 return errCode; 117 117 118 118 FIXME ("dwSize=%lu dwData2=%lu dwItems=%lu\n", 119 streamData.dwSize, streamData.dwData2, streamData.dwItems);119 streamData.dwSize, streamData.dwData2, streamData.dwItems); 120 120 121 121 if (lParam < sizeof(STREAMDATA) || 122 streamData.dwSize < sizeof(STREAMDATA) ||123 streamData.dwData2 < 1) {124 errCode = E_FAIL;122 streamData.dwSize < sizeof(STREAMDATA) || 123 streamData.dwData2 < 1) { 124 errCode = E_FAIL; 125 125 } 126 126 … … 128 128 hDpa = DPA_Create (streamData.dwItems); 129 129 if (!hDpa) 130 return E_OUTOFMEMORY;130 return E_OUTOFMEMORY; 131 131 132 132 if (!DPA_Grow (hDpa, streamData.dwItems)) 133 return E_OUTOFMEMORY;133 return E_OUTOFMEMORY; 134 134 135 135 /* load data from the stream into the dpa */ … … 137 137 for (loadData.nCount = 0; loadData.nCount < streamData.dwItems; loadData.nCount++) { 138 138 errCode = (loadProc)(&loadData, pStream, lParam); 139 if (errCode != S_OK) {140 errCode = S_FALSE;141 break;142 }143 144 *ptr = loadData.ptr;145 ptr++;139 if (errCode != S_OK) { 140 errCode = S_FALSE; 141 break; 142 } 143 144 *ptr = loadData.ptr; 145 ptr++; 146 146 } 147 147 … … 177 177 178 178 FIXME ("hDpa=%p loadProc=%p pStream=%p lParam=%lx\n", 179 hDpa, loadProc, pStream, lParam);179 hDpa, loadProc, pStream, lParam); 180 180 181 181 return E_FAIL; … … 200 200 BOOL WINAPI 201 201 DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags, 202 PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam)202 PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam) 203 203 { 204 204 INT nCount; … … 208 208 209 209 TRACE("%p %p %08lx %p %p %08lx)\n", 210 hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam);210 hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam); 211 211 212 212 if (IsBadWritePtr (hdpa1, sizeof(DPA))) 213 return FALSE;213 return FALSE; 214 214 215 215 if (IsBadWritePtr (hdpa2, sizeof(DPA))) 216 return FALSE;216 return FALSE; 217 217 218 218 if (IsBadCodePtr ((FARPROC)pfnCompare)) 219 return FALSE;219 return FALSE; 220 220 221 221 if (IsBadCodePtr ((FARPROC)pfnMerge)) 222 return FALSE;222 return FALSE; 223 223 224 224 if (dwFlags & DPAM_SORT) { 225 TRACE("sorting dpa's!\n");226 if (hdpa1->nItemCount > 0)227 DPA_Sort (hdpa1, pfnCompare, lParam);228 TRACE ("dpa 1 sorted!\n");229 if (hdpa2->nItemCount > 0)230 DPA_Sort (hdpa2, pfnCompare, lParam);231 TRACE ("dpa 2 sorted!\n");225 TRACE("sorting dpa's!\n"); 226 if (hdpa1->nItemCount > 0) 227 DPA_Sort (hdpa1, pfnCompare, lParam); 228 TRACE ("dpa 1 sorted!\n"); 229 if (hdpa2->nItemCount > 0) 230 DPA_Sort (hdpa2, pfnCompare, lParam); 231 TRACE ("dpa 2 sorted!\n"); 232 232 } 233 233 234 234 if (hdpa2->nItemCount < 1) 235 return TRUE;235 return TRUE; 236 236 237 237 TRACE("hdpa1->nItemCount=%d hdpa2->nItemCount=%d\n", 238 hdpa1->nItemCount, hdpa2->nItemCount);238 hdpa1->nItemCount, hdpa2->nItemCount); 239 239 240 240 … … 250 250 { 251 251 if (nIndex < 0) break; 252 nResult = (pfnCompare)(*pWork1, *pWork2, lParam);253 TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 254 nResult, nIndex, nCount);255 256 if (nResult == 0)257 {258 PVOID ptr;259 260 ptr = (pfnMerge)(1, *pWork1, *pWork2, lParam);261 if (!ptr)262 return FALSE;263 264 nCount--;265 pWork2--;266 *pWork1 = ptr;267 nIndex--;268 pWork1--;269 }270 else if (nResult < 0)271 {272 if (!dwFlags & 8)273 {274 PVOID ptr;275 276 ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1);277 278 (pfnMerge)(2, ptr, NULL, lParam);279 }280 nIndex--;281 pWork1--;282 }283 else284 {285 if (!dwFlags & 4)286 {287 PVOID ptr;288 289 ptr = (pfnMerge)(3, *pWork2, NULL, lParam);290 if (!ptr)291 return FALSE;292 DPA_InsertPtr (hdpa1, nIndex, ptr);293 }294 nCount--;295 pWork2--;296 }252 nResult = (pfnCompare)(*pWork1, *pWork2, lParam); 253 TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 254 nResult, nIndex, nCount); 255 256 if (nResult == 0) 257 { 258 PVOID ptr; 259 260 ptr = (pfnMerge)(1, *pWork1, *pWork2, lParam); 261 if (!ptr) 262 return FALSE; 263 264 nCount--; 265 pWork2--; 266 *pWork1 = ptr; 267 nIndex--; 268 pWork1--; 269 } 270 else if (nResult < 0) 271 { 272 if (!dwFlags & 8) 273 { 274 PVOID ptr; 275 276 ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1); 277 278 (pfnMerge)(2, ptr, NULL, lParam); 279 } 280 nIndex--; 281 pWork1--; 282 } 283 else 284 { 285 if (!dwFlags & 4) 286 { 287 PVOID ptr; 288 289 ptr = (pfnMerge)(3, *pWork2, NULL, lParam); 290 if (!ptr) 291 return FALSE; 292 DPA_InsertPtr (hdpa1, nIndex, ptr); 293 } 294 nCount--; 295 pWork2--; 296 } 297 297 298 298 } … … 358 358 359 359 if (lpSrc) 360 lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize);360 lpDest = HeapReAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, lpSrc, dwSize); 361 361 else 362 lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize);362 lpDest = HeapAlloc (COMCTL32_hHeap, HEAP_ZERO_MEMORY, dwSize); 363 363 364 364 TRACE("-- ret=%p\n", lpDest); … … 458 458 HANDLE WINAPI 459 459 CreateMRUListLazyA (LPCREATEMRULIST lpcml, DWORD dwParam2, 460 DWORD dwParam3, DWORD dwParam4);460 DWORD dwParam3, DWORD dwParam4); 461 461 462 462 … … 490 490 #if 0 491 491 if (!(hmru->dwParam1 & 1001)) { 492 RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ,493 hmru->lpszMRUString,494 strlen (hmru->lpszMRUString));492 RegSetValueExA (hmru->hKeyMRU, "MRUList", 0, REG_SZ, 493 hmru->lpszMRUString, 494 strlen (hmru->lpszMRUString)); 495 495 } 496 496 … … 506 506 /************************************************************************** 507 507 * AddMRUData [COMCTL32.167] 508 * 508 * 509 509 * Add item to MRU binary list. If item already exists in list then it is 510 510 * simply moved up to the top of the list and not added again. If list is … … 530 530 /************************************************************************** 531 531 * AddMRUStringA [COMCTL32.153] 532 * 532 * 533 533 * Add item to MRU string list. If item already exists in list them it is 534 534 * simply moved up to the top of the list and not added again. If list is … … 572 572 /************************************************************************** 573 573 * FindMRUData [COMCTL32.169] 574 * 574 * 575 575 * Searches binary list for item that matches lpData of length cbData. 576 576 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value … … 590 590 { 591 591 FIXME("(%08x, %p, %ld, %p) empty stub!\n", 592 hList, lpData, cbData, lpRegNum);592 hList, lpData, cbData, lpRegNum); 593 593 594 594 return 0; … … 597 597 /************************************************************************** 598 598 * FindMRUStringA [COMCTL32.155] 599 * 599 * 600 600 * Searches string list for item that matches lpszString. 601 601 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value … … 614 614 { 615 615 FIXME("(%08x, %s, %p) empty stub!\n", hList, debugstr_a(lpszString), 616 lpRegNum);616 lpRegNum); 617 617 618 618 return 0; … … 640 640 641 641 if (lpcml == NULL) 642 return 0;642 return 0; 643 643 644 644 if (lpcml->cbSize < sizeof(CREATEMRULIST)) 645 return 0;645 return 0; 646 646 647 647 FIXME("(%lu %lu %lx %lx \"%s\" %p)\n", 648 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags,649 (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare);648 lpcml->cbSize, lpcml->nMaxItems, lpcml->dwFlags, 649 (DWORD)lpcml->hKey, lpcml->lpszSubKey, lpcml->lpfnCompare); 650 650 651 651 /* dummy pointer creation */ … … 659 659 /************************************************************************** 660 660 * EnumMRUListA [COMCTL32.154] 661 * 661 * 662 662 * Enumerate item in a list 663 663 * … … 673 673 * of list returns -1. 674 674 * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in 675 * the list. 675 * the list. 676 676 */ 677 677 INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, … … 679 679 { 680 680 FIXME("(%08x, %d, %p, %ld): stub\n", hList, nItemPos, lpBuffer, 681 nBufferSize);681 nBufferSize); 682 682 return 0; 683 683 } … … 702 702 703 703 if (!lpDest && lpSrc) 704 return strlen (lpSrc);704 return strlen (lpSrc); 705 705 706 706 if (nMaxLen == 0) 707 return 0;707 return 0; 708 708 709 709 if (lpSrc == NULL) { 710 lpDest[0] = '\0';711 return 0;710 lpDest[0] = '\0'; 711 return 0; 712 712 } 713 713 714 714 len = strlen (lpSrc); 715 715 if (len >= nMaxLen) 716 len = nMaxLen - 1;716 len = nMaxLen - 1; 717 717 718 718 RtlMoveMemory (lpDest, lpSrc, len); … … 737 737 { 738 738 TRACE("(%p %p)\n", lppDest, lpSrc); 739 739 740 740 if (lpSrc) { 741 LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1);742 if (!ptr)743 return FALSE;744 strcpy (ptr, lpSrc);745 *lppDest = ptr;741 LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1); 742 if (!ptr) 743 return FALSE; 744 strcpy (ptr, lpSrc); 745 *lppDest = ptr; 746 746 } 747 747 else { 748 if (*lppDest) {749 COMCTL32_Free (*lppDest);750 *lppDest = NULL;751 }748 if (*lppDest) { 749 COMCTL32_Free (*lppDest); 750 *lppDest = NULL; 751 } 752 752 } 753 753 … … 775 775 776 776 if (!lpDest && lpSrc) 777 return strlenW (lpSrc);777 return strlenW (lpSrc); 778 778 779 779 if (nMaxLen == 0) 780 return 0;780 return 0; 781 781 782 782 if (lpSrc == NULL) { 783 lpDest[0] = L'\0';784 return 0;783 lpDest[0] = L'\0'; 784 return 0; 785 785 } 786 786 787 787 len = strlenW (lpSrc); 788 788 if (len >= nMaxLen) 789 len = nMaxLen - 1;789 len = nMaxLen - 1; 790 790 791 791 RtlMoveMemory (lpDest, lpSrc, len*sizeof(WCHAR)); … … 810 810 { 811 811 TRACE("(%p %p)\n", lppDest, lpSrc); 812 812 813 813 if (lpSrc) { 814 INT len = strlenW (lpSrc) + 1;815 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR));816 if (!ptr)817 return FALSE;818 strcpyW (ptr, lpSrc);819 *lppDest = ptr;814 INT len = strlenW (lpSrc) + 1; 815 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len * sizeof(WCHAR)); 816 if (!ptr) 817 return FALSE; 818 strcpyW (ptr, lpSrc); 819 *lppDest = ptr; 820 820 } 821 821 else { 822 if (*lppDest) {823 COMCTL32_Free (*lppDest);824 *lppDest = NULL;825 }822 if (*lppDest) { 823 COMCTL32_Free (*lppDest); 824 *lppDest = NULL; 825 } 826 826 } 827 827 … … 852 852 853 853 if (!lpDest && lpSrc) 854 return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL);854 return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL); 855 855 856 856 if (nMaxLen == 0) 857 return 0;857 return 0; 858 858 859 859 if (lpSrc == NULL) { 860 lpDest[0] = '\0';861 return 0;860 lpDest[0] = '\0'; 861 return 0; 862 862 } 863 863 864 864 len = WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL); 865 865 if (len >= nMaxLen) 866 len = nMaxLen - 1;866 len = nMaxLen - 1; 867 867 868 868 WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, lpDest, len, NULL, NULL); … … 897 897 898 898 if (lpSrc) { 899 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0);900 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len*sizeof(WCHAR));901 902 if (!ptr)903 return FALSE;904 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len);905 *lppDest = ptr;899 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0); 900 LPWSTR ptr = COMCTL32_ReAlloc (*lppDest, len*sizeof(WCHAR)); 901 902 if (!ptr) 903 return FALSE; 904 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len); 905 *lppDest = ptr; 906 906 } 907 907 else { 908 if (*lppDest) {909 COMCTL32_Free (*lppDest);910 *lppDest = NULL;911 }908 if (*lppDest) { 909 COMCTL32_Free (*lppDest); 910 *lppDest = NULL; 911 } 912 912 } 913 913 … … 944 944 if (hdsa) 945 945 { 946 hdsa->nItemCount = 0;946 hdsa->nItemCount = 0; 947 947 hdsa->pData = NULL; 948 hdsa->nMaxCount = 0;949 hdsa->nItemSize = nSize;950 hdsa->nGrow = max(1, nGrow);948 hdsa->nMaxCount = 0; 949 hdsa->nItemSize = nSize; 950 hdsa->nGrow = max(1, nGrow); 951 951 } 952 952 … … 972 972 973 973 if (!hdsa) 974 return FALSE;974 return FALSE; 975 975 976 976 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) 977 return FALSE;977 return FALSE; 978 978 979 979 return COMCTL32_Free (hdsa); … … 982 982 983 983 /************************************************************************** 984 * DSA_GetItem [COMCTL32.322] 984 * DSA_GetItem [COMCTL32.322] 985 985 * 986 986 * PARAMS … … 1000 1000 1001 1001 TRACE("(%p %d %p)\n", hdsa, nIndex, pDest); 1002 1002 1003 1003 if (!hdsa) 1004 return FALSE;1004 return FALSE; 1005 1005 if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) 1006 return FALSE;1006 return FALSE; 1007 1007 1008 1008 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); … … 1014 1014 1015 1015 /************************************************************************** 1016 * DSA_GetItemPtr [COMCTL32.323] 1016 * DSA_GetItemPtr [COMCTL32.323] 1017 1017 * 1018 1018 * Retrieves a pointer to the specified item. … … 1035 1035 1036 1036 if (!hdsa) 1037 return NULL;1037 return NULL; 1038 1038 if ((nIndex < 0) || (nIndex >= hdsa->nItemCount)) 1039 return NULL;1039 return NULL; 1040 1040 1041 1041 pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1042 1042 1043 1043 TRACE("-- ret=%p\n", pSrc); 1044 1044 … … 1048 1048 1049 1049 /************************************************************************** 1050 * DSA_SetItem [COMCTL32.325] 1050 * DSA_SetItem [COMCTL32.325] 1051 1051 * 1052 1052 * Sets the contents of an item in the array. … … 1067 1067 INT nSize, nNewItems; 1068 1068 LPVOID pDest, lpTemp; 1069 1069 1070 1070 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); 1071 1071 1072 1072 if ((!hdsa) || nIndex < 0) 1073 return FALSE;1074 1073 return FALSE; 1074 1075 1075 if (hdsa->nItemCount <= nIndex) { 1076 /* within the old array */1077 if (hdsa->nMaxCount > nIndex) {1078 /* within the allocated space, set a new boundary */1079 hdsa->nItemCount = nIndex + 1;1080 }1081 else {1082 /* resize the block of memory */1083 nNewItems =1084 hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1);1085 nSize = hdsa->nItemSize * nNewItems;1086 1087 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);1088 if (!lpTemp)1089 return FALSE;1090 1091 hdsa->nMaxCount = nNewItems;1092 hdsa->nItemCount = nIndex + 1;1093 hdsa->pData = lpTemp;1094 } 1076 /* within the old array */ 1077 if (hdsa->nMaxCount > nIndex) { 1078 /* within the allocated space, set a new boundary */ 1079 hdsa->nItemCount = nIndex + 1; 1080 } 1081 else { 1082 /* resize the block of memory */ 1083 nNewItems = 1084 hdsa->nGrow * ((INT)(((nIndex + 1) - 1) / hdsa->nGrow) + 1); 1085 nSize = hdsa->nItemSize * nNewItems; 1086 1087 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); 1088 if (!lpTemp) 1089 return FALSE; 1090 1091 hdsa->nMaxCount = nNewItems; 1092 hdsa->nItemCount = nIndex + 1; 1093 hdsa->pData = lpTemp; 1094 } 1095 1095 } 1096 1096 … … 1098 1098 pDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1099 1099 TRACE("-- move dest=%p src=%p size=%d\n", 1100 pDest, pSrc, hdsa->nItemSize);1100 pDest, pSrc, hdsa->nItemSize); 1101 1101 memmove (pDest, pSrc, hdsa->nItemSize); 1102 1102 … … 1106 1106 1107 1107 /************************************************************************** 1108 * DSA_InsertItem [COMCTL32.324] 1108 * DSA_InsertItem [COMCTL32.324] 1109 1109 * 1110 1110 * PARAMS … … 1124 1124 LPVOID lpTemp, lpDest; 1125 1125 LPDWORD p; 1126 1126 1127 1127 TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc); 1128 1128 1129 1129 if ((!hdsa) || nIndex < 0) 1130 return -1;1130 return -1; 1131 1131 1132 1132 for (i = 0; i < hdsa->nItemSize; i += 4) { 1133 p = *(DWORD**)((char *) pSrc + i);1134 if (IsBadStringPtrA ((char*)p, 256))1135 TRACE("-- %d=%p\n", i, (DWORD*)p);1136 else1137 TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p));1138 } 1139 1133 p = *(DWORD**)((char *) pSrc + i); 1134 if (IsBadStringPtrA ((char*)p, 256)) 1135 TRACE("-- %d=%p\n", i, (DWORD*)p); 1136 else 1137 TRACE("-- %d=%p [%s]\n", i, p, debugstr_a((char*)p)); 1138 } 1139 1140 1140 /* when nIndex >= nItemCount then append */ 1141 1141 if (nIndex >= hdsa->nItemCount) 1142 nIndex = hdsa->nItemCount;1142 nIndex = hdsa->nItemCount; 1143 1143 1144 1144 /* do we need to resize ? */ 1145 1145 if (hdsa->nItemCount >= hdsa->nMaxCount) { 1146 nNewItems = hdsa->nMaxCount + hdsa->nGrow;1147 nSize = hdsa->nItemSize * nNewItems;1148 1149 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);1150 if (!lpTemp)1151 return -1;1152 1153 hdsa->nMaxCount = nNewItems;1154 hdsa->pData = lpTemp; 1146 nNewItems = hdsa->nMaxCount + hdsa->nGrow; 1147 nSize = hdsa->nItemSize * nNewItems; 1148 1149 lpTemp = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); 1150 if (!lpTemp) 1151 return -1; 1152 1153 hdsa->nMaxCount = nNewItems; 1154 hdsa->pData = lpTemp; 1155 1155 } 1156 1156 1157 1157 /* do we need to move elements ? */ 1158 1158 if (nIndex < hdsa->nItemCount) { 1159 lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);1160 lpDest = (char *) lpTemp + hdsa->nItemSize;1161 nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize;1162 TRACE("-- move dest=%p src=%p size=%d\n",1163 lpDest, lpTemp, nSize);1164 memmove (lpDest, lpTemp, nSize);1159 lpTemp = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1160 lpDest = (char *) lpTemp + hdsa->nItemSize; 1161 nSize = (hdsa->nItemCount - nIndex) * hdsa->nItemSize; 1162 TRACE("-- move dest=%p src=%p size=%d\n", 1163 lpDest, lpTemp, nSize); 1164 memmove (lpDest, lpTemp, nSize); 1165 1165 } 1166 1166 … … 1169 1169 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1170 1170 TRACE("-- move dest=%p src=%p size=%d\n", 1171 lpDest, pSrc, hdsa->nItemSize);1171 lpDest, pSrc, hdsa->nItemSize); 1172 1172 memmove (lpDest, pSrc, hdsa->nItemSize); 1173 1173 … … 1177 1177 1178 1178 /************************************************************************** 1179 * DSA_DeleteItem [COMCTL32.326] 1179 * DSA_DeleteItem [COMCTL32.326] 1180 1180 * 1181 1181 * PARAMS … … 1193 1193 LPVOID lpDest,lpSrc; 1194 1194 INT nSize; 1195 1195 1196 1196 TRACE("(%p %d)\n", hdsa, nIndex); 1197 1197 1198 1198 if (!hdsa) 1199 return -1;1199 return -1; 1200 1200 if (nIndex < 0 || nIndex >= hdsa->nItemCount) 1201 return -1;1201 return -1; 1202 1202 1203 1203 /* do we need to move ? */ 1204 1204 if (nIndex < hdsa->nItemCount - 1) { 1205 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);1206 lpSrc = (char *) lpDest + hdsa->nItemSize;1207 nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1);1208 TRACE("-- move dest=%p src=%p size=%d\n",1209 lpDest, lpSrc, nSize);1210 memmove (lpDest, lpSrc, nSize);1211 } 1212 1205 lpDest = (char *) hdsa->pData + (hdsa->nItemSize * nIndex); 1206 lpSrc = (char *) lpDest + hdsa->nItemSize; 1207 nSize = hdsa->nItemSize * (hdsa->nItemCount - nIndex - 1); 1208 TRACE("-- move dest=%p src=%p size=%d\n", 1209 lpDest, lpSrc, nSize); 1210 memmove (lpDest, lpSrc, nSize); 1211 } 1212 1213 1213 hdsa->nItemCount--; 1214 1214 1215 1215 /* free memory ? */ 1216 1216 if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) { 1217 nSize = hdsa->nItemSize * hdsa->nItemCount;1218 1219 lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize);1220 if (!lpDest)1221 return -1;1222 1223 hdsa->nMaxCount = hdsa->nItemCount;1224 hdsa->pData = lpDest;1217 nSize = hdsa->nItemSize * hdsa->nItemCount; 1218 1219 lpDest = (LPVOID)COMCTL32_ReAlloc (hdsa->pData, nSize); 1220 if (!lpDest) 1221 return -1; 1222 1223 hdsa->nMaxCount = hdsa->nItemCount; 1224 hdsa->pData = lpDest; 1225 1225 } 1226 1226 … … 1247 1247 TRACE("(%p)\n", hdsa); 1248 1248 1249 if (!hdsa) 1250 return FALSE;1249 if (!hdsa) 1250 return FALSE; 1251 1251 if (hdsa->pData && (!COMCTL32_Free (hdsa->pData))) 1252 return FALSE;1252 return FALSE; 1253 1253 1254 1254 hdsa->nItemCount = 0; … … 1285 1285 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); 1286 1286 if (hdpa) { 1287 hdpa->nGrow = max(8, nGrow);1288 hdpa->hHeap = COMCTL32_hHeap;1289 hdpa->nMaxCount = hdpa->nGrow * 2;1290 hdpa->ptrs =1291 (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID));1287 hdpa->nGrow = max(8, nGrow); 1288 hdpa->hHeap = COMCTL32_hHeap; 1289 hdpa->nMaxCount = hdpa->nGrow * 2; 1290 hdpa->ptrs = 1291 (LPVOID*)COMCTL32_Alloc (hdpa->nMaxCount * sizeof(LPVOID)); 1292 1292 } 1293 1293 … … 1315 1315 1316 1316 if (!hdpa) 1317 return FALSE;1317 return FALSE; 1318 1318 1319 1319 if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) 1320 return FALSE;1320 return FALSE; 1321 1321 1322 1322 return HeapFree (hdpa->hHeap, 0, hdpa); … … 1344 1344 1345 1345 if (!hdpa) 1346 return FALSE;1346 return FALSE; 1347 1347 1348 1348 hdpa->nGrow = max(8, nGrow); … … 1379 1379 1380 1380 if (!hdpa) 1381 return NULL;1381 return NULL; 1382 1382 1383 1383 TRACE("(%p %p)\n", hdpa, hdpaNew); 1384 1384 1385 1385 if (!hdpaNew) { 1386 /* create a new DPA */1387 hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1388 sizeof(DPA));1389 hdpaTemp->hHeap = hdpa->hHeap;1390 hdpaTemp->nGrow = hdpa->nGrow;1386 /* create a new DPA */ 1387 hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1388 sizeof(DPA)); 1389 hdpaTemp->hHeap = hdpa->hHeap; 1390 hdpaTemp->nGrow = hdpa->nGrow; 1391 1391 } 1392 1392 else 1393 hdpaTemp = hdpaNew;1393 hdpaTemp = hdpaNew; 1394 1394 1395 1395 if (hdpaTemp->ptrs) { 1396 /* remove old pointer array */1397 HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs);1398 hdpaTemp->ptrs = NULL;1399 hdpaTemp->nItemCount = 0;1400 hdpaTemp->nMaxCount = 0;1396 /* remove old pointer array */ 1397 HeapFree (hdpaTemp->hHeap, 0, hdpaTemp->ptrs); 1398 hdpaTemp->ptrs = NULL; 1399 hdpaTemp->nItemCount = 0; 1400 hdpaTemp->nMaxCount = 0; 1401 1401 } 1402 1402 1403 1403 /* create a new pointer array */ 1404 1404 nNewItems = hdpaTemp->nGrow * 1405 ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1);1405 ((INT)((hdpa->nItemCount - 1) / hdpaTemp->nGrow) + 1); 1406 1406 nSize = nNewItems * sizeof(LPVOID); 1407 1407 hdpaTemp->ptrs = 1408 (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize);1408 (LPVOID*)HeapAlloc (hdpaTemp->hHeap, HEAP_ZERO_MEMORY, nSize); 1409 1409 hdpaTemp->nMaxCount = nNewItems; 1410 1410 … … 1412 1412 hdpaTemp->nItemCount = hdpa->nItemCount; 1413 1413 memmove (hdpaTemp->ptrs, hdpa->ptrs, 1414 hdpaTemp->nItemCount * sizeof(LPVOID));1414 hdpaTemp->nItemCount * sizeof(LPVOID)); 1415 1415 1416 1416 return hdpaTemp; … … 1438 1438 1439 1439 if (!hdpa) 1440 return NULL;1440 return NULL; 1441 1441 if (!hdpa->ptrs) { 1442 WARN("no pointer array.\n");1443 return NULL;1442 WARN("no pointer array.\n"); 1443 return NULL; 1444 1444 } 1445 1445 if ((i < 0) || (i >= hdpa->nItemCount)) { 1446 WARN("not enough pointers in array (%d vs %d).\n",i,hdpa->nItemCount);1447 return NULL;1446 WARN("not enough pointers in array (%d vs %d).\n",i,hdpa->nItemCount); 1447 return NULL; 1448 1448 } 1449 1449 … … 1474 1474 1475 1475 if (!hdpa->ptrs) 1476 return -1;1476 return -1; 1477 1477 1478 1478 for (i = 0; i < hdpa->nItemCount; i++) { 1479 if (hdpa->ptrs[i] == p)1480 return i;1479 if (hdpa->ptrs[i] == p) 1480 return i; 1481 1481 } 1482 1482 … … 1509 1509 1510 1510 if ((!hdpa) || (i < 0)) 1511 return -1;1511 return -1; 1512 1512 1513 1513 if (!hdpa->ptrs) { 1514 hdpa->ptrs =1515 (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1516 2 * hdpa->nGrow * sizeof(LPVOID));1517 if (!hdpa->ptrs)1518 return -1;1519 hdpa->nMaxCount = hdpa->nGrow * 2;1514 hdpa->ptrs = 1515 (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1516 2 * hdpa->nGrow * sizeof(LPVOID)); 1517 if (!hdpa->ptrs) 1518 return -1; 1519 hdpa->nMaxCount = hdpa->nGrow * 2; 1520 1520 nIndex = 0; 1521 1521 } 1522 1522 else { 1523 if (hdpa->nItemCount >= hdpa->nMaxCount) {1524 TRACE("-- resizing\n");1525 nNewItems = hdpa->nMaxCount + hdpa->nGrow;1526 nSize = nNewItems * sizeof(LPVOID);1527 1528 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1529 hdpa->ptrs, nSize);1530 if (!lpTemp)1531 return -1;1532 hdpa->nMaxCount = nNewItems;1533 hdpa->ptrs = lpTemp;1534 }1535 1536 if (i >= hdpa->nItemCount) {1537 nIndex = hdpa->nItemCount;1538 TRACE("-- appending at %d\n", nIndex);1539 }1540 else {1541 TRACE("-- inserting at %d\n", i);1542 lpTemp = hdpa->ptrs + i;1543 lpDest = lpTemp + 1;1544 nSize = (hdpa->nItemCount - i) * sizeof(LPVOID);1545 TRACE("-- move dest=%p src=%p size=%x\n",1546 lpDest, lpTemp, nSize);1547 memmove (lpDest, lpTemp, nSize);1548 nIndex = i;1549 }1523 if (hdpa->nItemCount >= hdpa->nMaxCount) { 1524 TRACE("-- resizing\n"); 1525 nNewItems = hdpa->nMaxCount + hdpa->nGrow; 1526 nSize = nNewItems * sizeof(LPVOID); 1527 1528 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1529 hdpa->ptrs, nSize); 1530 if (!lpTemp) 1531 return -1; 1532 hdpa->nMaxCount = nNewItems; 1533 hdpa->ptrs = lpTemp; 1534 } 1535 1536 if (i >= hdpa->nItemCount) { 1537 nIndex = hdpa->nItemCount; 1538 TRACE("-- appending at %d\n", nIndex); 1539 } 1540 else { 1541 TRACE("-- inserting at %d\n", i); 1542 lpTemp = hdpa->ptrs + i; 1543 lpDest = lpTemp + 1; 1544 nSize = (hdpa->nItemCount - i) * sizeof(LPVOID); 1545 TRACE("-- move dest=%p src=%p size=%x\n", 1546 lpDest, lpTemp, nSize); 1547 memmove (lpDest, lpTemp, nSize); 1548 nIndex = i; 1549 } 1550 1550 } 1551 1551 … … 1577 1577 { 1578 1578 LPVOID *lpTemp; 1579 1579 1580 1580 TRACE("(%p %d %p)\n", hdpa, i, p); 1581 1581 1582 1582 if ((!hdpa) || i < 0) 1583 return FALSE;1584 1583 return FALSE; 1584 1585 1585 if (hdpa->nItemCount <= i) { 1586 /* within the old array */1587 if (hdpa->nMaxCount > i) {1588 /* within the allocated space, set a new boundary */1589 hdpa->nItemCount = i+1;1590 }1591 else {1592 /* resize the block of memory */1593 INT nNewItems =1594 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1);1595 INT nSize = nNewItems * sizeof(LPVOID);1596 1597 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1598 hdpa->ptrs, nSize);1599 if (!lpTemp)1600 return FALSE;1601 1602 hdpa->nItemCount = nNewItems;1603 hdpa->ptrs = lpTemp; 1604 } 1586 /* within the old array */ 1587 if (hdpa->nMaxCount > i) { 1588 /* within the allocated space, set a new boundary */ 1589 hdpa->nItemCount = i+1; 1590 } 1591 else { 1592 /* resize the block of memory */ 1593 INT nNewItems = 1594 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1); 1595 INT nSize = nNewItems * sizeof(LPVOID); 1596 1597 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1598 hdpa->ptrs, nSize); 1599 if (!lpTemp) 1600 return FALSE; 1601 1602 hdpa->nItemCount = nNewItems; 1603 hdpa->ptrs = lpTemp; 1604 } 1605 1605 } 1606 1606 … … 1631 1631 LPVOID *lpDest, *lpSrc, lpTemp = NULL; 1632 1632 INT nSize; 1633 1633 1634 1634 TRACE("(%p %d)\n", hdpa, i); 1635 1635 1636 1636 if ((!hdpa) || i < 0 || i >= hdpa->nItemCount) 1637 return NULL;1637 return NULL; 1638 1638 1639 1639 lpTemp = hdpa->ptrs[i]; … … 1641 1641 /* do we need to move ?*/ 1642 1642 if (i < hdpa->nItemCount - 1) { 1643 lpDest = hdpa->ptrs + i;1644 lpSrc = lpDest + 1;1645 nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID);1646 TRACE("-- move dest=%p src=%p size=%x\n",1647 lpDest, lpSrc, nSize);1648 memmove (lpDest, lpSrc, nSize);1649 } 1650 1643 lpDest = hdpa->ptrs + i; 1644 lpSrc = lpDest + 1; 1645 nSize = (hdpa->nItemCount - i - 1) * sizeof(LPVOID); 1646 TRACE("-- move dest=%p src=%p size=%x\n", 1647 lpDest, lpSrc, nSize); 1648 memmove (lpDest, lpSrc, nSize); 1649 } 1650 1651 1651 hdpa->nItemCount --; 1652 1652 1653 1653 /* free memory ?*/ 1654 1654 if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) { 1655 INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount);1656 nSize = nNewItems * sizeof(LPVOID);1657 lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,1658 hdpa->ptrs, nSize);1659 if (!lpDest)1660 return NULL;1661 1662 hdpa->nMaxCount = nNewItems;1663 hdpa->ptrs = (LPVOID*)lpDest; 1655 INT nNewItems = max(hdpa->nGrow * 2, hdpa->nItemCount); 1656 nSize = nNewItems * sizeof(LPVOID); 1657 lpDest = (LPVOID)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1658 hdpa->ptrs, nSize); 1659 if (!lpDest) 1660 return NULL; 1661 1662 hdpa->nMaxCount = nNewItems; 1663 hdpa->ptrs = (LPVOID*)lpDest; 1664 1664 } 1665 1665 … … 1686 1686 TRACE("(%p)\n", hdpa); 1687 1687 1688 if (!hdpa) 1689 return FALSE;1688 if (!hdpa) 1689 return FALSE; 1690 1690 1691 1691 if (hdpa->ptrs && (!HeapFree (hdpa->hHeap, 0, hdpa->ptrs))) 1692 return FALSE;1692 return FALSE; 1693 1693 1694 1694 hdpa->nItemCount = 0; 1695 1695 hdpa->nMaxCount = hdpa->nGrow * 2; 1696 1696 hdpa->ptrs = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, 1697 hdpa->nMaxCount * sizeof(LPVOID));1697 hdpa->nMaxCount * sizeof(LPVOID)); 1698 1698 1699 1699 return TRUE; … … 1719 1719 static VOID 1720 1720 DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r, 1721 PFNDPACOMPARE pfnCompare, LPARAM lParam)1721 PFNDPACOMPARE pfnCompare, LPARAM lParam) 1722 1722 { 1723 1723 INT m; … … 1725 1725 1726 1726 TRACE("l=%i r=%i\n", l, r); 1727 1727 1728 1728 if (l==r) /* one element is always sorted */ 1729 1729 return; 1730 1730 if (r<l) /* oops, got it in the wrong order */ 1731 {1731 { 1732 1732 DPA_QuickSort(lpPtrs, r, l, pfnCompare, lParam); 1733 1733 return; 1734 }1734 } 1735 1735 m = (l+r)/2; /* divide by two */ 1736 1736 DPA_QuickSort(lpPtrs, l, m, pfnCompare, lParam); … … 1738 1738 1739 1739 /* join the two sides */ 1740 while( (l<=m) && (m<r) ) 1740 while( (l<=m) && (m<r) ) 1741 1741 { 1742 1742 if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0) … … 1772 1772 { 1773 1773 if (!hdpa || !pfnCompare) 1774 return FALSE;1774 return FALSE; 1775 1775 1776 1776 TRACE("(%p %p 0x%lx)\n", hdpa, pfnCompare, lParam); 1777 1777 1778 1778 if ((hdpa->nItemCount > 1) && (hdpa->ptrs)) 1779 DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1,1780 pfnCompare, lParam);1779 DPA_QuickSort (hdpa->ptrs, 0, hdpa->nItemCount - 1, 1780 pfnCompare, lParam); 1781 1781 1782 1782 return TRUE; … … 1809 1809 INT WINAPI 1810 1810 DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart, 1811 PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions)1811 PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions) 1812 1812 { 1813 1813 if (!hdpa || !pfnCompare || !pFind) 1814 return -1;1814 return -1; 1815 1815 1816 1816 TRACE("(%p %p %d %p 0x%08lx 0x%08x)\n", 1817 hdpa, pFind, nStart, pfnCompare, lParam, uOptions);1817 hdpa, pFind, nStart, pfnCompare, lParam, uOptions); 1818 1818 1819 1819 if (uOptions & DPAS_SORTED) { 1820 /* array is sorted --> use binary search */1821 INT l, r, x, n;1822 LPVOID *lpPtr;1823 1824 TRACE("binary search\n");1825 1826 l = (nStart == -1) ? 0 : nStart;1827 r = hdpa->nItemCount - 1;1828 lpPtr = hdpa->ptrs;1829 while (r >= l) {1830 x = (l + r) / 2;1831 n = (pfnCompare)(pFind, lpPtr[x], lParam);1832 if (n < 0)1833 r = x - 1;1834 else1835 l = x + 1;1836 if (n == 0) {1837 TRACE("-- ret=%d\n", n);1838 return n;1839 }1840 }1841 1842 if (uOptions & DPAS_INSERTBEFORE) {1843 TRACE("-- ret=%d\n", r);1844 return r;1845 }1846 1847 if (uOptions & DPAS_INSERTAFTER) {1848 TRACE("-- ret=%d\n", l);1849 return l;1850 }1820 /* array is sorted --> use binary search */ 1821 INT l, r, x, n; 1822 LPVOID *lpPtr; 1823 1824 TRACE("binary search\n"); 1825 1826 l = (nStart == -1) ? 0 : nStart; 1827 r = hdpa->nItemCount - 1; 1828 lpPtr = hdpa->ptrs; 1829 while (r >= l) { 1830 x = (l + r) / 2; 1831 n = (pfnCompare)(pFind, lpPtr[x], lParam); 1832 if (n < 0) 1833 r = x - 1; 1834 else 1835 l = x + 1; 1836 if (n == 0) { 1837 TRACE("-- ret=%d\n", n); 1838 return n; 1839 } 1840 } 1841 1842 if (uOptions & DPAS_INSERTBEFORE) { 1843 TRACE("-- ret=%d\n", r); 1844 return r; 1845 } 1846 1847 if (uOptions & DPAS_INSERTAFTER) { 1848 TRACE("-- ret=%d\n", l); 1849 return l; 1850 } 1851 1851 } 1852 1852 else { 1853 /* array is not sorted --> use linear search */1854 LPVOID *lpPtr;1855 INT nIndex;1856 1857 TRACE("linear search\n");1858 1859 nIndex = (nStart == -1)? 0 : nStart;1860 lpPtr = hdpa->ptrs;1861 for (; nIndex < hdpa->nItemCount; nIndex++) {1862 if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) {1863 TRACE("-- ret=%d\n", nIndex);1864 return nIndex;1865 }1866 }1853 /* array is not sorted --> use linear search */ 1854 LPVOID *lpPtr; 1855 INT nIndex; 1856 1857 TRACE("linear search\n"); 1858 1859 nIndex = (nStart == -1)? 0 : nStart; 1860 lpPtr = hdpa->ptrs; 1861 for (; nIndex < hdpa->nItemCount; nIndex++) { 1862 if ((pfnCompare)(pFind, lpPtr[nIndex], lParam) == 0) { 1863 TRACE("-- ret=%d\n", nIndex); 1864 return nIndex; 1865 } 1866 } 1867 1867 } 1868 1868 … … 1894 1894 1895 1895 if (hHeap) 1896 hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA));1896 hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA)); 1897 1897 else 1898 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA));1898 hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); 1899 1899 1900 1900 if (hdpa) { 1901 hdpa->nGrow = min(8, nGrow);1902 hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap;1903 hdpa->nMaxCount = hdpa->nGrow * 2;1904 hdpa->ptrs =1905 (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY,1906 hdpa->nMaxCount * sizeof(LPVOID));1901 hdpa->nGrow = min(8, nGrow); 1902 hdpa->hHeap = hHeap ? hHeap : COMCTL32_hHeap; 1903 hdpa->nMaxCount = hdpa->nGrow * 2; 1904 hdpa->ptrs = 1905 (LPVOID*)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, 1906 hdpa->nMaxCount * sizeof(LPVOID)); 1907 1907 } 1908 1908 … … 1940 1940 1941 1941 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n", 1942 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr,1943 lpNotify->dwParam5);1942 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr, 1943 lpNotify->dwParam5); 1944 1944 1945 1945 if (!lpNotify->hwndTo) 1946 return 0;1946 return 0; 1947 1947 1948 1948 if (lpNotify->hwndFrom == -1) { 1949 lpNmh = lpHdr;1950 idFrom = lpHdr->idFrom;1949 lpNmh = lpHdr; 1950 idFrom = lpHdr->idFrom; 1951 1951 } 1952 1952 else { 1953 if (lpNotify->hwndFrom) {1954 HWND hwndParent = GetParent (lpNotify->hwndFrom);1955 if (hwndParent) {1956 hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER);1957 if (hwndParent)1958 idFrom = GetDlgCtrlID (lpNotify->hwndFrom);1959 }1960 }1961 1962 lpNmh = (lpHdr) ? lpHdr : &nmhdr;1963 1964 lpNmh->hwndFrom = lpNotify->hwndFrom;1965 lpNmh->idFrom = idFrom;1966 lpNmh->code = uCode;1953 if (lpNotify->hwndFrom) { 1954 HWND hwndParent = GetParent (lpNotify->hwndFrom); 1955 if (hwndParent) { 1956 hwndParent = GetWindow (lpNotify->hwndFrom, GW_OWNER); 1957 if (hwndParent) 1958 idFrom = GetDlgCtrlID (lpNotify->hwndFrom); 1959 } 1960 } 1961 1962 lpNmh = (lpHdr) ? lpHdr : &nmhdr; 1963 1964 lpNmh->hwndFrom = lpNotify->hwndFrom; 1965 lpNmh->idFrom = idFrom; 1966 lpNmh->code = uCode; 1967 1967 } 1968 1968 … … 1987 1987 LRESULT WINAPI 1988 1988 COMCTL32_SendNotify (HWND hwndFrom, HWND hwndTo, 1989 UINT uCode, LPNMHDR lpHdr)1989 UINT uCode, LPNMHDR lpHdr) 1990 1990 { 1991 1991 NOTIFYDATA notify; 1992 1992 1993 1993 TRACE("(0x%04x 0x%04x %d %p)\n", 1994 hwndFrom, hwndTo, uCode, lpHdr);1994 hwndFrom, hwndTo, uCode, lpHdr); 1995 1995 1996 1996 notify.hwndFrom = hwndFrom; … … 2020 2020 LRESULT WINAPI 2021 2021 COMCTL32_SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode, 2022 LPNMHDR lpHdr, DWORD dwParam5)2022 LPNMHDR lpHdr, DWORD dwParam5) 2023 2023 { 2024 2024 NOTIFYDATA notify; … … 2026 2026 2027 2027 TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n", 2028 hwndFrom, hwndTo, uCode, lpHdr, dwParam5);2028 hwndFrom, hwndTo, uCode, lpHdr, dwParam5); 2029 2029 2030 2030 hwndNotify = hwndTo; 2031 2031 if (!hwndTo) { 2032 if (IsWindow (hwndFrom)) {2033 hwndNotify = GetParent (hwndFrom);2034 if (!hwndNotify)2035 return 0;2036 }2032 if (IsWindow (hwndFrom)) { 2033 hwndNotify = GetParent (hwndFrom); 2034 if (!hwndNotify) 2035 return 0; 2036 } 2037 2037 } 2038 2038 … … 2069 2069 2070 2070 if (*lpStr2 == 0) 2071 return ((LPSTR)lpStr1);2071 return ((LPSTR)lpStr1); 2072 2072 len1 = 0; 2073 2073 while (lpStr1[len1] != 0) ++len1; … … 2075 2075 while (lpStr2[len2] != 0) ++len2; 2076 2076 if (len2 == 0) 2077 return ((LPSTR)(lpStr1 + len1));2077 return ((LPSTR)(lpStr1 + len1)); 2078 2078 first = tolower (*lpStr2); 2079 2079 while (len1 >= len2) { 2080 if (tolower(*lpStr1) == first) {2081 for (i = 1; i < len2; ++i)2082 if (tolower (lpStr1[i]) != tolower(lpStr2[i]))2083 break;2084 if (i >= len2)2085 return ((LPSTR)lpStr1);2080 if (tolower(*lpStr1) == first) { 2081 for (i = 1; i < len2; ++i) 2082 if (tolower (lpStr1[i]) != tolower(lpStr2[i])) 2083 break; 2084 if (i >= len2) 2085 return ((LPSTR)lpStr1); 2086 2086 } 2087 ++lpStr1; --len1;2087 ++lpStr1; --len1; 2088 2088 } 2089 2089 return (NULL); … … 2116 2116 * 2117 2117 * Enumerates all items in a dynamic pointer array. 2118 * 2119 * PARAMS 2120 * hdpa [I] handle to the dynamic pointer array 2121 * enumProc [I] 2122 * lParam [I] 2123 * 2124 * RETURNS 2125 * none 2126 */ 2127 2128 VOID WINAPI 2129 DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) 2130 { 2131 INT i; 2132 2133 TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam); 2134 2135 if (!hdpa) 2136 return; 2137 if (hdpa->nItemCount <= 0) 2138 return; 2139 2140 for (i = 0; i < hdpa->nItemCount; i++) { 2141 if ((enumProc)(hdpa->ptrs[i], lParam) == 0) 2142 return; 2143 } 2144 2145 return; 2146 } 2147 2148 2149 /************************************************************************** 2150 * DPA_DestroyCallback [COMCTL32.386] 2151 * 2152 * Enumerates all items in a dynamic pointer array and destroys it. 2118 2153 * 2119 2154 * PARAMS … … 2123 2158 * 2124 2159 * RETURNS 2125 * none2126 */2127 2128 VOID WINAPI2129 DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam)2130 {2131 INT i;2132 2133 TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam);2134 2135 if (!hdpa)2136 return;2137 if (hdpa->nItemCount <= 0)2138 return;2139 2140 for (i = 0; i < hdpa->nItemCount; i++) {2141 if ((enumProc)(hdpa->ptrs[i], lParam) == 0)2142 return;2143 }2144 2145 return;2146 }2147 2148 2149 /**************************************************************************2150 * DPA_DestroyCallback [COMCTL32.386]2151 *2152 * Enumerates all items in a dynamic pointer array and destroys it.2153 *2154 * PARAMS2155 * hdpa [I] handle to the dynamic pointer array2156 * enumProc [I]2157 * lParam [I]2158 *2159 * RETURNS2160 2160 * Success: TRUE 2161 2161 * Failure: FALSE … … 2195 2195 2196 2196 if (!hdsa) 2197 return;2197 return; 2198 2198 if (hdsa->nItemCount <= 0) 2199 return;2199 return; 2200 2200 2201 2201 for (i = 0; i < hdsa->nItemCount; i++) { 2202 LPVOID lpItem = DSA_GetItemPtr (hdsa, i);2203 if ((enumProc)(lpItem, lParam) == 0)2204 return;2202 LPVOID lpItem = DSA_GetItemPtr (hdsa, i); 2203 if ((enumProc)(lpItem, lParam) == 0) 2204 return; 2205 2205 } 2206 2206 … … 2301 2301 if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue; 2302 2302 lpGotIt = lpStart; 2303 } 2303 } 2304 2304 return (LPSTR)lpGotIt; 2305 2305 } … … 2355 2355 if( strchrW(lpSet, *(WORD*)lpLoop)) 2356 2356 return (INT)(lpLoop-lpStr); 2357 2357 2358 2358 return (INT)(lpLoop-lpStr); 2359 2359 } … … 2399 2399 2400 2400 if (IsWindow (hwnd) == FALSE) 2401 return FALSE;2401 return FALSE; 2402 2402 2403 2403 if (b == 0) 2404 return FALSE;2404 return FALSE; 2405 2405 2406 2406
Note:
See TracChangeset
for help on using the changeset viewer.
