Search code examples
c#exceptionntfsinvalidargumentexception

Invalid disk name while creating object of RawDiskLibrary


I am trying to use NTFS to search files from my drive, for which I faced the attached exception while trying to create object of RAWDiskLibrary. I have C, D, E drives and having this issue while I select any of the drives. Please help me in this regard.

Exception details: Code: const char driveLetter = 'E'; RawDisk disk = new RawDisk(driveLetter); Exception:

                System.ArgumentException
                HResult=0x80070057
                Message=Invalid diskName: \\.\E:
               `enter code here` Source=RawDiskLib

Thanks

https://i.sstatic.net/VlsgK.jpg


Solution

  • Run the visual studio as administrator. It will work :-).