If the binary data contains two consecutive NULL characters,
Using a general allocation function sysallocstringBytelen will have a problem, it will cut off the data.
// error BYTE BUFFER [10] = "TEST / 0 / 0TEST"; BSTR BSTEMP; BSTEMP = SYSALLOCSTRINGBYTELEN (Buffer, 10);
The actual save content in BSTEMP has TEST
// Correct
BYTE BUFFER [10] = "TEST / 0 / 0TEST"; BSTR BSTEMP; BSTEMP = SYSALLOCSTRINGBYTELEN (NULL, 10); Memcpy (BSTEMP, BUFFER, 10);
In addition, when the BSTR data is transmitted with the component, the RAW method is used to call, and the _bstr_t package form cannot be used, otherwise the data is still packaged.