alphaleonis / AlphaFS

AlphaFS is a .NET library providing more complete Win32 file system functionality to the .NET platform than the standard System.IO classes.
http://alphafs.alphaleonis.com/
MIT License
558 stars 99 forks source link

File.Copy using \\?\Volume{guid} syntax throws not ready error #520

Open EricZimmerman opened 4 years ago

EricZimmerman commented 4 years ago

I am trying to copy files off an NTFS volume using the following syntax:

File.Copy(@"\?\Volume{2b0bf6a2-b2fb-4893-872a-5e4b19072ee2}\Users\e\AppData\Roaming\Microsoft\Windows\Recent!ForDDrive.lnk",@"C:\temp\1.lnk",CopyOptions.None)

but am always getting an exception about the device not being ready:

(21) The device is not ready: [\?\Volume{2b0bf6a2-b2fb-4893-872a-5e4b19072ee2}]

yet, if i navigate to that folder in Windows, i see a directory listing with the files, etc:

\?\Volume{2b0bf6a2-b2fb-4893-872a-5e4b19072ee2}\Users\e\AppData\Roaming\Microsoft\Windows\Recent

i have used this same path with other parts of AlphaFS and it works fine, so not sure why this is not working. i tried using PathFormat options too and it still did the same thing.

i looked at the unit test example to access things via shadow copies that uses GLOBALROOT to see if that shed any light on things, but it did not.

based on the stack, i think the issue is with the call to Directory.ExistsDrive.cs on line 76 as i had to use a different approach earlier in my project. if you do just Directory.Exists, it works, but the ExistsDrive thing explodes.

stack:

at Alphaleonis.Win32.Filesystem.Directory.ExistsDriveOrFolderOrFile(KernelTransaction transaction, String path, Boolean isFolder, Int32 lastError, Boolean throwIfDriveNotExists, Boolean throwIfFolderOrFileNotExists) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\Directory Class\Directory.ExistsDrive.cs:line 76 at Alphaleonis.Win32.Filesystem.File.CopyMoveCore(KernelTransaction transaction, Boolean driveChecked, Boolean isFolder, String sourcePath, String destinationPath, Nullable1 copyOptions, Nullable1 moveOptions, Boolean preserveDates, CopyMoveProgressRoutine progressHandler, Object userProgressData, CopyMoveResult copyMoveResult, PathFormat pathFormat) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 761 at Alphaleonis.Win32.Filesystem.File.Copy(String sourcePath, String destinationPath, CopyOptions copyOptions, PathFormat pathFormat) in C:\Users\jjangli\Documents\GitHub\AlphaFS\AlphaFS\Filesystem\File Class\File.Copy.cs:line 282 at kape.Classes.Copy.RawDiskLibCopy.Copy(String vssMountDirectory, Boolean deduplicate, Boolean usingContainer, TimeSpan findTime) in D:\Code\kape\kape\Classes\Copy\RawDiskLibCopy.cs:line 371

dpps5387690 commented 3 years ago

Any patch this bug method?

semwarden commented 1 year ago

Is there any fix for this bug? I'm facing the same problem. Can someone describes, how they solved this bug? Thank you