C:をFileStreamで直接開こうとしましたが成功しませんでした:
new FileStream("C:", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
System.UnauthorizedAccessExceptionが処理されませんでした
Message ="パス'C:\'へのアクセスが拒否されました。"
Source = "mscorlib"
スタックトレース:
in System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) in System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) in System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) in ReadingMftNewTest.Program.Main(String[] args) in D:\CS\2008\ReadingMftNewTest\ReadingMftNewTest\Program.cs:line 76
「C:」を開いたのに、エラーに「C:\」と表示されていることに注意してください。このスラッシュはどこから来たのですか?:\
CreateFile
APIを使用せずにC:を開く機会はありますか?
このコードはWIN32APIをサポートしないMonoでも実行する必要があるため、WIN32 APIに依存したくありませんが、通常のFileStream(Mono 1 Microsoft 0)でデバイスを正常に開くことができます。