Not the best way to call `VerLanguageName` in `TPJVersionInfo.GetLanguage`
delphidabbler opened this issue · comments
In
Line 648 in e98dc11
VerLanguageName
is called like this:
if fHaveInfo and
(VerLanguageName(GetLanguageCode, Buf, Pred(cBufSize)) > 0) then
Result := Buf;
However the VerLanguageName
docs say that if buffer size is too small, the language name is truncated. Also the number of characters written excludes the terminating null.
In practice the buffer used is probably large enough, but still the code is not best practice.
Maybe try something like example 2 from C++ (Cpp) VerLanguageName Examples - but note that the logic needs tweaking regarding buffer sizes.
To keep c++ compatibility allocation & freeing of memory will need to use GetMemory
& FreeMemory
rather than GetMem
& FreeMem
.