PREfast Warning 276 (Windows CE 5.0)
276 - Cast between semantically different string types.
Additional Information: char* to wchar_t*.
Consequence: This will result in garbled strings and possible crashes on 64-bit builds.
This warning indicates a potentially incorrect cast from an ANSI string (char_t*) to a Unicode string (wchar_t *).
Because Unicode strings have a character size of 2 bytes, this cast can yield strings that are not correctly terminated. Using such strings with the wcs* library of functions can cause buffer overruns and access violations.
Example
Defective Source
LPWSTR pSrc = (LPWSTR)"a";
WCHAR szBuffer[2];
wcscpy(szBuffer,
pSrc);
Corrected Source
LPWSTR pSrc = L"a";
WCHAR szBuffer[100];
wcscpy(szBuffer,
pSrc);
Send Feedback on this topic to the authors