How to make windows read all .dll files while scanning the c: drive : <p>I am trying to make file scanner that scans for dlls. I try to scan my C: Drive but it doesn't scan the whole thing it just scans the portion with some random .txt and .sys files</p>

<pre><code>using System;
using System.IO;
using System.Diagnostics;
using System.Threading;

namespace DLLScanner
{
class CheaterBeater

{
        static System.Collections.Specialized.StringCollection log = new System.Collections.Specialized.StringCollection();
        static void Main ()
        {
            string[] drives = System.Environment.GetLogicalDrives ();   

            foreach (string dr in drives) {
                System.IO.DriveInfo di = new System.IO.DriveInfo (dr);

                if (!di.IsReady) {
                    Console.WriteLine ("The drive {0} could not be read or processed (32 Bit System)", di.Name);
                    continue;
                }
                System.IO.DirectoryInfo rootDir = di.RootDirectory;
                WalkDirectoryTree (rootDir);
            }

            Console.WriteLine ("These are files with restricted access or could not be processed:");
            foreach (string s in log) {
                Console.WriteLine (s);
            }
            Console.WriteLine ("Press any key to exit");
            Console.ReadKey ();
        }

        static void WalkDirectoryTree (System.IO.DirectoryInfo root)
        {
            System.IO.FileInfo[] files = null;
            System.IO.DirectoryInfo[] subDirs = null;

            // First, process all the files directly under this folder
            try {
                files = root.GetFiles ("*.*");
            } catch (UnauthorizedAccessException e) {

                log.Add (e.Message);
            } catch (System.IO.DirectoryNotFoundException e) {
                Console.WriteLine (e.Message);
            }

            if (files != null) {
                foreach (System.IO.FileInfo fi in files) {
                    Console.WriteLine (fi.FullName);
                }
            }

        }   }
}
</code></pre>

<p>Any help is appreciated :)</p>
