Win32 Write RAW Physical Disk Python 3.3.2

khanta at gmail.com khanta at gmail.com
Fri Feb 21 16:32:35 EST 2014


Can anyone tell me if it is not possible?  It would save me a lot of time.
Has anyone ever written to the raw disk on windows? 



On Wednesday, February 19, 2014 7:42:02 AM UTC-5, khanta wrote:
> 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