Here is the definition of RegSetValueEx,
LONG WINAPI RegSetValueEx(
__in HKEY hKey,
__in_opt LPCTSTR lpValueName,
__reserved DWORD Reserved,
__in DWORD dwType,
__in_opt const BYTE *lpData,
__in DWORD cbData
);

According to MSDN, If the data is of type REG_SZ, REG_EXPAND_SZ, or REG_MULTI_SZ, cbData must include the size of the terminating null character or characters. But I tried to specify the cbData without considering terminating null character, it still works. It means, for example, if lpData points to _T("dullboy"), I specify cbData as 14, it still works as I specify cbData as 16. Would anybody here explain why? Thanks for your inputs.