Ignore:
Timestamp:
Mar 29, 2000, 5:24:08 PM (25 years ago)
Author:
cbratschi
Message:

onopen fix, FindFirstFileMultiA, "shell.dll" icon fix, load exe icons

File:
1 edited

Legend:

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

    r3250 r3271  
    1 /* $Id: enumidlist.cpp,v 1.3 2000-03-27 15:09:19 cbratschi Exp $ */
     1/* $Id: enumidlist.cpp,v 1.4 2000-03-29 15:24:03 cbratschi Exp $ */
    22
    33/*
     
    187187        ICOM_THIS(IEnumIDListImpl,iface);
    188188
     189        const MULTICOUNT = 64;
    189190        LPITEMIDLIST    pidl=NULL;
    190         WIN32_FIND_DATAA stffile;
     191        WIN32_FIND_DATAA *stffile = NULL;
     192        DWORD count;
    191193        HANDLE hFile;
    192194        CHAR  szPath[MAX_PATH];
     
    204206        {
    205207          TRACE("-- (%p)-> enumerate SHCONTF_FOLDERS of %s\n",This,debugstr_a(szPath));
    206           hFile = FindFirstFileA(szPath,&stffile);
    207           if ( hFile != INVALID_HANDLE_VALUE )
     208          count = MULTICOUNT;
     209          stffile = (WIN32_FIND_DATAA*)malloc(count*sizeof(WIN32_FIND_DATAA));
     210          hFile = FindFirstFileMultiA(szPath,stffile,&count);
     211          if (hFile != INVALID_HANDLE_VALUE)
    208212          {
    209213            do
    210214            {
    211               if (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
    212               { //directory
    213                 if (strcmp (stffile.cFileName, ".") && strcmp (stffile.cFileName, ".."))
    214                 {
    215                   pidl = _ILCreateFolder (&stffile);
    216                   if(pidl && AddToEnumList((IEnumIDList*)This, pidl))
     215              for (int x = 0;x < count;x++)
     216              {
     217                if (stffile[x].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
     218                { //directory
     219                  if (strcmp (stffile[x].cFileName, ".") && strcmp (stffile[x].cFileName, ".."))
    217220                  {
     221                    pidl = _ILCreateFolder (&stffile[x]);
     222                    if (pidl && AddToEnumList((IEnumIDList*)This, pidl))
     223                      continue;
     224                    free(stffile);
     225                    FindClose(hFile);
     226                    return FALSE;
     227                  }
     228                } else if (dwFlags & SHCONTF_NONFOLDERS)
     229                { //file
     230                  pidl = _ILCreateValue(&stffile[x]);
     231                  if (pidl && AddToEnumList2((IEnumIDList*)This, pidl))
    218232                    continue;
    219                   }
     233                  free(stffile);
     234                  FindClose(hFile);
    220235                  return FALSE;
    221236                }
    222               } else if (dwFlags & SHCONTF_NONFOLDERS)
    223               { //file
    224                 pidl = _ILCreateValue(&stffile);
    225                 if(pidl && AddToEnumList2((IEnumIDList*)This, pidl))
    226                 {
    227                   continue;
    228                 }
    229                 return FALSE;
    230237              }
    231             } while( FindNextFileA(hFile,&stffile));
    232             FindClose (hFile);
     238            } while(FindNextFileMultiA(hFile,stffile,&(count = MULTICOUNT)));
     239            FindClose(hFile);
    233240            UniteEnumLists((IEnumIDList*)This);
    234241          }
     
    239246        {
    240247          TRACE("-- (%p)-> enumerate SHCONTF_NONFOLDERS of %s\n",This,debugstr_a(szPath));
    241           hFile = FindFirstFileA(szPath,&stffile);
    242           if ( hFile != INVALID_HANDLE_VALUE )
     248          count = MULTICOUNT;
     249          if (!stffile) stffile = (WIN32_FIND_DATAA*)malloc(count*sizeof(WIN32_FIND_DATAA));
     250          hFile = FindFirstFileMultiA(szPath,stffile,&count);
     251          if (hFile != INVALID_HANDLE_VALUE)
    243252          {
    244253            do
    245254            {
    246               if (! (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
     255              for (int x = 0;x < count;x++)
    247256              {
    248                 pidl = _ILCreateValue(&stffile);
    249                 if(pidl && AddToEnumList((IEnumIDList*)This, pidl))
     257                if (! (stffile[x].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) )
    250258                {
    251                   continue;
     259                  pidl = _ILCreateValue(&stffile[x]);
     260                  if (pidl && AddToEnumList((IEnumIDList*)This, pidl))
     261                    continue;
     262                  free(stffile);
     263                  FindClose(hFile);
     264                  return FALSE;
    252265                }
    253                 return FALSE;
    254266              }
    255             } while( FindNextFileA(hFile,&stffile));
     267            } while(FindNextFileMultiA(hFile,stffile,&(count = MULTICOUNT)));
    256268            FindClose (hFile);
    257269          }
    258270        }
     271        if (stffile) free(stffile);
     272
    259273        return TRUE;
    260274}
Note: See TracChangeset for help on using the changeset viewer.