C
Computer Guru
Hello All,
I'm at my wit's end on this one, and would appreciate any help or
insight that could be given.
Environment: Windows Vista x64 ONLY
Code:
//START BUG
string bcdedit = Environment.SystemDirectory + @"\bcdedit.exe";
Console.WriteLine(bcdedit);
if (File.Exists(bcdedit))
Console.WriteLine("bcdedit.exe found at location" + bcdedit);
else
Console.WriteLine("bcdedit.exe was not found at " + bcdedit);
//END BUG
Output:
C:\Windows\System32\bcdedit.exe
bcdedit.exe was not found at location C:\Windows\System32\bcdedit.exe
----------------------
Problem is.... I *KNOW* the file exists in C:\Windows\System32\ and
that its name is bcdedit.exe
I can see the file, I can access it, I can copy it, and I can just
about anything else that I want with it.
To me, finding files should be like duck typing:
If you can see the duck and you can copy the duck, then the duck
definitely exists.
SO
The duck exists. It's there for sure. Yet the .NET 2.0 (or is it 3.0
in Vista? I forget) Framework can't see it :/
Perhaps someone can point me in the right direction here?
This code works just fine on Vista x86.
Is this really a .NET bug?
NOTE: Attempting to access the file (without checking that it exists)
crashes the program - as is expected from the above behavior.
Desperately awaiting a sane explanation to all this.
-CG
I'm at my wit's end on this one, and would appreciate any help or
insight that could be given.
Environment: Windows Vista x64 ONLY
Code:
//START BUG
string bcdedit = Environment.SystemDirectory + @"\bcdedit.exe";
Console.WriteLine(bcdedit);
if (File.Exists(bcdedit))
Console.WriteLine("bcdedit.exe found at location" + bcdedit);
else
Console.WriteLine("bcdedit.exe was not found at " + bcdedit);
//END BUG
Output:
C:\Windows\System32\bcdedit.exe
bcdedit.exe was not found at location C:\Windows\System32\bcdedit.exe
----------------------
Problem is.... I *KNOW* the file exists in C:\Windows\System32\ and
that its name is bcdedit.exe
I can see the file, I can access it, I can copy it, and I can just
about anything else that I want with it.
To me, finding files should be like duck typing:
If you can see the duck and you can copy the duck, then the duck
definitely exists.
SO
The duck exists. It's there for sure. Yet the .NET 2.0 (or is it 3.0
in Vista? I forget) Framework can't see it :/
Perhaps someone can point me in the right direction here?
This code works just fine on Vista x86.
Is this really a .NET bug?
NOTE: Attempting to access the file (without checking that it exists)
crashes the program - as is expected from the above behavior.
Desperately awaiting a sane explanation to all this.
-CG