Ver Mensaje Individual
  #10  
Antiguo 01-08-2006
[fer21unmsm] fer21unmsm is offline
Miembro Premium
 
Registrado: dic 2005
Ubicación: Lima
Posts: 627
Reputación: 19
fer21unmsm Va por buen camino
Cita:
Empezado por seoane
Nunca había oído hablar de un MBR que no midiera 512 bytes, pero hay muchas cosas que desconozco. Aunque lo que si se es que el tamaño del sector depende de la geometría del disco y no del formateo que se haga del mismo, aunque también puedo estar equivocado

De todas formas si ese es todo el problema lo solucionamos fácilmente averiguando el tamaño del sector y actuando en consecuencia:

Código Delphi [-]type DISK_GEOMETRY = record Cylinders: LARGE_INTEGER; MediaType: Integer; TracksPerCylinder: DWORD; SectorsPerTrack: DWORD; BytesPerSector: DWORD; end; const IOCTL_DISK_GET_DRIVE_GEOMETRY = 458752; function GetBytesPerSector(Drive: Integer): DWORD; var hDisk: THandle; Geometry: DISK_GEOMETRY; Returned: DWORD; begin Result:= 0; hDisk:= CreateFile(PChar('\\.\Physicaldrive' + IntToStr(Drive)),GENERIC_READ, FILE_SHARE_READ,nil,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN,0); if hDisk <> INVALID_HANDLE_VALUE then begin FillChar(Geometry,Sizeof(Geometry),0); if DeviceIoControl(hDisk,IOCTL_DISK_GET_DRIVE_GEOMETRY,nil,0,@Geometry, sizeof(Geometry),Returned,nil) then Result:= Geometry.BytesPerSector else ShowMessage(SysErrorMessage(GetLastError)); CloseHandle(hDisk); end else ShowMessage(SysErrorMessage(GetLastError)); end;
Lo voy a probar, gracias man.
__________________
"La información tiene más valor cuando se comparte"
Responder Con Cita