Ignore:
Timestamp:
Nov 2, 1999, 9:05:35 PM (26 years ago)
Author:
phaller
Message:

Add: update to wine/shell32 1999/11/02 #3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/pidl.cpp

    r1469 r1553  
    1 /* $Id: pidl.cpp,v 1.3 1999-10-27 09:03:31 phaller Exp $ */
     1/* $Id: pidl.cpp,v 1.4 1999-11-02 20:05:35 phaller Exp $ */
    22
    33/*
     
    855855         break;
    856856
     857       case CSIDL_NETWORK:
     858         *ppidl = _ILCreateNetwork ();
     859         hr = NOERROR;
     860         break;
     861
     862       case CSIDL_CONTROLS:
     863         *ppidl = _ILCreateControl ();
     864         hr = NOERROR;
     865         break;
     866
     867       case CSIDL_PRINTERS:
     868         *ppidl = _ILCreatePrinter ();
     869         hr = NOERROR;
     870         break;
     871
     872       case CSIDL_BITBUCKET:
     873         *ppidl = _ILCreateBitBucket ();
     874         hr = NOERROR;
     875         break;
     876
    857877       default:
    858878         if (SHGetSpecialFolderPathA(hwndOwner, szPath, nFolder, TRUE))
     
    11021122{
    11031123   return _ILCreate(PT_MYCOMP, &IID_IExplore, sizeof(GUID));
     1124}
     1125
     1126ODINFUNCTION0(LPITEMIDLIST,_ILCreateControl)
     1127{
     1128   return _ILCreate(PT_SPECIAL, &IID_Control, sizeof(GUID));
     1129}
     1130
     1131ODINFUNCTION0(LPITEMIDLIST,_ILCreatePrinter)
     1132{
     1133   return _ILCreate(PT_SPECIAL, &IID_Printer, sizeof(GUID));
     1134}
     1135
     1136ODINFUNCTION0(LPITEMIDLIST,_ILCreateNetwork)
     1137{
     1138   return _ILCreate(PT_MYCOMP, &IID_Network, sizeof(GUID));
     1139}
     1140
     1141ODINFUNCTION0(LPITEMIDLIST,_ILCreateBitBucket)
     1142{
     1143   return _ILCreate(PT_MYCOMP, &IID_BitBucket, sizeof(GUID));
    11041144}
    11051145
     
    15411581}
    15421582
     1583/*************************************************************************
     1584 * _ILGetFileDateTime
     1585 *
     1586 * Given the ItemIdList, get the FileTime
     1587 *
     1588 * PARAMS
     1589 *      pidl        [I] The ItemIDList
     1590 *      pFt         [I] the resulted FILETIME of the file
     1591 *
     1592 * RETURNS
     1593 *     True if Successful
     1594 *
     1595 * NOTES
     1596 *
     1597 */
     1598
     1599ODINFUNCTION2(BOOL, _ILGetFileDateTime,LPCITEMIDLIST, pidl,
     1600                                       FILETIME *,    pFt)
     1601{
     1602    LPPIDLDATA pdata =_ILGetDataPointer(pidl);
     1603
     1604    switch (pdata->type)
     1605    {
     1606        case PT_FOLDER:
     1607            DosDateTimeToFileTime(pdata->u.folder.uFileDate, pdata->u.folder.uFileTime, pFt);
     1608            break;
     1609        case PT_VALUE:
     1610            DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, pFt);
     1611            break;
     1612        default:
     1613            return FALSE;
     1614    }
     1615    return TRUE;
     1616}
     1617
     1618
    15431619ODINFUNCTION3(BOOL, _ILGetFileDate, LPCITEMIDLIST, pidl,
    15441620                                    LPSTR,         pOut,
    15451621                                    UINT,          uOutSize)
    1546 {  LPPIDLDATA pdata =_ILGetDataPointer(pidl);
     1622{
    15471623   FILETIME ft;
    15481624   SYSTEMTIME time;
    15491625
    1550    switch (pdata->type)
    1551    { case PT_FOLDER:
    1552        DosDateTimeToFileTime(pdata->u.folder.uFileDate, pdata->u.folder.uFileTime, &ft);
    1553        break;
    1554      case PT_VALUE:
    1555        DosDateTimeToFileTime(pdata->u.file.uFileDate, pdata->u.file.uFileTime, &ft);
    1556        break;
    1557      default:
    1558        return FALSE;
    1559    }
     1626   if (! _ILGetFileDateTime( pidl, &ft )) return FALSE;
     1627
    15601628   FileTimeToSystemTime (&ft, &time);
    15611629   return GetDateFormatA(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&time, NULL,  pOut, uOutSize);
    15621630}
    15631631
     1632/*************************************************************************
     1633 * _ILGetFileSize
     1634 *
     1635 * Given the ItemIdList, get the FileSize
     1636 *
     1637 * PARAMS
     1638 *      pidl    [I] The ItemIDList
     1639 * pOut  [I] The buffer to save the result
     1640 *      uOutsize [I] The size of the buffer
     1641 *
     1642 * RETURNS
     1643 *     The FileSize
     1644 *
     1645 * NOTES
     1646 * pOut can be null when no string is needed
     1647 *
     1648 */
    15641649
    15651650ODINFUNCTION3(BOOL,_ILGetFileSize,LPCITEMIDLIST, pidl,
    15661651                                  LPSTR,         pOut,
    15671652                                  UINT,          uOutSize)
    1568 {  LPPIDLDATA pdata =_ILGetDataPointer(pidl);
     1653{
     1654   LPPIDLDATA pdata =_ILGetDataPointer(pidl);
     1655   DWORD dwSize;
    15691656
    15701657   switch (pdata->type)
    15711658   { case PT_VALUE:
    1572        break;
    1573      default:
    1574        return FALSE;
    1575    }
    1576    StrFormatByteSizeA(pdata->u.file.dwFileSize, pOut, uOutSize);
    1577    return TRUE;
    1578 }
     1659       dwSize = pdata->u.file.dwFileSize;
     1660       if (pOut) StrFormatByteSizeA(dwSize, pOut, uOutSize);
     1661       return dwSize;
     1662   }
     1663   return 0;
     1664}
     1665
    15791666
    15801667
     
    16051692}
    16061693
     1694/*************************************************************************
     1695 * _ILGetFileType
     1696 *
     1697 * Given the ItemIdList, get the file type description
     1698 *
     1699 * PARAMS
     1700 *      pidl        [I] The ItemIDList (simple)
     1701 *      pOut        [I] The buffer to save the result
     1702 *      uOutsize    [I] The size of the buffer
     1703 *
     1704 * RETURNS
     1705 * nothing
     1706 *
     1707 * NOTES
     1708 * This function copies as much as possible into the buffer.
     1709 */
     1710ODINPROCEDURE3(_ILGetFileType,LPCITEMIDLIST, pidl,
     1711                              LPSTR,         pOut,
     1712                              UINT,          uOutSize)
     1713{
     1714   if(_ILIsValue(pidl))
     1715   {
     1716     char sTemp[64];
     1717          if(uOutSize > 0)
     1718          {
     1719            pOut[0] = 0;
     1720          }
     1721     if (_ILGetExtension (pidl, sTemp, 64))
     1722     {
     1723       if (!( HCR_MapTypeToValue(sTemp, sTemp, 64, TRUE)
     1724           && HCR_MapTypeToValue(sTemp, pOut, uOutSize, FALSE )))
     1725       {
     1726         lstrcpynA (pOut, sTemp, uOutSize - 6);
     1727         strcat (pOut, "-file");
     1728       }
     1729     }
     1730   }
     1731   else
     1732   {
     1733     lstrcpynA(pOut, "Folder", uOutSize);
     1734   }
     1735}
     1736
     1737/*************************************************************************
     1738 * _ILGetAttributeStr
     1739 *
     1740 * Given the ItemIdList, get the Attrib string format
     1741 *
     1742 * PARAMS
     1743 *      pidl        [I] The ItemIDList
     1744 *      pOut        [I] The buffer to save the result
     1745 *      uOutsize    [I] The size of the Buffer
     1746 *
     1747 * RETURNS
     1748 *     True if successful
     1749 *
     1750 * NOTES
     1751 *
     1752 */
     1753ODINFUNCTION3(BOOL, _ILGetAttributeStr, LPCITEMIDLIST, pidl,
     1754                                        LPSTR,         pOut,
     1755                                        UINT,          uOutSize)
     1756{
     1757    LPPIDLDATA pData =_ILGetDataPointer(pidl);
     1758    WORD wAttrib;
     1759    int i;
     1760
     1761    /* Need At Least 6 characters to represent the Attrib String */
     1762    if(uOutSize < 6)
     1763    {
     1764        return FALSE;
     1765    }
     1766    switch(pData->type)
     1767    {
     1768        case PT_FOLDER:
     1769            wAttrib = pData->u.folder.uFileAttribs;
     1770            break;
     1771        case PT_VALUE:
     1772            wAttrib = pData->u.file.uFileAttribs;
     1773            break;
     1774        default:
     1775            return FALSE;
     1776    }
     1777    i=0;
     1778    if(wAttrib & FILE_ATTRIBUTE_READONLY)
     1779    {
     1780        pOut[i++] = 'R';
     1781    }
     1782    if(wAttrib & FILE_ATTRIBUTE_HIDDEN)
     1783    {
     1784        pOut[i++] = 'H';
     1785    }
     1786    if(wAttrib & FILE_ATTRIBUTE_SYSTEM)
     1787    {
     1788        pOut[i++] = 'S';
     1789    }
     1790    if(wAttrib & FILE_ATTRIBUTE_ARCHIVE)
     1791    {
     1792        pOut[i++] = 'A';
     1793    }
     1794    if(wAttrib & FILE_ATTRIBUTE_COMPRESSED)
     1795    {
     1796        pOut[i++] = 'C';
     1797    }
     1798    pOut[i] = 0x00;
     1799    return TRUE;
     1800}
     1801
Note: See TracChangeset for help on using the changeset viewer.