c++ - How do I find out what physical drive a file is on? -
i find out physical media file on (either filename or handle).
i've read here can determine physical drive of given partition handle deviceiocontrol
call.
but how partition handle filename? (because ntfs allows mount partitions in folders, can't go drive letter.)
the reason i'm asking copying file physical drive fastest when using asynchronous methods, on same drive fastest when done synchronously larger buffer. want write function determine optimum copying algorithm given file , destination.
volumes in windows mapped drive letters (except on network shares).
you can create volume file device handle on source , destination using createfile()
passing in drive letter path (ie: \\.\c:\). use returned handle deviceiocontrol()
. compare physical drives between source , destination, , should good.
discussion explained here: "to obtain physical drive identifier volume, open ..." http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx