From f5cb3dde170221289dbc21ac7f86d185ff5a3e37 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 17 Sep 2003 20:15:21 +0000 Subject: [PATCH] Moved undocumented functions out of the exported commctrl.h. --- dlls/comctl32/animate.c | 1 + dlls/comctl32/comboex.c | 1 + dlls/comctl32/comctl32.h | 24 +++++++ dlls/comctl32/comctl32undoc.c | 64 +++++++++++------- dlls/comctl32/datetime.c | 1 + dlls/comctl32/imagelist.c | 1 + dlls/comctl32/ipaddress.c | 1 + dlls/comctl32/listview.c | 84 ++++++++++++------------ dlls/comctl32/nativefont.c | 1 + dlls/comctl32/pager.c | 1 + dlls/comctl32/progress.c | 1 + dlls/comctl32/rebar.c | 1 + dlls/comctl32/status.c | 1 + dlls/comctl32/toolbar.c | 2 +- dlls/comctl32/tooltips.c | 1 + dlls/comctl32/treeview.c | 2 +- dlls/comctl32/updown.c | 1 + dlls/shell32/iconcache.c | 19 ++---- dlls/shell32/shell32_main.c | 9 --- dlls/shell32/shlview.c | 22 +++---- include/commctrl.h | 119 +++++++--------------------------- 21 files changed, 161 insertions(+), 196 deletions(-) diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c index ba9738c4d2..00ac2c1a09 100644 --- a/dlls/comctl32/animate.c +++ b/dlls/comctl32/animate.c @@ -39,6 +39,7 @@ #include "commctrl.h" #include "vfw.h" #include "mmsystem.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(animate); diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c index 6010127103..f621c0bb9b 100644 --- a/dlls/comctl32/comboex.c +++ b/dlls/comctl32/comboex.c @@ -38,6 +38,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" #include "wine/unicode.h" diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index a9ad8e09f0..962b125d19 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -155,4 +155,28 @@ typedef struct WNDPROC origproc; } SUBCLASS_INFO, *LPSUBCLASS_INFO; +/* private heap memory functions */ + +LPVOID WINAPI COMCTL32_Alloc (DWORD); +LPVOID WINAPI COMCTL32_ReAlloc (LPVOID, DWORD); +BOOL WINAPI COMCTL32_Free (LPVOID); +DWORD WINAPI COMCTL32_GetSize (LPVOID); + +/* undocumented functions */ + +INT WINAPI Str_GetPtrA (LPCSTR, LPSTR, INT); +INT WINAPI Str_GetPtrW (LPCWSTR, LPWSTR, INT); + +INT WINAPI DPA_GetPtrIndex (const HDPA, LPVOID); +BOOL WINAPI DPA_Grow (const HDPA, INT); + +#define DPAM_NOSORT 0x0001 +#define DPAM_INSERT 0x0004 +#define DPAM_DELETE 0x0008 + +typedef PVOID (CALLBACK *PFNDPAMERGE)(DWORD,PVOID,PVOID,LPARAM); +BOOL WINAPI DPA_Merge (const HDPA, const HDPA, DWORD, PFNDPACOMPARE, PFNDPAMERGE, LPARAM); + +#define DPA_GetPtrCount(hdpa) (*(INT*)(hdpa)) + #endif /* __WINE_COMCTL32_H */ diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index e4f386fe9d..83e91cd8eb 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -61,6 +61,24 @@ WINE_DEFAULT_DEBUG_CHANNEL(commctrl); extern HANDLE COMCTL32_hHeap; /* handle to the private heap */ +struct _DSA +{ + INT nItemCount; + LPVOID pData; + INT nMaxCount; + INT nItemSize; + INT nGrow; +}; + +struct _DPA +{ + INT nItemCount; + LPVOID *ptrs; + HANDLE hHeap; + INT nGrow; + INT nMaxCount; +}; + typedef struct _STREAMDATA { DWORD dwSize; @@ -224,10 +242,10 @@ DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags, TRACE("%p %p %08lx %p %p %08lx)\n", hdpa1, hdpa2, dwFlags, pfnCompare, pfnMerge, lParam); - if (IsBadWritePtr (hdpa1, sizeof(DPA))) + if (IsBadWritePtr (hdpa1, sizeof(*hdpa1))) return FALSE; - if (IsBadWritePtr (hdpa2, sizeof(DPA))) + if (IsBadWritePtr (hdpa2, sizeof(*hdpa2))) return FALSE; if (IsBadCodePtr ((FARPROC)pfnCompare)) @@ -1330,7 +1348,7 @@ DSA_Create (INT nSize, INT nGrow) TRACE("(size=%d grow=%d)\n", nSize, nGrow); - hdsa = (HDSA)COMCTL32_Alloc (sizeof(DSA)); + hdsa = (HDSA)COMCTL32_Alloc (sizeof(*hdsa)); if (hdsa) { hdsa->nItemCount = 0; @@ -1663,7 +1681,7 @@ DPA_Create (INT nGrow) TRACE("(%d)\n", nGrow); - hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); + hdpa = (HDPA)COMCTL32_Alloc (sizeof(*hdpa)); if (hdpa) { hdpa->nGrow = max(8, nGrow); hdpa->hHeap = COMCTL32_hHeap; @@ -1766,7 +1784,7 @@ DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) if (!hdpaNew) { /* create a new DPA */ hdpaTemp = (HDPA)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, - sizeof(DPA)); + sizeof(*hdpaTemp)); hdpaTemp->hHeap = hdpa->hHeap; hdpaTemp->nGrow = hdpa->nGrow; } @@ -2237,9 +2255,9 @@ DPA_CreateEx (INT nGrow, HANDLE hHeap) TRACE("(%d %p)\n", nGrow, hHeap); if (hHeap) - hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(DPA)); + hdpa = (HDPA)HeapAlloc (hHeap, HEAP_ZERO_MEMORY, sizeof(*hdpa)); else - hdpa = (HDPA)COMCTL32_Alloc (sizeof(DPA)); + hdpa = (HDPA)COMCTL32_Alloc (sizeof(*hdpa)); if (hdpa) { hdpa->nGrow = min(8, nGrow); @@ -2502,11 +2520,11 @@ COMCTL32_StrToIntW (LPWSTR lpString) */ VOID WINAPI -DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) +DPA_EnumCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam) { INT i; - TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam); + TRACE("(%p %p %p)\n", hdpa, enumProc, lParam); if (!hdpa) return; @@ -2533,18 +2551,16 @@ DPA_EnumCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) * lParam [I] * * RETURNS - * Success: TRUE - * Failure: FALSE + * none */ -BOOL WINAPI -DPA_DestroyCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) +void WINAPI +DPA_DestroyCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam) { - TRACE("(%p %p %08lx)\n", hdpa, enumProc, lParam); + TRACE("(%p %p %p)\n", hdpa, enumProc, lParam); DPA_EnumCallback (hdpa, enumProc, lParam); - - return DPA_Destroy (hdpa); + DPA_Destroy (hdpa); } @@ -2563,11 +2579,11 @@ DPA_DestroyCallback (const HDPA hdpa, DPAENUMPROC enumProc, LPARAM lParam) */ VOID WINAPI -DSA_EnumCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam) +DSA_EnumCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, LPVOID lParam) { INT i; - TRACE("(%p %p %08lx)\n", hdsa, enumProc, lParam); + TRACE("(%p %p %p)\n", hdsa, enumProc, lParam); if (!hdsa) return; @@ -2595,18 +2611,16 @@ DSA_EnumCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam) * lParam [I] * * RETURNS - * Success: TRUE - * Failure: FALSE + * none */ -BOOL WINAPI -DSA_DestroyCallback (const HDSA hdsa, DSAENUMPROC enumProc, LPARAM lParam) +void WINAPI +DSA_DestroyCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, LPVOID lParam) { - TRACE("(%p %p %08lx)\n", hdsa, enumProc, lParam); + TRACE("(%p %p %p)\n", hdsa, enumProc, lParam); DSA_EnumCallback (hdsa, enumProc, lParam); - - return DSA_Destroy (hdsa); + DSA_Destroy (hdsa); } /************************************************************************** diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index d923674dba..efb80afaf7 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c @@ -36,6 +36,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(datetime); diff --git a/dlls/comctl32/imagelist.c b/dlls/comctl32/imagelist.c index 3088349812..08dd9182f0 100644 --- a/dlls/comctl32/imagelist.c +++ b/dlls/comctl32/imagelist.c @@ -51,6 +51,7 @@ #include "wingdi.h" #include "winuser.h" #include "commctrl.h" +#include "comctl32.h" #include "imagelist.h" #include "wine/debug.h" diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c index 03067d038b..2152429b62 100644 --- a/dlls/comctl32/ipaddress.c +++ b/dlls/comctl32/ipaddress.c @@ -44,6 +44,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/unicode.h" #include "wine/debug.h" diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 2a3729faab..173d03757b 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -1027,7 +1027,7 @@ testitem: pickarange: if (i->ranges) { - if (i->index < i->ranges->hdpa->nItemCount) + if (i->index < DPA_GetPtrCount(i->ranges->hdpa)) i->range = *(RANGE*)DPA_GetPtr(i->ranges->hdpa, i->index++); else goto end; } @@ -1053,7 +1053,7 @@ static inline BOOL iterator_prev(ITERATOR* i) if (i->nItem == -1) { start = TRUE; - if (i->ranges) i->index = i->ranges->hdpa->nItemCount; + if (i->ranges) i->index = DPA_GetPtrCount(i->ranges->hdpa); goto pickarange; } if (i->nItem == i->nSpecial) @@ -1089,7 +1089,7 @@ static RANGE iterator_range(ITERATOR* i) if (!i->ranges) return i->range; range.lower = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, 0)).lower; - range.upper = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, i->ranges->hdpa->nItemCount - 1)).upper; + range.upper = (*(RANGE*)DPA_GetPtr(i->ranges->hdpa, DPA_GetPtrCount(i->ranges->hdpa) - 1)).upper; return range; } @@ -1293,8 +1293,8 @@ static inline COLUMN_INFO * LISTVIEW_GetColumnInfo(LISTVIEW_INFO *infoPtr, INT n { static COLUMN_INFO mainItem; - if (nSubItem == 0 && infoPtr->hdpaColumns->nItemCount == 0) return &mainItem; - assert (nSubItem >= 0 && nSubItem < infoPtr->hdpaColumns->nItemCount); + if (nSubItem == 0 && DPA_GetPtrCount(infoPtr->hdpaColumns) == 0) return &mainItem; + assert (nSubItem >= 0 && nSubItem < DPA_GetPtrCount(infoPtr->hdpaColumns)); return (COLUMN_INFO *)DPA_GetPtr(infoPtr->hdpaColumns, nSubItem); } @@ -2299,7 +2299,7 @@ static SUBITEM_INFO* LISTVIEW_GetSubItemPtr(HDPA hdpaSubItems, INT nSubItem) INT i; /* we should binary search here if need be */ - for (i = 1; i < hdpaSubItems->nItemCount; i++) + for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); if (lpSubItem->iSubItem == nSubItem) @@ -2333,9 +2333,9 @@ static INT LISTVIEW_CalculateItemWidth(LISTVIEW_INFO *infoPtr) { RECT rcHeader; - if (infoPtr->hdpaColumns->nItemCount > 0) + if (DPA_GetPtrCount(infoPtr->hdpaColumns) > 0) { - LISTVIEW_GetHeaderRect(infoPtr, infoPtr->hdpaColumns->nItemCount - 1, &rcHeader); + LISTVIEW_GetHeaderRect(infoPtr, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1, &rcHeader); nItemWidth = rcHeader.right; } } @@ -2475,12 +2475,12 @@ static void ranges_assert(RANGES ranges, LPCSTR desc, const char *func, int line TRACE("*** Checking %s:%d:%s ***\n", func, line, desc); assert (ranges); - assert (ranges->hdpa->nItemCount >= 0); + assert (DPA_GetPtrCount(ranges->hdpa) >= 0); ranges_dump(ranges); prev = (RANGE *)DPA_GetPtr(ranges->hdpa, 0); - if (ranges->hdpa->nItemCount > 0) + if (DPA_GetPtrCount(ranges->hdpa) > 0) assert (prev->lower >= 0 && prev->lower < prev->upper); - for (i = 1; i < ranges->hdpa->nItemCount; i++) + for (i = 1; i < DPA_GetPtrCount(ranges->hdpa); i++) { curr = (RANGE *)DPA_GetPtr(ranges->hdpa, i); assert (prev->upper <= curr->lower); @@ -2504,7 +2504,7 @@ static void ranges_clear(RANGES ranges) { INT i; - for(i = 0; i < ranges->hdpa->nItemCount; i++) + for(i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++) COMCTL32_Free(DPA_GetPtr(ranges->hdpa, i)); DPA_DeleteAllPtrs(ranges->hdpa); } @@ -2523,9 +2523,9 @@ static RANGES ranges_clone(RANGES ranges) RANGES clone; INT i; - if (!(clone = ranges_create(ranges->hdpa->nItemCount))) goto fail; + if (!(clone = ranges_create(DPA_GetPtrCount(ranges->hdpa)))) goto fail; - for (i = 0; i < ranges->hdpa->nItemCount; i++) + for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++) { RANGE *newrng = (RANGE *)COMCTL32_Alloc(sizeof(RANGE)); if (!newrng) goto fail; @@ -2544,7 +2544,7 @@ static RANGES ranges_diff(RANGES ranges, RANGES sub) { INT i; - for (i = 0; i < sub->hdpa->nItemCount; i++) + for (i = 0; i < DPA_GetPtrCount(sub->hdpa); i++) ranges_del(ranges, *((RANGE *)DPA_GetPtr(sub->hdpa, i))); return ranges; @@ -2554,7 +2554,7 @@ static void ranges_dump(RANGES ranges) { INT i; - for (i = 0; i < ranges->hdpa->nItemCount; i++) + for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++) TRACE(" %s\n", debugrange(DPA_GetPtr(ranges->hdpa, i))); } @@ -2571,7 +2571,7 @@ static INT ranges_itemcount(RANGES ranges) { INT i, count = 0; - for (i = 0; i < ranges->hdpa->nItemCount; i++) + for (i = 0; i < DPA_GetPtrCount(ranges->hdpa); i++) { RANGE *sel = DPA_GetPtr(ranges->hdpa, i); count += sel->upper - sel->lower; @@ -2588,7 +2588,7 @@ static BOOL ranges_shift(RANGES ranges, INT nItem, INT delta, INT nUpper) index = DPA_Search(ranges->hdpa, &srchrng, 0, ranges_cmp, 0, DPAS_SORTED | DPAS_INSERTAFTER); if (index == -1) return TRUE; - for (; index < ranges->hdpa->nItemCount; index++) + for (; index < DPA_GetPtrCount(ranges->hdpa); index++) { chkrng = DPA_GetPtr(ranges->hdpa, index); if (chkrng->lower >= nItem) @@ -3331,7 +3331,7 @@ static BOOL set_sub_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL i if (infoPtr->dwStyle & LVS_OWNERDATA) return FALSE; /* set subitem only if column is present */ - if (lpLVItem->iSubItem >= infoPtr->hdpaColumns->nItemCount) return FALSE; + if (lpLVItem->iSubItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; /* First do some sanity checks */ if (lpLVItem->mask & ~(LVIF_TEXT | LVIF_IMAGE)) return FALSE; @@ -3350,7 +3350,7 @@ static BOOL set_sub_item(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem, BOOL i lpSubItem = (SUBITEM_INFO *)COMCTL32_Alloc(sizeof(SUBITEM_INFO)); if (!lpSubItem) return FALSE; /* we could binary search here, if need be...*/ - for (i = 1; i < hdpaSubItems->nItemCount; i++) + for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { tmpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); if (tmpSubItem->iSubItem > lpLVItem->iSubItem) break; @@ -3741,12 +3741,12 @@ static void LISTVIEW_RefreshReport(LISTVIEW_INFO *infoPtr, ITERATOR *i, HDC hdc, LISTVIEW_GetOrigin(infoPtr, &Origin); /* narrow down the columns we need to paint */ - for(colRange.lower = 0; colRange.lower < infoPtr->hdpaColumns->nItemCount; colRange.lower++) + for(colRange.lower = 0; colRange.lower < DPA_GetPtrCount(infoPtr->hdpaColumns); colRange.lower++) { LISTVIEW_GetHeaderRect(infoPtr, colRange.lower, &rcItem); if (rcItem.right + Origin.x >= rcClip.left) break; } - for(colRange.upper = infoPtr->hdpaColumns->nItemCount; colRange.upper > 0; colRange.upper--) + for(colRange.upper = DPA_GetPtrCount(infoPtr->hdpaColumns); colRange.upper > 0; colRange.upper--) { LISTVIEW_GetHeaderRect(infoPtr, colRange.upper - 1, &rcItem); if (rcItem.left + Origin.x < rcClip.right) break; @@ -4017,7 +4017,7 @@ static BOOL LISTVIEW_DeleteAllItems(LISTVIEW_INFO *infoPtr) if (!(infoPtr->dwStyle & LVS_OWNERDATA)) { hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, i); - for (j = 0; j < hdpaSubItems->nItemCount; j++) + for (j = 0; j < DPA_GetPtrCount(hdpaSubItems); j++) { hdrItem = (ITEMHDR *)DPA_GetPtr(hdpaSubItems, j); if (is_textW(hdrItem->pszText)) COMCTL32_Free(hdrItem->pszText); @@ -4056,14 +4056,14 @@ static void LISTVIEW_ScrollColumns(LISTVIEW_INFO *infoPtr, INT nColumn, INT dx) RECT rcOld, rcCol; INT nCol; - if (nColumn < 0 || infoPtr->hdpaColumns->nItemCount < 1) return; - lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, min(nColumn, infoPtr->hdpaColumns->nItemCount - 1)); + if (nColumn < 0 || DPA_GetPtrCount(infoPtr->hdpaColumns) < 1) return; + lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, min(nColumn, DPA_GetPtrCount(infoPtr->hdpaColumns) - 1)); rcCol = lpColumnInfo->rcHeader; - if (nColumn >= infoPtr->hdpaColumns->nItemCount) + if (nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) rcCol.left = rcCol.right; /* ajust the other columns */ - for (nCol = nColumn; nCol < infoPtr->hdpaColumns->nItemCount; nCol++) + for (nCol = nColumn; nCol < DPA_GetPtrCount(infoPtr->hdpaColumns); nCol++) { lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nCol); lpColumnInfo->rcHeader.left += dx; @@ -4108,8 +4108,8 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) TRACE("nColumn=%d\n", nColumn); - if (nColumn < 0 || infoPtr->hdpaColumns->nItemCount == 0 - || nColumn >= infoPtr->hdpaColumns->nItemCount) return FALSE; + if (nColumn < 0 || DPA_GetPtrCount(infoPtr->hdpaColumns) == 0 + || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; /* While the MSDN specifically says that column zero should not be deleted, it does in fact work on WinNT, and at least one app depends on it. On @@ -4118,7 +4118,7 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) we just delete the last column including the header. */ if (nColumn == 0) - nColumn = infoPtr->hdpaColumns->nItemCount - 1; + nColumn = DPA_GetPtrCount(infoPtr->hdpaColumns) - 1; LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcCol); @@ -4142,7 +4142,7 @@ static BOOL LISTVIEW_DeleteColumn(LISTVIEW_INFO *infoPtr, INT nColumn) hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem); nSubItem = 0; lpDelItem = 0; - for (i = 1; i < hdpaSubItems->nItemCount; i++) + for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); if (lpSubItem->iSubItem == nColumn) @@ -4294,7 +4294,7 @@ static BOOL LISTVIEW_DeleteItem(LISTVIEW_INFO *infoPtr, INT nItem) INT i; hdpaSubItems = (HDPA)DPA_DeletePtr(infoPtr->hdpaItems, nItem); - for (i = 0; i < hdpaSubItems->nItemCount; i++) + for (i = 0; i < DPA_GetPtrCount(hdpaSubItems); i++) { hdrItem = (ITEMHDR *)DPA_GetPtr(hdpaSubItems, i); if (is_textW(hdrItem->pszText)) COMCTL32_Free(hdrItem->pszText); @@ -4711,7 +4711,7 @@ static BOOL LISTVIEW_GetColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, LPLVCOLUMNW COLUMN_INFO *lpColumnInfo; HDITEMW hdi; - if (!lpColumn || nColumn < 0 || nColumn >= infoPtr->hdpaColumns->nItemCount) return FALSE; + if (!lpColumn || nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; lpColumnInfo = LISTVIEW_GetColumnInfo(infoPtr, nColumn); /* initialize memory */ @@ -4788,7 +4788,7 @@ static INT LISTVIEW_GetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn) nColumnWidth = infoPtr->nItemWidth; break; case LVS_REPORT: - if (nColumn < 0 || nColumn >= infoPtr->hdpaColumns->nItemCount) return 0; + if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return 0; LISTVIEW_GetHeaderRect(infoPtr, nColumn, &rcHeader); nColumnWidth = rcHeader.right - rcHeader.left; break; @@ -5849,7 +5849,7 @@ static INT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL s INT j; rcBounds.right = rcBounds.left; - for (j = 0; j < infoPtr->hdpaColumns->nItemCount; j++) + for (j = 0; j < DPA_GetPtrCount(infoPtr->hdpaColumns); j++) { rcBounds.left = rcBounds.right; rcBounds.right += LISTVIEW_GetColumnWidth(infoPtr, j); @@ -6230,7 +6230,7 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, TRACE("(nColumn=%d, lpColumn=%s, isW=%d)\n", nColumn, debuglvcolumn_t(lpColumn, isW), isW); if (!lpColumn || nColumn < 0) return -1; - nColumn = min(nColumn, infoPtr->hdpaColumns->nItemCount); + nColumn = min(nColumn, DPA_GetPtrCount(infoPtr->hdpaColumns)); ZeroMemory(&hdi, sizeof(HDITEMW)); column_fill_hditem(infoPtr, &hdi, nColumn, lpColumn, isW); @@ -6259,7 +6259,7 @@ static INT LISTVIEW_InsertColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, for (nItem = 0; nItem < infoPtr->nItemCount; nItem++) { hdpaSubItems = (HDPA)DPA_GetPtr(infoPtr->hdpaItems, nItem); - for (i = 1; i < hdpaSubItems->nItemCount; i++) + for (i = 1; i < DPA_GetPtrCount(hdpaSubItems); i++) { lpSubItem = (SUBITEM_INFO *)DPA_GetPtr(hdpaSubItems, i); if (lpSubItem->iSubItem >= nNewColumn) @@ -6305,7 +6305,7 @@ static BOOL LISTVIEW_SetColumnT(LISTVIEW_INFO *infoPtr, INT nColumn, TRACE("(nColumn=%d, lpColumn=%s, isW=%d)\n", nColumn, debuglvcolumn_t(lpColumn, isW), isW); - if (!lpColumn || nColumn < 0 || nColumn >= infoPtr->hdpaColumns->nItemCount) return FALSE; + if (!lpColumn || nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; ZeroMemory(&hdi, sizeof(HDITEMW)); if (lpColumn->mask & LVCF_FMT) @@ -6398,9 +6398,9 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) return TRUE; } - if (nColumn < 0 || nColumn >= infoPtr->hdpaColumns->nItemCount) return FALSE; + if (nColumn < 0 || nColumn >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return FALSE; - if (cx == LVSCW_AUTOSIZE || (cx == LVSCW_AUTOSIZE_USEHEADER && nColumn < infoPtr->hdpaColumns->nItemCount -1)) + if (cx == LVSCW_AUTOSIZE || (cx == LVSCW_AUTOSIZE_USEHEADER && nColumn < DPA_GetPtrCount(infoPtr->hdpaColumns) -1)) { INT nLabelWidth; LVITEMW lvItem; @@ -6427,7 +6427,7 @@ static BOOL LISTVIEW_SetColumnWidth(LISTVIEW_INFO *infoPtr, INT nColumn, INT cx) else if(cx == LVSCW_AUTOSIZE_USEHEADER) { /* if iCol is the last column make it fill the remainder of the controls width */ - if(nColumn == infoPtr->hdpaColumns->nItemCount - 1) + if(nColumn == DPA_GetPtrCount(infoPtr->hdpaColumns) - 1) { RECT rcHeader; POINT Origin; @@ -7884,7 +7884,7 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE TRACE("(lpnmh=%p)\n", lpnmh); - if (!lpnmh || lpnmh->iItem < 0 || lpnmh->iItem >= infoPtr->hdpaColumns->nItemCount) return 0; + if (!lpnmh || lpnmh->iItem < 0 || lpnmh->iItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return 0; switch (lpnmh->hdr.code) { diff --git a/dlls/comctl32/nativefont.c b/dlls/comctl32/nativefont.c index 762233f974..d05264a22d 100644 --- a/dlls/comctl32/nativefont.c +++ b/dlls/comctl32/nativefont.c @@ -35,6 +35,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(nativefont); diff --git a/dlls/comctl32/pager.c b/dlls/comctl32/pager.c index 1cadd56aba..49633b9868 100644 --- a/dlls/comctl32/pager.c +++ b/dlls/comctl32/pager.c @@ -36,6 +36,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(pager); diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c index 526999ca5f..20e7f263b7 100644 --- a/dlls/comctl32/progress.c +++ b/dlls/comctl32/progress.c @@ -40,6 +40,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(progress); diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index e89e406f4b..2b71d05df1 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -150,6 +150,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(rebar); diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c index fac07ac469..8b55b1af38 100644 --- a/dlls/comctl32/status.c +++ b/dlls/comctl32/status.c @@ -50,6 +50,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(statusbar); diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index b360c22bcd..e0346bb276 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -2607,7 +2607,7 @@ TOOLBAR_AddStringW (HWND hwnd, WPARAM wParam, LPARAM lParam) COMCTL32_Free(oldStrings); } - np=COMCTL32_StrChrW (p, L'|'); + np=strchrW (p, '|'); if (np!=NULL) { len = np - p; np++; diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c index db1bd32ea1..92532adbc8 100644 --- a/dlls/comctl32/tooltips.c +++ b/dlls/comctl32/tooltips.c @@ -81,6 +81,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(tooltips); diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c index 22cd0c8d67..fbf75ace7d 100644 --- a/dlls/comctl32/treeview.c +++ b/dlls/comctl32/treeview.c @@ -1815,7 +1815,7 @@ TREEVIEW_GetFont(TREEVIEW_INFO *infoPtr) static INT CALLBACK -TREEVIEW_ResetTextWidth(LPVOID pItem, DWORD unused) +TREEVIEW_ResetTextWidth(LPVOID pItem, LPVOID unused) { (void)unused; diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c index b829abd599..a8f4fac4f9 100644 --- a/dlls/comctl32/updown.c +++ b/dlls/comctl32/updown.c @@ -39,6 +39,7 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" +#include "comctl32.h" #include "wine/unicode.h" #include "wine/debug.h" diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index 8ef9488764..3b2a3dc615 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -267,24 +267,19 @@ BOOL SIC_Initialize(void) * * frees the cache */ -void SIC_Destroy(void) +static INT CALLBACK sic_free( LPVOID ptr, LPVOID lparam ) { - LPSIC_ENTRY lpsice; - int i; + SHFree(ptr); + return TRUE; +} +void SIC_Destroy(void) +{ TRACE("\n"); EnterCriticalSection(&SHELL32_SicCS); - if (sic_hdpa && NULL != DPA_GetPtr (sic_hdpa, 0)) - { - for (i=0; i < DPA_GetPtrCount(sic_hdpa); ++i) - { - lpsice = DPA_GetPtr(sic_hdpa, i); - SHFree(lpsice); - } - DPA_Destroy(sic_hdpa); - } + if (sic_hdpa) DPA_DestroyCallback(sic_hdpa, sic_free, NULL ); sic_hdpa = NULL; diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index dcf5f07b19..e0b24c405f 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -959,15 +959,6 @@ HRESULT WINAPI SHELL32_DllGetVersion (DLLVERSIONINFO *pdvi) */ void (WINAPI *pDLLInitComctl)(LPVOID); -LPVOID (WINAPI *pCOMCTL32_Alloc) (INT); -BOOL (WINAPI *pCOMCTL32_Free) (LPVOID); - -HANDLE (WINAPI *pCreateMRUListA) (LPVOID lpcml); -DWORD (WINAPI *pFreeMRUListA) (HANDLE hMRUList); -INT (WINAPI *pAddMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData); -INT (WINAPI *pFindMRUData) (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); -INT (WINAPI *pEnumMRUListA) (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); - static HINSTANCE hComctl32; HINSTANCE shell32_hInstance = 0; diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 5e26871a80..1f5f8e4033 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -563,12 +563,21 @@ static BOOLEAN LV_RenameItem(IShellViewImpl * This, LPCITEMIDLIST pidlOld, LPCIT * - fills the list into the view */ +static INT CALLBACK fill_list( LPVOID ptr, LPVOID arg ) +{ + LPITEMIDLIST pidl = ptr; + IShellViewImpl *This = arg; + /* in a commdlg This works as a filemask*/ + if ( IncludeObject(This, pidl)==S_OK ) LV_AddItem(This, pidl); + SHFree(pidl); + return TRUE; +} + static HRESULT ShellView_FillList(IShellViewImpl * This) { LPENUMIDLIST pEnumIDList; LPITEMIDLIST pidl; DWORD dwFetched; - INT i; HRESULT hRes; HDPA hdpa; @@ -605,21 +614,12 @@ static HRESULT ShellView_FillList(IShellViewImpl * This) /*turn the listview's redrawing off*/ SendMessageA(This->hWndList, WM_SETREDRAW, FALSE, 0); - for (i=0; i < DPA_GetPtrCount(hdpa); ++i) /* DPA_GetPtrCount is a macro*/ - { - pidl = (LPITEMIDLIST)DPA_GetPtr(hdpa, i); - - /* in a commdlg This works as a filemask*/ - if ( IncludeObject(This, pidl)==S_OK ) - LV_AddItem(This, pidl); - SHFree(pidl); - } + DPA_DestroyCallback( hdpa, fill_list, This ); /*turn the listview's redrawing back on and force it to draw*/ SendMessageA(This->hWndList, WM_SETREDRAW, TRUE, 0); IEnumIDList_Release(pEnumIDList); /* destroy the list*/ - DPA_Destroy(hdpa); return S_OK; } diff --git a/include/commctrl.h b/include/commctrl.h index 1172b23314..795837a77c 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -4378,112 +4378,41 @@ DECL_WINELIB_TYPE_AW(LPNMDATETIMEFORMATQUERY) SNDMSGA (hdp, DTM_GETMCFONT, 0, 0) +struct _DSA; +typedef struct _DSA *HDSA; +typedef INT (CALLBACK *PFNDSAENUMCALLBACK)(LPVOID, LPVOID); - - -/************************************************************************** - * UNDOCUMENTED functions - */ - -/* private heap memory functions */ - -LPVOID WINAPI COMCTL32_Alloc (DWORD); -LPVOID WINAPI COMCTL32_ReAlloc (LPVOID, DWORD); -BOOL WINAPI COMCTL32_Free (LPVOID); -DWORD WINAPI COMCTL32_GetSize (LPVOID); - -LPWSTR WINAPI COMCTL32_StrChrW (LPCWSTR, WORD); - - -INT WINAPI Str_GetPtrA (LPCSTR, LPSTR, INT); -BOOL WINAPI Str_SetPtrA (LPSTR *, LPCSTR); -INT WINAPI Str_GetPtrW (LPCWSTR, LPWSTR, INT); -BOOL WINAPI Str_SetPtrW (LPWSTR *, LPCWSTR); -#define Str_GetPtr WINELIB_NAME_AW(Str_GetPtr) -#define Str_SetPtr WINELIB_NAME_AW(Str_SetPtr) - - -/* Dynamic Storage Array */ - -typedef struct _DSA -{ - INT nItemCount; - LPVOID pData; - INT nMaxCount; - INT nItemSize; - INT nGrow; -} DSA, *HDSA; - -HDSA WINAPI DSA_Create (INT, INT); -BOOL WINAPI DSA_DeleteAllItems (const HDSA); -INT WINAPI DSA_DeleteItem (const HDSA, INT); -BOOL WINAPI DSA_Destroy (const HDSA); -BOOL WINAPI DSA_GetItem (const HDSA, INT, LPVOID); -LPVOID WINAPI DSA_GetItemPtr (const HDSA, INT); -INT WINAPI DSA_InsertItem (const HDSA, INT, LPVOID); -BOOL WINAPI DSA_SetItem (const HDSA, INT, LPVOID); - -typedef INT (CALLBACK *DSAENUMPROC)(LPVOID, DWORD); -VOID WINAPI DSA_EnumCallback (const HDSA, DSAENUMPROC, LPARAM); -BOOL WINAPI DSA_DestroyCallback (const HDSA, DSAENUMPROC, LPARAM); - - -/* Dynamic Pointer Array */ - -typedef struct _DPA -{ - INT nItemCount; - LPVOID *ptrs; - HANDLE hHeap; - INT nGrow; - INT nMaxCount; -} DPA, *HDPA; - -HDPA WINAPI DPA_Create (INT); -HDPA WINAPI DPA_CreateEx (INT, HANDLE); -BOOL WINAPI DPA_Destroy (const HDPA); -HDPA WINAPI DPA_Clone (const HDPA, const HDPA); -LPVOID WINAPI DPA_GetPtr (const HDPA, INT); -INT WINAPI DPA_GetPtrIndex (const HDPA, LPVOID); -BOOL WINAPI DPA_Grow (const HDPA, INT); -BOOL WINAPI DPA_SetPtr (const HDPA, INT, LPVOID); -INT WINAPI DPA_InsertPtr (const HDPA, INT, LPVOID); -LPVOID WINAPI DPA_DeletePtr (const HDPA, INT); -BOOL WINAPI DPA_DeleteAllPtrs (const HDPA); - -typedef INT (CALLBACK *PFNDPACOMPARE)(LPVOID, LPVOID, LPARAM); -BOOL WINAPI DPA_Sort (const HDPA, PFNDPACOMPARE, LPARAM); +HDSA WINAPI DSA_Create(INT, INT); +BOOL WINAPI DSA_Destroy(HDSA); +void WINAPI DSA_DestroyCallback(HDSA, PFNDSAENUMCALLBACK, LPVOID); +LPVOID WINAPI DSA_GetItemPtr(HDSA, INT); +INT WINAPI DSA_InsertItem(HDSA, INT, LPVOID); #define DPAS_SORTED 0x0001 #define DPAS_INSERTBEFORE 0x0002 #define DPAS_INSERTAFTER 0x0004 -INT WINAPI DPA_Search (const HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT); - -#define DPAM_NOSORT 0x0001 -#define DPAM_INSERT 0x0004 -#define DPAM_DELETE 0x0008 -typedef PVOID (CALLBACK *PFNDPAMERGE)(DWORD,PVOID,PVOID,LPARAM); -BOOL WINAPI DPA_Merge (const HDPA, const HDPA, DWORD, PFNDPACOMPARE, PFNDPAMERGE, LPARAM); +struct _DPA; +typedef struct _DPA *HDPA; -typedef INT (CALLBACK *DPAENUMPROC)(LPVOID, DWORD); -VOID WINAPI DPA_EnumCallback (const HDPA, DPAENUMPROC, LPARAM); -BOOL WINAPI DPA_DestroyCallback (const HDPA, DPAENUMPROC, LPARAM); - - -#define DPA_GetPtrCount(hdpa) (*(INT*)(hdpa)) -#define DPA_GetPtrPtr(hdpa) (*((LPVOID**)((BYTE*)(hdpa)+sizeof(INT)))) -#define DPA_FastGetPtr(hdpa,i) (DPA_GetPtrPtr(hdpa)[i]) - - -/* notification helper functions */ +typedef INT (CALLBACK *PFNDPAENUMCALLBACK)(LPVOID, LPVOID); +typedef INT (CALLBACK *PFNDPACOMPARE)(LPVOID, LPVOID, LPARAM); -LRESULT WINAPI COMCTL32_SendNotify (HWND, HWND, UINT, LPNMHDR); +HDPA WINAPI DPA_Create(INT); +BOOL WINAPI DPA_Destroy(HDPA); +LPVOID WINAPI DPA_DeletePtr(HDPA, INT); +BOOL WINAPI DPA_DeleteAllPtrs(HDPA); +BOOL WINAPI DPA_SetPtr(HDPA, INT, LPVOID); +LPVOID WINAPI DPA_GetPtr(HDPA, INT); +INT WINAPI DPA_InsertPtr(HDPA, INT, LPVOID); +BOOL WINAPI DPA_Sort(HDPA, PFNDPACOMPARE, LPARAM); +void WINAPI DPA_EnumCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID); +void WINAPI DPA_DestroyCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID); +INT WINAPI DPA_Search(HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT); -/* type and functionality of last parameter is still unknown */ -LRESULT WINAPI COMCTL32_SendNotifyEx (HWND, HWND, UINT, LPNMHDR, DWORD); +BOOL WINAPI Str_SetPtrW (LPWSTR *, LPCWSTR); #ifdef __cplusplus } -- 2.32.0.93.g670b81a890