I think the problem is the function declarations deceived you. VST chunks are not character data (strings) but usually raw binary data. Chunks can contain anything, even #0 is perfectly legal. So when you interpret it as string (remember that long strings end with #0) you can get broken/partial data.
If I were Ian I would have written the declarations as:
BASS_VST_GetChunk: function (VSTHandle: DWORD; IsPreset: BOOL; var Length: DWORD): Pointer; stdcall;
BASS_VST_SetChunk: function (VSTHandle: DWORD; IsPreset: BOOL; Chunk: Pointer; length: DWORD): DWORD; stdcall;
Using var DWORD instead of PDWORD would be much more Delphi like and using untyped Pointer instead of PAnsiChar could avoid misunderstanding like yours.
So the point is you should not convert Chunk data to string but handle it as raw binary data.
For saving Chunk data to a file you can do this:
Var
len: DWORD;
p: Pointer;
f: File;
fileName: String;
p := BASS_VST_GetChunk(AHandle, False, len);
if p <> nil then
Begin
fileName := 'vstdata.bin';
AssignFile(f, fileName);
Rewrite(f, 1);
Try
BlockWrite(f, p^, len);
Finally
CloseFile(f);
End;
End;
And for loading data back to plugin:
...
AssignFile(f, fileName);
Reset(f, 1);
len := FileSize(f);
Try
GetMem(p, len);
BlockRead(f, p^, len);
BASS_VST_SetChunk(AHandle, False, p, len);
Finally
FreeMem(p);
CloseFile(f);
End;