program Project1; uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; ...{$R *.RES} const BytesPerSector =512; SectorCount =1; SectorStart =0; drive ='/.PHYSICALDRIVE0'; var str :string; p :pchar; i :Cardinal; hDeviceHandle :Thandle; begin hDeviceHandle := CreateFile(drive, GENERIC_READ, FILE_SHARE_READ OR FILE_SHARE_WRITE, nil, OPEN_EXISTING,0, 0); if (hDeviceHandle <> INVALID_HANDLE_VALUE) then begin p:=allocmem(SectorCount*BytesPerSector); FileSeek(hDevicehandle,SectorStart*BytesPerSector,0); if FileRead(hDevicehandle,p[0],SectorCount*BytesPerSector)<>SectorCount*BytesPerSector then raise exception.create('读取错误'); str:=''; for i:=0 to 512-1do begin if i mod 16=0 then str:=str+format('0x%.8x ',[i]); str:=str+format(' %.2x',[integer(p[i])]); if i mod 16=15 then str:=str+#13#10; end; ShowMessage( str); freemem(p,SectorCount*BytesPerSector); closehandle(hDeviceHandle); end; end. ...{END}