Commit c4306497 authored by con's avatar con
Browse files

Sending a string should send a trainling zero as well.

parent 5d2a5521
......@@ -1442,8 +1442,6 @@ void Adapter::startInferiorIfNeeded()
appendByte(&ba, 0); // ?
QByteArray file("C:\\sys\\bin\\filebrowseapp.exe");
file.append('\0');
file.append('\0');
appendString(&ba, file, TargetByteOrder);
sendTrkMessage(0x40, CB(handleCreateProcess), ba); // Create Item
}
......
......@@ -629,10 +629,7 @@ void Adapter::startInferiorIfNeeded()
appendByte(&ba, 0); // ?
appendByte(&ba, 0); // ?
appendByte(&ba, 0); // ?
QByteArray file = m_fileName.toLocal8Bit();
file.append('\0');
file.append('\0');
appendString(&ba, file, TargetByteOrder);
appendString(&ba, m_fileName.toLocal8Bit(), TargetByteOrder);
sendTrkMessage(TrkCreateItem, CB(handleCreateProcess), ba); // Create Item
}
......
......@@ -264,9 +264,10 @@ void appendInt(QByteArray *ba, uint i, Endianness endian)
void appendString(QByteArray *ba, const QByteArray &str, Endianness endian)
{
const int n = str.size();
appendShort(ba, n, endian);
appendShort(ba, n+1, endian); // count the terminating \0
for (int i = 0; i != n; ++i)
ba->append(str.at(i));
ba->append('\0');
}
QByteArray errorMessage(byte code)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment