RCODE FTKAPI F_DirHdl::next( void)
{
	char					szFoundPath[ F_PATH_MAX_SIZE];
	char					szDummyPath[ F_PATH_MAX_SIZE];
	FLMUINT				uiSearchAttributes;
	FLMUINT				uiFoundAttrib;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();

	if( RC_BAD( m_rc))
	{
		goto Exit;
	}

	uiSearchAttributes =
		F_IO_FA_NORMAL | F_IO_FA_RDONLY | F_IO_FA_ARCHIVE | F_IO_FA_DIRECTORY;

	for( ;;)
	{
		if( m_bFirstTime)
		{
			m_bFirstTime = FALSE;

			if( RC_BAD( m_rc = f_fileFindFirst( m_szDirectoryPath, 
				uiSearchAttributes, &m_FindData, szFoundPath, &uiFoundAttrib)))
			{
				goto Exit;
			}
			
			m_bFindOpen = TRUE;
			m_uiAttrib = uiFoundAttrib;
		}
		else
		{
			if( RC_BAD( m_rc = f_fileFindNext( &m_FindData, 
				szFoundPath, &uiFoundAttrib)))
			{
				goto Exit;
			}
			
			m_uiAttrib = uiFoundAttrib;
		}

		if( RC_BAD( m_rc = pFileSystem->pathReduce( szFoundPath, 
			szDummyPath, m_szFileName)))
		{
			goto Exit;
		}

		if( pFileSystem->doesFileMatch( m_szFileName, m_szPattern))
		{
			break;
		}
	}

Exit:

	return( m_rc);
}
RCODE FTKAPI F_DirHdl::next( void)
{
	LONG					lError = 0;
	IF_FileSystem *	pFileSystem = f_getFileSysPtr();
	
	if( RC_BAD( m_rc))
	{
		goto Exit;
	}

	for( ;;)
	{
		if( (lError = DirectorySearch( 0, m_FindData.lVolumeNumber, 
			m_FindData.lDirectoryNumber, LONGNameSpace, 
			m_FindData.lCurrentEntryNumber, (BYTE *)"\x02\xFF*",
			-1, &m_FindData.pCurrentItem, 
			&m_FindData.lCurrentEntryNumber)) != 0)
		{
			if( (lError == ERR_NO_FILES_FOUND) || (lError == ERR_INVALID_PATH))
			{
				m_rc = RC_SET( NE_FLM_IO_NO_MORE_FILES);
			}
			else
			{
				m_rc = f_mapPlatformError( lError, NE_FLM_READING_FILE);
			}
			
			break;
		}

		if( pFileSystem->doesFileMatch( 
			(const char *)m_FindData.pCurrentItem->DFileName, m_szPattern))
		{
			break;
		}
	}
	
Exit:

	return( m_rc);
}