Ignore:
Timestamp:
Mar 26, 2000, 6:34:57 PM (25 years ago)
Author:
cbratschi
Message:

merged with Corel WINE 20000324

File:
1 edited

Legend:

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

    r1214 r3243  
    1 /* $Id: folders.cpp,v 1.1 1999-10-09 11:13:19 sandervl Exp $ */
     1/* $Id: folders.cpp,v 1.2 2000-03-26 16:34:41 cbratschi Exp $ */
    22
    33/*
     
    77 * Project Odin Software License can be found in LICENSE.TXT
    88 *
     9 * Corel WINE 20000324 level
    910 */
    1011
    1112/*
    12  *      Copyright 1997  Marcus Meissner
    13  *      Copyright 1998  Juergen Schmied
     13 *      Copyright 1997  Marcus Meissner
     14 *      Copyright 1998  Juergen Schmied
    1415 *
    1516 */
     
    4950
    5051typedef struct
    51 {       ICOM_VTABLE(IExtractIconA)*     lpvtbl;
    52         DWORD   ref;
    53         ICOM_VTABLE(IPersistFile)*      lpvtblPersistFile;
    54         LPITEMIDLIST    pidl;
     52{       ICOM_VTABLE(IExtractIconA)*     lpvtbl;
     53        DWORD   ref;
     54        ICOM_VTABLE(IPersistFile)*      lpvtblPersistFile;
     55        LPITEMIDLIST    pidl;
    5556} IExtractIconAImpl;
    5657
     
    6667static HRESULT WINAPI IExtractIconA_fnQueryInterface( IExtractIconA * iface, REFIID riid, LPVOID *ppvObj)
    6768{
    68         ICOM_THIS(IExtractIconAImpl,iface);
    69 
    70         char    xriid[50];
    71         WINE_StringFromCLSID((LPCLSID)riid,xriid);
    72         dprintf(("SHELL32:folders IExtractIconA_fnQueryInterface(%p)->(\n\tIID:\t%s,%p)\n",
     69        ICOM_THIS(IExtractIconAImpl,iface);
     70
     71        char    xriid[50];
     72        WINE_StringFromCLSID((LPCLSID)riid,xriid);
     73        dprintf(("SHELL32:folders IExtractIconA_fnQueryInterface(%p)->(\n\tIID:\t%s,%p)\n",
    7374           This,
    7475           xriid,
    7576           ppvObj));
    7677
    77         *ppvObj = NULL;
    78 
    79         if(IsEqualIID(riid, &IID_IUnknown))             /*IUnknown*/
    80         { *ppvObj = This;
    81         }
    82         else if(IsEqualIID(riid, &IID_IPersistFile))    /*IExtractIcon*/
    83         {    *ppvObj = (IPersistFile*)&(This->lpvtblPersistFile);
    84         }
    85         else if(IsEqualIID(riid, &IID_IExtractIconA))   /*IExtractIcon*/
    86         {    *ppvObj = (IExtractIconA*)This;
    87         }
    88 
    89         if(*ppvObj)
    90         { IExtractIconA_AddRef((IExtractIconA*) *ppvObj);       
    91           dprintf(("SHELL32:folders IExtractIconA_fnQueryInterface-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj));
    92           return S_OK;
    93         }
    94         dprintf(("SHELL32:folders IExtractIconA_fnQueryInterface-- Interface: E_NOINTERFACE\n"));
    95         return E_NOINTERFACE;
     78        *ppvObj = NULL;
     79
     80        if(IsEqualIID(riid, &IID_IUnknown))             /*IUnknown*/
     81        { *ppvObj = This;
     82        }
     83        else if(IsEqualIID(riid, &IID_IPersistFile))    /*IExtractIcon*/
     84        {    *ppvObj = (IPersistFile*)&(This->lpvtblPersistFile);
     85        }
     86        else if(IsEqualIID(riid, &IID_IExtractIconA))   /*IExtractIcon*/
     87        {    *ppvObj = (IExtractIconA*)This;
     88        }
     89
     90        if(*ppvObj)
     91        { IExtractIconA_AddRef((IExtractIconA*) *ppvObj);
     92          dprintf(("SHELL32:folders IExtractIconA_fnQueryInterface-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj));
     93          return S_OK;
     94        }
     95        dprintf(("SHELL32:folders IExtractIconA_fnQueryInterface-- Interface: E_NOINTERFACE\n"));
     96        return E_NOINTERFACE;
    9697}
    9798
     
    101102static ULONG WINAPI IExtractIconA_fnAddRef(IExtractIconA * iface)
    102103{
    103         ICOM_THIS(IExtractIconAImpl,iface);
    104 
    105         dprintf(("SHELL32:folders IExtractIconA_fnAddRef(%p)->(count=%lu)\n",
     104        ICOM_THIS(IExtractIconAImpl,iface);
     105
     106        dprintf(("SHELL32:folders IExtractIconA_fnAddRef(%p)->(count=%lu)\n",
    106107          This,
    107108          This->ref));
    108109
    109         shell32_ObjCount++;
    110 
    111         return ++(This->ref);
     110        shell32_ObjCount++;
     111
     112        return ++(This->ref);
    112113}
    113114/**************************************************************************
     
    116117static ULONG WINAPI IExtractIconA_fnRelease(IExtractIconA * iface)
    117118{
    118         ICOM_THIS(IExtractIconAImpl,iface);
    119 
    120         dprintf(("SHELL32:folders IExtractIconA_fnRelease(%p)->()\n",
     119        ICOM_THIS(IExtractIconAImpl,iface);
     120
     121        dprintf(("SHELL32:folders IExtractIconA_fnRelease(%p)->()\n",
    121122          This));
    122123
    123         shell32_ObjCount--;
    124 
    125         if (!--(This->ref))
    126         { dprintf(("SHELL32:folders  IExtractIconA_fnRelease destroying IExtractIcon(%p)\n",
     124        shell32_ObjCount--;
     125
     126        if (!--(This->ref))
     127        { dprintf(("SHELL32:folders  IExtractIconA_fnRelease destroying IExtractIcon(%p)\n",
    127128            This));
    128           SHFree(This->pidl);
    129           HeapFree(GetProcessHeap(),0,This);
    130           return 0;
    131         }
    132         return This->ref;
     129          SHFree(This->pidl);
     130          HeapFree(GetProcessHeap(),0,This);
     131          return 0;
     132        }
     133        return This->ref;
    133134}
    134135/**************************************************************************
     
    138139*/
    139140static HRESULT WINAPI IExtractIconA_fnGetIconLocation(
    140         IExtractIconA * iface,
    141         UINT uFlags,
    142         LPSTR szIconFile,
    143         UINT cchMax,
    144         int * piIndex,
    145         UINT * pwFlags)
    146 {
    147         ICOM_THIS(IExtractIconAImpl,iface);
    148 
    149         char    sTemp[MAX_PATH];
    150         DWORD   dwNr;
    151         GUID const * riid;
    152         LPITEMIDLIST    pSimplePidl = ILFindLastID(This->pidl);
    153                        
    154         dprintf(("SHELL32:folders IExtractIconA_fnGetIconLocation(%p) (flags=%u %p %u %p %p)\n",
     141        IExtractIconA * iface,
     142        UINT uFlags,
     143        LPSTR szIconFile,
     144        UINT cchMax,
     145        int * piIndex,
     146        UINT * pwFlags)
     147{
     148        ICOM_THIS(IExtractIconAImpl,iface);
     149
     150        char    sTemp[MAX_PATH];
     151        DWORD   dwNr;
     152        GUID const * riid;
     153        LPITEMIDLIST    pSimplePidl = ILFindLastID(This->pidl);
     154
     155        dprintf(("SHELL32:folders IExtractIconA_fnGetIconLocation(%p) (flags=%u %p %u %p %p)\n",
    155156          This,
    156157          uFlags,
     
    160161          pwFlags));
    161162
    162         if (pwFlags)
    163           *pwFlags = 0;
    164 
    165         if (_ILIsDesktop(pSimplePidl))
    166         {
    167           lstrcpynA(szIconFile, "shell32.dll", cchMax);
    168           *piIndex = 34;
    169         }
    170 
    171         /* my computer and other shell extensions */
    172         else if ( (riid = _ILGetGUIDPointer(pSimplePidl)) )
    173         {
    174           char xriid[50];
    175           strcpy(xriid,"CLSID\\");
    176           WINE_StringFromCLSID((LPCLSID)riid,&xriid[strlen(xriid)]);
    177 
    178           if (HCR_GetDefaultIcon(xriid, sTemp, MAX_PATH, &dwNr))
    179           {
    180             lstrcpynA(szIconFile, sTemp, cchMax);
    181             *piIndex = dwNr;
    182           }
    183           else
    184           {
    185             lstrcpynA(szIconFile, "shell32.dll", cchMax);
    186             *piIndex = 15;
    187           }
    188         }
    189 
    190         else if (_ILIsDrive (pSimplePidl))
    191         {
    192           if (HCR_GetDefaultIcon("Drive", sTemp, MAX_PATH, &dwNr))
    193           {
    194             lstrcpynA(szIconFile, sTemp, cchMax);
    195             *piIndex = dwNr;
    196           }
    197           else
    198           {
    199             lstrcpynA(szIconFile, "shell32.dll", cchMax);
    200             *piIndex = 8;
    201           }
    202         }
    203         else if (_ILIsFolder (pSimplePidl))
    204         {
    205           if (HCR_GetDefaultIcon("Folder", sTemp, MAX_PATH, &dwNr))
    206           {
    207             lstrcpynA(szIconFile, sTemp, cchMax);
    208             *piIndex = dwNr;
    209           }
    210           else
    211           {
    212             lstrcpynA(szIconFile, "shell32.dll", cchMax);
    213             *piIndex = 3;
    214           }
    215         }
    216         else    /* object is file */
    217         {
    218           if (_ILGetExtension (pSimplePidl, sTemp, MAX_PATH)
    219               && HCR_MapTypeToValue(sTemp, sTemp, MAX_PATH, TRUE)
    220               && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
    221           {
    222             if (!strcmp("%1",sTemp))            /* icon is in the file */
    223             {
    224               SHGetPathFromIDListA(This->pidl, sTemp);
    225               dwNr = 0;
    226             }
    227             lstrcpynA(szIconFile, sTemp, cchMax);
    228             *piIndex = dwNr;
    229           }
    230           else                                  /* default icon */
    231           {
    232             lstrcpynA(szIconFile, "shell32.dll", cchMax);
    233             *piIndex = 0;
    234           }
    235         }
    236 
    237         dprintf(("SHELL32:folders IExtractIconA_fnGetIconLocation -- %s %x\n",
     163        if (pwFlags)
     164          *pwFlags = 0;
     165
     166        if (_ILIsDesktop(pSimplePidl))
     167        {
     168          lstrcpynA(szIconFile, "shell32.dll", cchMax);
     169          *piIndex = 34;
     170        }
     171
     172        /* my computer and other shell extensions */
     173        else if (riid = _ILGetGUIDPointer(pSimplePidl))
     174        {
     175          char xriid[50];
     176          strcpy(xriid,"CLSID\\");
     177          WINE_StringFromCLSID((LPCLSID)riid,&xriid[strlen(xriid)]);
     178
     179          if (HCR_GetDefaultIcon(xriid, sTemp, MAX_PATH, &dwNr))
     180          {
     181            lstrcpynA(szIconFile, sTemp, cchMax);
     182            *piIndex = dwNr;
     183          }
     184          else
     185          {
     186            lstrcpynA(szIconFile, "shell32.dll", cchMax);
     187            *piIndex = 15;
     188          }
     189
     190        }
     191        else if (_ILIsDrive (pSimplePidl))
     192        {
     193          if (HCR_GetDefaultIcon("Drive", sTemp, MAX_PATH, &dwNr))
     194          {
     195            lstrcpynA(szIconFile, sTemp, cchMax);
     196            *piIndex = dwNr;
     197          }
     198          else
     199          {
     200            lstrcpynA(szIconFile, "shell32.dll", cchMax);
     201            *piIndex = 8;
     202          }
     203        }
     204        else if (_ILIsFolder (pSimplePidl))
     205        {
     206          if (HCR_GetDefaultIcon("Folder", sTemp, MAX_PATH, &dwNr))
     207          {
     208            lstrcpynA(szIconFile, sTemp, cchMax);
     209            *piIndex = dwNr;
     210          }
     211          else
     212          {
     213            lstrcpynA(szIconFile, "shell32.dll", cchMax);
     214            *piIndex = 3;
     215          }
     216        }
     217        else    /* object is file */
     218        {
     219          if (_ILGetExtension (pSimplePidl, sTemp, MAX_PATH)
     220              && HCR_MapTypeToValue(sTemp, sTemp, MAX_PATH, TRUE)
     221              && HCR_GetDefaultIcon(sTemp, sTemp, MAX_PATH, &dwNr))
     222          {
     223            if (!strcmp("%1",sTemp))            /* icon is in the file */
     224            {
     225              SHGetPathFromIDListA(This->pidl, sTemp);
     226              dwNr = 0;
     227            }
     228            lstrcpynA(szIconFile, sTemp, cchMax);
     229            *piIndex = dwNr;
     230          }
     231          else                                  /* default icon */
     232          {
     233            lstrcpynA(szIconFile, "shell32.dll", cchMax);
     234            *piIndex = 0;
     235          }
     236        }
     237
     238        dprintf(("SHELL32:folders IExtractIconA_fnGetIconLocation -- %s %x\n",
    238239          szIconFile,
    239240          *piIndex));
    240         return NOERROR;
     241        return NOERROR;
    241242}
    242243/**************************************************************************
     
    245246static HRESULT WINAPI IExtractIconA_fnExtract(IExtractIconA * iface, LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize)
    246247{
    247         ICOM_THIS(IExtractIconAImpl,iface);
    248 
    249         dprintf(("SHELL32:folders IExtractIconA_fnExtract (%p) (file=%p index=%u %p %p size=%u) semi-stub\n",
     248        ICOM_THIS(IExtractIconAImpl,iface);
     249
     250        dprintf(("SHELL32:folders IExtractIconA_fnExtract (%p) (file=%p index=%u %p %p size=%u) semi-stub\n",
    250251          This,
    251252          pszFile,
     
    255256          nIconSize));
    256257
    257         if (phiconLarge)
    258           *phiconLarge = pImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT);
    259 
    260         if (phiconSmall)
    261           *phiconSmall = pImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT);
    262 
    263         return S_OK;
     258        if (phiconLarge)
     259          *phiconLarge = pImageList_GetIcon(ShellBigIconList, nIconIndex, ILD_TRANSPARENT);
     260
     261        if (phiconSmall)
     262          *phiconSmall = pImageList_GetIcon(ShellSmallIconList, nIconIndex, ILD_TRANSPARENT);
     263
     264        return S_OK;
    264265}
    265266
    266267static struct ICOM_VTABLE(IExtractIconA) eivt =
    267 {       
    268         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    269         IExtractIconA_fnQueryInterface,
    270         IExtractIconA_fnAddRef,
    271         IExtractIconA_fnRelease,
    272         IExtractIconA_fnGetIconLocation,
    273         IExtractIconA_fnExtract
     268{
     269        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     270        IExtractIconA_fnQueryInterface,
     271        IExtractIconA_fnAddRef,
     272        IExtractIconA_fnRelease,
     273        IExtractIconA_fnGetIconLocation,
     274        IExtractIconA_fnExtract
    274275};
    275276
     
    279280 */
    280281static HRESULT WINAPI IEIPersistFile_fnQueryInterface(
    281         IPersistFile    *iface,
    282         REFIID          iid,
    283         LPVOID          *ppvObj)
    284 {
    285         _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
    286 
    287         return IShellFolder_QueryInterface((IExtractIconA*)This, iid, ppvObj);
     282        IPersistFile    *iface,
     283        REFIID          iid,
     284        LPVOID          *ppvObj)
     285{
     286        _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
     287
     288        return IShellFolder_QueryInterface((IExtractIconA*)This, iid, ppvObj);
    288289}
    289290
     
    292293 */
    293294static ULONG WINAPI IEIPersistFile_fnAddRef(
    294         IPersistFile    *iface)
    295 {
    296         _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
    297 
    298         return IExtractIconA_AddRef((IExtractIconA*)This);
     295        IPersistFile    *iface)
     296{
     297        _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
     298
     299        return IExtractIconA_AddRef((IExtractIconA*)This);
    299300}
    300301
     
    303304 */
    304305static ULONG WINAPI IEIPersistFile_fnRelease(
    305         IPersistFile    *iface)
    306 {
    307         _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
    308 
    309         return IExtractIconA_Release((IExtractIconA*)This);
     306        IPersistFile    *iface)
     307{
     308        _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
     309
     310        return IExtractIconA_Release((IExtractIconA*)This);
    310311}
    311312
     
    314315 */
    315316static HRESULT WINAPI IEIPersistFile_fnGetClassID(
    316         IPersistFile    *iface,
    317         LPCLSID         lpClassId)
    318 {
    319         CLSID StdFolderID = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
    320 
    321         if (lpClassId==NULL)
    322           return E_POINTER;
    323 
    324         memcpy(lpClassId, &StdFolderID, sizeof(StdFolderID));
    325 
    326         return S_OK;
     317        IPersistFile    *iface,
     318        LPCLSID         lpClassId)
     319{
     320        CLSID StdFolderID = { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} };
     321
     322        if (lpClassId==NULL)
     323          return E_POINTER;
     324
     325        memcpy(lpClassId, &StdFolderID, sizeof(StdFolderID));
     326
     327        return S_OK;
    327328}
    328329
     
    342343static HRESULT WINAPI IEIPersistFile_fnLoad(IPersistFile* iface, LPCOLESTR pszFileName, DWORD dwMode)
    343344{
    344         _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
    345         FIXME("%p\n", This);
    346         return E_NOTIMPL;
     345        _ICOM_THIS_From_IPersistFile(IExtractIconA, iface);
     346        FIXME("%p\n", This);
     347        return E_NOTIMPL;
    347348
    348349}
     
    380381static struct ICOM_VTABLE(IPersistFile) pfvt =
    381382{
    382         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    383         IEIPersistFile_fnQueryInterface,
    384         IEIPersistFile_fnAddRef,
    385         IEIPersistFile_fnRelease,
    386         IEIPersistFile_fnGetClassID,
    387         IEIPersistFile_fnIsDirty,       /* IEIPersistFile_fnIsDirty */
    388         IEIPersistFile_fnLoad,
    389         IEIPersistFile_fnSave,          /* IEIPersistFile_fnSave */
    390         IEIPersistFile_fnSaveCompleted, /* IEIPersistFile_fnSaveCompleted */
    391         IEIPersistFile_fnGetCurFile     /* IEIPersistFile_fnGetCurFile */
     383        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     384        IEIPersistFile_fnQueryInterface,
     385        IEIPersistFile_fnAddRef,
     386        IEIPersistFile_fnRelease,
     387        IEIPersistFile_fnGetClassID,
     388        IEIPersistFile_fnIsDirty,       /* IEIPersistFile_fnIsDirty */
     389        IEIPersistFile_fnLoad,
     390        IEIPersistFile_fnSave,          /* IEIPersistFile_fnSave */
     391        IEIPersistFile_fnSaveCompleted, /* IEIPersistFile_fnSaveCompleted */
     392        IEIPersistFile_fnGetCurFile     /* IEIPersistFile_fnGetCurFile */
    392393};
    393394
     
    397398IExtractIconA* IExtractIconA_Constructor(LPCITEMIDLIST pidl)
    398399{
    399         IExtractIconAImpl* ei;
    400 
    401         ei=(IExtractIconAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconAImpl));
    402         ei->ref=1;
    403         ei->lpvtbl = &eivt;
    404         ei->lpvtblPersistFile = &pfvt;
    405         ei->pidl=ILClone(pidl);
    406 
    407         pdump(pidl);
    408 
    409         dprintf(("SHELL32:folders IExtractIconA_Constructor(%p)\n",
     400        IExtractIconAImpl* ei;
     401
     402        ei=(IExtractIconAImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconAImpl));
     403        ei->ref=1;
     404        ei->lpvtbl = &eivt;
     405        ei->lpvtblPersistFile = &pfvt;
     406        ei->pidl=ILClone(pidl);
     407
     408        pdump(pidl);
     409
     410        dprintf(("SHELL32:folders IExtractIconA_Constructor(%p)\n",
    410411          ei));
    411         shell32_ObjCount++;
    412         return (IExtractIconA *)ei;
    413 }
    414 
    415 
     412        shell32_ObjCount++;
     413        return (IExtractIconA *)ei;
     414}
     415
     416
Note: See TracChangeset for help on using the changeset viewer.