2011-06-29 5 views
4

私はLinuxで/ dev/sdaと同じくらい簡単ですが、Windowsではどのようにディスクを開き、低レベルでデータを読み始めますか? PythonでWindowsでディスクを開き、低レベルでデータを読み取る方法は?

私が試してみた:

f = open("K:", "r") 

をし、私はこのエラーを取得する:

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
IOError: [Errno 13] Permission denied: 'K:' 

私も管理者として、このエラーが発生します。

+1

から私はWin32の拡張win32fileを使用する必要がありますと思いますか?誰か知っていますか? – nobody

答えて

6

http://support.microsoft.com/kb/100027

To open a physical hard drive for direct disk access (raw I/O) in a Win32-based application, use a device name of the form

\\.\PhysicalDriveN 

where N is 0, 1, 2, and so forth, representing each of the physical drives in the system.

To open a logical drive, direct access is of the form

\\.\X: 

where X: is a hard-drive partition letter, floppy disk drive, or CD-ROM drive.

+0

どのドライブがどのドライブであるかをどのように知っていますか? – nobody

+0

ディスクマネージャは信頼できると思いますか? – nobody

+0

私はディスクマネージャが正しいと思いますが、破壊的な何かをする前に再チェックします:-) –