DirectoryInfo.GetFiles () Doesn't return all files
I'm just experimenting a bit with my own folder browser. I notice that when I look at the System32 folder in Windows 7 I get some strange results. Here's the code:
DataTable dt=new DataTable();
string Folder="C:\\Windows\\System32";
DirectoryInfo DI = new DirectoryInfo(Folder);
foreach (FileInfo FI in DI.GetFiles())
{
DataRow Row = dt.NewRow();
if(FI.Name== "accelerometerdll.DLL")
{
}
Row["Name"] = FI.Name;
Row["Created"] = FI.CreationTime;
Row["Size"] = FI.Length;
dt.Rows.Add(Row);
}
dataGridView1.DataSource = dt;
The list of files is incomplete at startup. The total number of files disabled is over 400 files compared to Windows Explorer.
There is a simple file checker named "accelometerdll.dll" to try and fix this problem. This file is absolutely located in the System32 folder. I can see it in Explorer and I can see it in the command window when I do DIR . However, this never shows up in my datatable. The condition is never met. It looks like it's just invisible. I tried to run this as administrator with the same results.
Even more annoying is that it shows a file called "12520437.cpx" and I can't see it in either explorer or command window. It seems to be in the SysWOW64 folder and not the System32 folder ???
My main goal here is to show EXACTLY the same files that explorer shows when opening any folder.
Any ideas?
source to share