Changeset 9374 for trunk/src


Ignore:
Timestamp:
Oct 29, 2002, 2:47:35 PM (23 years ago)
Author:
sandervl
Message:

reverted back to old code due to regressions in latest Wine

Location:
trunk/src/comctl32
Files:
4 added
2 deleted
1 edited

Legend:

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

    r9370 r9374  
    7474typedef HRESULT (CALLBACK *DPALOADPROC)(LPLOADDATA,IStream*,LPARAM);
    7575#endif
     76
     77INT __cdecl _wtoi(LPWSTR string);
    7678
    7779/**************************************************************************
     
    281283        }
    282284        nResult = (pfnCompare)(*pWork1, *pWork2, lParam);
    283         TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n",
     285        TRACE("compare result=%d, dpa1.cnt=%d, dpa2.cnt=%d\n", 
    284286              nResult, nIndex, nCount);
    285287
     
    530532
    531533    /* open the sub key */
    532     if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,
     534    if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 
    533535                              0, KEY_WRITE, &newkey))) {
    534536        /* not present - what to do ??? */
     
    550552    if (mp->wineFlags & WMRUF_CHANGED) {
    551553        mp->wineFlags &= ~WMRUF_CHANGED;
    552         err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ,
     554        err = RegSetValueExA(newkey, "MRUList", 0, REG_SZ, 
    553555                             mp->realMRU, strlen(mp->realMRU) + 1);
    554556        if (err) {
     
    563565            witem->itemFlag &= ~WMRUIF_CHANGED;
    564566            realname[0] = 'a' + i;
    565             err = RegSetValueExW(newkey, realname, 0,
    566                                  (mp->extview.dwFlags & MRUF_BINARY_LIST) ?
     567            err = RegSetValueExW(newkey, realname, 0, 
     568                                 (mp->extview.dwFlags & MRUF_BINARY_LIST) ? 
    567569                                 REG_BINARY : REG_SZ,
    568570                                 &witem->datastart, witem->size);
     
    609611/**************************************************************************
    610612 *                  FindMRUData [COMCTL32.169]
    611  *
     613 * 
    612614 * Searches binary list for item that matches lpData of length cbData.
    613615 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
     
    644646    for(i=0; i<mp->cursize; i++) {
    645647        if (mp->extview.dwFlags & MRUF_BINARY_LIST) {
    646             if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart,
     648            if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart, 
    647649                                         cbData))
    648650                break;
     
    677679        *lpRegNum = 'a' + i;
    678680
    679     TRACE("(%p, %p, %ld, %p) returning %d\n",
     681    TRACE("(%08x, %p, %ld, %p) returning %d\n",
    680682           hList, lpData, cbData, lpRegNum, ret);
    681683
     
    686688/**************************************************************************
    687689 *              AddMRUData [COMCTL32.167]
    688  *
     690 * 
    689691 * Add item to MRU binary list.  If item already exists in list then it is
    690692 * simply moved up to the top of the list and not added again.  If list is
     
    726728
    727729    /* Allocate space for new item and move in the data */
    728     mp->array[replace] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(cbData +
     730    mp->array[replace] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(cbData + 
    729731                                                               sizeof(WINEMRUITEM));
    730732    witem->itemFlag |= WMRUIF_CHANGED;
     
    738740    }
    739741    mp->realMRU[0] = replace + 'a';
    740     TRACE("(%p, %p, %ld) adding data, /%c/ now most current\n",
     742    TRACE("(%08x, %p, %ld) adding data, /%c/ now most current\n",
    741743          hList, lpData, cbData, replace+'a');
    742744    ret = replace;
     
    752754/**************************************************************************
    753755 *              AddMRUStringW [COMCTL32.401]
    754  *
     756 * 
    755757 * Add item to MRU string list.  If item already exists in list them it is
    756758 * simply moved up to the top of the list and not added again.  If list is
     
    768770AddMRUStringW(HANDLE hList, LPCWSTR lpszString)
    769771{
    770     FIXME("(%p, %s) empty stub!\n", hList, debugstr_w(lpszString));
     772    FIXME("(%08x, %s) empty stub!\n", hList, debugstr_w(lpszString));
    771773
    772774    return 0;
     
    779781AddMRUStringA(HANDLE hList, LPCSTR lpszString)
    780782{
    781     FIXME("(%p, %s) empty stub!\n", hList, debugstr_a(lpszString));
     783    FIXME("(%08x, %s) empty stub!\n", hList, debugstr_a(lpszString));
    782784
    783785    return 0;
     
    799801DelMRUString(HANDLE hList, INT nItemPos)
    800802{
    801     FIXME("(%p, %d): stub\n", hList, nItemPos);
     803    FIXME("(%08x, %d): stub\n", hList, nItemPos);
    802804    return TRUE;
    803805}
     
    815817/**************************************************************************
    816818 *                  FindMRUStringA [COMCTL32.155]
    817  *
     819 * 
    818820 * Searches string list for item that matches lpszString.
    819821 * Returns position in list order 0 -> MRU and if lpRegNum != NULL then value
     
    866868
    867869    /* open the sub key */
    868     if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,
     870    if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey, 
    869871                                0,
    870872                                emptyW,
    871                                 REG_OPTION_NON_VOLATILE,
     873                                REG_OPTION_NON_VOLATILE, 
    872874                                KEY_READ | KEY_WRITE,
    873875                                0,
     
    885887    if (newkey) {
    886888        datasize = mp->extview.nMaxItems + 1;
    887         if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU,
     889        if((err=RegQueryValueExA( newkey, "MRUList", 0, &type, mp->realMRU, 
    888890                                  &datasize))) {
    889891            /* not present - set size to 1 (will become 0 later) */
     
    905907                ERR("Key %s not found 1\n", debugstr_w(realname));
    906908            }
    907             mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize +
     909            mp->array[i] = witem = (LPWINEMRUITEM)COMCTL32_Alloc(datasize + 
    908910                                                                 sizeof(WINEMRUITEM));
    909911            witem->size = datasize;
    910             if(RegQueryValueExW( newkey, realname, 0, &type,
     912            if(RegQueryValueExW( newkey, realname, 0, &type, 
    911913                                 &witem->datastart, &datasize)) {
    912914                /* not present - what to do ??? */
     
    947949    mp->isUnicode = TRUE;
    948950
    949     return CreateMRUListLazy_common(mp);
     951    return CreateMRUListLazy_common(mp);   
    950952}
    951953
     
    10161018 *    of list returns -1.
    10171019 *    If lpBuffer == NULL or nItemPos is -ve return value is no. of items in
    1018  *    the list.
     1020 *    the list. 
    10191021 */
    10201022INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer,
     
    10311033    TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired);
    10321034    witem = mp->array[desired];
    1033     datasize = min( witem->size, nBufferSize );
     1035    datasize = min( witem->size, nBufferSize ); 
    10341036    memcpy( lpBuffer, &witem->datastart, datasize);
    1035     TRACE("(%p, %d, %p, %ld): returning len=%d\n",
     1037    TRACE("(%08x, %d, %p, %ld): returning len=%d\n",
    10361038          hList, nItemPos, lpBuffer, nBufferSize, datasize);
    10371039    return datasize;
     
    10401042/**************************************************************************
    10411043 *                EnumMRUListA [COMCTL32.154]
    1042  *
     1044 * 
    10431045 */
    10441046INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer,
     
    10571059    witem = mp->array[desired];
    10581060    if(mp->extview.dwFlags & MRUF_BINARY_LIST) {
    1059         datasize = min( witem->size, nBufferSize );
     1061        datasize = min( witem->size, nBufferSize ); 
    10601062        memcpy( lpBuffer, &witem->datastart, datasize);
    10611063    } else {
     
    10661068                            lpBuffer, datasize, NULL, NULL);
    10671069    }
    1068     TRACE("(%p, %d, %p, %ld): returning len=%d\n",
     1070    TRACE("(%08x, %d, %p, %ld): returning len=%d\n",
    10691071          hList, nItemPos, lpBuffer, nBufferSize, datasize);
    10701072    return datasize;
    10711073}
    1072 
     1074 
    10731075
    10741076/**************************************************************************
     
    11261128{
    11271129    TRACE("(%p %p)\n", lppDest, lpSrc);
    1128 
     1130 
    11291131    if (lpSrc) {
    11301132        LPSTR ptr = COMCTL32_ReAlloc (*lppDest, strlen (lpSrc) + 1);
     
    11991201{
    12001202    TRACE("(%p %p)\n", lppDest, lpSrc);
    1201 
     1203 
    12021204    if (lpSrc) {
    12031205        INT len = strlenW (lpSrc) + 1;
     
    13711373
    13721374/**************************************************************************
    1373  * DSA_GetItem [COMCTL32.322]
     1375 * DSA_GetItem [COMCTL32.322] 
    13741376 *
    13751377 * PARAMS
     
    13891391
    13901392    TRACE("(%p %d %p)\n", hdsa, nIndex, pDest);
    1391 
     1393   
    13921394    if (!hdsa)
    13931395        return FALSE;
     
    14031405
    14041406/**************************************************************************
    1405  * DSA_GetItemPtr [COMCTL32.323]
     1407 * DSA_GetItemPtr [COMCTL32.323] 
    14061408 *
    14071409 * Retrieves a pointer to the specified item.
     
    14291431
    14301432    pSrc = (char *) hdsa->pData + (hdsa->nItemSize * nIndex);
    1431 
     1433   
    14321434    TRACE("-- ret=%p\n", pSrc);
    14331435
     
    14371439
    14381440/**************************************************************************
    1439  * DSA_SetItem [COMCTL32.325]
     1441 * DSA_SetItem [COMCTL32.325] 
    14401442 *
    14411443 * Sets the contents of an item in the array.
     
    14561458    INT  nSize, nNewItems;
    14571459    LPVOID pDest, lpTemp;
    1458 
     1460   
    14591461    TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
    14601462
    14611463    if ((!hdsa) || nIndex < 0)
    14621464        return FALSE;
    1463 
     1465     
    14641466    if (hdsa->nItemCount <= nIndex) {
    14651467        /* within the old array */
     
    14811483            hdsa->nItemCount = nIndex + 1;
    14821484            hdsa->pData = lpTemp;
    1483         }
     1485        }   
    14841486    }
    14851487
     
    14951497
    14961498/**************************************************************************
    1497  * DSA_InsertItem [COMCTL32.324]
     1499 * DSA_InsertItem [COMCTL32.324] 
    14981500 *
    14991501 * PARAMS
     
    15121514    INT   nNewItems, nSize;
    15131515    LPVOID  lpTemp, lpDest;
    1514 
     1516   
    15151517    TRACE("(%p %d %p)\n", hdsa, nIndex, pSrc);
    15161518
     
    15321534
    15331535        hdsa->nMaxCount = nNewItems;
    1534         hdsa->pData = lpTemp;
     1536        hdsa->pData = lpTemp;         
    15351537    }
    15361538
     
    15571559
    15581560/**************************************************************************
    1559  * DSA_DeleteItem [COMCTL32.326]
     1561 * DSA_DeleteItem [COMCTL32.326] 
    15601562 *
    15611563 * PARAMS
     
    15731575    LPVOID lpDest,lpSrc;
    15741576    INT  nSize;
    1575 
     1577   
    15761578    TRACE("(%p %d)\n", hdsa, nIndex);
    15771579
     
    15901592        memmove (lpDest, lpSrc, nSize);
    15911593    }
    1592 
     1594   
    15931595    hdsa->nItemCount--;
    1594 
     1596   
    15951597    /* free memory ? */
    15961598    if ((hdsa->nMaxCount - hdsa->nItemCount) >= hdsa->nGrow) {
     
    16271629    TRACE("(%p)\n", hdsa);
    16281630
    1629     if (!hdsa)
     1631    if (!hdsa) 
    16301632        return FALSE;
    16311633    if (hdsa->pData && (!COMCTL32_Free (hdsa->pData)))
     
    18531855    INT i;
    18541856
    1855     if (!hdpa || !hdpa->ptrs)
     1857    if (!hdpa->ptrs)
    18561858        return -1;
    18571859
     
    18831885DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p)
    18841886{
     1887    INT   nNewItems, nSize, nIndex = 0;
     1888    LPVOID  *lpTemp, *lpDest;
     1889
    18851890    TRACE("(%p %d %p)\n", hdpa, i, p);
    18861891
    1887     if (!hdpa || i < 0) return -1;
    1888 
    1889     if (i >= 0x7fff)
    1890         i = hdpa->nItemCount;
    1891 
    1892     if (i >= hdpa->nItemCount)
    1893         return DPA_SetPtr(hdpa, i, p) ? i : -1;
    1894 
    1895     /* create empty spot at the end */
    1896     if (!DPA_SetPtr(hdpa, hdpa->nItemCount, 0)) return -1;
    1897     memmove (hdpa->ptrs + i + 1, hdpa->ptrs + i, (hdpa->nItemCount - i - 1) * sizeof(LPVOID));
    1898     hdpa->ptrs[i] = p;
    1899     return i;
    1900 }
     1892    if ((!hdpa) || (i < 0))
     1893        return -1;
     1894
     1895    if (!hdpa->ptrs) {
     1896        hdpa->ptrs =
     1897            (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
     1898                                2 * hdpa->nGrow * sizeof(LPVOID));
     1899        if (!hdpa->ptrs)
     1900            return -1;
     1901        hdpa->nMaxCount = hdpa->nGrow * 2;
     1902        nIndex = 0;
     1903    }
     1904    else {
     1905        if (hdpa->nItemCount >= hdpa->nMaxCount) {
     1906            TRACE("-- resizing\n");
     1907            nNewItems = hdpa->nMaxCount + hdpa->nGrow;
     1908            nSize = nNewItems * sizeof(LPVOID);
     1909
     1910            lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
     1911                                           hdpa->ptrs, nSize);
     1912            if (!lpTemp)
     1913                return -1;
     1914            hdpa->nMaxCount = nNewItems;
     1915            hdpa->ptrs = lpTemp;
     1916        }
     1917
     1918        if (i >= hdpa->nItemCount) {
     1919            nIndex = hdpa->nItemCount;
     1920            TRACE("-- appending at %d\n", nIndex);
     1921        }
     1922        else {
     1923            TRACE("-- inserting at %d\n", i);
     1924            lpTemp = hdpa->ptrs + i;
     1925            lpDest = lpTemp + 1;
     1926            nSize  = (hdpa->nItemCount - i) * sizeof(LPVOID);
     1927            TRACE("-- move dest=%p src=%p size=%x\n",
     1928                   lpDest, lpTemp, nSize);
     1929            memmove (lpDest, lpTemp, nSize);
     1930            nIndex = i;
     1931        }
     1932    }
     1933
     1934    /* insert item */
     1935    hdpa->nItemCount++;
     1936    hdpa->ptrs[nIndex] = p;
     1937
     1938    return nIndex;
     1939}
     1940
    19011941
    19021942/**************************************************************************
     
    19191959{
    19201960    LPVOID *lpTemp;
    1921 
     1961   
    19221962    TRACE("(%p %d %p)\n", hdpa, i, p);
    19231963
    1924     if (!hdpa || i < 0 || i > 0x7fff)
     1964    if ((!hdpa) || i < 0)
    19251965        return FALSE;
    1926 
     1966     
    19271967    if (hdpa->nItemCount <= i) {
    19281968        /* within the old array */
    1929         if (hdpa->nMaxCount <= i) {
     1969        if (hdpa->nMaxCount > i) {
     1970            /* within the allocated space, set a new boundary */
     1971            hdpa->nItemCount = i+1;
     1972        }
     1973        else {
    19301974            /* resize the block of memory */
    19311975            INT nNewItems =
     
    19331977            INT nSize = nNewItems * sizeof(LPVOID);
    19341978
    1935             if (hdpa->ptrs)
    1936                 lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, nSize);
    1937             else
    1938                 lpTemp = (LPVOID*)HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY, nSize);
    1939            
     1979            lpTemp = (LPVOID*)HeapReAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,
     1980                                           hdpa->ptrs, nSize);
    19401981            if (!lpTemp)
    19411982                return FALSE;
    19421983
    1943             hdpa->nMaxCount = nNewItems;
    1944             hdpa->ptrs = lpTemp;
    1945         }
    1946         hdpa->nItemCount = i+1;
     1984            hdpa->nItemCount = nNewItems;
     1985            hdpa->ptrs = lpTemp;       
     1986        }   
    19471987    }
    19481988
     
    19732013    LPVOID *lpDest, *lpSrc, lpTemp = NULL;
    19742014    INT  nSize;
    1975 
     2015   
    19762016    TRACE("(%p %d)\n", hdpa, i);
    19772017
     
    19902030        memmove (lpDest, lpSrc, nSize);
    19912031    }
    1992 
     2032   
    19932033    hdpa->nItemCount --;
    1994 
     2034   
    19952035    /* free memory ?*/
    19962036    if ((hdpa->nMaxCount - hdpa->nItemCount) >= hdpa->nGrow) {
     
    20032043
    20042044        hdpa->nMaxCount = nNewItems;
    2005         hdpa->ptrs = (LPVOID*)lpDest;
     2045        hdpa->ptrs = (LPVOID*)lpDest;         
    20062046    }
    20072047
     
    20282068    TRACE("(%p)\n", hdpa);
    20292069
    2030     if (!hdpa)
     2070    if (!hdpa) 
    20312071        return FALSE;
    20322072
     
    20672107
    20682108    TRACE("l=%i r=%i\n", l, r);
    2069 
     2109 
    20702110    if (l==r)    /* one element is always sorted */
    20712111        return;
     
    20802120
    20812121    /* join the two sides */
    2082     while( (l<=m) && (m<r) )
     2122    while( (l<=m) && (m<r) ) 
    20832123    {
    20842124        if(pfnCompare(lpPtrs[l],lpPtrs[m+1],lParam)>0)
     
    21982238
    21992239        TRACE("linear search\n");
    2200 
     2240       
    22012241        nIndex = (nStart == -1)? 0 : nStart;
    22022242        lpPtr = hdpa->ptrs;
     
    22332273    HDPA hdpa;
    22342274
    2235     TRACE("(%d %p)\n", nGrow, hHeap);
     2275    TRACE("(%d 0x%x)\n", nGrow, hHeap);
    22362276
    22372277    if (hHeap)
     
    22812321    UINT idFrom = 0;
    22822322
    2283     TRACE("(%p %p %d %p 0x%08lx)\n",
     2323    TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
    22842324           lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr,
    22852325           lpNotify->dwParam5);
     
    22882328        return 0;
    22892329
    2290     if (lpNotify->hwndFrom == (HWND)-1) {
     2330    if (lpNotify->hwndFrom == -1) {
    22912331        lpNmh = lpHdr;
    22922332        idFrom = lpHdr->idFrom;
     
    23342374    NOTIFYDATA notify;
    23352375
    2336     TRACE("(%p %p %d %p)\n",
     2376    TRACE("(0x%04x 0x%04x %d %p)\n",
    23372377           hwndTo, hwndFrom, uCode, lpHdr);
    23382378
     
    23682408    HWND hwndNotify;
    23692409
    2370     TRACE("(%p %p %d %p 0x%08lx)\n",
     2410    TRACE("(0x%04x 0x%04x %d %p 0x%08lx)\n",
    23712411           hwndFrom, hwndTo, uCode, lpHdr, dwParam5);
    23722412
     
    24512491COMCTL32_StrToIntW (LPWSTR lpString)
    24522492{
    2453     return atoiW(lpString);
     2493    return _wtoi(lpString);
    24542494}
    24552495
     
    24632503 *     hdpa     [I] handle to the dynamic pointer array
    24642504 *     enumProc [I]
    2465  *     lParam   [I]
     2505 *     lParam   [I] 
    24662506 *
    24672507 * RETURNS
     
    26442684        if (dbcs && lpStart[1] != HIBYTE(wMatch)) continue;
    26452685        lpGotIt = lpStart;
    2646     }
     2686    }   
    26472687    return (LPSTR)lpGotIt;
    26482688}
     
    26982738    if( strchrW(lpSet, *(WORD*)lpLoop))
    26992739      return (INT)(lpLoop-lpStr);
    2700 
     2740 
    27012741  return (INT)(lpLoop-lpStr);
    27022742}
     
    27112751BOOL WINAPI COMCTL32_410( HWND hw, DWORD b, DWORD c, DWORD d) {
    27122752
    2713    FIXME("(%p, %lx, %lx, %lx): stub!\n", hw, b, c, d);
     2753   FIXME("(%x, %lx, %lx, %lx): stub!\n", hw, b, c, d);
    27142754
    27152755   return TRUE;
     
    27252765BOOL WINAPI COMCTL32_411( HWND hw, DWORD b, DWORD c) {
    27262766
    2727    FIXME("(%p, %lx, %lx): stub!\n", hw, b, c);
     2767   FIXME("(%x, %lx, %lx): stub!\n", hw, b, c);
    27282768
    27292769   return TRUE;
     
    27392779BOOL WINAPI COMCTL32_412( HWND hwnd, DWORD b, DWORD c)
    27402780{
    2741     FIXME("(%p, %lx, %lx): stub!\n", hwnd, b, c);
     2781    FIXME("(%x, %lx, %lx): stub!\n", hwnd, b, c);
    27422782
    27432783    if (IsWindow (hwnd) == FALSE)
     
    27602800BOOL WINAPI COMCTL32_413( HWND hw, DWORD b, DWORD c, DWORD d) {
    27612801
    2762    FIXME("(%p, %lx, %lx, %lx): stub!\n", hw, b, c, d);
     2802   FIXME("(%x, %lx, %lx, %lx): stub!\n", hw, b, c, d);
    27632803
    27642804   return TRUE;
     
    27762816{
    27772817
    2778    FIXME("(%p, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e);
     2818   FIXME("(%x, %lx, %lx, %lx, %lx): stub!\n", hwnd, b, c, d, e);
    27792819
    27802820   return TRUE;
Note: See TracChangeset for help on using the changeset viewer.