using IO_IOCTL_FIND_NEXT_FILE

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

using IO_IOCTL_FIND_NEXT_FILE

Jump to solution
1,088 Views
Wanderer
Contributor II

I want to be able to scroll through available files on a disk without knowing the file names beforehand.

 

I am trying to modify the MFSUG example, "List all files and subdirectories in a directory", by creating subroutines for both IO_IOCTL_FIND_FIRST_FILE and IO_IOCTL_FIND_NEXT_FILE.  For example, main() calls find_first_file() then subsequently calls find_next_file() each time I want to know the next file.

 

For some reason, MFS_SEARCH_DATA struct gets reset each time I call IO_IOCTL_FIND_NEXT_FILE so the required previous file is not saved.

 

Any ideas?

 

Thanks, gj

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
571 Views
PetrM
Senior Contributor I

Hello,

 

it does not create a list of any kind. The search data only contain information about one (last) file that matched your search criteria. You have to save the information needed yourself after each find-next-search.

 

PetrM

 

View solution in original post

0 Kudos
Reply
3 Replies
571 Views
oliviachristyva
Contributor III

Hi guys,

I am working with the same thing. I reached till directory listing all the files but I dont know how to configure IO_IOCTL_FIND_FIRST_FILE and IO_IOCTL_FIND_NEXT_FILE to find the file I want from a USB stick .Please share your snippet to find the files and save it in a buffer.

Regards,

Olivia

0 Kudos
Reply
572 Views
PetrM
Senior Contributor I

Hello,

 

it does not create a list of any kind. The search data only contain information about one (last) file that matched your search criteria. You have to save the information needed yourself after each find-next-search.

 

PetrM

 

0 Kudos
Reply
571 Views
Wanderer
Contributor II

Thanks PetrM,

 

Defining MFS_SEARCH_DATA struct as STATIC worked.  


Cheers, gj

0 Kudos
Reply