Win32 Write RAW Physical Disk Python 3.3.2

khanta khanta at gmail.com
Wed Feb 19 07:42:02 EST 2014


Hello,
 I am trying to write to the raw physical disk on Windows 8.1 but I
get an error:
PermissionError: [Errno 13] Permission denied: '\\\\.\\PHYSICALDRIVE2\\\\'

OS: Windows 8.1
Python: 3.3.2
Drive is a USB drive
Running as administrator

Code Snippet:

       with open(r"\\.\PHYSICALDRIVE2\\", "rb+") as f:  #Writing Binary!
            f.seek(unallocatedoffset + 0)
            f.write(t1)


or

        with open('\\\\.\\PHYSICALDRIVE2\\', "rb+") as f:  #Writing Binary!
            f.seek(unallocatedoffset + 0)
            f.write(t1)

or

f = os.fdopen(os.open('\\\\.\\PHYSICALDRIVE2\\' os.O_CREAT |
os.O_WRONLY | os.O_APPEND | os.O_EXCL))


Any suggestions?  Is it possible?



More information about the Python-list mailing list