Writing to '\\.\X:' that has no backing PhysicalDrive?
Ilya Basin
basinilya@gmail.com
Sun Dec 29 18:11:57 GMT 2024
Thanks Christian.
exec 4> /proc/sys/DosDevices/E:
works.
-------- Original Message --------
From: Christian Franke via Cygwin <cygwin@cygwin.com>
Sent: Thursday, October 24, 2024 at 9:50 PM UTC+4
To: cygwin@cygwin.com
Cc: Christian Franke <Christian.Franke@t-online.de>
Subject: RE: Writing to '\\.\X:' that has no backing PhysicalDrive?
Ilya Basin via Cygwin wrote:
>> Hi.
>> I was trying to write an .img file to a VeraCrypt drive.
>> VeraCrypt doesn't create a virtual PhysicalDrive so tools like Rufus don't see it.
>> I hoped that with cygwin I would be able to do that, but Cygwin only creates /dev/sd?? nodes for PhysicalDrive partitions.
>> I tried `dd` with '\\.\X:', but it can't open for writing because it treats it as a directory (reading succeeds).
>>
>> $ dd count=1 if='\\.\E:' | xxd
>> 1+0 records in
>> 1+0 records out
>> 512 bytes copied, 0.0213007 s, 24.0 kB/s
>> 00000000: eb52 904e 5446 5320 2020 2000 0208 0000 .R.NTFS .....
>> ...
>>
>> $ dd if=/dev/null count=0 of='\\.\E:'
>> dd: failed to open '\\.\E:': Is a directory
Could reproduce this. The inconsistency between open for reading vs. writing of '\\.\E:' is actually interesting. Subtle bug in Cygwin?
>>
>> Same error in MSYS2.
>>
>> Does cygwin provide some (hidden) /dev/ nodes for drive letters or volumes like "\\?\Volume{GUID}"? Can I create one with mknod?
Alternatively, VeraCrypt Volumes could be accessed via:
$ ls -l /proc/sys/DosDevices/E:
lr--r--r-- 1 ... /proc/sys/DosDevices/E: -> /proc/sys/Device/VeraCryptVolumeE
But /proc/sys is completely R/O like /proc/registry, so you cannot write the image via this path.
OT:
/proc/sys/Device/HarddiskVolumeShadowCopyN[/PATH/TO/FILE] allows to read the image and individual files from a volume shadow copy.
More information about the Cygwin
mailing list