I can't give you a complete solution, but hopefully this could point you in the right direction.
We did something similar once, but our app did not search in the complete file system, but only in the current directory.
The functions we needed to use were:
_chdir
_findfirst
_findnext
_findclose
Here's some example code (from a Microsoft page):
<pre>
// crt_find.c
// This program uses the 32-bit _find functions to print
// a list of all files (and their attributes) with a .C extension
// in the current directory.
#include <stdio.h>
#include <stdlib.h>
#include <io.h>
#include <time.h>
int main( void )
{
struct _finddata_t c_file;
intptr_t hFile;
// Find first .c file in current directory
if( (hFile = _findfirst( "*.c", &c_file )) == -1L )
printf( "No *.c files in current directory!n" );
else
{
printf( "Listing of .c filesnn" );
printf( "RDO HID SYS ARC FILE DATE %25c SIZEn", ' ' );
printf( "--- --- --- --- ---- ---- %25c ----n", ' ' );
do {
char buffer[30];
printf( ( c_file.attrib & _A_RDONLY ) ? " Y " : " N " );
printf( ( c_file.attrib & _A_HIDDEN ) ? " Y " : " N " );
printf( ( c_file.attrib & _A_SYSTEM ) ? " Y " : " N " );
printf( ( c_file.attrib & _A_ARCH ) ? " Y " : " N " );
ctime_s( buffer, _countof(buffer), &c_file.time_write );
printf( " %-12s %.24s %9ldn",
c_file.name, buffer, c_file.size );
} while( _findnext( hFile, &c_file ) == 0 );
_findclose( hFile );
}
}</pre>
And here are some documentation links:
<a href="http://msdn.microsoft.com/en-us/library/bf7fwze1.aspx">_chdir, _wchdir</a>
<a href="http://msdn.microsoft.com/en-us/library/zyzxfzac(VS.71).aspx">_findfirst, _findfirst64, _findfirsti64, _wfindfirst, _wfindfirst64, _wfindfirsti64</a>
<a href="http://msdn.microsoft.com/en-us/library/6tkkkc1y.aspx">_findnext, _wfindnext</a>
<a href="http://msdn.microsoft.com/en-us/library/0165cecc.aspx">_findclose</a>
Hope this helps.