[Declares] Fastest way to scan folders?

The following will give you a list of directory entries, very quickly (on Win32 target at least).

Function FastItems(extends f as FolderItem) As FolderItem()
  #if Not TargetWin32
    return nil
   #endif
    // Return all of the files within a folder in the quickest way possible.
    // courtesy: http://forums.realsoftware.com/viewtopic.php?f=1&t=13692&st=0&sk=t&sd=a&hilit=folderItem+aaron&start=15
    // With modificaitons by me to use NativePath, corrected a minor bug and ignore ".", ".." entries.
    // NOTE: This is windows only....XP to present.
    
    Soft Declare Function FindFirstFileA Lib "Kernel32" ( path as CString, data as Ptr ) as Integer
    Soft Declare Function FindFirstFileW Lib "Kernel32" ( path as WString, data as Ptr ) as Integer
    Soft Declare Function FindNextFileA Lib "Kernel32" ( handle as Integer, data as Ptr ) as Boolean
    Soft Declare Function FindNextFileW Lib "Kernel32" ( handle as Integer, data as Ptr ) as Boolean
    Declare Sub FindClose Lib "Kernel32" ( handle as Integer )
    
    dim ret( -1 ) as FolderItem
    dim handle as Integer
    
    // Sanity check
    if not f.Directory then return ret
    
    dim data as MemoryBlock
    if System.IsFunctionAvailable( "FindFirstFileW", "Kernel32" ) then
      data = new MemoryBlock( 592 )
      handle = FindFirstFileW( f.NativePath + "*.*", data )
    else
      data = new MemoryBlock( 318 )
      handle = FindFirstFileA( f.NativePath + "*.*", data )
    end if
    
    if handle <> -1 then
      // Loop over all of the items in using the handle and the find data
      dim done as Boolean
      do
        // Add the current item
        dim temp as FolderItem
        if System.IsFunctionAvailable( "FindFirstFileW", "Kernel32" ) then
          temp = GetFolderItem(f.NativePath+data.WString(44),FolderItem.PathTypeNative)   //FolderItem( data.WString( 44 ), FolderItem.PathTypeAbsolute )
          
          // Loop to the next item
          done = FindNextFileW( handle, data )
        else
          temp = GetFolderItem(f.NativePath+data.WString(44),FolderItem.PathTypeNative)   //FolderItem( data.WString( 44 ), FolderItem.PathTypeAbsolute )
          
          // Loop to the next item
          done = FindNextFileA( handle, data )
        end if
        
        // Add the current item to our list
        // Ignore . and ..
        Dim tmpString as String = temp.Name
        If tmpString <> "." and tmpString <> ".." then
          ret.Append( temp )
        End If
      loop until not done
      
      FindClose( handle )
    end if
    
    return ret
End Function