Ignore:
Timestamp:
May 22, 2000, 7:25:13 PM (25 years ago)
Author:
cbratschi
Message:

merged with Corel WINE 20000513, added new DPA_* functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/comctl32/comctl32undoc.cpp

    r3385 r3585  
    1 /* $Id: comctl32undoc.cpp,v 1.3 2000-04-15 14:22:11 cbratschi Exp $ */
     1/* $Id: comctl32undoc.cpp,v 1.4 2000-05-22 17:25:07 cbratschi Exp $ */
    22/*
    33 * Undocumented functions from COMCTL32.DLL
     
    1313
    1414/*
    15  - Corel 20000317 level
     15 - Corel 20000513 level
    1616 - (WINE 20000130 level)
    1717*/
     
    12771277        hdpa->ptrs =
    12781278            (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
    1279                                 2 * hdpa->nGrow * sizeof(LPVOID));
     1279                                hdpa->nGrow * sizeof(LPVOID));
    12801280        if (!hdpa->ptrs)
    12811281            return -1;
    1282         hdpa->nMaxCount = hdpa->nGrow * 2;
     1282        hdpa->nMaxCount = hdpa->nGrow;
    12831283        nIndex = 0;
    12841284    }
    12851285    else {
    1286         if (hdpa->nItemCount >= hdpa->nMaxCount) {
     1286        if (hdpa->nItemCount == hdpa->nMaxCount) {
    12871287//          TRACE (commctrl, "-- resizing\n");
    12881288            nNewItems = hdpa->nMaxCount + hdpa->nGrow;
     
    13501350        if (hdpa->nMaxCount > i) {
    13511351            /* within the allocated space, set a new boundary */
    1352             hdpa->nItemCount = i;
     1352            hdpa->nItemCount = i+1;
    13531353        }
    13541354        else {
    13551355            /* resize the block of memory */
    13561356            INT nNewItems =
    1357                 hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1);
     1357                hdpa->nGrow * (((i+1) / hdpa->nGrow) + 1);
    13581358            INT nSize = nNewItems * sizeof(LPVOID);
    13591359
     
    14131413
    14141414    hdpa->nItemCount --;
     1415    hdpa->ptrs[hdpa->nItemCount] = NULL;
    14151416
    14161417    /* free memory ?*/
    1417     if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
    1418         INT nNewItems = MAX(hdpa->nGrow*2,hdpa->nItemCount);
     1418    if ((hdpa->nMaxCount - hdpa->nItemCount) > hdpa->nGrow) {
     1419        INT nNewItems = hdpa->nMaxCount - hdpa->nGrow;
    14191420
    14201421        nSize = nNewItems * sizeof(LPVOID);
     
    17051706    return hdpa;
    17061707}
    1707 
     1708#if 0
     1709/**************************************************************************
     1710 * DPA_LoadStream [COMCTL32.9]
     1711 *
     1712 * Loads a dynamic pointer array from a stream
     1713 *
     1714 * PARAMS
     1715 *     phDpa    [O] pointer to a handle to a dynamic pointer array
     1716 *     loadProc [I] pointer to a callback function
     1717 *     pStream  [I] pointer to a stream
     1718 *     lParam   [I] application specific value
     1719 *
     1720 * NOTES
     1721 *     No more information available yet!
     1722 */
     1723HRESULT WINAPI
     1724DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam)
     1725{
     1726    HRESULT errCode;
     1727    LARGE_INTEGER position;
     1728    ULARGE_INTEGER newPosition;
     1729    STREAMDATA  streamData;
     1730    LOADDATA loadData;
     1731    ULONG ulRead;
     1732    HDPA hDpa;
     1733    PVOID *ptr;
     1734
     1735    //FIXME ("phDpa=3D%p loadProc=3D%p pStream=3D%p lParam=3D%lx\n",phDpa, loadProc, pStream, lParam);
     1736
     1737    if (!phDpa || !loadProc || !pStream)
     1738        return E_INVALIDARG;
     1739
     1740    *phDpa = (HDPA)NULL;
     1741
     1742    position.s.LowPart = 0;
     1743    position.s.HighPart = 0;
     1744
     1745
     1746
     1747    errCode = IStream_Seek (pStream, position, STREAM_SEEK_CUR, &newPosition);
     1748
     1749    if (errCode != S_OK)
     1750        return errCode;
     1751
     1752
     1753    errCode = IStream_Read (pStream, &streamData, sizeof(STREAMDATA), = &ulRead);
     1754
     1755    if (errCode != S_OK)
     1756        return errCode;
     1757
     1758    //FIXME ("dwSize=3D%lu dwData2=3D%lu dwItems=3D%lu\n",streamData.dwSize, streamData.dwData2, streamData.dwItems);
     1759
     1760    if (lParam < sizeof(STREAMDATA) ||
     1761        streamData.dwSize < sizeof(STREAMDATA) ||
     1762        streamData.dwData2 < 1) {
     1763        errCode = E_FAIL;
     1764    }
     1765
     1766    /* create the dpa */
     1767
     1768    hDpa = DPA_Create (streamData.dwItems);
     1769
     1770    if (!hDpa)
     1771        return E_OUTOFMEMORY;
     1772
     1773    if (!DPA_Grow (hDpa, streamData.dwItems))
     1774        return E_OUTOFMEMORY;
     1775
     1776    /* load data from the stream into the dpa */
     1777
     1778    ptr = hDpa->ptrs;
     1779    for (loadData.nCount = 0; loadData.nCount < streamData.dwItems; loadData.nCount++) {
     1780        errCode = (loadProc)(&loadData, pStream, lParam);
     1781
     1782        if (errCode != S_OK) {
     1783            errCode = S_FALSE;
     1784            break;
     1785        }
     1786
     1787        *ptr = loadData.ptr;
     1788        ptr++;
     1789    }
     1790
     1791    /* set the number of items */
     1792
     1793    hDpa->nItemCount = loadData.nCount;
     1794
     1795    /* store the handle to the dpa */
     1796
     1797    *phDpa = hDpa;
     1798
     1799    //FIXME ("new hDpa=3D%p\n", hDpa);
     1800
     1801    return errCode;
     1802
     1803}
     1804
     1805/**************************************************************************
     1806 * DPA_SaveStream [COMCTL32.10]
     1807 *
     1808 * Saves a dynamic pointer array to a stream
     1809 *
     1810 * PARAMS
     1811 *     hDpa     [I] handle to a dynamic pointer array
     1812 *     loadProc [I] pointer to a callback function
     1813 *     pStream  [I] pointer to a stream
     1814 *     lParam   [I] application specific value
     1815 *
     1816 * NOTES
     1817 *     No more information available yet!
     1818 */
     1819HRESULT WINAPI
     1820DPA_SaveStream (const HDPA hDpa, DPALOADPROC loadProc, IStream *pStream,LPARAM lParam)
     1821{
     1822    //FIXME ("hDpa=3D%p loadProc=3D%p pStream=3D%p lParam=3D%lx\n",hDpa, loadProc, pStream, lParam);
     1823
     1824    return E_FAIL;
     1825}
     1826#endif
    17081827/**************************************************************************
    17091828 * Notification functions
Note: See TracChangeset for help on using the changeset viewer.