Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2010-02

version info resource reading

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Paul Ishenin

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.

Reply by email