Declare an OleVariant and IEnumVariant in Inno Setup

436 views Asked by At

I have a function for getting BIOS serial numbers in the code section that works in Delphi but it doesn't recognize the variable declarations. How do I get around this.

var
  FSWbemLocator : OleVariant;
  FWMIService   : OleVariant;  

function GetWMIstring(const WMIClass, WMIProperty:string): string;
var
  FWbemObjectSet: OleVariant;
  FWbemObject   : OleVariant;
  oEnum         : lEnumVariant;
  iValue        : LongWord;
begin;
  Result:='';
  FWbemObjectSet:= FWMIService.ExecQuery(Format('Select %s from %s',[WMIProperty, WMIClass]),'WQL',wbemFlagForwardOnly);
  oEnum         := IUnknown(FWbemObjectSet._NewEnum) as IEnumVariant;
  if oEnum.Next(1, FWbemObject, iValue) = 0 then
    if not VarIsNull(FWbemObject.Properties_.Item(WMIProperty).Value) then
      Result:=FWbemObject.Properties_.Item(WMIProperty).Value;

  FWbemObject:=Unassigned;
end;
0

There are 0 answers