Hi All,
The variable str was defined as CStringA type, and it contains 57 chars with
embedded NULL chars copied from some memory buffer, now I want to convert it
into a BSTR string using the following statements:
1) int nLen = str.GetLength();
2) int nChars = MultiByteToWideChar(CP_ACP, NULL, str, nLen, NULL, NULL);
3) bstr = SysAllocStringLen(NULL, nChars);
4) MultiByteToWideChar(CP_ACP, NULL, str, nLen, bstr, nChars);
at line#1 I got nLen 57, but at line#2, I got nChars 50, why nChars should
not be 57? Am I doing something wrong?
PS: The str is "50 4b 01 02 14 00 14 00 02 00 08 00 60 8b 16 33 00 00 60 8b
ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 ff ff 00 00 00 00 00 00 00 00
bb b0 fb c2 ee 9d 8f 0e de 04 00 00"
TIA