Einzelnen Beitrag anzeigen

Benutzerbild von Flocke
Flocke

Registriert seit: 9. Jun 2005
Ort: Unna
1.172 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#29

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 11. Nov 2005, 14:45
Noch was: wie sehen eigentlich die Geräteparameter bei dir aus?
Hier mal meine Liste (OnStream DI-30 ADR):
Code:
GetTapeParameters / GET_TAPE_DRIVE_INFORMATION:
  ECC: Yes
  Compression: No
  DataPadding: Yes
  ReportSetmarks: No
  [color=blue]DefaultBlockSize: 32768
  MaximumBlockSize: 32768
  MinimumBlockSize: 32768[/color]
  MaximumPartitionCount: 1
  FeaturesLow: $1211750
    [ - ] Creates `fixed´ data partitions
    [ - ] Creates `select´ data partitions
    [ - ] Creates `initiator-defined´ partitions
    [ X ] Supports `short erase´ operations
    [color=red][ - ] Supports `long erase´ operations[/color]
    [ X ] Performs erase operations from the beginning-of-partition marker only
    [ - ] Performs immediate erase operations (returns when the erase operation begins)
    [ X ] Returns the maximum capacity of the tape
    [ X ] Returns the remaining capacity of the tape
    [ X ] Supports `fixed-length´ block mode
    [ - ] Supports `variable-length´ block mode
    [ X ] Returns error if tape is `write-enabled´ or `write-protected´
    [ - ] Supports the `end-of-medium´ warning size
    [ X ] Supports hardware error correction
    [ - ] Supports hardware data compression
    [ - ] Supports data padding
    [ - ] Supports setmark reporting
    [ - ] Provides current device-specific block address
    [ X ] Provides current logical block address (and logical tape partition)
    [ - ] Supports setting the `end-of-medium´ warning size
    [ X ] Physically ejects tape on a software eject
    [ - ] Can report if cleaning is required
    [ - ] Can set compression at the beginning-of-partition marker only
  FeaturesHigh: $2474007
    [ X ] Enables and disables the device for further operations
    [ X ] Supports tape tensioning
    [ X ] Enables and disables the tape ejection mechanism
    [ - ] Supports immediate rewind operation
    [ - ] Supports setting the size of a fixed-length logical block or variable-length block mode
    [ - ] Supports immediate load and unload operations
    [ - ] Supports immediate tape tensioning
    [ - ] Supports immediate lock and unlock operations
    [ - ] Enables and disables hardware error correction
    [ - ] Enables and disables hardware data compression
    [ - ] Enables and disables data padding
    [ - ] Enables and disables the reporting of setmarks
    [ - ] Can move to a device specific block address
    [ - ] Can move to a device-specific block address immediately
    [ X ] Can move to a logical block address in a partition
    [ - ] Can move to a logical block address in a partition immediately
    [ X ] Can move to the end-of-data marker in a partition
    [ X ] Can move forward (or backward) a specified number of blocks
    [ X ] Can move forward (or backward) a specified number of filemarks
    [ - ] Can move forward (or backward) to the first occurrence of a specified number of consecutive filemarks
    [ - ] Can move forward (or backward) a specified number of setmarks
    [ - ] Can move forward (or backward) to the first occurrence of a specified number of consecutive setmarks
    [ X ] Can move backward over blocks, filemarks, or setmarks
    [ - ] Supports immediate spacing
    [ - ] Writes setmarks
    [ X ] Writes filemarks
    [ - ] Writes short filemarks
    [ - ] Writes long filemarks
    [ - ] Supports immediate writing of short and long filemarks
    [ - ] Supports tape formatting operations
    [ - ] Supports immediate tape formatting operations
  EOTWarningZoneSize: 0
Interessant hier:
rot Kann kein LONG_ERASE - das geht bei dir ja wohl auch nicht
blau Kann *NUR* Blöcke mit 32K Größe - WriteFile muss immer ein Vielfaches dieser Blockgröße schreiben.

Außerdem: die Typen weiter oben stimmten immer noch nicht, nimm entweder aus der Jedi-ApiLib die Dateien JwaWinBase.pas und JwaWinNT.pas oder nimm diese hier:

Delphi-Quellcode:
const
  GET_TAPE_MEDIA_INFORMATION = 0;
  {$EXTERNALSYM GET_TAPE_MEDIA_INFORMATION}
  GET_TAPE_DRIVE_INFORMATION = 1;
  {$EXTERNALSYM GET_TAPE_DRIVE_INFORMATION}

type
  PTapeGetMediaParameters = ^TTapeGetMediaParameters;
  _TAPE_GET_MEDIA_PARAMETERS = record
    Capacity: int64;
    Remaining: int64;
    BlockSize: DWORD;
    PartitionCount: DWORD;
    WriteProtected: ByteBool;
  end;
  {$EXTERNALSYM _TAPE_GET_MEDIA_PARAMETERS}
  TTapeGetMediaParameters = _TAPE_GET_MEDIA_PARAMETERS;
  TAPE_GET_MEDIA_PARAMETERS = _TAPE_GET_MEDIA_PARAMETERS;
  {$EXTERNALSYM TAPE_GET_MEDIA_PARAMETERS}

  PTapeGetDriveParameters = ^TTapeGetDriveParameters;
  _TAPE_GET_DRIVE_PARAMETERS = record
    ECC: ByteBool;
    Compression: ByteBool;
    DataPadding: ByteBool;
    ReportSetmarks: ByteBool;
    DefaultBlockSize: DWORD;
    MaximumBlockSize: DWORD;
    MinimumBlockSize: DWORD;
    MaximumPartitionCount: DWORD;
    FeaturesLow: DWORD;
    FeaturesHigh: DWORD;
    EOTWarningZoneSize: DWORD;
  end;
  {$EXTERNALSYM _TAPE_GET_DRIVE_PARAMETERS}
  TTapeGetDriveParameters = _TAPE_GET_DRIVE_PARAMETERS;
  TAPE_GET_DRIVE_PARAMETERS = _TAPE_GET_DRIVE_PARAMETERS;
  {$EXTERNALSYM TAPE_GET_DRIVE_PARAMETERS}

// Definitions for FeaturesLow parameter
const
  TAPE_DRIVE_FIXED = $00000001; {$EXTERNALSYM TAPE_DRIVE_FIXED}
  TAPE_DRIVE_SELECT = $00000002; {$EXTERNALSYM TAPE_DRIVE_SELECT}
  TAPE_DRIVE_INITIATOR = $00000004; {$EXTERNALSYM TAPE_DRIVE_INITIATOR}
  TAPE_DRIVE_ERASE_SHORT = $00000010; {$EXTERNALSYM TAPE_DRIVE_ERASE_SHORT}
  TAPE_DRIVE_ERASE_LONG = $00000020; {$EXTERNALSYM TAPE_DRIVE_ERASE_LONG}
  TAPE_DRIVE_ERASE_BOP_ONLY = $00000040; {$EXTERNALSYM TAPE_DRIVE_ERASE_BOP_ONLY}
  TAPE_DRIVE_ERASE_IMMEDIATE = $00000080; {$EXTERNALSYM TAPE_DRIVE_ERASE_IMMEDIATE}
  TAPE_DRIVE_TAPE_CAPACITY = $00000100; {$EXTERNALSYM TAPE_DRIVE_TAPE_CAPACITY}
  TAPE_DRIVE_TAPE_REMAINING = $00000200; {$EXTERNALSYM TAPE_DRIVE_TAPE_REMAINING}
  TAPE_DRIVE_FIXED_BLOCK = $00000400; {$EXTERNALSYM TAPE_DRIVE_FIXED_BLOCK}
  TAPE_DRIVE_VARIABLE_BLOCK = $00000800; {$EXTERNALSYM TAPE_DRIVE_VARIABLE_BLOCK}
  TAPE_DRIVE_WRITE_PROTECT = $00001000; {$EXTERNALSYM TAPE_DRIVE_WRITE_PROTECT}
  TAPE_DRIVE_EOT_WZ_SIZE = $00002000; {$EXTERNALSYM TAPE_DRIVE_EOT_WZ_SIZE}
  TAPE_DRIVE_ECC = $00010000; {$EXTERNALSYM TAPE_DRIVE_ECC}
  TAPE_DRIVE_COMPRESSION = $00020000; {$EXTERNALSYM TAPE_DRIVE_COMPRESSION}
  TAPE_DRIVE_PADDING = $00040000; {$EXTERNALSYM TAPE_DRIVE_PADDING}
  TAPE_DRIVE_REPORT_SMKS = $00080000; {$EXTERNALSYM TAPE_DRIVE_REPORT_SMKS}
  TAPE_DRIVE_GET_ABSOLUTE_BLK = $00100000; {$EXTERNALSYM TAPE_DRIVE_GET_ABSOLUTE_BLK}
  TAPE_DRIVE_GET_LOGICAL_BLK = $00200000; {$EXTERNALSYM TAPE_DRIVE_GET_LOGICAL_BLK}
  TAPE_DRIVE_SET_EOT_WZ_SIZE = $00400000; {$EXTERNALSYM TAPE_DRIVE_SET_EOT_WZ_SIZE}
  TAPE_DRIVE_EJECT_MEDIA = $01000000; {$EXTERNALSYM TAPE_DRIVE_EJECT_MEDIA}
  TAPE_DRIVE_CLEAN_REQUESTS = $02000000; {$EXTERNALSYM TAPE_DRIVE_CLEAN_REQUESTS}
  TAPE_DRIVE_SET_CMP_BOP_ONLY = $04000000; {$EXTERNALSYM TAPE_DRIVE_SET_CMP_BOP_ONLY}

// Definitions for FeaturesHigh parameter
// ACHTUNG für den direkten Bit-Test gemacht, anders als im Standard definiert
const
  TAPE_DRIVE_LOAD_UNLOAD = $00000001; {$EXTERNALSYM TAPE_DRIVE_LOAD_UNLOAD}
  TAPE_DRIVE_TENSION = $00000002; {$EXTERNALSYM TAPE_DRIVE_TENSION}
  TAPE_DRIVE_LOCK_UNLOCK = $00000004; {$EXTERNALSYM TAPE_DRIVE_LOCK_UNLOCK}
  TAPE_DRIVE_REWIND_IMMEDIATE = $00000008; {$EXTERNALSYM TAPE_DRIVE_REWIND_IMMEDIATE}
  TAPE_DRIVE_SET_BLOCK_SIZE = $00000010; {$EXTERNALSYM TAPE_DRIVE_SET_BLOCK_SIZE}
  TAPE_DRIVE_LOAD_UNLD_IMMED = $00000020; {$EXTERNALSYM TAPE_DRIVE_LOAD_UNLD_IMMED}
  TAPE_DRIVE_TENSION_IMMED = $00000040; {$EXTERNALSYM TAPE_DRIVE_TENSION_IMMED}
  TAPE_DRIVE_LOCK_UNLK_IMMED = $00000080; {$EXTERNALSYM TAPE_DRIVE_LOCK_UNLK_IMMED}
  TAPE_DRIVE_SET_ECC = $00000100; {$EXTERNALSYM TAPE_DRIVE_SET_ECC}
  TAPE_DRIVE_SET_COMPRESSION = $00000200; {$EXTERNALSYM TAPE_DRIVE_SET_COMPRESSION}
  TAPE_DRIVE_SET_PADDING = $00000400; {$EXTERNALSYM TAPE_DRIVE_SET_PADDING}
  TAPE_DRIVE_SET_REPORT_SMKS = $00000800; {$EXTERNALSYM TAPE_DRIVE_SET_REPORT_SMKS}
  TAPE_DRIVE_ABSOLUTE_BLK = $00001000; {$EXTERNALSYM TAPE_DRIVE_ABSOLUTE_BLK}
  TAPE_DRIVE_ABS_BLK_IMMED = $00002000; {$EXTERNALSYM TAPE_DRIVE_ABS_BLK_IMMED}
  TAPE_DRIVE_LOGICAL_BLK = $00004000; {$EXTERNALSYM TAPE_DRIVE_LOGICAL_BLK}
  TAPE_DRIVE_LOG_BLK_IMMED = $00008000; {$EXTERNALSYM TAPE_DRIVE_LOG_BLK_IMMED}
  TAPE_DRIVE_END_OF_DATA = $00010000; {$EXTERNALSYM TAPE_DRIVE_END_OF_DATA}
  TAPE_DRIVE_RELATIVE_BLKS = $00020000; {$EXTERNALSYM TAPE_DRIVE_RELATIVE_BLKS}
  TAPE_DRIVE_FILEMARKS = $00040000; {$EXTERNALSYM TAPE_DRIVE_FILEMARKS}
  TAPE_DRIVE_SEQUENTIAL_FMKS = $00080000; {$EXTERNALSYM TAPE_DRIVE_SEQUENTIAL_FMKS}
  TAPE_DRIVE_SETMARKS = $00100000; {$EXTERNALSYM TAPE_DRIVE_SETMARKS}
  TAPE_DRIVE_SEQUENTIAL_SMKS = $00200000; {$EXTERNALSYM TAPE_DRIVE_SEQUENTIAL_SMKS}
  TAPE_DRIVE_REVERSE_POSITION = $00400000; {$EXTERNALSYM TAPE_DRIVE_REVERSE_POSITION}
  TAPE_DRIVE_SPACE_IMMEDIATE = $00800000; {$EXTERNALSYM TAPE_DRIVE_SPACE_IMMEDIATE}
  TAPE_DRIVE_WRITE_SETMARKS = $01000000; {$EXTERNALSYM TAPE_DRIVE_WRITE_SETMARKS}
  TAPE_DRIVE_WRITE_FILEMARKS = $02000000; {$EXTERNALSYM TAPE_DRIVE_WRITE_FILEMARKS}
  TAPE_DRIVE_WRITE_SHORT_FMKS = $04000000; {$EXTERNALSYM TAPE_DRIVE_WRITE_SHORT_FMKS}
  TAPE_DRIVE_WRITE_LONG_FMKS = $08000000; {$EXTERNALSYM TAPE_DRIVE_WRITE_LONG_FMKS}
  TAPE_DRIVE_WRITE_MARK_IMMED = $10000000; {$EXTERNALSYM TAPE_DRIVE_WRITE_MARK_IMMED}
  TAPE_DRIVE_FORMAT = $20000000; {$EXTERNALSYM TAPE_DRIVE_FORMAT}
  TAPE_DRIVE_FORMAT_IMMEDIATE = $40000000; {$EXTERNALSYM TAPE_DRIVE_FORMAT_IMMEDIATE}
... und hier der Code zum Anzeigen:

Delphi-Quellcode:
const
  CFeaturesLow: array [0 .. 30] of string = (
    'Creates `fixed´ data partitions',
    'Creates `select´ data partitions',
    'Creates `initiator-defined´ partitions',
    '',
    'Supports `short erase´ operations',
    'Supports `long erase´ operations',
    'Performs erase operations from the beginning-of-partition marker only',
    'Performs immediate erase operations (returns when the erase operation begins)',
    'Returns the maximum capacity of the tape',
    'Returns the remaining capacity of the tape',
    'Supports `fixed-length´ block mode',
    'Supports `variable-length´ block mode',
    'Returns error if tape is `write-enabled´ or `write-protected´',
    'Supports the `end-of-medium´ warning size',
    '',
    '',
    'Supports hardware error correction',
    'Supports hardware data compression',
    'Supports data padding',
    'Supports setmark reporting',
    'Provides current device-specific block address',
    'Provides current logical block address (and logical tape partition)',
    'Supports setting the `end-of-medium´ warning size',
    '',
    'Physically ejects tape on a software eject',
    'Can report if cleaning is required',
    'Can set compression at the beginning-of-partition marker only',
    '',
    '',
    '',
    ''
  );

  CFeaturesHigh: array [0 .. 30] of string = (
    'Enables and disables the device for further operations',
    'Supports tape tensioning',
    'Enables and disables the tape ejection mechanism',
    'Supports immediate rewind operation',
    'Supports setting the size of a fixed-length logical block or variable-length block mode',
    'Supports immediate load and unload operations',
    'Supports immediate tape tensioning',
    'Supports immediate lock and unlock operations',
    'Enables and disables hardware error correction',
    'Enables and disables hardware data compression',
    'Enables and disables data padding',
    'Enables and disables the reporting of setmarks',
    'Can move to a device specific block address',
    'Can move to a device-specific block address immediately',
    'Can move to a logical block address in a partition',
    'Can move to a logical block address in a partition immediately',
    'Can move to the end-of-data marker in a partition',
    'Can move forward (or backward) a specified number of blocks',
    'Can move forward (or backward) a specified number of filemarks',
    'Can move forward (or backward) to the first occurrence of a specified number of consecutive filemarks',
    'Can move forward (or backward) a specified number of setmarks',
    'Can move forward (or backward) to the first occurrence of a specified number of consecutive setmarks',
    'Can move backward over blocks, filemarks, or setmarks',
    'Supports immediate spacing',
    'Writes setmarks',
    'Writes filemarks',
    'Writes short filemarks',
    'Writes long filemarks',
    'Supports immediate writing of short and long filemarks',
    'Supports tape formatting operations',
    'Supports immediate tape formatting operations'
  );

