Iam trying to access a physical cdrom device in order to check if it is bootable so i need to read bytes from it. I’ve tried the following 2 ways with no luck:
Method A:
FileStream stream = new FileStream(H:, FileMode.Open);
but i get access denied on H:. which i know i have access.
Method B:
Through Pinvoke
IntPtr handle = CreateFile(source, FileAccess.Read, FileShare.ReadWrite, 0, FileMode.Open, 0, IntPtr.Zero);
binReader = new BinaryReader(new FileStream(handle, FileAccess.Read,true));
But i get:
FileStream will not open Win32 devices such as disk partitions and tape drives.
Avoid use of “\.\” in the path.
Is there any way to accomplish what i want in c#?
Thanks alot
ok … problem was the difference between a DVD and a CD … obviously we cant read DVDs that way … but here you go …