Because wcslen
tells you how many characters something is in length, and WriteFile
writes bytes and TCHAR
is multi-byte (or two bytes). So, you've asked WriteFile
to write half of the characters in the string you've passed to it.
If you want to write all the characters or get the size of the string in bytes, you could use wcslen(frmdata1) * sizeof(TCHAR)