//...
const
  YesNo: array [boolean] of string[3] = ( 'No', 'Yes' );
  Boxed: array [boolean] of string[3] = ( ' - ', ' X ' );
var
  hf: THandle;
  dp: TTapeGetDriveParameters;
  err, dw: DWORD;
  k: integer;

  procedure Msg(const str: string);
  begin
    Memo1.Lines.Add(str);
  end;

begin
  // ...
    Msg('Querying drive information');

    dw := SizeOf(dp);
    err := GetTapeParameters(hf, GET_TAPE_DRIVE_INFORMATION, dw, @dp);
    if err <> NO_ERROR then
      RaiseLastOsError(err);

    Msg('Drive information:');
    Msg(Format(' ECC: %s', [YesNo[dp.ECC]]));
    Msg(Format(' Compression: %s', [YesNo[dp.Compression]]));
    Msg(Format(' DataPadding: %s', [YesNo[dp.ECC]]));
    Msg(Format(' ReportSetmarks: %s', [YesNo[dp.ReportSetmarks]]));
    Msg(Format(' DefaultBlockSize: %d', [dp.DefaultBlockSize]));
    Msg(Format(' MaximumBlockSize: %d', [dp.MaximumBlockSize]));
    Msg(Format(' MinimumBlockSize: %d', [dp.MinimumBlockSize]));
    Msg(Format(' MaximumPartitionCount: %d', [dp.MaximumPartitionCount]));
    Msg(Format(' FeaturesLow: $%x', [dp.FeaturesLow]));
    for k := 0 to 30 do
      if CFeaturesLow[k] <> 'then
        Msg(Format(' [%s] %s', [Boxed[Odd(dp.FeaturesLow shr k)], CFeaturesLow[k]]));
    Msg(Format(' FeaturesHigh: $%x', [dp.FeaturesHigh]));
    for k := 0 to 30 do
      if CFeaturesHigh[k] <> 'then
        Msg(Format(' [%s] %s', [Boxed[Odd(dp.FeaturesHigh shr k)], CFeaturesHigh[k]]));
    Msg(Format(' EOTWarningZoneSize: %d', [dp.EOTWarningZoneSize]));
  // ...
Volker
Besucht meine Garage
Aktuell: RtfLabel 1.3d, PrintToFile 1.4
  Mit Zitat antworten Zitat