[fpc-devel] version info resource reading
Paul Ishenin
ip at kmiac.ru
Mon Feb 8 11:10:31 CET 2010
Hello, FPC developers' list.
I need to read version info I put to resource and I tried to use
TVersionResource class for that. It has LoadData method. So I tried:
var
Stream: TResourceStream;
Stream := TResourceStream.CreateFromID(Instance, 1, PChar(RT_VERSION));
FVersResource.SetCustomRawDataStream(Stream);
...
But... TVersionResource has a bug :(
LoadData method has ReadWideString call which reads widestring and
returns a shortstring as result. All is fine except one small detail:
ReadWideString code:
repeat
RawData.ReadBuffer(w,2);
ws:=ws+widechar(w);
until w=0;
Therefore ReadWideString return has a #0 at the end.
Later in LoadData method we have the next comparisions:
if block.key='StringFileInfo'
if block.key='VarFileInfo'
They evaluates to false because block.key has the #0 char at the end.
I suppose we need to fix ReadWideString to return value without the #0 char.
--
Best regards,
Paul Ishenin.
More information about the fpc-devel
mailing list