diff --git a/dlls/comctl32/comctl32.spec b/dlls/comctl32/comctl32.spec index 0bd8b13e174..aff8c8b8335 100644 --- a/dlls/comctl32/comctl32.spec +++ b/dlls/comctl32/comctl32.spec @@ -131,6 +131,7 @@ @ stdcall DrawShadowText(long wstr long ptr long long long long long) @ stdcall DrawStatusText(long ptr ptr long) DrawStatusTextA @ stdcall DrawStatusTextW(long ptr wstr long) +@ stdcall DSA_Clone(ptr) @ stdcall FlatSB_EnableScrollBar (long long long) @ stdcall FlatSB_GetScrollInfo (long long ptr) @ stdcall FlatSB_GetScrollPos (long long) diff --git a/dlls/comctl32/dsa.c b/dlls/comctl32/dsa.c index 71837db1d93..73f0d3041a2 100644 --- a/dlls/comctl32/dsa.c +++ b/dlls/comctl32/dsa.c @@ -434,3 +434,39 @@ void WINAPI DSA_DestroyCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, DSA_EnumCallback (hdsa, enumProc, lParam); DSA_Destroy (hdsa); } + +/************************************************************************** + * DSA_Clone [COMCTL32.@] + * + * Creates a copy of a dsa + * + * PARAMS + * hdsa [I] handle to the dynamic storage array + * + * RETURNS + * Cloned dsa + */ +HDSA WINAPI DSA_Clone(HDSA hdsa) +{ + HDSA dest; + INT i; + + TRACE("(%p)\n", hdsa); + + if (!hdsa) + return NULL; + + dest = DSA_Create (hdsa->nItemSize, hdsa->nGrow); + if (!dest) + return NULL; + + for (i = 0; i < hdsa->nItemCount; i++) { + void *ptr = DSA_GetItemPtr (hdsa, i); + if (DSA_InsertItem (dest, DA_LAST, ptr) == -1) { + DSA_Destroy (dest); + return NULL; + } + } + + return dest; +}