Gut Ok, aber trotzdem hat mir das noch nicht bei meinem Hauptproblem geholfen.
Das der String nicht mehr so aussieht wie ich ihn beabsichtige zu senden.
Hier nochmal die Funktion SendData:
(Diese hatte ich nicht verändert da Pointer ja nix mit den letzten Veränderungen im Delphi zu tun hatten)
Delphi-Quellcode:
// Sends binary data. Returns number of bytes sent. Timeout overrides
// the value specifiend in the OutputTimeout property
function TCommPortDriver.SendDataEx(DataPtr: PChar;
DataSize,
Timeout: DWORD ): DWORD;
var
nToSend, nSent, t1: DWORD;
begin
// Do nothing if port has not been opened
Result := 0;
if not Connected then
exit;
// Current time
t1 := GetTickCount;
// Loop until all data sent or timeout occurred
while DataSize > 0 do
begin
// Get TX buffer free space
nToSend := OutFreeSpace;
// If output buffer has some free space...
if nToSend > 0 then
begin
// Check signals
if FCkLineStatus and (GetLineStatus = []) then
exit;
// Don't send more bytes than we actually have to send
if nToSend > DataSize then
nToSend := DataSize;
// Send
WriteFile( FHandle, DataPtr^, nToSend, nSent, nil );
nSent := abs( nSent );
if nSent > 0 then
begin
// Update number of bytes sent
Result := Result + nSent;
// Decrease the count of bytes to send
DataSize := DataSize - nSent;
// Inc. data pointer
DataPtr := DataPtr + nSent;
// Get current time
t1 := GetTickCount;
// Continue. This skips the time check below (don't stop
// trasmitting if the Timeout is set too low)
continue;
end;
end;
// Buffer is full. If we are waiting too long then exit
if DWORD(GetTickCount-t1) > Timeout then
exit;
end;
end;
// Send data (breaks the data in small packets if it doesn't fit in the output
// buffer)
function TCommPortDriver.SendData( DataPtr: pointer; DataSize: DWORD ): DWORD;
begin
Result := SendDataEx( DataPtr, DataSize, FOutputTimeout );
end;