Sektor von IDE-Gerät lesen?

#449750
Mit cygwin und dd sollte es gehen. Vielleicht gibts auch nen dd unter 
win.
Du kannst mal nach rawrite.exe suchen, vielleicht kanns das auch, wird 
benutzt um images auf floppy zu schreiben. findet sich auf jeder 
linux-install-cd oder auf nem ftp, wo man linux findet
OP #449836
Ja, WinHex kenne ich. genau so meine ich es, also ektoren, nicht 
zwangsläufig eine Datei lesen.

Hast Du denn ein Beispiel, wie man das prinzipiell mit API macht?

kann denn rawrite auch lesen? Ich möchte schon selbst programmieren, 
suche also kein fertiges Programm, sondern das Prinzip.. Habe gehört, 
INT13 geht nicht mehr wegen Schutz vom Betriebssystem?
Persönliche Seite #449852
Int13 gibt es nicht mehr. Das war DOS und das ist tot.

Der Zugriff erfolgt mit den üblichen Datei-Lesefunktionen, das dafür zu 
verwendende Handle wird mit CreateFile erzeugt.

1
HANDLE hFile;
2

3
hFile = CreateFile("\\\\.\\c:", ...);
Bei folgenden Zugriffen muss in ganzen Sektoren (also in 
512-Byte-Häppchen) gelesen werden.

Mehr und Details hier:

(Auszug aus der Dokumentation von CreateFile)


Disk Devices
Volume handles may be opened as noncached at the discretion of the file 
system, even when the noncached option is not specified with CreateFile. 
You should assume that all Microsoft file systems open volume handles as 
noncached. The restrictions on noncached I/O for files apply to volumes 
as well.

A file system may or may not require buffer alignment even though the 
data is noncached. However, if the noncached option is specified when 
opening a volume, buffer alignment is enforced regardless of the file 
system on the volume. It is recommended on all file systems that you 
open volume handles as noncached and follow the noncached I/O 
restrictions.

Windows NT/2000/XP: You can use the CreateFile function to open a disk 
drive or a partition on a disk drive. The function returns a handle to 
the disk device; that handle can be used with the DeviceIOControl 
function. The following requirements must be met in order for such a 
call to succeed:

The caller must have administrative privileges for the operation to 
succeed on a hard disk drive.
The lpFileName string should be of the form \\.\PHYSICALDRIVEx to open 
the hard disk x. Hard disk numbers start at zero. For example:
String Meaning
\\.\PHYSICALDRIVE2 Obtains a handle to the third physical drive on the 
user's computer.


For an example showing how to open a physical drive, see Calling 
DeviceIoControl on Windows NT/2000.

The lpFileName string should be \\.\x: to open a floppy drive x or a 
partition x on a hard disk. For example:
String Meaning
\\.\A: Obtains a handle to drive A on the user's computer.
\\.\C: Obtains a handle to drive C on the user's computer.


There is no trailing backslash in a drive name. The string "\\.\c:\" 
refers to the root directory of drive C.

On Windows 2000 or later, you can also open a volume by referring to its 
unique volume name. In this case also, there should be no trailing 
backslash on the unique volume name.

Note that all I/O buffers should be sector aligned (aligned on addresses 
in memory that are integer multiples of the volume's sector size), even 
if the disk device is opened without the FILE_FLAG_NO_BUFFERING flag. 
Depending the disk, this requirement may not be enforced.

Windows 95/98/Me: This technique does not work for opening a logical 
drive. Specifying a string in this form causes CreateFile to return an 
error.

The dwCreationDisposition parameter must have the OPEN_EXISTING value.
When opening a floppy disk or a partition on a hard disk, you must set 
the FILE_SHARE_WRITE flag in the dwShareMode parameter.

Antwort schreiben

Eine eigene Frage? Dieser Thread ist über 19 Jahre alt. Stell sie in einem eigenen Thread – dort lesen mehr Leute mit, und sie wird öfter und schneller beantwortet.

Neuen Thread starten

Eine Lösung, Ergänzung oder Rückmeldung zu diesem Thread? Dann antworte hier.

Formatierung
  • [c]C-Code[/c]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.