Hmmm, one annotation: The more I think about it the more I get convinced, that it is not allowed to just cast the memory pointer to an LPCTSTR, because the trailing zero is missing. Instead it should be copied to an according buffer. So it should be:
LPCTSTR lpszString = reinterpret\_cast< LPCTSTR>( lpVoid );
TCHAR \*tcBuffer = new TCHAR\[ dwSize + 1 \];
if ( NULL != tcBuffer )
{
ZeroMemory( tcBuffer, ( dwSize + 1 ) \* sizeof( TCHAR ) );
memcpy( tcBuffer, lpszString, dwSize \* sizeof( TCHAR ) );
}
But this is only the case with strings. Byte buffer or similar can't be used directly anyway (like LPCTSTR). Jens