A customer admitted that they had a bug in their code:
// error checking removed for expository purposes
// code that writes out the data
RegSetValueEx(hkey, pszValue, 0, REG_SZ, (const BYTE *)pszData,
_tcslen(pszData) * sizeof(TCHAR) + 1);
// code that reads the data...