给你个读的例子,写的没敢试验,因为我只有一个HD.[
]
procedure TForm1.Button1Click(Sender: TObject);
var ;hFile:THandle ;
; ; ;bytesread
WORD;
; ; ;buf: array[0..511] of char ;
; ; ;Security: TSecurityAttributes;
begin
;hFile:=CreateFile('//./PhysicalDrive0',GENERIC_READ, FILE_SHARE_READ or FILE_SHARE_WRITE, nil ,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,0);
; if hFile=INVALID_HANDLE_VALUE then
; begin
; ; ShowMessage('No file exists yet.' );
; ; Exit;
; end;
; if not ;ReadFile(hFile, buf, sizeof(buf), bytesread, nil) then showmessage('Error');
end;