This StackOverflow question has an answer that requires the volume to be locked/dismounted, but it seems this is not necessarily required. When I use the hex editor HxD (Tools
> Open disk
) to open a volume (logical disks) or a physical disk, I can open C:
and even the SSD it is in seamlessly. I can keep using the C drive without problems, and HxD updates its content.
Also, when I use MSVC, with fopen("\\.\D:", "rb")
and fgetc()
, I am able to read the first byte of the raw disk/volume D:
. This also happens with MinGW, which I think links to MSVC’s library.
So, how can I do this using the Win32 API? Or is MSVC doing sinister things that are not normally done by the Win32 API?