Einzelnen Beitrag anzeigen

Benutzerbild von Samashy
Samashy

Registriert seit: 20. Feb 2004
Ort: Cottbus
127 Beiträge
 
Delphi 10.4 Sydney
 
#1

TByteSOAPArray vs. TByteDynArray

  Alt 26. Jul 2021, 11:46
Hallo,

ich versuche ein bestehendes Tool auf 64Bit hochzuziehen.
Das Tool füttert einen Restservice mit Dateien. In der 32Bit Variante forderte der Webservice:
Code:
const content: TByteDynArray
und in 64
Code:
const content: TByteSOAPArray
Mit dieser Funktion:
Code:
function FileToByteArray( const FileName : string ) : TByteDynArray; stdcall;
  const BLOCK_SIZE=1024;
  var BytesRead, BytesToWrite, Count : integer;
    F : FIle of Byte;
    pTemp : Pointer;
  begin
    AssignFile( F, FileName );
    Reset(F);
    try
      Count := FileSize( F );
      SetLength(Result, Count );
      pTemp := @Result[0];
      BytesRead := BLOCK_SIZE;
      while (BytesRead = BLOCK_SIZE ) do
      begin
        BytesToWrite := Min(Count, BLOCK_SIZE);
        BlockRead(F, pTemp^, BytesToWrite , BytesRead );
        pTemp := Pointer(LongInt(pTemp) + BLOCK_SIZE);
        Count := Count-BytesRead;
      end;
  finally
    CloseFile( F );
  end;
 end;
hatte ich bisher die Datei in das Array geschrieben.

Wie muss ich diese Funktion umschreiben?
  Mit Zitat antworten Zitat