I see that a lot of functions need you to set a size for the string which is the output.
GetComputerNameW needs:
WCHAR wStrName[16U];
DWORD uSize = 16U;
GetComputerNameW(wStrName, &uSize);
RegSetValueExW needs:
WCHAR wStrExec[1024U];
RegSetValueExW(..., (wcslen(wStrExec) + 1U) * sizeof(WCHAR));
GetWindowTextW needs:
WCHAR wStrText[1024U];
GetWindowsTextW(..., sizeof(wStrText));
GetModuleBaseNameW needs:
WCHAR wStrName[1024U];
GetModuleBaseNameW(..., sizeof(wStrName) / sizeof(WCHAR));
My question is, how to make the difference between the sizes set? The strings are always defined as WCHAR and the sizes set differ so much.
If you carefully read the documentation, you'll see that the size parameter is the size of the output buffer in bytes typically:
Which of course yields that you need to: