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/enumidlist.cpp

    r1214 r3243  
    1 /* $Id: enumidlist.cpp,v 1.1 1999-10-09 11:13:18 sandervl Exp $ */
     1/* $Id: enumidlist.cpp,v 1.2 2000-03-26 16:34:40 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  *      IEnumIDList
     13 *      IEnumIDList
    1314 *
    14  *      Copyright 1998  Juergen Schmied <juergen.schmied@metronet.de>
     15 *      Copyright 1998  Juergen Schmied <juergen.schmied@metronet.de>
    1516 */
    1617
     
    4748typedef struct tagENUMLIST
    4849{
    49         struct tagENUMLIST      *pNext;
    50         LPITEMIDLIST            pidl;
     50        struct tagENUMLIST      *pNext;
     51        LPITEMIDLIST            pidl;
    5152
    5253} ENUMLIST, *LPENUMLIST;
     
    5455typedef struct
    5556{
    56         ICOM_VTABLE(IEnumIDList)*       lpvtbl;
    57         DWORD                           ref;
    58         LPENUMLIST                      mpFirst;
    59         LPENUMLIST                      mpLast;
    60         LPENUMLIST                      mpCurrent;
     57        ICOM_VTABLE(IEnumIDList)*       lpvtbl;
     58        DWORD                           ref;
     59        LPENUMLIST                      mpFirst;
     60        LPENUMLIST                      mpLast;
     61        LPENUMLIST                      mpCurrent;
    6162
    6263} IEnumIDListImpl;
     
    6869 */
    6970static BOOL AddToEnumList(
    70         IEnumIDList * iface,
    71         LPITEMIDLIST pidl)
    72 {
    73         ICOM_THIS(IEnumIDListImpl,iface);
    74 
    75         LPENUMLIST  pNew;
    76 
    77         TRACE("(%p)->(pidl=%p)\n",This,pidl);
    78         pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST));
    79         if(pNew)
    80         {
    81           /*set the next pointer */
    82           pNew->pNext = NULL;
    83           pNew->pidl = pidl;
    84 
    85           /*is This the first item in the list? */
    86           if(!This->mpFirst)
    87           {
    88             This->mpFirst = pNew;
    89             This->mpCurrent = pNew;
    90           }
    91 
    92           if(This->mpLast)
    93           {
    94             /*add the new item to the end of the list */
    95             This->mpLast->pNext = pNew;
    96           }
    97        
    98           /*update the last item pointer */
    99           This->mpLast = pNew;
    100           TRACE("-- (%p)->(first=%p, last=%p)\n",This,This->mpFirst,This->mpLast);
    101           return TRUE;
    102         }
    103         return FALSE;
     71        IEnumIDList * iface,
     72        LPITEMIDLIST pidl)
     73{
     74        ICOM_THIS(IEnumIDListImpl,iface);
     75
     76        LPENUMLIST  pNew;
     77
     78        TRACE("(%p)->(pidl=%p)\n",This,pidl);
     79        pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST));
     80        if(pNew)
     81        {
     82          /*set the next pointer */
     83          pNew->pNext = NULL;
     84          pNew->pidl = pidl;
     85
     86          /*is This the first item in the list? */
     87          if(!This->mpFirst)
     88          {
     89            This->mpFirst = pNew;
     90            This->mpCurrent = pNew;
     91          }
     92
     93          if(This->mpLast)
     94          {
     95            /*add the new item to the end of the list */
     96            This->mpLast->pNext = pNew;
     97          }
     98
     99          /*update the last item pointer */
     100          This->mpLast = pNew;
     101          TRACE("-- (%p)->(first=%p, last=%p)\n",This,This->mpFirst,This->mpLast);
     102          return TRUE;
     103        }
     104        return FALSE;
    104105}
    105106
     
    108109 */
    109110static BOOL CreateFolderEnumList(
    110         IEnumIDList * iface,
    111         LPCSTR lpszPath,
    112         DWORD dwFlags)
    113 {
    114         ICOM_THIS(IEnumIDListImpl,iface);
    115 
    116         LPITEMIDLIST    pidl=NULL;
    117         WIN32_FIND_DATAA stffile;       
    118         HANDLE hFile;
    119         CHAR  szPath[MAX_PATH];
    120 
    121         TRACE("(%p)->(path=%s flags=0x%08lx) \n",This,debugstr_a(lpszPath),dwFlags);
    122 
    123         if(!lpszPath || !lpszPath[0]) return FALSE;
    124 
    125         strcpy(szPath, lpszPath);
    126         PathAddBackslashA(szPath);
    127         strcat(szPath,"*.*");
    128 
    129         /*enumerate the folders*/
    130         if(dwFlags & SHCONTF_FOLDERS)
    131         {
    132           TRACE("-- (%p)-> enumerate SHCONTF_FOLDERS of %s\n",This,debugstr_a(szPath));
    133           hFile = FindFirstFileA(szPath,&stffile);
    134           if ( hFile != INVALID_HANDLE_VALUE )
    135           {
    136             do
    137             {
    138               if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && strcmp (stffile.cFileName, ".") && strcmp (stffile.cFileName, ".."))
    139               {
    140                 pidl = _ILCreateFolder (&stffile);
    141                 if(pidl && AddToEnumList((IEnumIDList*)This, pidl))
    142                 {
    143                   continue;
    144                 }
    145                 return FALSE;
    146               }
    147             } while( FindNextFileA(hFile,&stffile));
    148             FindClose (hFile);
    149           }
    150         }
    151 
    152         /*enumerate the non-folder items (values) */
    153         if(dwFlags & SHCONTF_NONFOLDERS)
    154         {
    155           TRACE("-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n",This,debugstr_a(szPath));
    156           hFile = FindFirstFileA(szPath,&stffile);
    157           if ( hFile != INVALID_HANDLE_VALUE )
    158           {
    159             do
    160             {
    161               if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
    162               {
    163                 pidl = _ILCreateValue(&stffile);
    164                 if(pidl && AddToEnumList((IEnumIDList*)This, pidl))
    165                 {
    166                   continue;
    167                 }
    168                 return FALSE;
    169               }
    170             } while( FindNextFileA(hFile,&stffile));
    171             FindClose (hFile);
    172           }
    173         }
    174         return TRUE;
     111        IEnumIDList * iface,
     112        LPCSTR lpszPath,
     113        DWORD dwFlags)
     114{
     115        ICOM_THIS(IEnumIDListImpl,iface);
     116
     117        LPITEMIDLIST    pidl=NULL;
     118        WIN32_FIND_DATAA stffile;
     119        HANDLE hFile;
     120        CHAR  szPath[MAX_PATH];
     121
     122        TRACE("(%p)->(path=%s flags=0x%08lx) \n",This,debugstr_a(lpszPath),dwFlags);
     123
     124        if(!lpszPath || !lpszPath[0]) return FALSE;
     125
     126        strcpy(szPath, lpszPath);
     127        PathAddBackslashA(szPath);
     128        strcat(szPath,"*.*");
     129
     130        /*enumerate the folders*/
     131        if(dwFlags & SHCONTF_FOLDERS)
     132        {
     133          TRACE("-- (%p)-> enumerate SHCONTF_FOLDERS of %s\n",This,debugstr_a(szPath));
     134          hFile = FindFirstFileA(szPath,&stffile);
     135          if ( hFile != INVALID_HANDLE_VALUE )
     136          {
     137            do
     138            {
     139              if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && strcmp (stffile.cFileName, ".") && strcmp (stffile.cFileName, ".."))
     140              {
     141                pidl = _ILCreateFolder (&stffile);
     142                if(pidl && AddToEnumList((IEnumIDList*)This, pidl))
     143                {
     144                  continue;
     145                }
     146                return FALSE;
     147              }
     148            } while( FindNextFileA(hFile,&stffile));
     149            FindClose (hFile);
     150          }
     151        }
     152
     153        /*enumerate the non-folder items (values) */
     154        if(dwFlags & SHCONTF_NONFOLDERS)
     155        {
     156          TRACE("-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n",This,debugstr_a(szPath));
     157          hFile = FindFirstFileA(szPath,&stffile);
     158          if ( hFile != INVALID_HANDLE_VALUE )
     159          {
     160            do
     161            {
     162              if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
     163              {
     164                pidl = _ILCreateValue(&stffile);
     165                if(pidl && AddToEnumList((IEnumIDList*)This, pidl))
     166                {
     167                  continue;
     168                }
     169                return FALSE;
     170              }
     171            } while( FindNextFileA(hFile,&stffile));
     172            FindClose (hFile);
     173          }
     174        }
     175        return TRUE;
    175176}
    176177
     
    179180 */
    180181static BOOL CreateDesktopEnumList(
    181         IEnumIDList * iface,
    182         DWORD dwFlags)
    183 {
    184         ICOM_THIS(IEnumIDListImpl,iface);
    185 
    186         LPITEMIDLIST    pidl=NULL;
    187         HKEY hkey;
    188         char    szPath[MAX_PATH];
    189 
    190         TRACE("(%p)->(flags=0x%08lx) \n",This,dwFlags);
    191 
    192         /*enumerate the root folders */
    193         if(dwFlags & SHCONTF_FOLDERS)
    194         {
    195           /*create the pidl for This item */
    196           pidl = _ILCreateMyComputer();
    197           if(pidl)
    198           {
    199             if(!AddToEnumList((IEnumIDList*)This, pidl))
    200               return FALSE;
    201           }
    202 
    203           if (! RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\desktop\\NameSpace", 0, KEY_READ, &hkey))
    204           {
    205             char iid[50];
    206             int i=0;
    207 
    208             while (1)
    209             {
    210               DWORD size = sizeof (iid);
    211 
    212               if (ERROR_SUCCESS!=RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL, NULL))
    213                 break;
    214 
    215               pidl = _ILCreateSpecial(iid);
    216 
    217               if(pidl)
    218                 AddToEnumList((IEnumIDList*)This, pidl);
    219 
    220               i++;
    221             }
    222             RegCloseKey(hkey);
    223           }
    224         }
    225 
    226         /*enumerate the elements in %windir%\desktop */
    227         SHGetSpecialFolderPathA(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
    228         CreateFolderEnumList( (IEnumIDList*)This, szPath, dwFlags);
    229        
    230         return TRUE;
     182        IEnumIDList * iface,
     183        DWORD dwFlags)
     184{
     185        ICOM_THIS(IEnumIDListImpl,iface);
     186
     187        LPITEMIDLIST    pidl=NULL;
     188        HKEY hkey;
     189        char    szPath[MAX_PATH];
     190
     191        TRACE("(%p)->(flags=0x%08lx) \n",This,dwFlags);
     192
     193        /*enumerate the root folders */
     194        if(dwFlags & SHCONTF_FOLDERS)
     195        {
     196          /*create the pidl for This item */
     197          pidl = _ILCreateMyComputer();
     198          if(pidl)
     199          {
     200            if(!AddToEnumList((IEnumIDList*)This, pidl))
     201              return FALSE;
     202          }
     203
     204          if (! RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\desktop\\NameSpace", 0, KEY_READ, &hkey))
     205          {
     206            char iid[50];
     207            int i=0;
     208
     209            while (1)
     210            {
     211              DWORD size = sizeof (iid);
     212
     213              if (ERROR_SUCCESS!=RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL, NULL))
     214                break;
     215
     216              pidl = _ILCreateSpecial(iid);
     217
     218              if(pidl)
     219                AddToEnumList((IEnumIDList*)This, pidl);
     220
     221              i++;
     222            }
     223            RegCloseKey(hkey);
     224          }
     225        }
     226#ifndef SHELL_NO_DESKTOP
     227        /*enumerate the elements in %windir%\desktop */
     228        SHGetSpecialFolderPathA(0, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
     229        CreateFolderEnumList( (IEnumIDList*)This, szPath, dwFlags);
     230#endif
     231        return TRUE;
    231232}
    232233
     
    235236 */
    236237static BOOL CreateMyCompEnumList(
    237         IEnumIDList * iface,
    238         DWORD dwFlags)
    239 {
    240         ICOM_THIS(IEnumIDListImpl,iface);
    241 
    242         LPITEMIDLIST    pidl=NULL;
    243         DWORD           dwDrivemap;
    244         CHAR            szDriveName[4];
    245         HKEY            hkey;
    246 
    247         TRACE("(%p)->(flags=0x%08lx) \n",This,dwFlags);
    248 
    249         /*enumerate the folders*/
    250         if(dwFlags & SHCONTF_FOLDERS)
    251         {
    252           dwDrivemap = GetLogicalDrives();
    253           strcpy (szDriveName,"A:\\");
    254           while (szDriveName[0]<='Z')
    255           {
    256             if(dwDrivemap & 0x00000001L)
    257             {
    258               pidl = _ILCreateDrive(szDriveName);
    259               if(pidl)
    260               {
    261                 if(!AddToEnumList((IEnumIDList*)This, pidl))
    262                   return FALSE;
    263               }
    264             }
    265             szDriveName[0]++;
    266             dwDrivemap = dwDrivemap >> 1;
    267           }
    268 
    269           TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",This);
    270           if (! RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\mycomputer\\NameSpace", 0, KEY_READ, &hkey))
    271           {
    272             char iid[50];
    273             int i=0;
    274 
    275             while (1)
    276             {
    277               DWORD size = sizeof (iid);
    278 
    279               if (ERROR_SUCCESS!=RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL, NULL))
    280                 break;
    281 
    282               pidl = _ILCreateSpecial(iid);
    283 
    284               if(pidl)
    285                 AddToEnumList((IEnumIDList*)This, pidl);
    286 
    287               i++;
    288             }
    289             RegCloseKey(hkey);
    290           }
    291         }
    292         return TRUE;
     238        IEnumIDList * iface,
     239        DWORD dwFlags)
     240{
     241        ICOM_THIS(IEnumIDListImpl,iface);
     242
     243        LPITEMIDLIST    pidl=NULL;
     244        DWORD           dwDrivemap;
     245        CHAR            szDriveName[4];
     246        HKEY            hkey;
     247
     248        TRACE("(%p)->(flags=0x%08lx) \n",This,dwFlags);
     249
     250        /*enumerate the folders*/
     251        if(dwFlags & SHCONTF_FOLDERS)
     252        {
     253          dwDrivemap = GetLogicalDrives();
     254          strcpy (szDriveName,"A:\\");
     255          while (szDriveName[0]<='Z')
     256          {
     257            if(dwDrivemap & 0x00000001L)
     258            {
     259              pidl = _ILCreateDrive(szDriveName);
     260              if(pidl)
     261              {
     262                if(!AddToEnumList((IEnumIDList*)This, pidl))
     263                  return FALSE;
     264              }
     265            }
     266            szDriveName[0]++;
     267            dwDrivemap = dwDrivemap >> 1;
     268          }
     269
     270          TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n",This);
     271          if (! RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\explorer\\mycomputer\\NameSpace", 0, KEY_READ, &hkey))
     272          {
     273            char iid[50];
     274            int i=0;
     275
     276            while (1)
     277            {
     278              DWORD size = sizeof (iid);
     279
     280              if (ERROR_SUCCESS!=RegEnumKeyExA(hkey, i, iid, &size, 0, NULL, NULL, NULL))
     281                break;
     282
     283              pidl = _ILCreateSpecial(iid);
     284
     285              if(pidl)
     286                AddToEnumList((IEnumIDList*)This, pidl);
     287
     288              i++;
     289            }
     290            RegCloseKey(hkey);
     291          }
     292        }
     293        return TRUE;
    293294}
    294295
     
    297298*/
    298299static BOOL DeleteList(
    299         IEnumIDList * iface)
    300 {
    301         ICOM_THIS(IEnumIDListImpl,iface);
    302 
    303         LPENUMLIST  pDelete;
    304 
    305         TRACE("(%p)->()\n",This);
    306        
    307         while(This->mpFirst)
    308         { pDelete = This->mpFirst;
    309           This->mpFirst = pDelete->pNext;
    310           SHFree(pDelete->pidl);
    311           SHFree(pDelete);
    312         }
    313         This->mpFirst = This->mpLast = This->mpCurrent = NULL;
    314         return TRUE;
     300        IEnumIDList * iface)
     301{
     302        ICOM_THIS(IEnumIDListImpl,iface);
     303
     304        LPENUMLIST  pDelete;
     305
     306        TRACE("(%p)->()\n",This);
     307
     308        while(This->mpFirst)
     309        { pDelete = This->mpFirst;
     310          This->mpFirst = pDelete->pNext;
     311          SHFree(pDelete->pidl);
     312          SHFree(pDelete);
     313        }
     314        This->mpFirst = This->mpLast = This->mpCurrent = NULL;
     315        return TRUE;
    315316}
    316317
     
    320321 */
    321322static HRESULT WINAPI IEnumIDList_fnQueryInterface(
    322         IEnumIDList * iface,
    323         REFIID riid,
    324         LPVOID *ppvObj)
    325 {
    326         ICOM_THIS(IEnumIDListImpl,iface);
    327 
    328         char    xriid[50];
    329         WINE_StringFromCLSID((LPCLSID)riid,xriid);
     323        IEnumIDList * iface,
     324        REFIID riid,
     325        LPVOID *ppvObj)
     326{
     327        ICOM_THIS(IEnumIDListImpl,iface);
     328
     329        char    xriid[50];
     330        WINE_StringFromCLSID((LPCLSID)riid,xriid);
    330331
    331332  dprintf(("SHELL32:enumidlist: IEnumIDList_fnQueryInterface((%p)->(\n\tIID:\t%s,%p)\n",
     
    334335           ppvObj));
    335336
    336         *ppvObj = NULL;
    337 
    338         if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
    339         { *ppvObj = This;
    340         }
    341         else if(IsEqualIID(riid, &IID_IEnumIDList))  /*IEnumIDList*/
    342         {    *ppvObj = (IEnumIDList*)This;
    343         }
    344 
    345         if(*ppvObj)
    346         { IEnumIDList_AddRef((IEnumIDList*)*ppvObj);
    347           TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
    348           return S_OK;
    349         }
    350        
    351         TRACE("-- Interface: E_NOINTERFACE\n");
    352         return E_NOINTERFACE;
     337        *ppvObj = NULL;
     338
     339        if(IsEqualIID(riid, &IID_IUnknown))          /*IUnknown*/
     340        { *ppvObj = This;
     341        }
     342        else if(IsEqualIID(riid, &IID_IEnumIDList))  /*IEnumIDList*/
     343        {    *ppvObj = (IEnumIDList*)This;
     344        }
     345
     346        if(*ppvObj)
     347        { IEnumIDList_AddRef((IEnumIDList*)*ppvObj);
     348          TRACE("-- Interface: (%p)->(%p)\n",ppvObj,*ppvObj);
     349          return S_OK;
     350        }
     351
     352        TRACE("-- Interface: E_NOINTERFACE\n");
     353        return E_NOINTERFACE;
    353354}
    354355
     
    357358 */
    358359static ULONG WINAPI IEnumIDList_fnAddRef(
    359         IEnumIDList * iface)
    360 {
    361         ICOM_THIS(IEnumIDListImpl,iface);
     360        IEnumIDList * iface)
     361{
     362        ICOM_THIS(IEnumIDListImpl,iface);
    362363
    363364  dprintf(("SHELL32:enumidlist: IEnumIDList_fnAddRef((%p)->(%lu)\n",
     
    365366           This->ref));
    366367
    367         shell32_ObjCount++;
    368         return ++(This->ref);
     368        shell32_ObjCount++;
     369        return ++(This->ref);
    369370}
    370371/******************************************************************************
     
    372373 */
    373374static ULONG WINAPI IEnumIDList_fnRelease(
    374         IEnumIDList * iface)
    375 {
    376         ICOM_THIS(IEnumIDListImpl,iface);
     375        IEnumIDList * iface)
     376{
     377        ICOM_THIS(IEnumIDListImpl,iface);
    377378
    378379  dprintf(("SHELL32:enumidlist: IEnumIDList_fnRelease((%p)->(%lu)\n",
     
    380381           This->ref));
    381382
    382         shell32_ObjCount--;
    383 
    384         if (!--(This->ref))
    385         { TRACE(" destroying IEnumIDList(%p)\n",This);
    386           DeleteList((IEnumIDList*)This);
    387           HeapFree(GetProcessHeap(),0,This);
    388           return 0;
    389         }
    390         return This->ref;
     383        shell32_ObjCount--;
     384
     385        if (!--(This->ref))
     386        { TRACE(" destroying IEnumIDList(%p)\n",This);
     387          DeleteList((IEnumIDList*)This);
     388          HeapFree(GetProcessHeap(),0,This);
     389          return 0;
     390        }
     391        return This->ref;
    391392}
    392393
     
    396397
    397398static HRESULT WINAPI IEnumIDList_fnNext(
    398         IEnumIDList * iface,
    399         ULONG celt,
    400         LPITEMIDLIST * rgelt,
    401         ULONG *pceltFetched)
    402 {
    403         ICOM_THIS(IEnumIDListImpl,iface);
    404 
    405         ULONG    i;
    406         HRESULT  hr = S_OK;
    407         LPITEMIDLIST  temp;
     399        IEnumIDList * iface,
     400        ULONG celt,
     401        LPITEMIDLIST * rgelt,
     402        ULONG *pceltFetched)
     403{
     404        ICOM_THIS(IEnumIDListImpl,iface);
     405
     406        ULONG    i;
     407        HRESULT  hr = S_OK;
     408        LPITEMIDLIST  temp;
    408409
    409410  dprintf(("SHELL32:enumidlist: IEnumIDList_fnNext((%p)->(%ld,%p, %p)\n",
     
    416417 * subsystems actually use it (and so may a third party browser)
    417418 */
    418         if(pceltFetched)
    419           *pceltFetched = 0;
    420 
    421         *rgelt=0;
    422        
    423         if(celt > 1 && !pceltFetched)
    424         { return E_INVALIDARG;
    425         }
    426 
    427         for(i = 0; i < celt; i++)
    428         { if(!(This->mpCurrent))
    429           { hr =  S_FALSE;
    430             break;
    431           }
    432           temp = ILClone(This->mpCurrent->pidl);
    433           rgelt[i] = temp;
    434           This->mpCurrent = This->mpCurrent->pNext;
    435         }
    436         if(pceltFetched)
    437         {  *pceltFetched = i;
    438         }
    439 
    440         return hr;
     419        if(pceltFetched)
     420          *pceltFetched = 0;
     421
     422        *rgelt=0;
     423
     424        if(celt > 1 && !pceltFetched)
     425        { return E_INVALIDARG;
     426        }
     427
     428        for(i = 0; i < celt; i++)
     429        { if(!(This->mpCurrent))
     430          { hr =  S_FALSE;
     431            break;
     432          }
     433          temp = ILClone(This->mpCurrent->pidl);
     434          rgelt[i] = temp;
     435          This->mpCurrent = This->mpCurrent->pNext;
     436        }
     437        if(pceltFetched)
     438        {  *pceltFetched = i;
     439        }
     440
     441        return hr;
    441442}
    442443
     
    445446*/
    446447static HRESULT WINAPI IEnumIDList_fnSkip(
    447         IEnumIDList * iface,ULONG celt)
    448 {
    449         ICOM_THIS(IEnumIDListImpl,iface);
    450 
    451         DWORD    dwIndex;
    452         HRESULT  hr = S_OK;
     448        IEnumIDList * iface,ULONG celt)
     449{
     450        ICOM_THIS(IEnumIDListImpl,iface);
     451
     452        DWORD    dwIndex;
     453        HRESULT  hr = S_OK;
    453454
    454455  dprintf(("SHELL32:enumidlist: IEnumIDList_fnSkip((%p)->(%lu)\n",
     
    456457           celt));
    457458
    458         for(dwIndex = 0; dwIndex < celt; dwIndex++)
    459         { if(!This->mpCurrent)
    460           { hr = S_FALSE;
    461             break;
    462           }
    463           This->mpCurrent = This->mpCurrent->pNext;
    464         }
    465         return hr;
     459        for(dwIndex = 0; dwIndex < celt; dwIndex++)
     460        { if(!This->mpCurrent)
     461          { hr = S_FALSE;
     462            break;
     463          }
     464          This->mpCurrent = This->mpCurrent->pNext;
     465        }
     466        return hr;
    466467}
    467468
     
    471472*/
    472473static HRESULT WINAPI IEnumIDList_fnReset(
    473         IEnumIDList * iface)
    474 {
    475         ICOM_THIS(IEnumIDListImpl,iface);
     474        IEnumIDList * iface)
     475{
     476        ICOM_THIS(IEnumIDListImpl,iface);
    476477
    477478  dprintf(("SHELL32:enumidlist: IEnumIDList_fnReset((%p)\n",
    478479           This));
    479480
    480         This->mpCurrent = This->mpFirst;
    481         return S_OK;
     481        This->mpCurrent = This->mpFirst;
     482        return S_OK;
    482483}
    483484/**************************************************************************
     
    485486*/
    486487static HRESULT WINAPI IEnumIDList_fnClone(
    487         IEnumIDList * iface,LPENUMIDLIST * ppenum)
    488 {
    489         ICOM_THIS(IEnumIDListImpl,iface);
     488        IEnumIDList * iface,LPENUMIDLIST * ppenum)
     489{
     490        ICOM_THIS(IEnumIDListImpl,iface);
    490491
    491492  dprintf(("SHELL32:enumidlist: IEnumIDList_fnClone((%p)->() to (%p)->() not implemented\n",
     
    493494           ppenum));
    494495
    495         return E_NOTIMPL;
     496        return E_NOTIMPL;
    496497}
    497498
     
    501502static ICOM_VTABLE (IEnumIDList) eidlvt =
    502503{
    503         ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
    504         IEnumIDList_fnQueryInterface,
    505         IEnumIDList_fnAddRef,
    506         IEnumIDList_fnRelease,
    507         IEnumIDList_fnNext,
    508         IEnumIDList_fnSkip,
    509         IEnumIDList_fnReset,
    510         IEnumIDList_fnClone,
     504        ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
     505        IEnumIDList_fnQueryInterface,
     506        IEnumIDList_fnAddRef,
     507        IEnumIDList_fnRelease,
     508        IEnumIDList_fnNext,
     509        IEnumIDList_fnSkip,
     510        IEnumIDList_fnReset,
     511        IEnumIDList_fnClone,
    511512};
    512513
     
    517518
    518519IEnumIDList * IEnumIDList_Constructor(
    519         LPCSTR lpszPath,
    520         DWORD dwFlags,
    521         DWORD dwKind)
    522 {
    523         IEnumIDListImpl*        lpeidl;
    524         BOOL                    ret = FALSE;   
    525 
    526         lpeidl = (IEnumIDListImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumIDListImpl));
     520        LPCSTR lpszPath,
     521        DWORD dwFlags,
     522        DWORD dwKind)
     523{
     524        IEnumIDListImpl*        lpeidl;
     525        BOOL                    ret = FALSE;
     526
     527        lpeidl = (IEnumIDListImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumIDListImpl));
    527528
    528529  dprintf(("SHELL32:enumidlist: IEnumIDList_Constructor((%p)->(%08xh flags=0x%08lx kind=0x%08lx)\n",
     
    532533           dwKind));
    533534
    534         if (lpeidl)
    535         {
    536           lpeidl->ref = 1;
    537           lpeidl->lpvtbl = &eidlvt;
    538 
    539           switch (dwKind)
    540           {
    541             case EIDL_DESK:
    542               ret = CreateDesktopEnumList((IEnumIDList*)lpeidl, dwFlags);
    543               break;
    544 
    545             case EIDL_MYCOMP:
    546               ret = CreateMyCompEnumList((IEnumIDList*)lpeidl, dwFlags);
    547               break;
    548 
    549             case EIDL_FILE:
    550               ret = CreateFolderEnumList((IEnumIDList*)lpeidl, lpszPath, dwFlags);
    551               break;
    552           }
    553 
    554           if(ret)
    555           {
    556             shell32_ObjCount++;
    557           }
    558           else
    559           {
    560             if (lpeidl)
    561             {
    562               HeapFree(GetProcessHeap(),0,lpeidl);
    563             }
    564           }
    565         }
    566 
    567         TRACE("-- (%p)->()\n",lpeidl);
    568 
    569         return (IEnumIDList*)lpeidl;
    570 }
    571 
     535        if (lpeidl)
     536        {
     537          lpeidl->ref = 1;
     538          lpeidl->lpvtbl = &eidlvt;
     539
     540          switch (dwKind)
     541          {
     542            case EIDL_DESK:
     543              ret = CreateDesktopEnumList((IEnumIDList*)lpeidl, dwFlags);
     544              break;
     545
     546            case EIDL_MYCOMP:
     547              ret = CreateMyCompEnumList((IEnumIDList*)lpeidl, dwFlags);
     548              break;
     549
     550            case EIDL_FILE:
     551              ret = CreateFolderEnumList((IEnumIDList*)lpeidl, lpszPath, dwFlags);
     552              break;
     553          }
     554
     555          if(ret)
     556          {
     557            shell32_ObjCount++;
     558          }
     559          else
     560          {
     561            if (lpeidl)
     562            {
     563              HeapFree(GetProcessHeap(),0,lpeidl);
     564            }
     565          }
     566        }
     567
     568        TRACE("-- (%p)->()\n",lpeidl);
     569
     570        return (IEnumIDList*)lpeidl;
     571}
     572
Note: See TracChangeset for help on using the changeset viewer.