![]() |
Bandlaufwerk / Streamer ansprechen unter Delphi.
Hi,
ich bin auf der suche nach eine möglichkein ein bandlaufwerk anzusprechen( Read / Save / Format ), es steht leider nicht sehr viel darüber geschrieben. Ein oder andere artikel habe ich gefunden aber nichts konkretes. Es handelt sich hier um SCSI Bandlaufwerke DDS2-4 und SLR wie auch DLT. Könnt Ihr mir behilflich sein ??? Gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Du kannst das erste Bandlaufwerk wie eine Datei mit dem Dateinamen \\.\tape0 öffnen. Ein-/Ausgabe sollte mit den normalen Funktionen gehen. Es gibt die API-Funktionen
![]() ![]() ![]() ![]() ![]() Ein kleines Programm in C das das Tape anspricht habe ich ![]() ![]() |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
DANKE ERSTMAL FÜR DIE SCHNELLE ANTWORT, WERDE SOFORT CHECKEN !!
DANKE und gruss aus W-tal |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Da hab ich noch eine Frage / Problemm,
und zwar es geht um die Function GetTapeParameters So Sieht die in C aus
Code:
Und so habe ich es umgeschriebenDWORD GetTapeParameters( HANDLE hDevice, DWORD dwOperation, LPDWORD lpdwSize, LPVOID lpTapeInformation );
Delphi-Quellcode:
GMP istVar Si : dword; ew : dword; ti : GMP; Begin ... ew := GetTapeParameters( TapeHandle, GET_TAPE_MEDIA_INFORMATION, Size, @TI ); If TI.WriteProtected Then ShowMessage('WriteProtect'); End;
Delphi-Quellcode:
Aber irgend wie Functioniert Das Nicht !!!
Type
GMP = Record Capacity : LongInt; Remaining : LongInt; BlockSize : dWORD; PartitionCount : dWORD; WriteProtected : Boolean; End; Auch wenn ich GMP.Capacity Abfrage oder andere parameter bekomme ich nur sch... aber nicht das was ich haben will. Wo hab ich misst gebaut ? gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
wie hast du die Funktion übersetzt? hast du eventuell StdCall vergessen?
|
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Also die Funktionen für den Tape-Zugriff sind ja in Windows.pas deklariert, allerdings die Strukturen nicht. LARGE_INTEGER ist IMHO ein int64. Hier meine Übersetzung (ungetestet):
Delphi-Quellcode:
Übrigens ist sicher der ganze Abschnitt "
type
PTapeGetMediaParameters = ^TapeGetMediaParameters; _TAPE_GET_MEDIA_PARAMETERS = record Capacity: int64; Remaining: int64; BlockSize: DWORD; PartitionCount: DWORD; WriteProtected: Boolean; 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: Boolean; Compression: Boolean; DataPadding: Boolean; ReportSetmarks: Boolean; DefaultBlockSize: DWORD; MaximumBlockSize: DWORD; MinimumBlockSize: DWORD; MaximumPartitionCount: 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} ![]() ![]() //EDIT: Typen korrigiert |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Ja das ist das,
jetzt sieht es auf jeden fall besser aus ! Danke Flocke !!!!!!!! |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Hier ist aber noch ein Hacken !
Wenn ich zb. Anzeigen möchte DefaultBlockSize sollte eingentlich wert rauskommen mit 512 kommt aber 2, sowie MinimumBlockSize kommt ein exotisches Wert der grösser ist als MaximumBlockSize der eben so exotisch erscheint. gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Ich hab's !
Entgültig ist es geschaft. Problemme hat es gemacht : LongBool habe ich ersetzt mit Boolean Packed record mit normalen record und func. 100% Danke euch allen gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Zitat:
|
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
ByteBool statt Boolean ist sicherer.
|
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Zitat:
|
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Also bis jetzt waren das Relativ kleine Problemme, Problemme auf die eine lösung in sicht war. Jetzt bin ich auf ein problemm gestossen wo nichtmal msdn von ms konnte mir helfen.
PrepareTape Zitat:
Ich brauch es für mein Streamer Tandberg Data SLR bis 200GB oder DDS3 und 4 bis 40GB. Habt Ihr vieleicht eine idee warum wird die PrepareTape Function nicht unterstützt ? Gibts vieleicht irgend wo eine externe DLL die mann von Delphi aus nutzen kann ? MfG Seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Und noch was,
Wenn der Windows 2K und WXP kann eine sicherung machen auf oben gennanten Laufwerken dann musste das doch funktionieren ohne zusätzlichen DLL's die nicht in System vorhanden sind. Die Frage bleibt, wie es funktioniert. Bei msdn bin ich noch gestossen auf ![]() gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
zu 1. Das Band kann wahrscheinlich nicht formatiert werden, ähnlich wie man moderne Festplatten nicht mehr Low-Level-Formatieren sollte. Nimm statt dessen einfach TAPE_ERASE_LONG, dass macht das Band auch leer.
zu 2. Die Seite ist über Treiber, nicht über die Anwendungssoftware. Schau dir wirklich mal den Link von oben an ( ![]() |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Hallo und Guten Morgen,
danke für deine Antwort, du hast Recht, ich habe es gelöscht und auch hast du Rech mit dem LowLevel. Andere Grosse Software hersteller ( Veritas unc co. ) nutzen auch das nicht mehr. Ich habe diesen mt.c mir genau angeschaut leider fehlt da BackupWrite, und da komme ich nicht mit zu recht. Damit habe ich zwei Problemme, 1:
Code:
ich bekomme nirgends wo Informationen wie soll lpContext aufgebaut sein.
BOOL BackupWrite(
HANDLE hFile, LPBYTE lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, BOOL bAbort, BOOL bProcessSecurity, LPVOID* lpContext ); 2: Das zweite problemm kommt wenn mann kein C beherst.
Code:
Hier kommt doch ein Pointer ins Spiel
LPBYTE lpBuffer
Ich habe den BackupWrite so varstanden :
Delphi-Quellcode:
Es wird Bemengelt von den Compiler @ou,
...
str : TMemoryStream; ou : dWord; lpc : _CONTEXT; ... BackupWrite( TapeHandle,@str,str.Size, @ou, False, False, @lpc ); Wenn ich aber "ou" ohne "@" reinsetzte ist es wieder o.k. Und das macht mich irre, ich denke doch wenn es LPBYTE oder LPDWORD in C steht handelt es sich um ein Pointer. Und das mit dem @lpc klappt auch nicht. Help seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Du musst natürlich auch beachten, wie die "Übersetzung" in Windows.pas aussieht.
Delphi-Quellcode:
lpContext ist einfach ein Zeiger, den du Anfangs mit nil initialisieren musst und einfach bei allen weiteren Aufrufen wieder angibst, ohne den Inhalt zu verändern - sonst muss dich dieser Parameter nicht interessieren. Wenn du fertig bist mit dem Schreiben, dann musst du halt BackupWrite noch einmal mit eben diesem Zeiger aufrufen und bAbort auf true setzen - das gibt den Speicher wieder frei. (Steht übrigens alles im PSDK zu BackupWrite)
function BackupWrite(hFile: THandle; lpBuffer: PByte; nNumberOfBytesToWrite: DWORD;
var lpNumberOfBytesWritten: DWORD; bAbort, bProcessSecurity: BOOL; var lpContext: Pointer): BOOL; stdcall; lpBuffer ist ein Zeiger auf die Daten - in deinem Fall, bei einem TMemoryStream, würdest du hier str.Memory angeben. |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Flocke nicht aufregen,
Delphi-Quellcode:
Passiert nichts. Irgend wo mache ich noch fehler.
Var str : TMemoryStream;
ou : dword; lcm : pointer; begin TapeHandle := OPENDRIVE; str := TMemoryStream.Create; str.LoadFromFile('C:\mt.exe'); lcm := nil; ou := 0; showmessage(inttostr(str.Size)); // Länge des mt.exe = 23040 BackupWrite( TapeHandle,str.Memory,str.Size,ou, false,false, lcm ); showmessage(inttostr(ou)); // Geschriebene länge = 204 BackupWrite( TapeHandle,str.Memory,str.Size,ou, true,false, lcm ); str.Free; CLOSEDRIVE; Andere Frage, Was ist TapeMark ? Ist das änlich mit cluster auf hdd ? Gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Bei dem MT.EXE SourceCode habe ich folgendes :
Code:
Da ich von C nichts verstehe wie kann man es übersetzten?
SetTapePosition( tapedrive, TAPE_ABSOLUTE_BLOCK,0,(DWORD)(position & 0xffffffff),
(DWORD)((position >> 32) & 0xffffffff),FALSE) (DWORD)(position & 0xffffffff) und (DWORD)((position >> 32) & 0xffffffff) Es handelt sich hierbei um Zitat:
Seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Wieso habe ich denn Gestern deine neuen Beiträge nicht mitbekommen :gruebel:
Zitat:
<Hinzugefügt> Mit BackupRead liest man nicht nur die reinen Daten einer Datei, sondern alle Streams (z.B. die ACLs, also die Zugriffsrechte). Dabei bekommst du für jeden Stream jeweils eine WIN32_STREAM_ID-Struktur inkl. des Namens und im Anschluss daran die Daten des Streams, deren Größe im Feld Size angegeben ist (evtl. plus Füll-Bytes, um auf 32-Bits auszurichten). Wenn du also alle Daten, die du mit BackupRead liest, mit BackupWrite wieder schreibst, dann stellst du nicht nur den Inhalt der Datei wieder her sondern auch alle anderen Attribute. </Hinzugefügt> Zitat:
Zitat:
(DWORD)((position >> 32) & 0xffffffff) - die oberen 32 Bits Wenn du nur mit Integer arbeitest (für Dateizähler bzw. Dateigröße), dann kannst du für dwOffsetHigh einfach 0 angeben. Wenn du mit Int64 arbeitest, dann nimm LARGE_INTEGER(Zahl).LowPart und LARGE_INTEGER(Zahl).HighPart |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
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:
und Read
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;
Delphi-Quellcode:
Da bekomme ich am ende noch ein speicher error.
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; 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 |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
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 ![]() 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... |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Also die Datenmenge stimmt zu 100%.
Der fehler an der sache ist TmemoryStream. Ich habe getestet :
Delphi-Quellcode:
Und das klappt schon mal nicht. Also es liegt erstmal nicht an den Tape selbst,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); es liegt daran die daten von TMemoryStream mittels WriteFile zu speichern. Da muss ich noch dran feilen. gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Ich gebe schon langsam auf. :wall:
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:
Help.
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; seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
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; |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
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 :gruebel: . 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 :gruebel: Also wenn ich speicher Reserviere mit :
Delphi-Quellcode:
Ich würde einfach gern sehen was er in buf reingeladen hat Byte für Byte.Var buf : Pointer; Begin buf := VirtualAlloc( nil, 10, MEM_COMMIT, PAGE_READWRITE ); ... BackupRead( xy, buf, 10, .... Da buf ist ein Pointer wie kann ich die Speicher Adresse buf und buf+1, und buf+2 .... Auslesen ? Gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
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 |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Zitat:
Zitat:
Zitat:
|
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Noch was: wie sehen eigentlich die Geräteparameter bei dir aus?
Hier mal meine Liste (OnStream DI-30 ADR):
Code:
Interessant hier:
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 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:
... und hier der Code zum Anzeigen:
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}
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])); // ... |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Also Bei Mir Sieht es so aus :
Nur warum andere Software Kann ShortErase durchführen ??? gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Ich habe es noch ein mal anders versucht :
Delphi-Quellcode:
Es sieht garnicht so schlecht aus.
Var buf : Pointer;
re : boolean; bow : dword; bor : dword; lcm : pointer; inf : thandle; tot : dWord; tot1 : dWord; begin TapeHandle := OPENDRIVE_READ; Security.nLength := SizeOf( TSecurityAttributes ); Security.bInheritHandle := False; Security.lpSecurityDescriptor := nil; SetTapePosition ( TapeHandle, 4, 0, 0,0, False ); buf := VirtualAlloc( nil, 512, MEM_COMMIT, PAGE_READWRITE ); inf := CreateFile('C:\mt.exe',GENERIC_READ,0, @Security,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); tot := 0; tot1:= 0; bor := 1; While bor>0 do Begin lcm := nil; re := ReadFile(inf,buf,512,bor,lcm); If bor>0 Then Begin lcm := nil; re := WriteFile( TapeHandle, buf, bor, bow, lcm); Inc( tot, bor ); Inc( tot1,bow ); End; End; ShowMessage('Read :'+inttostr(tot)+chr(10)+'Write :'+IntToStr(tot1)); WriteTapeMark( TapeHandle, 0, 1, False ); CloseHandle( inf ); CloseDrive; VirtualFree( buf, 512, MEM_DECOMMIT ); Es wird auf dem Band aufgenohmen aber ab den Offset 4 jest 512 Bytes gibts differenz zur orginal file. Die differenz ist 8 Byte Lang und wiederholt sich regelmessig jede 512 Bytes. Und am Ende Bekomme ich noch ein mechtiges Delphi Abstürz. vermutlich geht hier um den speicher ( immer noch ) |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Der Fehler am Ende, kommt ungefähr nach 2-5 sek und lautet :
bds.exe - bordbk90N.dll Internal Error IMP-2627 nach par mal ok kommt Acces violation adress xy in module 'bordbk90N.dll'. Read of adresse xy. :wall: :wall: :wall: :wall: :wall: :wall: :wall: :wall: |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
1. Microsoft empfiehlt ~100 Blocks am Anfang einer Partition zu überspringen, da manche Streamer dort eigene Daten ablegen, du solltest also jeweils ein
Delphi-Quellcode:
vor das Lesen und Schreiben setzen.
SetTapePosition(TapeHandle, TAPE_LOGICAL_BLOCK, 0, 100, 0, false);
2. Du MUSST bei ReadFile als 5. Parameter nil angeben, ansonsten meint Windows, dass du überlappende I/O-Operationen durchführen willst. Das dürfte deine verzögerten Abstürze verursachen. 3. Du solltest den Speicher mit
Delphi-Quellcode:
wieder freigeben.
VirtualFree(buf, 0, MEM_RELEASE);
|
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Hi, Danke .
Wede sofort in angriff nehmen. Weist du vieleicht wo kann mann überprüfen den eingelegten band typ ? Also bei anderen back.prog. zeigt der mir an welchen band tüp ich gerade in laufwerk habe, zb 50GB oder 24 GB ... Gruss seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Zitat:
schade, mir ist schon schlecht :wall: ; seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Hi,
ich glaube ich hab das Problemm gelöst, es funktioniert. Aber zurück zum den Roport. Das erste Report von DriveParameters hat angezeigt da das laufwerk nicht unterstützt Compression, nach dem ich ein bespieltes band mit anderen software eingelegt habe und den test nochmal durchgeführt habe ist folgendes ergebis gekommen :
Siehe Compression. :gruebel: seba |
Re: Bandlaufwerk / Streamer ansprechen unter Delphi.
Der Thread ist ja aus 2005 hat zufällig jemand daran weiter geschrieben und eine halbwegs brauchbare Lösung
Wäre schon nett sonst muß ich alles nochmal machen und mich auch mit den Problemen auseinandersetzen :-( Grüße Joachim |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:00 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz