AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Bandlaufwerk / Streamer ansprechen unter Delphi.
Thema durchsuchen
Ansicht
Themen-Optionen

Bandlaufwerk / Streamer ansprechen unter Delphi.

Offene Frage von "shifter"
Ein Thema von shifter · begonnen am 7. Nov 2005 · letzter Beitrag vom 19. Aug 2009
Antwort Antwort
Seite 3 von 4     123 4      
shifter

Registriert seit: 2. Jan 2005
175 Beiträge
 
Delphi 2007 Enterprise
 
#21

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 10. Nov 2005, 16:28
Hi,

das schein langsam zu funktionieren.
Speichern kann ich jetzt auf band, und bei lesen bkomme ich nicht das was ich gespeichert habe.

ich wwrde dir mal posten wie die beiden routinen aussehen.

Write
Delphi-Quellcode:
Var buf : Array [0..512] of Byte;
    re : dWord;
    str : TMemoryStream;
    bow : dWord;
    lcm : pointer;
begin

TapeHandle := OPENDRIVE;

str := TMemoryStream.Create;
str.LoadFromFile('C:\mt.exe');
str.Position :=0;
lcm := nil;
bow := 0;

WriteTapeMark( TapeHandle, 0, 1, False );
WriteFile( TapeHandle, str.memory, str.Size, bow, lcm );

showmessage(inttostr(bow));

str.Free;
closedrive;
und Read
Delphi-Quellcode:
Var bow : dword;
    bwr : dword;
    lcm : pointer;
    buf : pointer;
    outf : Thandle;
    total : dword;
begin
  TapeHandle := OPENDRIVE;

  Security.nLength := SizeOf( TSecurityAttributes );
  Security.bInheritHandle := False;
  Security.lpSecurityDescriptor := nil;

// SetTapePosition( TapeHandle,2, 0,1,0, False);

  lcm := nil;
  buf := VirtualAlloc( lcm, 512, MEM_COMMIT,PAGE_READWRITE );

  outf := CreateFile('C:\Temp\mt-test.exe',GENERIC_WRITE,0,
              @Security,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

  ReadFile( TapeHandle, buf, 512, bow,nil );

  bow := 1;
  total := 0;
  While bow>0 do begin
    ReadFile( TapeHandle, buf, 512, bow,nil );
    if bow>0 then WriteFile( outf, buf, bow, bwr, nil);
    inc( total, bow );
  End;

  closehandle(outf);
  showmessage(inttostr(total));
  closedrive;
Da bekomme ich am ende noch ein speicher error.
Ich bin mir aber nicht ganz sicher ob das mit dem speicher reservierung ganz ok ist.


Ich werde es auf jeden fall noch weiter quellen.

gruss
seba
  Mit Zitat antworten Zitat
Benutzerbild von Flocke
Flocke

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

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 10. Nov 2005, 17:54
Stimmen die Daten denn überhaupt nicht überein oder sind sie nur um ~512 Bytes verschoben? Da wäre ein Test mit einer reinen Textdatei vielleicht sinnvoller

Habe hier noch ein paar Grundlagen gefunden.

1. die Datenmenge sollte immer ein Vielfaches der Blockgröße sein (das wird deinen Schreibfehler verursachen)
2. ein FILEMARK schreibt man hinter das Ende der Datei, nicht davor

Ansonsten ist es wohl viel Ausprobieren. Obwohl es mich wirklich interessiert (habe selbst ein Tape), habe ich momentan nicht die Zeit da herumzuexperimentieren...
Volker
Besucht meine Garage
Aktuell: RtfLabel 1.3d, PrintToFile 1.4
  Mit Zitat antworten Zitat
shifter

Registriert seit: 2. Jan 2005
175 Beiträge
 
Delphi 2007 Enterprise
 
#23

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 10. Nov 2005, 18:41
Also die Datenmenge stimmt zu 100%.

Der fehler an der sache ist TmemoryStream.

Ich habe getestet :

Delphi-Quellcode:

str := TMemoryStream.Create;
str.LoadFromFile('C:\mt.exe');
str.Position :=0;
lcm := nil;
bow := 0;

  outf := CreateFile('C:\Temp\mt-test.exe',GENERIC_WRITE,0,
              @Security,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

  WriteFile( outf, str.memory, str.Size, bow, nil);
Und das klappt schon mal nicht. Also es liegt erstmal nicht an den Tape selbst,
es liegt daran die daten von TMemoryStream mittels WriteFile zu speichern.

Da muss ich noch dran feilen.

gruss
seba
  Mit Zitat antworten Zitat
shifter

Registriert seit: 2. Jan 2005
175 Beiträge
 
Delphi 2007 Enterprise
 
#24

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 10. Nov 2005, 22:40
Ich gebe schon langsam auf.

Wenn ich zum testen ein file lade in speicher mittels VirtuallAlloc und BackupRead,
und auf festplatte wieder speichere mit BackupWrite ist alles OK.

Das heist mit dem VirtuallAlloc hat es gecklapt.

Wenn ich aber mit WriteFile auf Band das aufnehmen möchte bekomme ich False als ergebnis von
WriteFile und geschriebene menge = 0.

Wenn ich das gleiche mache aber stat VirtuallAlloc, verwende ich TmemoryStream klapt das mit dem nachbar
und es wird gespeichert auf band. Aber der inchalt ist nicht der der sein soll.

Und so versuche ich aufzunehmen :
Delphi-Quellcode:
Var buf : Pointer;
    re : boolean;
    bow : dword;
    bor : dword;
    lcm : pointer;
    inf : thandle;
begin

  TapeHandle := OPENDRIVE_READ;

  Security.nLength := SizeOf( TSecurityAttributes );
  Security.bInheritHandle := False;
  Security.lpSecurityDescriptor := nil;

  SetTapePosition ( TapeHandle, 4, 0, 0,0, False );

  buf := VirtualAlloc( nil, 23040, MEM_COMMIT, PAGE_READWRITE );
  inf := CreateFile('C:\mt.exe',GENERIC_READ,0,
              @Security,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

  lcm := nil;
  BackupRead( inf, buf, 23040, bor, false, false, lcm );
  closedrive;

  tapehandle := opendrive_write;
  lcm := nil;
  re := WriteFile( TapeHandle, buf, bor, bow, lcm);

// und hier wird es gemeldet das re=FALSE und bow=0

  WriteTapeMark( TapeHandle, 0, 1, False );

  closehandle(inf);
  closedrive;
Help.

seba
  Mit Zitat antworten Zitat
Benutzerbild von Flocke
Flocke

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

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 11. Nov 2005, 08:08
Wieso hast du denn ein CloseDrive hinter dem BackupRead?

... Moment, muss mal eben meinen Rechner neu starten ...
... So, wieder da ...

Du solltest dir angewöhnen, bei API-Funktionen, die fehlschlagen können, ein RaiseLastOsError zu setzen - dann erhälst du nämlich auch eine Fehlermeldung!

Beispiel:
Delphi-Quellcode:
if not WriteFile(TapeHandle, buf, bor, bow, lcm) then
  RaiseLastOsError;
Volker
Besucht meine Garage
Aktuell: RtfLabel 1.3d, PrintToFile 1.4
  Mit Zitat antworten Zitat
shifter

Registriert seit: 2. Jan 2005
175 Beiträge
 
Delphi 2007 Enterprise
 
#26

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 11. Nov 2005, 12:59
Hallo,

das mit dem CLOSEDRIVE; ist hier aus versehen reingeckommen.
Ich habe RaiseLastOsError eingebaut :

System Error. Code:87. Falsche Parameter

Der Compiler hat nicht gemeckert .

Wenn Ich aber diese funktion stat WriteFile ausführe mit BackupWrite dann ist die welt wieder in ordnung.

Aber mal was anderes,
Wie kann ich zB. aus einem Reserviertem speicher bereich ein Byte mir anzeigen lassen

Also wenn ich speicher Reserviere mit :
Delphi-Quellcode:

Var
   buf : Pointer;
Begin
   buf := VirtualAlloc( nil, 10, MEM_COMMIT, PAGE_READWRITE );
   ...
   BackupRead( xy, buf, 10, ....
Ich würde einfach gern sehen was er in buf reingeladen hat Byte für Byte.
Da buf ist ein Pointer wie kann ich die Speicher Adresse buf und buf+1, und buf+2 ....
Auslesen ?

Gruss
seba
  Mit Zitat antworten Zitat
shifter

Registriert seit: 2. Jan 2005
175 Beiträge
 
Delphi 2007 Enterprise
 
#27

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 11. Nov 2005, 13:19
Und noch was,

wenn ich EraseTape mit dem parameter TAPE_ERASE_SHORT ausführen möchte dann bekomme
ich Fehler meldung Unzulässige Parameter. Das ist erstaunlich da mit einem
Backup Programm kann ich es machen ohne problemme .

gruss
seba
  Mit Zitat antworten Zitat
Benutzerbild von Flocke
Flocke

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

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 11. Nov 2005, 13:30
Zitat von shifter:
Hallo,

das mit dem CLOSEDRIVE; ist hier aus versehen reingeckommen.
Ich habe RaiseLastOsError eingebaut :

System Error. Code:87. Falsche Parameter

Der Compiler hat nicht gemeckert .
Die Parameter sind ja auch syntaktisch richtig - wieso sollte der Compiler da meckern?

Zitat von shifter:
Wenn Ich aber diese funktion stat WriteFile ausführe mit BackupWrite dann ist die welt wieder in ordnung.
Es muss aber auch mit WriteFile gehen.

Zitat von shifter:
Ich würde einfach gern sehen was er in buf reingeladen hat Byte für Byte.
Da buf ist ein Pointer wie kann ich die Speicher Adresse buf und buf+1, und buf+2 ....
Auslesen ?
Deklariere die Variable als PByte (statt Pointer) und trage im Ausdrucksfenster buf^ ein, Anzeige auf hexadezimal stellen und Anzahl Wiederholungen auf ~50.
Volker
Besucht meine Garage
Aktuell: RtfLabel 1.3d, PrintToFile 1.4
  Mit Zitat antworten Zitat
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
shifter

Registriert seit: 2. Jan 2005
175 Beiträge
 
Delphi 2007 Enterprise
 
#30

Re: Bandlaufwerk / Streamer ansprechen unter Delphi.

  Alt 11. Nov 2005, 16:09
Also Bei Mir Sieht es so aus :

  • Drive information:
    ECC: No
    Compression: No
    DataPadding: No
    ReportSetmarks: Yes
    DefaultBlockSize: 512
    MaximumBlockSize: 65536
    MinimumBlockSize: 1
    MaximumPartitionCount: 2
    FeaturesLow: $3A1CE1
    [ X ] Creates `fixed´ data partitions
    [ - ] Creates `select´ data partitions
    [ - ] Creates `initiator-defined´ partitions
    [ - ] Supports `short erase´ operations
    [ X ] Supports `long erase´ operations
    [ X ] Performs erase operations from the beginning-of-partition marker only
    [ X ] Performs immediate erase operations (returns when the erase operation begins)
    [ - ] Returns the maximum capacity of the tape
    [ - ] Returns the remaining capacity of the tape
    [ X ] Supports `fixed-length´ block mode
    [ X ] Supports `variable-length´ block mode
    [ X ] Returns error if tape is `write-enabled´ or `write-protected´
    [ - ] Supports the `end-of-medium´ warning size
    [ - ] Supports hardware error correction
    [ X ] Supports hardware data compression
    [ - ] Supports data padding
    [ X ] Supports setmark reporting
    [ X ] Provides current device-specific block address
    [ X ] 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
    FeaturesHigh: $135F527F
    [ X ] Enables and disables the device for further operations
    [ X ] Supports tape tensioning
    [ X ] Enables and disables the tape ejection mechanism
    [ X ] Supports immediate rewind operation
    [ X ] Supports setting the size of a fixed-length logical block or variable-length block mode
    [ X ] Supports immediate load and unload operations
    [ X ] Supports immediate tape tensioning
    [ - ] Supports immediate lock and unlock operations
    [ - ] Enables and disables hardware error correction
    [ X ] Enables and disables hardware data compression
    [ - ] Enables and disables data padding
    [ - ] Enables and disables the reporting of setmarks
    [ X ] 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
    [ X ] Can move forward (or backward) to the first occurrence of a specified number of consecutive filemarks
    [ X ] 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
    [ X ] Writes setmarks
    [ X ] Writes filemarks
    [ - ] Writes short filemarks
    [ - ] Writes long filemarks
    [ X ] Supports immediate writing of short and long filemarks
    [ - ] Supports tape formatting operations
    [ - ] Supports immediate tape formatting operations
    EOTWarningZoneSize: 0



Nur warum andere Software Kann ShortErase durchführen ???

gruss
seba
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 3 von 4     123 4      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:28 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz