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.

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to