const GUID &providerID = sourceEvent.GetProvider()->GetProviderID();
unsigned int eventID = sourceEvent.GetEventID();
unsigned int eventVersion = sourceEvent.GetEventVersion();
- unsigned int instancePayloadSize = sizeof(providerID) + sizeof(eventID) + sizeof(eventVersion) + payloadLength;
+ unsigned int instancePayloadSize = sizeof(providerID) + sizeof(eventID) + sizeof(eventVersion) + sizeof(payloadLength) + payloadLength;
// Allocate the payload.
BYTE *pInstancePayload = new BYTE[instancePayloadSize];
memcpy(currentPtr, &eventVersion, sizeof(eventVersion));
currentPtr += sizeof(eventVersion);
+ // Write the size of the metadata.
+ memcpy(currentPtr, &payloadLength, sizeof(payloadLength));
+ currentPtr += sizeof(payloadLength);
+
// Write the incoming payload data.
memcpy(currentPtr, pPayloadData, payloadLength);
sizeof(m_threadID) + // Thread ID
sizeof(m_timeStamp) + // TimeStamp
m_dataLength + // Event payload data length
+ sizeof(unsigned int) + // Prepended stack payload size in bytes
m_stackContents.GetSize(); // Stack payload size
// Write the size of the event to the file.
pSerializer->WriteBuffer(m_pData, m_dataLength);
}
+ // Write the size of the stack in bytes.
+ unsigned int stackSize = m_stackContents.GetSize();
+ pSerializer->WriteBuffer((BYTE*)&stackSize, sizeof(stackSize));
+
// Write the stack if present.
- if(m_stackContents.GetSize() > 0)
+ if(stackSize > 0)
{
- pSerializer->WriteBuffer(m_stackContents.GetPointer(), m_stackContents.GetSize());
+ pSerializer->WriteBuffer(m_stackContents.GetPointer(), stackSize);
}
}