I created a little program on python that reads the boot sector at a low level so it will not corrupt the device. I successfully ran this program yesterday in Linux and I got the idea to do the same thing in Windows. But the only problem that came was that I wasn't enabled to read for example:\Device\Harddisk0\Partition1
, the boot partition or \Device\Harddisk0\DR0
, the raw disk 0. Each time that I try it throws an error: No such a file or a directory
What I am doing wrong?
The Correct Way To Do It Is:
import os
disk_fd = os.open( r"\\.\PhysicalDrive0", os.O_RDONLY | os.O_BINARY)
data = os.read(disk_fd, 512)
os.close(disk_fd)
Thanks To @eryksun