You are not logged in.
Pages: 1
after commit enhanced RetrieveSystemInfo e.g. running from a VM I received a runtime 217
Error:
ERegistryException exception message : Invalid data type for 'SystemBiosVersion'.
on then line
prod := SysUtils.Trim(ReadString('SystemBiosVersion'));
The problem is that the key value is multi-line (REG_MULTI_SZ) and the readstring function can't read
this only happens if there is no "SystemProductName" key in the windows registry
Offline
A possible fix:
var
buffer: string;
len: Cardinal;
...
if OpenKeyReadOnly('\Hardware\Description\System') then begin
if prod='' then begin
len := GetDataSize('SystemBiosVersion'); //new
SetLength(buffer, len); //new
ReadBinaryData('SystemBiosVersion', Pointer(buffer)^, len); //new
prod := UTF8ToString(Trim(StringReplaceAll(StringToUTF8(buffer), #0, ' '))); //new
end;
if prodver='' then begin
prodver := SysUtils.Trim(ReadString('VideoBiosVersion'));
i := Pos(#13,prodver);
if i>0 then // e.g. multilines 'Oracle VM VirtualBox Version 5.2.33'
SetLength(prodver,i-1);
end;
end;
....
Offline
Please check https://synopse.info/fossil/info/6a4eec4faf
It should work as expected now, thanks to the new TWinRegistry object, which is REG_MULTI_SZ ready.
Online
ab, thanks for the fix but the fossil commit was not for github.
The SynCommons.pas file has not been updated on github.
Offline
Pages: 1